Cleaned up and merge other Linux snippit repo

Meged https://git.bprieshof.nl/brammp/linux into ./Linux
This commit is contained in:
2023-11-17 00:05:49 +01:00
parent 0638efa018
commit 9fb35960f9
53 changed files with 1851 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
#Proxmox Use SMTP to send mail
#Vars
MailFromName=$(hostname)
MailFormAddress=noreply@domain.com
MailFromServer=mail.provider.com
MailFromServerPort=465
MailFromPasswd=<MailBoxPassword>
MailTo=administrator@domain.com
#install dependencies
apt install libsasl2-modules -y
#Generating Configs
echo "[$MailFromServer]:$MailFromServerPort $MailFormAddress:$MailFromPasswd" > /etc/postfix/sasl_passwd
echo "/.+/ $MailFromName<$MailFormAddress>" > /etc/postfix/sender_canonical_maps
echo "/From:.*/ REPLACE From: $MailFromName<$MailFormAddress>" > /etc/postfix/header_check
sed -i '/relayhost/c\' /etc/postfix/main.cf
cat << EOF >> /etc/postfix/main.cf
#Custom PostfixSMTP config
relayhost = [$MailFromServer]:$MailFromServerPort
smtp_tls_wrappermode = yes
smtp_tls_security_level = encrypt
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
smtp_header_checks = regexp:/etc/postfix/header_check
EOF
postmap /etc/postfix/sasl_passwd
systemctl restart postfix