apt-get install openssl ssl-cert postfix mailutils openssl ssl-cert mailutils libsasl2-2 ca-certificates libsasl2-modules -y
nano /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
myhostname=poseidon.siua.ac.cr
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost = (<========================== eliminar esta linea)
mynetworks = 127.0.0.0/8
inet_interfaces = loopback-only
recipient_delimiter = +
# SMTP relayhost
relayhost = [smtp.gmail.com]:587
## TLS Settings
smtp_tls_loglevel = 1
smtp_tls_CAfile = /etc/postfix/certs/CAcert.pem
smtp_tls_cert_file = /etc/postfix/certs/mycert.pem
smtp_tls_key_file = /etc/postfix/certs/mykey.pem
smtp_use_tls = yes
smtpd_tls_CAfile = /etc/postfix/certs/CAcert.pem
smtpd_tls_cert_file = /etc/postfix/certs/mycert.pem
smtpd_tls_key_file = /etc/postfix/certs/mykey.pem
smtpd_tls_received_header = yes
smtpd_use_tls = yes
# configuracao tls
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
# alias de mapeamento interno para externo
smtp_generic_maps = hash:/etc/postfix/generic
nano /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 interuniversitariadealajuela@gmail.com:AC2
nano /etc/postfix/generic
root@localhost.localdomain interuniversitariadealajuela@gmail.com
- Otorgar permisos y generar archivos .db
chmod 600 /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/generic
postmap /etc/postfix/sasl_passwd
postmap /etc/postfix/generic
mkdir /etc/postfix/certs/
cd /etc/postfix/certs/
openssl dsaparam -out dsaparam.pem 2048
openssl req -x509 -nodes -days 3650 -newkey dsa:dsaparam.pem -out mycert.pem -keyout mykey.pem
Generating a 2048 bit DSA private key
writing new private key to 'mykey.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CR
State or Province Name (full name) [Some-State]:Alajuela
Locality Name (eg, city) []:Alajuela
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SIUA
Organizational Unit Name (eg, section) []:UGIT
Common Name (e.g. server FQDN or YOUR name) []:UGIT
Email Address []:interuniversitariadealajuela@gmail.com
ln -s mycert.pem CAcert.pem
openssl req -x509 -new -days 3650 -key /etc/postfix/certs/mykey.pem -out /etc/postfix/certs/mycert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CR
State or Province Name (full name) [Some-State]:Alajuela
Locality Name (eg, city) []:Alajuela
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SIUA
Organizational Unit Name (eg, section) []:UGIT
Common Name (e.g. server FQDN or YOUR name) []:UGIT
Email Address []:interuniversitariadealajuela@gmail.com
- Eliminamos el certificado:
rm dsaparam.pem
/etc/init.d/postfix reload
echo "esta es la prueba de envio de correo" | mail -s "este es mi asunto" gustavo.matamoros@gmail.com