<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Temporini Matteo &#187; pop3</title>
	<atom:link href="http://www.temporini.net/category/pop3/feed" rel="self" type="application/rss+xml" />
	<link>http://www.temporini.net</link>
	<description>It&#039;s time to fix!</description>
	<lastBuildDate>Fri, 27 Jan 2012 23:21:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Virtual Users And Domains With Postfix, Courier, MySQL (Ubuntu 8.04 LTS 64bit)</title>
		<link>http://www.temporini.net/virtual-users-and-domains-with-postfix-courier-mysql-and-ubuntu-804-lts-64bit</link>
		<comments>http://www.temporini.net/virtual-users-and-domains-with-postfix-courier-mysql-and-ubuntu-804-lts-64bit#comments</comments>
		<pubDate>Tue, 27 Jan 2009 15:52:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[cyrus]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Domain Name System]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pop3]]></category>
		<category><![CDATA[posta]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[servizi]]></category>
		<category><![CDATA[sicurezza]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[virtualhost]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webserver]]></category>
		<category><![CDATA[configurazione]]></category>
		<category><![CDATA[cyrus imap posta mail]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Matteo]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://www.temporini.net/?p=233</guid>
		<description><![CDATA[<p>Questa guida vuole essere una quick reference per installare un server di posta con antispam e gestione relativamente semplice di utenti e domini, tramite ubuntu 8.04 TLS 64bit.</p> <p>Le feature principali sono:</p> <p>- SMTP-AUTH e TLS</p> <p>- password encrypted</p> <p>- Amavisd, SpamAssassin e ClamAV</p> <p></p> <p>La guida di riferimento principale la potete trovare all&#8217;indirizzo http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04, [...]]]></description>
			<content:encoded><![CDATA[<p>Questa guida vuole essere una <strong>quick reference</strong> per installare un server di posta con antispam e gestione relativamente semplice di utenti e domini, tramite ubuntu 8.04 TLS <strong>64bit</strong>.</p>
<p>Le feature principali sono:</p>
<p>- <strong>SMTP-AUTH </strong>e<strong> TLS</strong></p>
<p><strong>- </strong>password<strong> </strong><strong>encrypted</strong></p>
<p><strong>- </strong><strong>Amavisd</strong>, <strong>SpamAssassin</strong> e <strong>ClamAV</strong></p>
<p><span id="more-233"></span></p>
<p>La guida di riferimento principale la potete trovare all&#8217;indirizzo <a href="http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04">http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04</a>, la scrivo per il semplice motivo che la versione di ubuntu a 64bit differisce per alcuni pacchetti rispetto alla versione equivalente a 32bit. A differenza della guida principale ho deciso di non utilizzare la quota, in quanto volevo un sistema che non necessitasse di alcun tipo di ricompilazione esterna.</p>
<h3><strong>1. Preliminari</strong></h3>
<p>Eseguiamo:<br />
<code>root@localhost: sudo su</code><br />
<code>root@localhost: ln -sf /bin/bash /bin/sh</code><br />
<code>root@localhost: /etc/init.d/apparmor stop</code><br />
<code>root@localhost: update-rc.d -f apparmor remove</code></p>
<h3>2. Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin</h3>
<p>Procediamo con l&#8217;installazione dei pacchetti che ci servono:</p>
<p><code>root@localhost: apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl phpmyadmin apache2 libapache2-mod-php5 php5 php5-mysql libpam-smbpass</code></p>
<p>A questo punto vi verranno fatte delle domande post installazione a cui dovrete risopndere come a seguire:</p>
<p><span class="system">New password for the MySQL &#8220;root&#8221; user:</span> <span class="highlight">&lt;&#8211; <strong>yourrootsqlpassword</strong></span><br />
<span class="system">Repeat password for the MySQL &#8220;root&#8221; user:</span> <span class="highlight">&lt;&#8211; <strong>yourrootsqlpassword</strong></span><br />
<span class="system">Create directories for web-based administration?</span> <span class="highlight">&lt;&#8211; <strong>No</strong></span><br />
<span class="system">General type of mail configuration:</span> <span class="highlight">&lt;&#8211; <strong>Internet Site</strong></span><br />
<span class="system">System mail name:</span> <span class="highlight">&lt;&#8211; <strong>server1.example.com</strong></span><br />
<span class="system">SSL certificate required</span> <span class="highlight">&lt;&#8211; <strong>Ok</strong></span><br />
<span class="system">Web server to reconfigure automatically:</span> <span class="highlight">&lt;&#8211; <strong>apache2</strong></span></p>
<p><span class="highlight">A questo punto sulla guida originale si passava alla configurazione della quota, che noi non vogliamo usare, se voi volete farlo, prendete come riferimento la guida originale.</span></p>
<h3><span class="highlight">3. Creiamo </span>il database MySQL per Postfix/Courier</h3>
<p>Creiamo il database <em>mail</em></p>
<p><code>root@localhost: mysqladmin -u root -p create mail</code></p>
<p>entriamo nella shell di mysql</p>
<p><code>root@localhost: mysql -u root -p</code></p>
<p>On the MySQL shell, we create the user <span class="system">mail_admin</span> with the passwort <span class="system">mail_admin_password</span> (replace it with your own password) who has <span class="system">SELECT,INSERT,UPDATE,DELETE</span> privileges on the <span class="system">mail</span> database. This user will be used by Postfix and Courier to connect to the mail database</p>
<p>Sulla shell di MySQL, creeremo l&#8217;utente <em>mail_admin</em> con la password &#8220;<em>mail_admin_password</em>&#8220;, che avrà diritti di SELECT,INSERT,UPDATE,DELETE sul database <em>mail</em>.</p>
<p><code>mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost' IDENTIFIED BY 'mail_admin_password';</code><br />
<code>mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE ON mail.* TO 'mail_admin'@'localhost.localdomain' IDENTIFIED BY 'mail_admin_password';</code><br />
<code>mysql&gt; FLUSH PRIVILEGES;</code></p>
<p>selezioniamo ora il database <em>mail</em></p>
<p><code>mysql&gt; USE mail;</code></p>
<p>Creiamo ora le tabelle che ci servono:</p>
<p><code>CREATE TABLE domains (<br />
domain varchar(50) NOT NULL,<br />
PRIMARY KEY (domain) )<br />
TYPE=MyISAM;</code></p>
<p><code>CREATE TABLE forwardings (<br />
source varchar(80) NOT NULL,<br />
destination TEXT NOT NULL,<br />
PRIMARY KEY (source) )<br />
TYPE=MyISAM;</code></p>
<p><code>CREATE TABLE users (<br />
email varchar(80) NOT NULL,<br />
password varchar(20) NOT NULL,<br />
PRIMARY KEY (email)<br />
) TYPE=MyISAM;</code></p>
<p><code>CREATE TABLE transport (<br />
domain varchar(128) NOT NULL default '',<br />
transport varchar(128) NOT NULL default '',<br />
UNIQUE KEY domain (domain)<br />
) TYPE=MyISAM;</code></p>
<p><code>quit;</code></p>
<p>A questo punto avremo le seguenti tabelle:</p>
<p>- <code>domains : indica quali domini gestisce il nostro server di posta</code></p>
<p>- <code>forwardings : gestisce la lista dei forwarding di una determinata casella di posta verso un altra</code></p>
<p>- <code>users : le effettive caselle di posta, con tanto di nome utente e password</code></p>
<p>- <code>transport: serve a passare la gestione della singola email a un altro server, sintassi smtp:[1.2.3.4] le parentesi quadre indicano che non si deve fare nessuna query al dns, in questo caso va indicato l'indirizzo ip corretto.</code></p>
<p>Ora tramite phpmyadmin accessibile sul vostro webserver http://ip-del-server/phpmyadmin potrete gestire tutto quel che riguarda gli account di posta.</p>
<h3>4- Configurazione Postfix</h3>
<p>Editiamo</p>
<p><code>vi /etc/mysql/my.cnf</code></p>
<p>e configuriamo la voce</p>
<pre>[...]
bind-address            = 127.0.0.1
[...]</pre>
<p>se abbiamo modificato il file, eventualmente lanciamo il comando /etc/init.d/mysql restart</p>
<p>Creiamo il file<br />
<code>vi /etc/postfix/mysql-virtual_domains.cf</code></p>
<p>e inseriamo</p>
<pre>user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT domain AS virtual FROM domains WHERE domain='%s'
hosts = 127.0.0.1</pre>
<p>creiamo il file</p>
<p><code>vi /etc/postfix/mysql-virtual_forwardings.cf</code></p>
<pre>user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT destination FROM forwardings WHERE source='%s'
hosts = 127.0.0.1</pre>
<p>creiamo il file</p>
<p><code>vi /etc/postfix/mysql-virtual_mailboxes.cf</code></p>
<pre>user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s'
hosts = 127.0.0.1</pre>
<p>creiamo il file</p>
<p><code>vi /etc/postfix/mysql-virtual_email2email.cf</code></p>
<pre>user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT email FROM users WHERE email='%s'
hosts = 127.0.0.1</pre>
<p>creiamo il file</p>
<p><code>nano /etc/postfix/mysql-virtual_transports.cf</code></p>
<pre>user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT transport FROM transport WHERE domain='%s'
hosts = 127.0.0.1</pre>
<p>Modifichiamo ora i permessi ai file</p>
<p><code>chmod o= /etc/postfix/mysql-virtual_*.cf<br />
chgrp postfix /etc/postfix/mysql-virtual_*.cf</code></p>
<p>Creiamo ora il gruppo e l&#8217;utente vmail</p>
<p><code>groupadd -g 5000 vmail<br />
useradd -g vmail -u 5000 vmail -d /home/vmail -m</code></p>
<p>Eseguiamo ora i comandi di configurazione di postfix, facendo cura di modificare il server server1.example.com con il nostro FQDN.</p>
<p><code>postconf -e 'myhostname = server1.example.com'<br />
postconf -e 'mydestination = server1.example.com, localhost, localhost.localdomain'<br />
postconf -e 'mynetworks = 127.0.0.0/8'<br />
postconf -e 'virtual_alias_domains ='<br />
postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf'<br />
postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'<br />
postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf'<br />
postconf -e 'virtual_mailbox_base = /home/vmail'<br />
postconf -e 'virtual_uid_maps = static:5000'<br />
postconf -e 'virtual_gid_maps = static:5000'<br />
postconf -e 'smtpd_sasl_auth_enable = yes'<br />
postconf -e 'broken_sasl_auth_clients = yes'<br />
postconf -e 'smtpd_sasl_authenticated_header = yes'<br />
postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'<br />
postconf -e 'smtpd_use_tls = yes'<br />
postconf -e 'smtpd_tls_cert_file = /etc/postfix/smtpd.cert'<br />
postconf -e 'smtpd_tls_key_file = /etc/postfix/smtpd.key'<br />
postconf -e 'transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf'<br />
#postconf -e 'virtual_create_maildirsize = yes'<br />
#postconf -e 'virtual_mailbox_extended = yes'<br />
#postconf -e 'virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf'<br />
#postconf -e 'virtual_mailbox_limit_override = yes'<br />
#postconf -e 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."'<br />
#postconf -e 'virtual_overquota_bounce = yes'<br />
postconf -e 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps'</code></p>
<p>Creiamo ora il certificato ssl</p>
<p><code>cd /etc/postfix<br />
openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509</code></p>
<p>e completiamo le richieste del certificato come a seguire</p>
<pre>Country Name (2 letter code) [AU]: &lt;-- Enter your Country Name (e.g., "DE").
State or Province Name (full name) [Some-State]: &lt;-- Enter your State or Province Name.
Locality Name (eg, city) []: &lt;-- Enter your City.
Organization Name (eg, company) [Internet Widgits Pty Ltd]: &lt;-- Enter your Organization Name (e.g., the name of your company).
Organizational Unit Name (eg, section) []: &lt;-- Enter your Organizational Unit Name (e.g. "IT Department").
Common Name (eg, YOUR name) []: &lt;-- Enter the Fully Qualified Domain Name of the system (e.g. "server1.example.com").
Email Address []: &lt;-- Enter your Email Address.</pre>
<p>e modifichiamo i permessi come segue</p>
<p><code>chmod o= /etc/postfix/smtpd.key</code></p>
<h3>5. Configure Saslauthd</h3>
<p>Creiamo la cartella per saslauthd</p>
<p><code>mkdir -p /var/spool/postfix/var/run/saslauthd</code></p>
<p>Editiamo ora il file /etc/default/saslauthd settando <em>START</em> a <em>yes</em> e cambiando <em>OPTIONS=&#8221;-c -m /var/run/saslauthd&#8221;</em> a <em>OPTIONS=&#8221;-c -m /var/spool/postfix/var/run/saslauthd -r&#8221;</em>:</p>
<p><code>vi /etc/default/saslauthd</code></p>
<p>il risultato sarà</p>
<pre>#
# Settings for saslauthd daemon
# Please read /usr/share/doc/sasl2-bin/README.Debian for details.
#</pre>
<pre># Should saslauthd run automatically on startup? (default: no)
START=yes</pre>
<pre># Description of this saslauthd instance. Recommended.
# (suggestion: SASL Authentication Daemon)
DESC="SASL Authentication Daemon"</pre>
<pre># Short name of this saslauthd instance. Strongly recommended.
# (suggestion: saslauthd)
NAME="saslauthd"</pre>
<pre># Which authentication mechanisms should saslauthd use? (default: pam)
#
# Available options in this Debian package:
# getpwent  -- use the getpwent() library function
# kerberos5 -- use Kerberos 5
# pam       -- use PAM
# rimap     -- use a remote IMAP server
# shadow    -- use the local shadow password file
# sasldb    -- use the local sasldb database file
# ldap      -- use LDAP (configuration is in /etc/saslauthd.conf)
#
# Only one option may be used at a time. See the saslauthd man page
# for more information.
#
# Example: MECHANISMS="pam"
MECHANISMS="pam"</pre>
<pre># Additional options for this mechanism. (default: none)
# See the saslauthd man page for information about mech-specific options.
MECH_OPTIONS=""</pre>
<pre># How many saslauthd processes should we run? (default: 5)
# A value of 0 will fork a new process for each connection.
THREADS=5</pre>
<pre># Other options (default: -c -m /var/run/saslauthd)
# Note: You MUST specify the -m option or saslauthd won't run!
#
# See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
# See the saslauthd man page for general information about these options.
#
# Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
#OPTIONS="-c -m /var/run/saslauthd"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"</pre>
<p>Editiamo il file</p>
<p><code>vi /etc/pam.d/smtp</code></p>
<p>inseriamo</p>
<pre>auth    required   pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1</pre>
<p>Creiamo il file</p>
<p><code>vi /etc/postfix/sasl/smtpd.conf</code></p>
<p>e inseriamo</p>
<pre>pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: mail_admin
sql_passwd: sysop
sql_database: mail
sql_select: select password from users where email = '%u'</pre>
<p>aggiungiamo l&#8217;utente postfix al gruppo sals</p>
<p><code>root@localhost: adduser postfix sasl</code></p>
<p>e riavviamo postfix e sasl</p>
<p><code>/etc/init.d/postfix restart<br />
/etc/init.d/saslauthd restart</code></p>
<p>Configuriamo ora courier</p>
<p><code>vi /etc/courier/authdaemonrc</code></p>
<p>e modifichiamo</p>
<pre>[...]
authmodulelist="authmysql"
[...]</pre>
<p>Creiamo un backup di /etc/courier/authmysqlrc e svuotiamo il vecchio file</p>
<p><code>cp /etc/courier/authmysqlrc /etc/courier/authmysqlrc_orig<br />
cat /dev/null &gt; /etc/courier/authmysqlrc</code></p>
<p>Editiamo ora il file</p>
<p><code>vi /etc/courier/authmysqlrc</code></p>
<p>e inseriamo</p>
<pre>MYSQL_SERVER localhost
MYSQL_USERNAME mail_admin
MYSQL_PASSWORD mail_admin_password
MYSQL_PORT 0
MYSQL_DATABASE mail
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD 5000
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD "/home/vmail"
MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
#MYSQL_NAME_FIELD</pre>
<p>e riavviamo courier</p>
<p><code>/etc/init.d/courier-authdaemon restart<br />
/etc/init.d/courier-imap restart<br />
/etc/init.d/courier-imap-ssl restart<br />
/etc/init.d/courier-pop restart<br />
/etc/init.d/courier-pop-ssl restart</code></p>
<p>Controlliamo ora se il nostro server pop3 funziona</p>
<p><code>telnet localhost pop3</code></p>
<p>scrivete <em>QUIT</em> e dovrebbe darvi qualcosa di simile a</p>
<pre>root@localhost: telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Hello there.
quit
+OK Better luck next time.
Connection closed by foreign host.
root@localhost:</pre>
<p>7. Modifichiamo /etc/aliases</p>
<p>Modifichiamo /etc/aliases con qualcosa simile a</p>
<p><code>vi /etc/aliases</code></p>
<pre>[...]
postmaster: root
root: postmaster@yourdomain.tld
[...]</pre>
<p>dopo di che ad ogni modifica di /etc/aliases lanciamo</p>
<p><code>root@localhost: newaliases</code></p>
<p>e riavviamo postfix</p>
<p><code>root@localhost: /etc/init.d/postfix restart </code></p>
<h3>8. Installiamo Amavisd-new, Spamassassin, Clamv</h3>
<p>Lanciamo il comando:</p>
<p><code>apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax</code></p>
<p>Abilitamo Clamav e Spamassassin editando il file <span class="system">/etc/amavis/conf.d/15-content_filter_mode , decommentando le linee </span><em><span class="system">@bypass_virus_checks_maps</span></em> e <em><span class="system">@bypass_spam_checks_maps</span></em></p>
<p><code>vi /etc/amavis/conf.d/15-content_filter_mode</code></p>
<p>Che diventerà una cosa simile a:</p>
<pre>@bypass_virus_checks_maps = (
   \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);</pre>
<pre>#
# Default SPAM checking mode
# Uncomment the two lines below to enable it back
#</pre>
<pre>@bypass_spam_checks_maps = (
   \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);</pre>
<pre>1;  # ensure a defined return</pre>
<p>Controlliamo inoltre i settaggi dell&#8217;antispam e dell&#8217;antivirus nel file /etc/amavis/conf.d/20-debian_defaults , dovrebbero andare bene per tutti e non necessitano di modifiche particolari.</p>
<p>Editiamo il file /etc/amavis/conf.d/50-user</p>
<p><code>vi /etc/amavis/conf.d/50-user</code></p>
<p>ed aggiungiamo</p>
<pre>$pax='pax';</pre>
<p>avendo come risultato qualcosa di simile a:</p>
<pre>use strict;</pre>
<pre>#
# Place your configuration directives here.  They will override those in
# earlier files.
#
# See /usr/share/doc/amavisd-new/ for documentation and examples of
# the directives you can use in this file
#</pre>
<pre>$pax='pax';</pre>
<pre>#------------ Do not modify anything below this line -------------
1;  # ensure a defined return</pre>
<p>Eseguiamo questi comandi per aggiungere clamav al gruppo di amavis e riavviare amavisd-new e clamav:</p>
<p><code>adduser clamav amavis<br />
/etc/init.d/amavis restart<br />
/etc/init.d/clamav-daemon restart<br />
/etc/init.d/clamav-freshclam restart</code></p>
<p>Configuriamo ora postfix affinchè inoltri le email in arrivo all&#8217;antivirus amavisd-new</p>
<p><code>postconf -e 'content_filter = amavis:[127.0.0.1]:10024'<br />
postconf -e 'receive_override_options = no_address_mappings'</code></p>
<p>Modifichiamo il file /etc/postfix/master.cf</p>
<p><code>vi /etc/postfix/master.cf</code></p>
<p>e aggiungiamo alla fine</p>
<pre>[...]
amavis unix - - - - 2 smtp
        -o smtp_data_done_timeout=1200
        -o smtp_send_xforward_command=yes</pre>
<pre>127.0.0.1:10025 inet n - - - - smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o strict_rfc821_envelopes=yes
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_bind_address=127.0.0.1</pre>
<p>e riavviamo postfix</p>
<p><code>/etc/init.d/postfix restart</code></p>
<p>ora eseguendo</p>
<p><code>netstat -tap</code></p>
<p>dovreste vedere Postfix (smtp 25) e 10025, e amavisd-new sulla 10024</p>
<pre>root@server1:/etc/postfix# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost.localdo:10024 *:*                     LISTEN      15645/amavisd (mast
tcp        0      0 localhost.localdo:10025 *:*                     LISTEN      16677/master
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      6177/mysqld
tcp        0      0 *:www                   *:*                     LISTEN      5367/apache2
tcp        0      0 *:smtp                  *:*                     LISTEN      16677/master
tcp6       0      0 [::]:imaps              [::]:*                  LISTEN      14020/couriertcpd
tcp6       0      0 [::]:pop3s              [::]:*                  LISTEN      14088/couriertcpd
tcp6       0      0 [::]:pop3               [::]:*                  LISTEN      14051/couriertcpd
tcp6       0      0 [::]:imap2              [::]:*                  LISTEN      13983/couriertcpd
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      4006/sshd
tcp6       0     52 server1.example.com:ssh 192.168.0.210%8191:3340 ESTABLISHED 4059/0
root@server1:/etc/postfix#</pre>
<h3>9. Install Razor, Pyzor And Configure SpamAssassin</h3>
<p>Installiamo ora Razor, Pyzor che utilizzano una rete di filtri spam collaborativa sostenuta da varie community.</p>
<p>Eseguiamo il comando:</p>
<p><code>apt-get install razor pyzor</code></p>
<p>A questo punto editiamo</p>
<p><code>vi /etc/spamassassin/local.cf</code></p>
<pre>[...]
#pyzor
use_pyzor 1
pyzor_path /usr/bin/pyzor</pre>
<pre>#razor
use_razor2 1
razor_config /etc/razor/razor-agent.conf</pre>
<pre>#bayes
use_bayes 1
use_bayes_rules 1
bayes_auto_learn 1</pre>
<p>Possiamo configurare la nostra configurazione di spamassassin con il comando:</p>
<p><code>spamassassin --lint</code></p>
<p>e non dovrebbe darci alcun errore sul risultato.</p>
<p>Riavviamo ora amavis:</p>
<p><code>/etc/init.d/amavis restart</code></p>
<p>Aggiorniamo le nuove regole di Spamassassin con</p>
<p><code>sa-update --no-gpg</code></p>
<p>Creiamo un comando crontab per aggiornare le regole ogni tot tempo</p>
<p><code>crontab -e</code></p>
<p>e inseriamo</p>
<pre>23 4 */2 * * /usr/bin/sa-update --no-gpg &amp;&gt; /dev/null</pre>
<h3>10. Test postfix</h3>
<p>Controliamo ora se tutto funziona, controlliamo ora se postfix è pronto per SMTP-AUTH e TLS<br />
<code>telnet localhost 25</code></p>
<p class="command">dopo la connessione diamo il comando</p>
<p><code>ehlo localhost</code></p>
<p class="command">e dovremmo trovare la stringa</p>
<p><code>250-STARTTLS</code></p>
<p>e<br />
<code>50-AUTH LOGIN PLAIN</code></p>
<p>Qualcosa tipo:</p>
<pre>root@server1:/usr/local/sbin# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
root@server1:/usr/local/sbin#</pre>
<p>Non ci resta che popolare il database con i dati che ci interessano, ometto questa parte in quanto la ritengo particolarmente semplice ed intuitiva,</p>
<p>Mi soffermo su due aspetti, il primo riguarda le PASSWORD. Quando inserite un nuovo utente mi raccomando di selezionare il tipo di campo per le password come ENCRYPT, altrimenti non vi funzionerà l&#8217;autenticazione.</p>
<p>Date un occhio alle tabelle del link http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04-p4 in fondo alla pagina.</p>
<h3>11. Inviare un messaggio di benvenuto per creare la Maildir</h3>
<p>Una volta creato un account email è necessario inviare un&#8217;email affinchè venga creata immediatamente la directory dove verranno salvate le email. Se questo non viene fatto, quando qualcuno proverà a collegarsi via pop3 gli verrà dato un messaggio di errore. Provvediamo quandi a installare mailx tramite:</p>
<p><code>apt-get install mailx</code></p>
<p>per inviare un&#8217;email ci basta dare il comando</p>
<p><code>mailx sales@example.com</code></p>
<p>e compilare i seguenti campi</p>
<pre>mailx sales@example.com
Subject: Welcome &lt;-- ENTER
Welcome! Have fun with your new mail account. &lt;-- ENTER
&lt;-- CTRL+D
Cc: &lt;-- ENTER</pre>
<p>A questo punto potete installare squirrelmail e company per gestire la posta come preferite.</p>
<p>Saluti<br />
Matteo</p>
]]></content:encoded>
			<wfw:commentRss>http://www.temporini.net/virtual-users-and-domains-with-postfix-courier-mysql-and-ubuntu-804-lts-64bit/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Gmail: IMAP</title>
		<link>http://www.temporini.net/gmail-imap</link>
		<comments>http://www.temporini.net/gmail-imap#comments</comments>
		<pubDate>Wed, 24 Oct 2007 14:22:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[pop3]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://www.temporini.net/gmail-imap</guid>
		<description><![CDATA[<p>A distanza di alcuni anni dal lancio del servizio di Gmail di Google, è stata introdotta finalmente la possiblità di utilizzare il servizio IMAP accanto ai servizi già attivi di POP3 e SMTP.</p> <p>Il link per configurare il supporto IMAP a gmail lo trovate a questo indirizzo: http://mail.google.com/support/bin/answer.py?answer=77695 </p> <p>Saluti</p> <p>NOTA: non tutte le email [...]]]></description>
			<content:encoded><![CDATA[<p>A distanza di alcuni anni dal lancio del servizio di <a href="http://www.gamil.com" title="Gmail">Gmail</a> di <a href="http://www.google.com" title="Google.">Google</a>, è stata introdotta finalmente la possiblità di utilizzare il servizio IMAP accanto ai servizi già attivi di POP3 e SMTP.</p>
<p>Il link per configurare il supporto IMAP a gmail lo trovate a questo indirizzo: <a href="http://mail.google.com/support/bin/answer.py?answer=77695">http://mail.google.com/support/bin/answer.py?answer=77695 </a></p>
<p>Saluti</p>
<p>NOTA: non tutte le email sono abilitate al servizio, lo stanno facendo pian piano, per cui se ancora non funziona attendete fiduciosi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.temporini.net/gmail-imap/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controllo email via telnet</title>
		<link>http://www.temporini.net/controllo-email-via-telnet</link>
		<comments>http://www.temporini.net/controllo-email-via-telnet#comments</comments>
		<pubDate>Wed, 26 Sep 2007 10:24:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[pop3]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.temporini.net/controllo-email-via-telnet</guid>
		<description><![CDATA[<p>Capita spesso che qualcuno mi chiami dicendo &#8220;non mi funziona la posta!!&#8221;, e l&#8217;unica cosa da fare è contorllare se effettivamente tutto funziona.</p> <p>Purtroppo lavorando spesso via console non sno dotato di strumenti &#8220;belli&#8221; come un browser o un client di posta, e devo arrangiarmi come meglio posso.</p> <p>L&#8217;unica cosa che mi torna utile è [...]]]></description>
			<content:encoded><![CDATA[<p>Capita spesso che qualcuno mi chiami dicendo &#8220;non mi funziona la posta!!&#8221;, e l&#8217;unica cosa da fare è contorllare se effettivamente tutto funziona.</p>
<p>Purtroppo lavorando spesso via <strong>console</strong> non sno dotato di strumenti &#8220;belli&#8221; come un browser o un client di posta, e devo arrangiarmi come meglio posso.</p>
<p>L&#8217;unica cosa che mi torna utile è il <strong>telnet</strong>.</p>
<p>Per prima cosa dobbiamo sapere il nome dell&#8217;host a cui vogliamo accedere per leggere la posta via <strong>POP</strong> , nel nostro esempio lo chiameremo mail.domain.tld.</p>
<p>C: Comando da lanciare</p>
<p>S: Risposta del server</p>
<p><code>C: telnet mail.domain.tld 110<br />
S: +OK POP3 server ready<br />
C: USER test@domain.tld<br />
S: +OK<br />
C: PASS miapass<br />
S: +OK test@domain.tld has 2 messages (320 octets)<br />
C: QUIT</code></p>
<p>Un esempio tipico di sessione è il seguente<br />
<code></code></p>
<p><code>C: telnet mail.domain.tld 110</code><br />
<code> S: +OK POP3 server ready<br />
C: USER test@domain.tld<br />
S: +OK test@domain.tld has 2 messages (320 octets)<br />
C: LIST<br />
S: +OK 2 messages (320 octets)<br />
C: RETR 1<br />
S: +OK 120 octets &lt;il server POP3 invia il messaggio 1&gt;<br />
C: DELE 1<br />
S: +OK message 1 deleted<br />
C: QUIT<br />
S: +OK </code><code>test@domain.tld</code><code> POP3 server signing off<br />
C: QUIT &lt;chiude la connessione&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.temporini.net/controllo-email-via-telnet/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

