ubuntu, postfix setup
This commit is contained in:
parent
40fc62fb4e
commit
fdb25d8a9e
58
ubuntu-postfix-setup.sh
Normal file
58
ubuntu-postfix-setup.sh
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# source:
|
||||||
|
# https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-22-04
|
||||||
|
#
|
||||||
|
|
||||||
|
set your_domain="abc.com"
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install mailutils
|
||||||
|
|
||||||
|
# sudo vim /etc/postfix/main.cf
|
||||||
|
#
|
||||||
|
# masquerade_domains = {your_main_domain}
|
||||||
|
# inet_interfaces = loopback-only
|
||||||
|
|
||||||
|
# restart service
|
||||||
|
sudo systemctl restart postfix
|
||||||
|
|
||||||
|
# to test smtp is working:
|
||||||
|
# echo "This is the body of the email" | mail -s "This is the subject line" your_email_address
|
||||||
|
|
||||||
|
# to add email forwarding:
|
||||||
|
# sudo vim /etc/aliases
|
||||||
|
#
|
||||||
|
# postmaster: root
|
||||||
|
# root: your_email_address
|
||||||
|
#
|
||||||
|
# for the change to take effect run:
|
||||||
|
# sudo newaliases
|
||||||
|
#
|
||||||
|
# to test email forwarding:
|
||||||
|
# echo "This is the body of the email" | mail -s "This is the subject line" root
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Enable SMTP Encryption
|
||||||
|
#
|
||||||
|
# install certbot:
|
||||||
|
sudo apt install certbot
|
||||||
|
|
||||||
|
# make sure server port 80 is open underfirewall
|
||||||
|
# if you are using on server firewall "ufw", do:
|
||||||
|
# sudo ufw allow 80
|
||||||
|
|
||||||
|
# get cert
|
||||||
|
sudo certbot certonly --standalone --rsa-key-size 4096 --agree-tos --preferred-challenges http -d $your_domain
|
||||||
|
|
||||||
|
# sudo vim /etc/postfix/main.cf
|
||||||
|
#
|
||||||
|
# smtpd_tls_cert_file=/etc/letsencrypt/live/your_domain/fullchain.pem
|
||||||
|
# smtpd_tls_key_file=/etc/letsencrypt/live/your_domain/privkey.pem
|
||||||
|
|
||||||
|
# restart service
|
||||||
|
# sudo systemctl restart postfix
|
||||||
|
|
||||||
|
# test
|
||||||
|
# echo "This is the body of an encrypted email" | mail -s "This is the subject line" root
|
Loading…
Reference in New Issue
Block a user