|
Christoph Galuschka |
47aac2 |
#!/bin/sh
|
|
Christoph Galuschka |
47aac2 |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
47aac2 |
|
|
Christoph Galuschka |
47aac2 |
t_Log "Running $0 - Postfix plain SASL test."
|
|
Christoph Galuschka |
47aac2 |
t_Log "Installing prerequisits"
|
|
Christoph Galuschka |
47aac2 |
|
|
Christoph Galuschka |
47aac2 |
t_InstallPackage dovecot nc
|
|
Christoph Galuschka |
47aac2 |
|
|
Christoph Galuschka |
47aac2 |
if [ $centos_ver = 6 ]
|
|
Christoph Galuschka |
47aac2 |
then
|
|
Christoph Galuschka |
f944d2 |
#creating backups of changed files
|
|
Christoph Galuschka |
f944d2 |
cp -a /etc/postfix/main.cf /etc/postfix/main.cf_testing
|
|
Christoph Galuschka |
f944d2 |
cp -a /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf_testing
|
|
Christoph Galuschka |
f944d2 |
|
|
Christoph Galuschka |
47aac2 |
#adding parameters to postfix
|
|
Christoph Galuschka |
47aac2 |
cat >> /etc/postfix/main.cf <
|
|
Christoph Galuschka |
f944d2 |
smtpd_sasl_auth_enable = yes
|
|
Christoph Galuschka |
f944d2 |
broken_sasl_auth_clients = yes
|
|
Christoph Galuschka |
f944d2 |
smtpd_sasl_type = dovecot
|
|
Christoph Galuschka |
f944d2 |
smtpd_sasl_path = private/auth
|
|
Christoph Galuschka |
f944d2 |
smtpd_sasl_security_options = noanonymous
|
|
Christoph Galuschka |
47aac2 |
|
|
Christoph Galuschka |
f944d2 |
smtpd_recipient_restrictions =
|
|
Christoph Galuschka |
47aac2 |
permit_mynetworks,
|
|
Christoph Galuschka |
47aac2 |
permit_sasl_authenticated,
|
|
Christoph Galuschka |
47aac2 |
reject_unauth_destination
|
|
Christoph Galuschka |
f944d2 |
EOF
|
|
Christoph Galuschka |
f944d2 |
|
|
Christoph Galuschka |
47aac2 |
#adding parameters to dovecot
|
|
Christoph Galuschka |
47aac2 |
cat >> /etc/dovecot/dovecot.conf <
|
|
Christoph Galuschka |
f944d2 |
service auth {
|
|
Christoph Galuschka |
f944d2 |
unix_listener /var/spool/postfix/private/auth {
|
|
Christoph Galuschka |
f944d2 |
mode = 0660
|
|
Christoph Galuschka |
f944d2 |
user = postfix
|
|
Christoph Galuschka |
f944d2 |
group = postfix
|
|
Christoph Galuschka |
47aac2 |
}
|
|
Christoph Galuschka |
f944d2 |
}
|
|
Christoph Galuschka |
f944d2 |
EOF
|
|
Christoph Galuschka |
47aac2 |
#restarting services
|
|
Christoph Galuschka |
47aac2 |
t_ServiceControl postfix restart
|
|
Christoph Galuschka |
47aac2 |
t_ServiceControl dovecot restart
|
|
Christoph Galuschka |
47aac2 |
|
|
Christoph Galuschka |
47aac2 |
#Running test
|
|
Christoph Galuschka |
47aac2 |
echo "ehlo test" | nc -w 3 localhost 25 | grep -q 'AUTH PLAIN'
|
|
Christoph Galuschka |
f944d2 |
ret_val=$?
|
|
Christoph Galuschka |
47aac2 |
else
|
|
Christoph Galuschka |
47aac2 |
t_Log 'C5 System, test not yet working, skipping'
|
|
Christoph Galuschka |
f944d2 |
ret_val=0
|
|
Christoph Galuschka |
47aac2 |
fi
|
|
Christoph Galuschka |
f944d2 |
# restoring changed files
|
|
Christoph Galuschka |
f944d2 |
mv -f /etc/postfix/main.cf_testing /etc/postfix/main.cf
|
|
Christoph Galuschka |
f944d2 |
mv -f /etc/dovecot/dovecot.conf_testing /etc/dovecot/dovecot.conf
|
|
Christoph Galuschka |
f944d2 |
|
|
Christoph Galuschka |
47aac2 |
t_CheckExitStatus $ret_val
|