Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti...

33
Servizi di posta elettronica Servizi di posta elettronica Serate a tema Serate a tema Amministrazione sistemi Linux Amministrazione sistemi Linux 26 aprile 2010 26 aprile 2010 Marco Moser Marco Moser Linuxtrent Linuxtrent

Transcript of Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti...

Page 1: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Servizi di posta elettronicaServizi di posta elettronica

Serate a temaSerate a temaAmministrazione sistemi LinuxAmministrazione sistemi Linux

26 aprile 201026 aprile 2010Marco MoserMarco Moser

LinuxtrentLinuxtrent

Page 2: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

ContestoContesto

Page 3: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

TerminiTermini

● Mail User Agent → legge la posta via file, pop3, Mail User Agent → legge la posta via file, pop3, imap (mutt, thunderbird, webmail)imap (mutt, thunderbird, webmail)

● Mail Transfer Agent → riceve, spedisce, inoltra Mail Transfer Agent → riceve, spedisce, inoltra via smtp (sendmail, postfix, qmail)via smtp (sendmail, postfix, qmail)

● Mail Delivery Agent → consegna la posta Mail Delivery Agent → consegna la posta (procmail, deliver, lda)(procmail, deliver, lda)

Page 4: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Protocollo SMTPProtocollo SMTP

● Simple Mail Transport Protocol (1982) Simple Mail Transport Protocol (1982) ● Porta 25 Porta 25 ● Legge (e scrive) gli header dell'email → ascii a Legge (e scrive) gli header dell'email → ascii a

7bit7bit● Non certifica il mittente dei messaggiNon certifica il mittente dei messaggi● ESMTP (2008) → 8bit, uft8, starttls, ESMTP (2008) → 8bit, uft8, starttls,

autenticazione, ...autenticazione, ...

Page 5: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Esempio SMTPEsempio SMTPtelnet www.example.com 25telnet www.example.com 25

S: 220 www.example.com ESMTP PostfixS: 220 www.example.com ESMTP Postfix C: HELO mydomain.comC: HELO mydomain.com S: 250 Hello mydomain.com, pleased to meet youS: 250 Hello mydomain.com, pleased to meet you C: MAIL FROM: <[email protected]>C: MAIL FROM: <[email protected]> S: 250 [email protected] ... Sender okS: 250 [email protected] ... Sender ok C: RCPT TO: <[email protected]>C: RCPT TO: <[email protected]> S: 250 [email protected] ... Recipient OkS: 250 [email protected] ... Recipient Ok C: DATAC: DATA S: 354 End data with "." on a line by itselfS: 354 End data with "." on a line by itself C: Subject: messaggio di provaC: Subject: messaggio di prova C: From: [email protected]: From: [email protected] C: To: [email protected]: To: [email protected] C:C: C: Ciao,C: Ciao, C: questa è una prova.C: questa è una prova. C: .C: . S: 250 Ok: queued as 12345S: 250 Ok: queued as 12345 C: QUITC: QUIT S: 221 ByeS: 221 Bye

* wikipedia* wikipedia

Page 6: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Protocollo POPProtocollo POP

● Post Office Protocol (ver. 3)Post Office Protocol (ver. 3)● Porta 110 (plain o starttls) oppure 995 (ssl)Porta 110 (plain o starttls) oppure 995 (ssl)● Autentica l'utenteAutentica l'utente● Elenca, mostra e cancella la postaElenca, mostra e cancella la posta

Page 7: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Esempio POPEsempio POPtelnet www.example.com 110telnet www.example.com 110

S:+OK <[email protected]>S:+OK <[email protected]>C:USER pippoC:USER pippoS:+OKS:+OKC:PASS plutoC:PASS plutoS:+OKS:+OKC:LISTC:LISTS:+OKS:+OK 1 8171 817 2 1242 124 ..C:RETR 1C:RETR 1S:+OKS:+OK Return-Path: <[email protected]>Return-Path: <[email protected]> Delivered-To: [email protected]: [email protected] Date: Sat, 22 Oct 2005 13:24:54 +0200Date: Sat, 22 Oct 2005 13:24:54 +0200 From: Mario Rossi <[email protected]>From: Mario Rossi <[email protected]> Subject: xxxxSubject: xxxx Content-Type: text/plain; charset=ISO-8859-1Content-Type: text/plain; charset=ISO-8859-1 testo messaggiotesto messaggio ..C:DELE 1C:DELE 1S:+OKS:+OKC:QUITC:QUITS:+OKS:+OK

* wikipedia* wikipedia

Page 8: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Protocollo IMAPProtocollo IMAP

● Internet Message Access Protocol (ver. 4 1996)Internet Message Access Protocol (ver. 4 1996)● Porta 143 (plain o starttls) oppure 993 (ssl)Porta 143 (plain o starttls) oppure 993 (ssl)● Autentica utente → instaura una sessione, consente Autentica utente → instaura una sessione, consente

l'accesso concorrente all'accountl'accesso concorrente all'account● Elenca, mostra, cancella e archivia la posta → Elenca, mostra, cancella e archivia la posta →

organizzazione in cartelle, flags (letta, inoltrata, ..., di organizzazione in cartelle, flags (letta, inoltrata, ..., di lavoro, urgente), primitive per la ricercalavoro, urgente), primitive per la ricerca

● Scaricamento parziale dell'email (mime)Scaricamento parziale dell'email (mime)● Shared foldersShared folders

Page 9: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Esempio IMAPEsempio IMAPtelnet imap.joker.net 143telnet imap.joker.net 143* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] joker.net * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] joker.net IMAP4rev1 2001.315 at Sun, 13 Jul 2003 22:09:17 +0200 (CEST)IMAP4rev1 2001.315 at Sun, 13 Jul 2003 22:09:17 +0200 (CEST)a100 LOGIN homer onsllsa100 LOGIN homer onsllsa100 OK [CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS SCAN SORT a100 OK [CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS SCAN SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User homer THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User homer authenticatedauthenticateda101 select inboxa101 select inbox* 2 EXISTS* 2 EXISTS……a102 fetch 1:2 (flags body[header.fields (subject)]) a102 fetch 1:2 (flags body[header.fields (subject)]) ......a103 FETCH 1 (body[text])a103 FETCH 1 (body[text])* 1 FETCH (BODY[TEXT] {105}* 1 FETCH (BODY[TEXT] {105}Messaggio di prova,Messaggio di prova,Blah blahBlah blaha104 STORE 1 +FLAGS (\Deleted)a104 STORE 1 +FLAGS (\Deleted)* 1 FETCH (FLAGS (\Seen \Deleted NonJunk))* 1 FETCH (FLAGS (\Seen \Deleted NonJunk))a104 OK STORE completeda104 OK STORE completeda106 LOGOUTa106 LOGOUTa106 OK LOGOUT completeda106 OK LOGOUT completed

* openskill.info* openskill.info

Page 10: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Esempio EmailEsempio EmailReturn-Path: <[email protected]>Return-Path: <[email protected]>Delivered-To: [email protected]: [email protected]: from smtp-OUT05A.alice.it (smtp-OUT05A.alice.it [85.33.3.5])Received: from smtp-OUT05A.alice.it (smtp-OUT05A.alice.it [85.33.3.5])

by mail.oltrefersina.it (Postfix) with ESMTP id 4D319CF8005by mail.oltrefersina.it (Postfix) with ESMTP id 4D319CF8005for <[email protected]>; Sat, 24 Apr 2010 11:37:16 +0200 (CEST)for <[email protected]>; Sat, 24 Apr 2010 11:37:16 +0200 (CEST)

Received: from FBCMMO04.fbc.local ([7.168.68.254]) by smtp-OUT05A.alice.it with Received: from FBCMMO04.fbc.local ([7.168.68.254]) by smtp-OUT05A.alice.it with Microsoft SMTPSVC(6.0.3790.3959);Microsoft SMTPSVC(6.0.3790.3959);

Sat, 24 Apr 2010 11:37:16 +0200Sat, 24 Apr 2010 11:37:16 +0200Received: from FBCMCL01B02.fbc.local ([192.168.69.83]) by FBCMMO04.fbc.local with Received: from FBCMCL01B02.fbc.local ([192.168.69.83]) by FBCMMO04.fbc.local with Microsoft SMTPSVC(6.0.3790.3959);Microsoft SMTPSVC(6.0.3790.3959);

Sat, 24 Apr 2010 11:36:50 +0200Sat, 24 Apr 2010 11:36:50 +0200Received: from [192.168.1.100] ([87.2.104.48]) by FBCMCL01B02.fbc.local with Microsoft Received: from [192.168.1.100] ([87.2.104.48]) by FBCMCL01B02.fbc.local with Microsoft SMTPSVC(6.0.3790.3959);SMTPSVC(6.0.3790.3959);

Sat, 24 Apr 2010 11:36:50 +0200Sat, 24 Apr 2010 11:36:50 +0200Message-ID: <[email protected]>Message-ID: <[email protected]>Date: Sat, 24 Apr 2010 11:36:51 +0200Date: Sat, 24 Apr 2010 11:36:51 +0200From: "Polisportiva Oltrefersina.it" <[email protected]>From: "Polisportiva Oltrefersina.it" <[email protected]>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9.1.9) Gecko/20100317 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4Thunderbird/3.0.4MIME-Version: 1.0MIME-Version: 1.0To: Polisportiva Oltrefersina <[email protected]>To: Polisportiva Oltrefersina <[email protected]>Subject: provaSubject: provaContent-Type: text/plain; charset=ISO-8859-15; format=flowedContent-Type: text/plain; charset=ISO-8859-15; format=flowedContent-Transfer-Encoding: 7bitContent-Transfer-Encoding: 7bitX-OriginalArrivalTime: 24 Apr 2010 09:36:50.0685 (UTC) FILETIME=[AAAF2AD0:01CAE391]X-OriginalArrivalTime: 24 Apr 2010 09:36:50.0685 (UTC) FILETIME=[AAAF2AD0:01CAE391]

Email di provaEmail di prova

Page 11: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

MIMEMIME

● Multipurpose Internet Mail ExtensionsMultipurpose Internet Mail Extensions● Supporta il trasporto di mail non-ascii e multipartSupporta il trasporto di mail non-ascii e multipart

Header non ascii → Subject: =?ISO-8859-15?Q?perch=E8_poich=E8?=Header non ascii → Subject: =?ISO-8859-15?Q?perch=E8_poich=E8?=

Content-Transfer-Encoding: 8bitContent-Transfer-Encoding: 8bit

......

Content-Type: multipart/mixed;Content-Type: multipart/mixed;

boundary="----_=_NextPart_001_01C9E9B3.91ED543C"boundary="----_=_NextPart_001_01C9E9B3.91ED543C"

......

------_=_NextPart_002_01C9E9B3.91ED543C------_=_NextPart_002_01C9E9B3.91ED543C

Content-Type: text/plain;Content-Type: text/plain;

charset="iso-8859-1"charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printableContent-Transfer-Encoding: quoted-printable

Page 12: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

MTAMTA

● Sendmail (Allman 1980) → storico ma ostico da Sendmail (Allman 1980) → storico ma ostico da configurareconfigurare

● Qmail (Berstein 1995) → nasce molto sicuro (taglia 1 Qmail (Berstein 1995) → nasce molto sicuro (taglia 1 bug = 1.000$), da compilare, oggi la licenza e' public bug = 1.000$), da compilare, oggi la licenza e' public domain, e' un progetto fermodomain, e' un progetto fermo

● Postfix (IBM, Venema 1997) → sicuro, flessibile e Postfix (IBM, Venema 1997) → sicuro, flessibile e diffusodiffuso

● Altri: Exim, Apache James, ...Altri: Exim, Apache James, ...

Page 13: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix minimalePostfix minimale

● Server minimale → email per utenti locali Server minimale → email per utenti locali (/etc/passwd) + invio al mondo(/etc/passwd) + invio al mondo

● apt-get install postfix mailx apt-get install postfix mailx ● vi /etc/postfix/main.cfvi /etc/postfix/main.cf

– myhostname=mail.oltrefersina.itmyhostname=mail.oltrefersina.it– mydestination = $myhostname, localhost.mydestination = $myhostname, localhost.

$mydomain, localhost$mydomain, localhost– mynetworks = 127.0.0.0/8mynetworks = 127.0.0.0/8

Page 14: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix minimalePostfix minimale

● vi /etc/aliasesvi /etc/aliases– root: [email protected]: [email protected]

● /usr/bin/newaliases/usr/bin/newaliases● /etc/init.d/postfix restart/etc/init.d/postfix restart● TestTest

– mailx -s OK marcomoser [email protected] -s OK marcomoser [email protected]– prova email prova email

Page 15: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix utilityPostfix utility

● mailq → coda messaggimailq → coda messaggi● postsuper -r AEF2ACF8004 → rimuove dalla postsuper -r AEF2ACF8004 → rimuove dalla

codacoda● postqueue -f → svuota codapostqueue -f → svuota coda● tail -f /var/log/mail.info → file di logtail -f /var/log/mail.info → file di log● /var/spool/mail/ → caselle mbox/var/spool/mail/ → caselle mbox

Page 16: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix AlicePostfix Alice

● Mail server con relay su alice businessMail server con relay su alice business● apt-get install libsasl2-modulesapt-get install libsasl2-modules● vi /etc/postfix/main.cfvi /etc/postfix/main.cf

– myhostname=server1myhostname=server1– mydestination = $myhostname, localhost.mydestination = $myhostname, localhost.

$mydomain, localhost$mydomain, localhost– mynetworks = 127.0.0.0/8 192.168.0.0/24mynetworks = 127.0.0.0/8 192.168.0.0/24– relayhost = [mail.191.biz]relayhost = [mail.191.biz]

Page 17: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix AlicePostfix Alice

● main.cfmain.cf

– smtp_sasl_auth_enable = yessmtp_sasl_auth_enable = yes– smtp_sasl_type = cyrussmtp_sasl_type = cyrus– smtpd_use_tls = nosmtpd_use_tls = no– smtp_sasl_security_options = noanonymoussmtp_sasl_security_options = noanonymous– # evita ntlm# evita ntlm– smtp_sasl_mechanism_filter = LOGINsmtp_sasl_mechanism_filter = LOGIN– smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwdsmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd– # logging debug_peer_list = mail.191.biz# logging debug_peer_list = mail.191.biz

● vi /etc/postfix/sasl_passwdvi /etc/postfix/sasl_passwd

– mail.191.biz mail.191.biz [email protected]@yyy.191.it:xpasswordx:xpasswordx● postmap /etc/postfix/sasl/sasl_passwdpostmap /etc/postfix/sasl/sasl_passwd

Page 18: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Poor programmer - antispamPoor programmer - antispam

● Postgrey → greylisting (rifiuto temporaneo)Postgrey → greylisting (rifiuto temporaneo)● Real-time Blackhole List → elenco di host sconsigliatiReal-time Blackhole List → elenco di host sconsigliati● vi main.cfvi main.cf

– smtpd_recipient_restrictions = permit_mynetworks,smtpd_recipient_restrictions = permit_mynetworks,– reject_unauth_destination,reject_unauth_destination,– reject_rbl_client sbl.spamhaus.org,reject_rbl_client sbl.spamhaus.org,– reject_rbl_client bl.spamcop.net,reject_rbl_client bl.spamcop.net,– check_policy_service inet:127.0.0.1:60000check_policy_service inet:127.0.0.1:60000

Page 19: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

AntispamAntispam

● Apache SpamAssasin → bayesian: filtra la posta Apache SpamAssasin → bayesian: filtra la posta in ingresso valutandone il contenuto [perl]in ingresso valutandone il contenuto [perl]

● DSPAM → autoapprendimento, filtri bayesian [c] DSPAM → autoapprendimento, filtri bayesian [c] + gui+ gui

● Amavis → spamassasin + clamav (antivirus)Amavis → spamassasin + clamav (antivirus)● ASSP → smtp proxy server (bayesian, rbl, urirbl, ASSP → smtp proxy server (bayesian, rbl, urirbl,

greylisting, …) + guigreylisting, …) + gui● ThunderBayes++ → Thunderbird pluginThunderBayes++ → Thunderbird plugin

Page 20: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Utenti virtualiUtenti virtuali

# Crea user vmail# Crea user vmailgroupadd -g 5000 vmailgroupadd -g 5000 vmailuseradd -m -u 5000 -g 5000 -s /bin/false vmailuseradd -m -u 5000 -g 5000 -s /bin/false vmail

vi main.cfvi main.cf# elenco dei domini per cui accettare la email# elenco dei domini per cui accettare la emailvirtual_mailbox_domains = /etc/postfix/vhostsvirtual_mailbox_domains = /etc/postfix/vhosts

# homedir delle caselle virtual# homedir delle caselle virtualvirtual_mailbox_base = /home/vmailvirtual_mailbox_base = /home/vmailvirtual_uid_maps = static:5000virtual_uid_maps = static:5000virtual_gid_maps = static:5000virtual_gid_maps = static:5000

# elenca puntualmente tutte le caselle postali e directory # elenca puntualmente tutte le caselle postali e directory relativarelativavirtual_mailbox_maps = hash:/etc/postfix/vmailboxvirtual_mailbox_maps = hash:/etc/postfix/vmailbox

# elenca tutti gli alias# elenca tutti gli aliasvirtual_alias_maps = hash:/etc/postfix/valiasvirtual_alias_maps = hash:/etc/postfix/valias

Page 21: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Utenti virtualiUtenti virtuali

vi /etc/postfix/vhostsvi /etc/postfix/vhostsoltrefersina.itoltrefersina.it

vi /etc/postfix/vmailboxvi /etc/postfix/[email protected] oltrefersina.it/info/[email protected] oltrefersina.it/info/[email protected] oltrefersina.it/moser/[email protected] oltrefersina.it/moser/[email protected] oltrefersina.it/calcio/[email protected] oltrefersina.it/calcio/

vi /etc/postfix/valiasvi /etc/postfix/[email protected] [email protected]@oltrefersina.it [email protected]

postmap /etc/postfix/vmailboxpostmap /etc/postfix/vmailboxpostmap /etc/postfix/valiaspostmap /etc/postfix/valiasPostfix reloadPostfix reload

Page 22: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

DovecotDovecot

● T.Sirainen, Finlandia (2002) – Ubuntu 8.04 1.0, beta 2.0T.Sirainen, Finlandia (2002) – Ubuntu 8.04 1.0, beta 2.0● server IMAP e POP3 con supporto per i protocolli sicuri server IMAP e POP3 con supporto per i protocolli sicuri

IMAPS e POPS, TLS e SSLIMAPS e POPS, TLS e SSL● caselle di posta in entrambi i formati: mbox e Maildir. caselle di posta in entrambi i formati: mbox e Maildir. ● Autenticazione degli utenti → passwd, pam, ldap, sqlAutenticazione degli utenti → passwd, pam, ldap, sql● Implementa un lda con mail quota e sieve (vacation, Implementa un lda con mail quota e sieve (vacation,

redirect)redirect)● Parla con postfix → sasl (scenario server)Parla con postfix → sasl (scenario server)● Sicurezza → taglia 1 bug = 1.000 EuroSicurezza → taglia 1 bug = 1.000 Euro

Page 23: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

LDALDA

apt-get install dovecot-imapd dovecot-pop3dapt-get install dovecot-imapd dovecot-pop3d

vi /etc/dovecot/dovecot.confvi /etc/dovecot/dovecot.conf

protocols = imap imaps pop3 pop3sprotocols = imap imaps pop3 pop3s

# outlook non ha il tls# outlook non ha il tlsdisable_plaintext_auth = nodisable_plaintext_auth = no

mail_location = maildir:/home/vmail/%d/%nmail_location = maildir:/home/vmail/%d/%n

# abilita il local delivery agent + sieve script# abilita il local delivery agent + sieve scriptprotocol lda {protocol lda { # Address to use when sending rejection mails.# Address to use when sending rejection mails. postmaster_address = [email protected]_address = [email protected] # Enabling Sieve plugin for server-side mail filtering# Enabling Sieve plugin for server-side mail filtering mail_plugins = cmusievemail_plugins = cmusieve}}

Page 24: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Auth + SieveAuth + Sieveauth default {auth default { # il methodo login e' usato da outlook (sasl)# il methodo login e' usato da outlook (sasl) mechanisms = plain loginmechanisms = plain login

#passdb passwd-file { # quello solo per deny = yes#passdb passwd-file { # quello solo per deny = yes #passdb pam {#passdb pam {

passdb passwd-file {passdb passwd-file { args = /home/dovecot/passwd-%dargs = /home/dovecot/passwd-%d }}

userdb passwd-file {userdb passwd-file { args = /home/dovecot/passwd-%dargs = /home/dovecot/passwd-%d }}

# user needs access to only user and password databases# user needs access to only user and password databases user = rootuser = root

## dovecot-lda specific settings## dovecot-lda specific settings #### socket listen {socket listen { master {master { path = /var/run/dovecot/auth-masterpath = /var/run/dovecot/auth-master mode = 0600mode = 0600 user = vmail # User running Dovecot LDAuser = vmail # User running Dovecot LDA #group = vmail # Or alternatively mode 0660 + LDA user in this group#group = vmail # Or alternatively mode 0660 + LDA user in this group }}}}plugin {plugin { sieve = /home/vmail/%d/%n/sievesieve = /home/vmail/%d/%n/sieve}}

Page 25: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Postfix - DovecotPostfix - Dovecot

vi /etc/postfix/main.cfvi /etc/postfix/main.cfdovecot_destination_recipient_limit = 1dovecot_destination_recipient_limit = 1virtual_transport = dovecotvirtual_transport = dovecot

vi /etc/postfix/master.cfvi /etc/postfix/master.cf# service type private unpriv chroot wakeup maxproc # service type private unpriv chroot wakeup maxproc command + argscommand + args# dovecot lda# dovecot ldadovecot unix - n n - - pipedovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}${sender} -d ${recipient}

Page 26: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

File utenti + sievercFile utenti + sieverc

Vi /etc/dovecot/passwdVi /etc/dovecot/passwd

# user:password:uid:gid:(gecos):home:(shell):extra_fields# user:password:uid:gid:(gecos):home:(shell):[email protected]:{plain}xxx:5000:[email protected]:{plain}xxx:5000:5000

vi /home/vmail/oltrefersina.it/moser/sievercvi /home/vmail/oltrefersina.it/moser/sievercrequire "fileinto";require "fileinto";

# mailing linuxtrent# mailing linuxtrentif header :contains "to" "[email protected]" {if header :contains "to" "[email protected]" { fileinto "Mailing.Linuxtrent";fileinto "Mailing.Linuxtrent"; stop;stop;}}if header :contains "to" "[email protected]" {if header :contains "to" "[email protected]" { fileinto "Mailing.Soci Linuxtrent";fileinto "Mailing.Soci Linuxtrent"; stop;stop;}}

Page 27: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Qmail + vpopmail + qmailadminQmail + vpopmail + qmailadmin

● Vpopmail (Inter7 GPL)Vpopmail (Inter7 GPL)● virtual domains, virtual users → file system, sql, virtual domains, virtual users → file system, sql,

ldapldap● Gui per l'amministratore e per gli utenti (forward, Gui per l'amministratore e per gli utenti (forward,

vacation, autoresponder)vacation, autoresponder)● Nota dolente... si parte dai sorgenti: qmail, Nota dolente... si parte dai sorgenti: qmail,

vpopmail, dovecot/courier-imapvpopmail, dovecot/courier-imap

Page 28: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Qmailadmin (web)Qmailadmin (web)

Page 29: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

Mozilla ThunderbirdMozilla Thunderbird

Page 30: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

NOCCNOCC

Page 31: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

RoundCubeRoundCube

Page 32: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

GroupwareGroupware

● Overlook (openit) → rubrica, calendario Overlook (openit) → rubrica, calendario (condivisi)(condivisi)

● EgroupwareEgroupware● ZimbraZimbra● HordeHorde● ……● SugarCRMSugarCRM

Page 33: Serate a tema Amministrazione sistemi Linux · ThunderBayes++ → Thunderbird plugin. Utenti virtuali # Crea user vmail groupadd -g 5000 vmail useradd -m -u 5000 -g 5000 -s /bin/false

ConclusioniConclusioni

● Fonti:Fonti:– http://it.wikipedia.orghttp://it.wikipedia.org– http://www.postfix.orghttp://www.postfix.org– http://wiki.dovecot.org/http://wiki.dovecot.org/– http://openskill.info/http://openskill.info/

● Licenza della presentazione:Licenza della presentazione:– Autore: Marco Moser <[email protected]>Autore: Marco Moser <[email protected]>– Licenza: Creative Commons Attribuzione - Condividi allo Licenza: Creative Commons Attribuzione - Condividi allo

stesso modo 2.5 Italia Licensestesso modo 2.5 Italia License– http://creativecommons.org/licenses/by-sa/2.5/it/http://creativecommons.org/licenses/by-sa/2.5/it/