Dieses kleine Script soll Usern helfen, die einen Relyhost für Postfix einrichten wollen. Dazu fragt das Script die nötigen Werte vom User ab und trägt diese in die Postfix Konfiguration ein.
#!/bin/sh main='/usr/syno/mailstation/etc/main.cf' #main='./main.cf' #map='./smtp_auth' map='/usr/syno/mailstation/etc/smtp_auth' echo -n 'Hostname des Relayhosts: ' while read relayhost do [ "x$relayhost" != 'x' ] && break echo -n 'Hostname des Relayhosts: ' && continue done echo -n "$relayhost als Relay (r) oder Fallback (f) einrichten? Default f: " while read type do case $type in 'r' | 'f') break ;; *) type='f' break ;; esac done echo -n "Benutzername fuer ${relayhost}: " while read user do [ "x$user" != 'x' ] && break done if [ "x$user" != 'x' ] then echo -n "Passwort fuer $user auf $relayhost: " while read passwort do break done fi for i in relayhost smtp_sasl_auth_enable smtp_sasl_password_maps smtp_sasl_security_options smtp_use_tls smtp_enforce_tls smtp_tls_enforce_peername do case $i in 'relayhost') [ "$type" == 'f' ] && echo 'fallback_relay = '$relayhost >> $main [ "$type" == 'r' ] && echo 'relayhost = '$relayhost >> $main ;; 'smtp_sasl_auth_enable' | 'smtp_use_tls' | 'smtp_enforce_tls') echo "$i = yes" >> $main ;; 'smtp_sasl_password_maps') echo "$i = $map" >> $main echo "$relayhost ${user}:${passwort}" >> $map /usr/syno/mailstation/sbin/postmap $map ;; 'smtp_sasl_security_options') echo "$i = noanonymous" >> $main ;; 'smtp_tls_enforce_peername') echo "$i = no" >> $main ;; *) continue ;; esac done