duplicate imap uid validities with mbsync - emacs

I am using mbsync to get imap mail from my university server and then dovecot locally to serve it to gnus/emacs. This works fine on one desktop machine, and one laptop, but a second laptop creates duplicate UIDs everytime I use it to access my mail. As I have the exact same set-up (to the best of my knowledge) on all three machines I am a bit baffled as to the source of this error. Does this ring any bells for anyone? Is there some sort of hidden or temp file that might be the source of such a problem that I could look for? Any guidance is appreciated.
mbsync version = 1.2.0
emacs = 24.5.50.1
dovecot 2.2.18
gnus 5.13
P.S. A great guide to fix these problems once they occur is this blog post here: http://tiborsimko.org/mbsync-duplicate-uid.html

Related

three ways to let PHP and a regular user edit the same files

I am a web developer, and for some upcoming projects I would like to use a file-based CMS. This means that many of the files I create at the start must be editable by the PHP user later, but also remain editable for my user (and also the other way around). My PC runs Debian 9, which I love but am not super knowledgeable about, and I have also just set up a local network server with Debian 9 for backups and possibly file sharing. (I'm using Webmin to configure this, which reflects my level of command line skills).
On my online shared hosting server, the PHP user and the FTP user seem to be the same, and 644/755 permissions work fine, this is also recommended by the CMS I'm using. I would like to mimic this on my computer so I don't have to fiddle with permissions all the time. But how do I do this? Currently, my regular user (anna) does not have access to www-data's files and vice versa. Putting them in the same group still means changing file permissions. Making anna the PHP user is a Bad Idea (as far as I understand it) because anna has sudo permissions.
So far I have researched three possible solutions that I don't really know very much about, and I would like to know which is the best route to take.
Develop locally on my computer and use apache-mpm-itk or suPHP to let PHP edit the files (I got that idea from this question on ServerFault).
Develop locally on my computer and rsync the files to my server with grunt-rsync, and somehow get rsync to set the ownership to www-data (another ServerFault thread helping here).
Mount the project's server directory, which is owned by www-data, on my computer with SSHFS and then either edit the files on the server directly or copy them over from my local directory with grunt-copy.
What do you think: from a security and ease of use perspective, which is the best way? Or do you know an even better one?
Thank you for taking the time to read and think about this!
Anna~
I figured it out! I finally ended up reading about running PHP as CGI instead of as an Apache module, and that this would solve my permissions problem. Plus, as far as I understand it, there are no extra security precautions to take when I'm the only one working with it on my local computer.
In case someone comes across this who might find it helpful, here's what I did (basically following these instructions):
I installed php7.0-fpm
Edited /etc/apache2/sites-enabled/000-default.conf and put the following just before </VirtualHost>:
DirectoryIndex index.php
<LocationMatch "^(.*\.php)$">
ProxyPass fcgi://127.0.0.1:9000/var/www/html
</LocationMatch>
I activated the Apache module proxy_fcgi (via Webmin, which apparently does an automatic Apache restart)
In /etc/php/7.0/fpm/pool.d/www.conf I commented out a listen line and put another below like this:
; listen = /run/php/php7.0-fpm.sock
listen = 127.0.0.1:9000
I then restarted PHP-FPM with this command: /etc/init.d/php7.0-fpm restart (a little different from the instructions, I'm on Debian 9). After that, phpinfo() gave me the Server API "FPM/FastCGI".
And finally, I changed the user and group from www-data to anna in three places, twice in /etc/php/7.0/fpm/pool.d/www.conf and then once more in /usr/lib/tmpfiles.d/php7.0-fpm.conf (this last bit may be Ubuntu/Debian specific, my thanks go to Keith for a comment on StackExchange).
And that was it! :-)

I cannot send mail with SwiftMailer or PHPMailer from Localhost using gmail

I have recently been unable to send out mails through php on localhost. I use PHPMailer and SwiftMailer in different parts of the application.
With SwiftMailer I get this:
Connection could not be established with host smtp.gmail.com [ #0]
With PHPMailer, the message is:
SMTP Error: Could not connect to SMTP host.
My settings on SwiftMailer look like this:
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
->setUsername(APP_GMAIL_EMAIL)
->setPassword(APP_GMAIL_PWD);
I have gone through several threads here at SO and elsewhere, and tried many 'fixes' but the error messages remain the same. Some "solutions" I've tried are:
Enable OpenSSL inphp.ini (It was previously off)
Change smtp.gmail.com to smtp.googlemail.com
Replace smtp.gmail.com with certain gmail IP addresses
Replace smtp.gmail.com with gethostbyname('smtp.gmail.com')
Add ->setSourceIp('0.0.0.0') to the instantiation code above, after setUsername and setPassword
This code was previously working, and I'm not sure what could have broken the function. As part of troubleshooting, I have just confirmed that a similar code on Linux shared hosting is emailing satisfactorily, suggesting that the problem is somehow from my environment. Thus, I even tried different sources of internet access, in case it's an ISP thing.
How can I crack this nut?
I have been able to overcome the problem, at least with SwiftMailer. The solution must have arisen after my PHP upgrade from 5.2.5 to 5.6, which is the version I have currently. The insight came from this page:
https://github.com/swiftmailer/swiftmailer/issues/544
If you are using PHP 5.6, the error does occur because of the "SSL
context options" used for the stream context in swiftmailer. IN PHP
5.6 verify_peer and verify_peer_name the default was set to TRUE, so PHP checks the SSL certificate. It is currently not possible to
disable it in swiftmailer using some options.
You could disable the SSL check by modifying the function
"_establishSocketConnection" in StreamBuffer.php. Add these lines
before stream_socket_client command:
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
It would be great if these options could be set without hacking the
code.
Thanks to https://stackoverflow.com/a/29448735/2554788 who first pointed me to the said post.
By the way, the path to StreamBuffer.php is:
\lib\classes\Swift\Transport
A word of warning though: this solution is based on hacking the code inside a class, and will probably fail, say, after upgrading SwiftMailer versions (in which case you'd need to go back and hack the code again).
Perhaps, more current versions of SwiftMailer have put their acts together in PHP 5.6 (I use SwiftMailer 5.1 currently). I intend to try an upgrade ASAP, hoping there has been an elegant fix for this issue.

How can I use Mandrill App as system message mailer on Parallels Panel?

Currently I have my CentOS system set up with Parallels Panel and have my mailing system working nicely. But I'd prefer to have my system messages to be mailed using Mandrill App (MailChimp guys).
I have it working now with a kind of a mixed setup. Simple, though working. But now I get an error in my mail logs saying the following:
Jan 4 10:41:11 shinjuku postfix/smtp[29469]: certificate verification failed for smtp.mandrillapp.com[46.137.69.113]:25: untrusted issuer /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server#thawte.com`
After this I've tried configuring the smtp_tls_CApath and smtpd_tls_CApath to point to /etc/ssl/certs, but still no luck on this part.
Does someone have an idea on how I can get this working to have ALL system messages to be sent using Mandrill, instead of built-in config?
Mark, for CentOS try this for your CAPath/CAfile
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt

Server Manipulation using Linode Manager or other techniques to develop a mirror site

A quick question, does anyone know how I can take an address say www.google.com and create a mirror site such as www.newsite.google.com ?
I'm a beginner when it comes to server testing and server manipulation. I normally just drag and drop through SFTP/FTP.
Any ideas or thoughts?
Thanks, Chris
After a couple of tips from a former colleague, we sat down and talked about this issue.
First of all we mentioned APACHE VHOSTS - needed to add a directory for my sub domain, e.g. new.google.com
To do this I had to SSH the server and perform sudo, vim and a range of commmands on directories and files.
As I use linode manger, I had to add an A record to make the sub domain active/work.
All now works and I have a new sub domain.

Using MailDir as a Backend for Gnus

I am using offlineimap to sync my gmail account to a locak maildir, then using gnus to read that directory everything is fine but gnus uses its own flags for marking read unread status of messages and they are not synced back to gmail. is there a way to force gnus to use standart maildir flags?
I use offlineimap and dovecot to download and serve my mail locally. I also use GNUS. Getting dovecot to work kept me from using GNUS for quite a while since GNUS's support for maildir is so lousy. This is what I needed to make dovecot work:
mail_location = maildir:~/Mail:LAYOUT=fs:INBOX=~/Mail/INBOX
One of the really nice parts of my solution is that I have a real and working offline sync, so that when the network is unavailable (approximate 80% of the time while on campus) I still can check and sort my mail.
This has been fixed in nnmaildir in Gnus trunk as of 2012-09-05. The fix appeared in the Gnus version released with Emacs 24.3.
A solution is to use a local imap server (as dovecot) to look at your maildir, and to use gnus to access to this imap server.
AFAIK, the situation has not improved about nnmaildir and gnus since this.
For this exact situation, I'm now using mutt, setting Emacs as its editor.
Here is everything the official manual has to say about maildirs and GNUS - I personally couldn't find there what you're looking for, but then again I'm a mew user, maybe you'll notice something I didn't. I hear, though, that Wanderlust has the best maildir support of all the Emacs mail readers.