hidden:Redirect local root mail to an external email address on HPSS servers

From Lsdf
Revision as of 17:27, 20 January 2017 by Ahmad (talk | contribs)

Redirect local root mail to an external email address on HPSS servers

1. Check if "postfix" bzw. sendmail mail server is already installed.

Notice: on RHEL Hosts postfix is already installed but on SL hosts its sendmail.

# service postfix status

# yum install postfix (On HPSS Server it was already installed and running)

2. Edit /etc/aliases

root: hpss-admin@lists.kit.edu

4. Run command on shell:

# newaliases

5. Restart mail server

# service postfix restart

6. Test

#echo "Hello from hpsscr01." | mail -s "hpsscr01 email-test-message" root

Relaying emails through another Server

As hpssmvr04 does not have a 141.* but an external Gridka IP 192.108.47.248 it can not send out emails via postfix to KIT mailserver. Therefore we have to use one of the other hpss movers acting as a relayhost for hpssmvr04.

hpssmvr04 configuration

1. set relayhost hpssmvr03

# vi /etc/postfix/main.cf
 relayhost = 192.168.0.13

we use the internal 192.168.0.* IPs.

2. Restart postfix

# service postfix restart

hpssmvr03 configuration

1. use the KIT mailserver scc-mailin-cn-01.scc.kit.edu as the remote mailserver on which you have a valid email account with the username and password.

2. perform the following commands

# postconf -e 'relayhost = scc-mailin-cn-01.scc.kit.edu'
# postconf -e 'smtp_sasl_auth_enable = yes'
# postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
# postconf -e 'smtp_sasl_security_options ='

3. Create a sasl_passwd file with a valid email account

# echo "<KIT remote mailserver>  <valid-email-account>:<password>" > /etc/postfix/sasl_passwd

e.g:

# echo "scc-mailin-cn-01.scc.kit.edu  ahmad.hammad@kit.edu:<password>" > /etc/postfix/sasl_passwd

4. Set file permissions

# Chown root:root /etc/postfix/sasl_passwd
# chmod 600 /etc/postfix/sasl_passwd

5. Create sasl_passwd.db file that postfix can read

# postmap /etc/postfix/sasl_passwd

6. Let also 192.168.0.13 listen on Port 25 (smpt)

# vi /etc/postfix/main.cf
inet_interfaces = 192.168.0.13,localhost 

7. Restart postfix

# service postfix restart

Test from hpssmv04

# echo "mailtest from hpssmvr04" | mail -s "mailtest from hpssmvr04" root