Posts Tagged ‘postfix’

archlinux: postfix +gmail

Saturday, January 30th, 2010

Aupa oingutan archlinux-eko postfix-e konfigurekue gmail-egaz ibiltzeko, debian-elez idxe bardiñe da baie gauze batzuk kanbidxe bidiez :)

$ su
# pacman -S postfix openssl
# mv /etc/postfix/main.cf /etc/postfix/main.cf.bak

/etc/postfix/main.cf

# 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

/etc/postfix/sasl_passwd

[smtp.gmail.com]:587    user@gmail.com:passwd
# mv /etc/postfix/generic /etc/postfix/generic.bak

/etc/postfix/generic

user@gmail.com user@gmail.com
# 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 1024 -out dsa1024.pem
# openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out mycert.pem -keyout mykey.pem

# ln -s mycert.pem CAcert.pem

# openssl req -x509 -new -days 3650 -key /etc/postfix/certs/mykey.pem -out /etc/postfix/certs/mycert.pem

# rm dsa1024.pem
# /etc/rc.d/postfix start
:: Starting Postfix [FAIL]
# /etc/rc.d/postfix stop

LOGS:

# tail /var/log/mail.log
Jan 30 12:21:51 arch postfix[5641]: fatal: chdir(/usr/libexec/postfix): No such file or directory
# mkdir /usr/libexec
# ln -s /usr/lib/postfix /usr/libexec/postfix
# /etc/rc.d/postfix start
:: Starting Postfix [DONE]
# exit
$ echo "content" | mail -s "subject" user@mail.com

debian: postfix + gmail

Thursday, December 17th, 2009

Aupa artistas, postfix e-mail zerbitzari bet da eta konfigureku gmail-egaz e-mailek al izateko bota. Gauzie da IP dinamikotik ezindixela e-mailek bota, honegaz al izango lekidu e-mailek bota bai IP dinamiko batetik eta bai IP estatiko batetik geure gmail kontuen bidez:

  • 1.- root moduen konekta:

    su
  • 2.- paketiek instala:

    apt-get install postfix bsd-mailx openssl
  • 3.- postfix instalaziñuen konfigure: postfix instalakeran pregunte’kozku ia ze motatako konfiguraziñue gudun:

    sin configuración
  • 4.- postfix konfigure: /etc/postfix/main.cf

    # 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
  • 5.- smtp-ientzako password-a: /etc/postfix/sasl_passwd

    [smtp.gmail.com]:587 usuaidxue@gmail.com:password-a

    kanbidxe zeuon datuetara

    # chmod 600 /etc/postfix/sasl_passwd
    # postmap /etc/postfix/sasl_passwd
    
  • 6.- Bidaltzailie konfigure: /etc/postfix/generic

    usuaidxue@localhost.localdomain usuaidxue@gmail.com

    hau pausue naiz eta derrigorrezkue ezan 1go mandan zeuok guzuiena imiñi, bigarrena bai da derrigorrezkue imintzie (gmail-en usuaidxuena)

    # chmod 600 /etc/postfix/generic
    # postmap /etc/postfix/generic
    
  • 7.- Zertifikauek eta haunek upin danak konfigure:

    # mkdir /etc/postfix/certs/
    # cd /etc/postfix/certs/
    # openssl dsaparam 1024 -out dsa1024.pem
    # openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out mycert.pem -keyout mykey.pem

    Hau eindxe gero dato batzuk eskatuko’zkuz, al’zuie inbenta, baie akorda gero bardiñe sartun biko’zuie eta :)
    Adibidie:

    Generating a 1024 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]:EU
    State or Province Name (full name) [Some-State]:Bizkaia
    Locality Name (eg, city) []:Bermeo
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:hackin.badakigu
    Organizational Unit Name (eg, section) []:zital.hackin.badakigu
    Common Name (eg, YOUR name) []:zital
    Email Address []:zital@hakinbadakigu.net


    # openssl req -x509 -new -days 3650 -key /etc/postfix/certs/mykey.pem -out /etc/postfix/certs/mycert.pem

    oin ostabe lengo bardiñe:

    Generating a 1024 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]:EU
    State or Province Name (full name) [Some-State]:Bizkaia
    Locality Name (eg, city) []:Bermeo
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:hackin.badakigu
    Organizational Unit Name (eg, section) []:zital.hackin.badakigu
    Common Name (eg, YOUR name) []:zital
    Email Address []:zital@hakinbadakigu.net


    # rm dsa1024.pem
  • 8.- postfix reinizie:

    # /etc/init.d/postfix restart
  • 9.- root modotik urten:

    exit
  • 10.- proba :)

    $ echo "Pruebie gorputze" | mail -s "pruebie asuntue" zital@hakinbadakigu.net
  • *.- Apunte batzuk: # gudau esan komandue root moduen idazten dotela, artxibo baten barruen badauen komentaidxue eta $ komandue usuaidxo normal moduen idazten dotela :)

  • Hametik atata:
    http://www.esdebian.org/foro/19603/dudas-servidor-correo-ip-dinamicasmtp-google-solucionado