Thursday, September 22, 2016

Compile Zulip desktop client on Ubuntu xenial

You can install Zulip client on a fresh Ubuntu Xenial installation by the following commands:


sudo apt-get install git cmake qt5-default libqt5svg5-dev libqt5webkit5-dev qtmultimedia5-dev libjson0-dev phonon-backend-gstreamer  phonon4qt5-backend-gstreamer

wget https://github.com/zulip/zulip-desktop/archive/0.5.1.tar.gz
tar -zxf 0.5.1
cd zulip-desktop-0.5.1
mkdir build
cd build
cmake .. -DBUILD_WITH_QT5=On
make
sudo make install
cd /usr/share/applications
sudo ln -s /usr/local/share/applications/Zulip.desktop

Friday, September 16, 2016

FIXED: DomainKey signature breaks when sending emails with PHP mail

I experienced a very strange issue with php mail() function on one of my servers yesterday. The story goes like this:

PHP mail() uses /usr/sbin/sendmail to send emails by default. I had a ded server with Plesk panel. I had configured the postfix mail server there to have valid DomainKey / DKIM / SPF authentications. DomainKey/DKIM signatures would work fine when clients sent emails using Outlook or Thunderbird, but DomainKey signatures got broken when emails were sent through PHP mail() function.

The reason was the wrong d=$DOMAIN variable used in DomainKey signature when emails were sent through php mail() function. Strangely enough, I found that it only happens when "FROM" header is set in $additional_headers of php mail() function. Therefore:

mail($dest_email, $subject, $message, "FROM: Mos GH mos@holding.com");


breaks DomainKey signatures. The workaround is to remove FROM header and put the sender in $additional_parameters variable:
mail($dest_email, $subject, $message, "", "-f mos@holding.com");

However  you can't give your full name like this.

Alternatively one can use PHPMailer to send emails directly through  SMTP instead of sendmail to avoid the issue.

p.s. You can send a test email message to check-auth@verifier.port25.com to see how well your emails are authenticated. It's a robot and usually replies back to you with your authentication results in seconds.

Wednesday, September 14, 2016

FIXED: warning: SASL authentication failure: realm changed: authentication aborted, PLESK

Yesterday I found that outlook couldnt connect to the mail server while I was working on installing Postfix with STARTTLS on a Plesk server. I could see the following errors in the error log file:

postfix/smtpd[1929]: warning: SASL authentication failure: realm changed: authentication aborted
postfix/smtpd[1929]: warning: SASL DIGEST-MD5 authentication failed: authentication failure

This is while Thunderbird was working fine. The error appears to be from outlook that couldnt send the account credentials using DIGEST-MD5 encryption. The following workaround could be applied:

Edit /usr/lib64/sasl2/smtpd.conf and update:
mech_list: CRAM-MD5 PLAIN LOGIN

Edit /etc/postfix/main.cf and update:
smtpd_sasl_security_options = noanonymous

and finally run:
service postfix restart
service saslauthd restart

Tuesday, September 13, 2016

VIM and Python :: Ubuntu Xenial

Yesterday I read about making VIM to a powerful IDE for Python here:  VIM and Python - a Match Made in Heaven

The above post is almost complete and covers everything. I tried to run the configuration on Ubuntu Xenial and noticed that the following updates apply to the article:


1- Use the following code in PEP8 Python indentation instead of the default one of the blog post:

au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix |

au BufNewFile,BufRead *.js,*.html,*.css
    \ set tabstop=2 |
    \ set softtabstop=2 |
    \ set shiftwidth=2 |


2- Add the following line before the code provided in Flagging Unnecessary Whitespace of the blog post:

highlight BadWhitespace ctermbg=red guibg=darkred


3- Use py3 << EOF instead of py << EOF in Virtualenv Support of the blog post.


4- Assign F6 key to toggle NERDTree:

nnoremap <F6> :NERDTreeToggle<CR>

and add the following lines to have powerline and NERDTree activated at startup:

autocmd vimenter * NERDTree
set laststatus=2
set t_Co=256



Happy developing!

How to disable Debian 12 sleep on production servers

 Debian 12 has power saver enabled by default which causes your server to go to sleep if there is no mouse / keyboard interaction. To resolv...