Altering e-mail ‘Return-Path’ with exim4 and PHP mailer in Wikitech Labs

While implementing VERP, I always found that the ‘Return-Path’ address of any send email — was getting rewritten to root@wikimedia.org. This was frustrating as I had already changed the $header['Return-Path'] many times in the UserMailer.php and the result was just this one.
Problem:-
* Rewrite custom generated Return-Path to email-headers while sending
* Implement VERP addressing to handle bounces
Solution:-
*The PHP part:
+ Make sure the UserMailer.php ( or anyother file that sends the mail ) have custom header configurations such as:

$headers[ ‘Return-Path’ ] = ‘return-to-here@domain’ ;
mail( $to, $sub, $body, $headers );
*Now, the exim4 part:
+ Open your sudo nano /etc/exim4/exim4.conf and add the following line to the main configuration area:
( optional )

# Return Path
return_path_remove = false 

+ Remove the line errors_to from the desired router (( here wiki_mail router )

wiki_mail:
driver = manualroute
condition = ${if eqi{$header_X-Mailer:}{MediaWiki mailer}}
errors_to = ${if def:h_return-path: {${address:$h_return-path:}} fail}
headers_remove = return-path
transport = remote_smtp
route_list = *     

Yay! all done. Now, $ sudo /etc/init.d/exim4 restart
Now test it by sending a mail to some remote id, using Special:EmailUser
PS: There is a shorter version, with just removing the errors_to from the wiki_mail router.

$ mosh – ing into the Wikitech bastion host

Those who got no idea what bastion server is :-
* bastion host :- A Bastion host is a special purpose computer on a network specifically designed and configured to withstand attacks. The computer generally hosts a single application, for example a proxy server, and all other services are removed or limited to reduce the threat to the computer. ( from wikipedia 😉

Being far away from the Wikitech hosts, I had my own difficulties connecting to my Wikitech labs instance. The response time between key stroke and output almost crossed 1 sec in certain cases. Desperate, I was searching for alternatives for SSH, and came across this amazing software, mosh (http://mosh.mit.edu/).
You can install mosh by :- $ sudo apt-get install mosh
You can connect via mosh using the folowing command :
$ mosh user@server.com
instead of $ ssh user@server.com

Troubleshooting connection to Wikitech-Labs:-
* If you get an error message like :

$ mosh user@bastion.wmflabs.org
mosh-server: invalid option -- 'l'
Usage: mosh-server new [-s] [-i LOCALADDR] [-p PORT] [-c COLORS] [-- COMMAND...]
mosh-server: invalid option -- 'l'
Usage: mosh-server new [-s] [-i LOCALADDR] [-p PORT] [-c COLORS] [-- COMMAND...]
mosh-server: invalid option -- 'l'
Usage: mosh-server new [-s] [-i LOCALADDR] [-p PORT] [-c COLORS] [-- COMMAND...]
setlocale: No such file or directory
Connection to bastion.wmflabs.org closed.
/usr/bin/mosh: Did not find mosh server startup message.

if you are using
* the default bash shell :
$ nano .bashrc
* the zsh shell :
$ nano .zshrc

and add the following lines to the end of the file :-

export LANG="en_US.UTF-8 locale"
export LC_ALL="en_US.UTF-8"

to update the shell, run
$ source .zshrc
or
$ source .bashrc