Visualizzazione post con etichetta exim4. Mostra tutti i post
Visualizzazione post con etichetta exim4. Mostra tutti i post

venerdì 4 maggio 2012

Configurazione exim "mail sent by smarthost" (smtp.gmail.com)

Per prima cosa:
dpkg-reconfigure exim4-config











Poi, nasce un problema, che ho risolto leggendo "/usr/share/doc/exim4-base/README.Debian.gz", qua l'estratto della parte significativa:
2.3.1. Using Exim as SMTP-AUTH client

   If you want to set up Exim as SMTP AUTH client for delivery to your
   internet access provider's smarthost put the name of the server, your
   login and password in /etc/exim4/passwd.client. See the man page for
   exim4-config_files(5) for more information about the required format.

   If you need to enable AUTH PLAIN or AUTH LOGIN for unencrypted
   connections because your service provider does support neither TLS
   encryption nor the CRAM MD5 authentication method, you can do so by
   setting the AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS macro. Please refer to
   Section 2.1.3, "Using Exim Macros to control the configuration" for
   an explanation of how best to do this.

   /etc/exim4/passwd.client needs to be readable for the exim user (user
   Debian-exim, group Debian-exim). It is suggested that you keep the
   default permissions root:Debian-exim 0640.

Allora, ho consultato pure:
man exim4_passwd_client
Trovando:
/etc/exim4/passwd.client
       contains account and password data for SMTP authentication when exim is authenticating as a client to some remote server.

       The file should contain lines of the form

       target.mail.server.example:login-user-name:password

       which  will  cause exim to use login-user-name and password when sending messages to a server with the canonical host name target.mail.server.examâ
       ple.  Please note that this does not configure the mail server to send to (this is determined in Debconf), but only creates the correlation between
       host name and authentication credentials to avoid exposing passwords to the wrong host.

       Please  note that target.mail.server.example is currently the value that exim can read from reverse DNS: It first follows the host name of the tarâ
       get system until it finds and IP address, and then looks up the reverse DNS for that IP address to use the outcome of this query (or the IP address
       itself should the query fail) as index into /etc/exim4/passwd.client.

       This goes inevitably wrong if the host name of the mail server is a CNAME (a DNS alias), or the reverse lookup does not fit the forward one.

       Currently,  you  need to manually lookup all reverse DNS names for all IP addresses that your SMTP server host name points to, for example by using
       the host command.  If the SMTP smarthost alias expands to multiple IPs, you need to have multiple lines for all the hosts.  When your  ISP  changes
       the alias, you will need to manually fix that.

       You may minimize this trouble by using a wild card entry or regular expressions, thus reducing the risk of divulging the password to the wrong SMTP
       server while reducing the number of necessary lines.  For a deeper discussion, see the Debian BTS #244724.

       password is your SMTP password in clear text. If you do not know about your SMTP password, you can try using your POP3 password as a first guess.

       This file must be readable for the Debian-exim user and should not be readable for others. Recommended file mode is root:Debian-exim 640.

       # example for CONFDIR/passwd.client
       # this will only match if the serverâs generic name matches exactly
       mail.server.example:user:password
       # this will deliver the password to any server
       *:username:password
       # this will deliver the password to servers whose generic name ends in
       # mail.server.example
       *.mail.server.example:user:password
       # this will deliver the password to servers whose generic name matches
       # the regular expression
       ^smtp[0-9]*.mail.server.example:user:password

Per verificare:
host smtp.gmail.com
smtp.gmail.com is an alias for gmail-smtp-msa.l.google.com.
gmail-smtp-msa.l.google.com has address 173.194.66.109
gmail-smtp-msa.l.google.com has address 173.194.66.108

Ho di conseguenza modificato il file "/etc/exim4/passwd.client" cosi`:
# password file used when the local exim is authenticating to a remote
# host as a client.
#
# see exim4_passwd_client(5) for more documentation
#
# Example:
### target.mail.server.example:login:password
gmail-smtp-msa.l.google.com:USERNAME@gmail.com:PASSWORD

sabato 16 ottobre 2010

Debian - Posta elettronica (lettura in locale e spedizione)

Dopo aver configurato il sistema per l'utilizzo della posta tramite IMAP, ho considerato di mantenere ed utilizzare comunque, anche quella in locale.

Ho creato un nuovo file di configurazione per mutt, chaimandolo ".muttrc.local", questo e` il contenuto:
set mbox_type=Maildir
set folder=~/.maildir
set spoolfile=~/.maildir/
set record=~/.maildir/sent/

# Maybe we shouldn't set index_format here, but this is a recommended
# one for maildir-style folders.

set index_format="%4C %Z %{%b %d} %-16.16L  %s"

######################################################################
#
# mySystem configuration file for Mutt
#

color hdrdefault cyan black
color quoted magenta black
color signature brightred black
color indicator brightyellow red
color error brightred black
color status brightyellow blue
color tree brightmagenta black  # the thread tree in the index menu
color tilde brightmagenta black
color message brightcyan black
color normal white black
color attachment brightmagenta black
color search black green        # how to hilite search patterns in the pager
color header brightyellow black ^(From|Subject):
color body brightyellow black "(ftp|http)://[^ ]+"      # point out URLs
color body brightcyan black [-a-z_0-9.]+@[-a-z_0-9.]+   # e-mail addresses
color underline brightgreen black

set from="NOMECASELLADIPOSTA@alice.it"
set hostname=alice.it
set realname=NOMECASELLADICPOSTA(senza @alice.it)
set sort=threads
set editor=vim
#set charset="ISO-8859-15"

# Scarica la posta / esegui fetchmail premendo il tasto G
#macro index G "!fetchmail -a -m 'procmail -d %T'\r"
#macro pager G "!fetchmail -a -m 'procmail -d %T'\r"

# Lista degli header da togliere quando visualizzo la mail
ignore *
unignore  Date To From: Subject X-Mailer Organization User-Agent
hdr_order Date From To Subject X-Mailer User-Agent Organization

# lbdb database
#%set query_command="lbdbq %s"

# abook
#set query_command="abook --mutt-query '%s'"
#macro pager A "abook --add-email"
Si puo` notare come abbia disattivato l'utilizzo delle impostazioni per lo scaricamento della posta (fetchmail) e per la rubrica (abook, ho scoperto che in debian sono gia` inserite in "/etc/Muttrc.d/abook.rc" :P ).

Per utilizzare questo file di configurazione in avvio, il comando e`:
mutt -F .muttrc.local
che ho messo in un file chiamato "mutt-local.sh" rendendolo eseguibile.

Avevo dimenticato che si devono creare le directory:
mkdir -p .maildir/{cur,new,tmp}

Poi ho riconfigurato "exim4", da root:
dpkg-reconfigure exim4-config
rispondendo cosi`:
mail sent by smarthost; received via SMTP or fetchmail
DOMINIO.MIO
127.0.0.1
DOMINIO.MIO
LASCIATA VUOTA
out.alice.it
Yes
alice.it
No
Maildir format in home directory
Yes
per lasciarmi la possibilita` di inviare mail all'esterno.

2010.10.16
Corretto configurazione exim4 perche` cercava di spedire al SMTP esterno qualsiasi mail.

giovedì 30 settembre 2010

Debian - Posta elettronica (mutt)

Qui non so se riusciro` ad essere sufficientemente 'chiaro', perche` ho dovuto rivedere un paio di volte alcune configurazioni, in quanto non avevo capito o avevo risposto male, o altro ..

Un paio di righe per spiegare la situazione.
Mi trovo nella rete, ma voglio lasciare questo pc indipendente, ovvero, deve poter inviare e ricevere posta da un server remoto (alice) e per una sola casella (anche se potrebbero essere piu` di una, ma sempre con lo stesso provider/isp, piu` correttamente: stesso server smtp).

ATTENZIONE:
I riferimenti sono ad una casella della posta di alice, ho evidenziato con nomi di comodo il mio dominio, il mio username, ecc.ecc., facilmente individuabili.

I programmi erano praticamente tutti gia` installati, mancavano:
apt-get install fetchmail abook
Per prima cosa ho riconfigurato "exim4":
dpkg-reconfigure exim4-config
Rispondendo cosi`:
mail sent by smarthost; received via SMTP or fetchmail
DOMINIO.MIO
127.0.0.1
DOMINIO.MIO
LASCIATA VUOTA
out.alice.it
Yes
DOMINIO.MIO
No
Maildir format in home directory
No
Poi ho configurato fetchmail:
vi .fetchmailrc
poll "in.alice.it" protocol pop3
  user "NOMECASELLADIPOSTA" password "PASSWORD" is "USERNAME" here
    forcecr
Poi ho configurato procmail (dove ho praticamente eliminato tutte le regole di smistamente della posta che avevo dalla precedente configurazione):
vi .procmailrc
MAILDIR=$HOME/.maildir  # Controllare che esista !!!
Poi ho configurato mutt:
vi .muttrc
set mbox_type=Maildir
set folder=~/.maildir
set spoolfile=~/.maildir/
set record=~/.maildir/sent/
set move=no

set index_format="%4C %Z %{%b %d} %-16.16L  %s"

color hdrdefault cyan black
color quoted magenta black
color signature brightred black
color indicator brightyellow red
color error brightred black
color status brightyellow blue
color tree brightmagenta black # the thread tree in the index menu
color tilde brightmagenta black
color message brightcyan black
color normal white black
color attachment brightmagenta black
color search black green # how to hilite search patterns in the pager
color header brightyellow black ^(From|Subject):
color body brightyellow black "(ftp|http)://[^ ]+" # point out URLs
color body brightcyan black [-a-z_0-9.]+@[-a-z_0-9.]+ # e-mail addresses
color underline brightgreen black

set from="NOMEDELLACASELLADIPOSTA"
#set use_domain="no"
#%set use_from="no"
#%set use_domain
set hostname=alice.it
set realname=NOMEDELLACASELLA(senza @DOMINIO)
set sort=threads
set editor=vim
#set charset="ISO-8859-15"

# esegui fetchmail premendo il tasto G
macro index G "!fetchmail -a -m 'procmail -d %T'\r"
macro pager G "!fetchmail -a -m 'procmail -d %T'\r"

# Lista degli header da togliere quando visualizzo la mail
ignore *
unignore  Date To From: Subject X-Mailer Organization User-Agent
hdr_order Date From To Subject X-Mailer User-Agent Organization

# abook
set query_command="abook --mutt-query '%s'"
macro pager A "abook --add-email"
Ed infine ho creato le directory:
mkdir -p .maildir/{cur,new,tmp}

Mutt (promemoria)
Il tasto "G" scarica la posta, il tasto "Q" ricerca nella rubrica (abook), il tasto "A" aggiunge l'indirizzo alla rubrica.

Riferimenti:
http://wiki.mutt.org/?MuttGuide/Aliases

Ho messo solo un riferimento, perche` non ho consultato pagine, molti comandi li conoscevo gia`, ed anche le risposte (o quasi).
Le difficolta` sono sopraggiunte nel ritocco del ".muttrc", questa volta ho dovuto eliminare la voce "set sendmail" e modificare la macro del tasto "A", che non funzionava piu`.