Server Setup · 4 min read · Oct 03, 2025

Il Server Perfetto - Mandriva 2009.1 Free (x86_64) [ISPConfig 2] - Pagina 5

10 MySQL 5

Per installare MySQL 5, eseguiamo semplicemente:

urpmi MySQL MySQL-client lib64mysql-devel

Per impostazione predefinita, il networking non è abilitato nel pacchetto MySQL di Mandriva 2009.1, ma il networking è richiesto da ISPConfig. Possiamo cambiare questo commentando la riga skip-networking in /etc/my.cnf.

vi /etc/my.cnf

| [...] # Non ascoltare affatto su una porta TCP/IP. Questo può essere un miglioramento della sicurezza, # se tutti i processi che devono connettersi a mysqld vengono eseguiti sullo stesso host. # Tutte le interazioni con mysqld devono essere effettuate tramite socket Unix o pipe nominate. # Nota che utilizzare questa opzione senza abilitare le pipe nominate su Windows # (tramite l'opzione "enable-named-pipe") renderà mysqld inutile! # #skip-networking [...] |

Dopo, creiamo i collegamenti di avvio del sistema per MySQL…

chkconfig mysqld on

… e lo avviamo:

/etc/init.d/mysqld start

Ora controlla che il networking sia abilitato. Esegui

netstat -tap | grep mysql

L’output dovrebbe apparire così:

[root@server1 var]# netstat -tap | grep mysql  
tcp        0      0 *:mysql-im                     *:*                         LISTEN      3411/mysqlmanager  
tcp        0      0 *:mysql                         *:*                         LISTEN      3421/mysqld  
[root@server1 var]#

Successivamente, esegui

mysqladmin -u root password yourrootsqlpassword  
mysqladmin -h server1.example.com -u root password yourrootsqlpassword

per impostare una password per l’utente root (altrimenti chiunque può accedere al tuo database MySQL!).

11 Postfix Con SMTP-AUTH E TLS; Dovecot

Installa i pacchetti richiesti (Postfix, cyrus-sasl, Dovecot, ecc.) in questo modo:

urpmi cyrus-sasl lib64sasl2 lib64sasl2-devel lib64sasl2-plug-plain lib64sasl2-plug-anonymous lib64sasl2-plug-crammd5 lib64sasl2-plug-digestmd5 lib64sasl2-plug-gssapi lib64sasl2-plug-login postfix dovecot

Poi esegui:

postconf -e 'mydestination = /etc/postfix/local-host-names, localhost.$mydomain'  
postconf -e 'smtpd_sasl_local_domain ='  
postconf -e 'smtpd_sasl_auth_enable = yes'  
postconf -e 'smtpd_sasl_security_options = noanonymous'  
postconf -e 'broken_sasl_auth_clients = yes'  
postconf -e 'smtpd_sasl_authenticated_header = yes'  
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'  
postconf -e 'inet_interfaces = all'  
postconf -e 'mynetworks = 127.0.0.0/8'  
touch /etc/postfix/local-host-names

Poi impostiamo il nome host nella nostra installazione di Postfix (assicurati di sostituire server1 e example.com con le tue impostazioni):

postconf -e 'mydomain = example.com'  
postconf -e 'myhostname = server1.$mydomain'

Modifica /etc/sasl2/smtpd.conf. Dovrebbe apparire così:

vi /etc/sasl2/smtpd.conf

| # File di configurazione della libreria SASL per postfix # tutti i parametri sono documentati in: # /usr/share/doc/cyrus-sasl/options.html # I parametri mech_list elencano i meccanismi sasl da utilizzare, # il predefinito è tutti i meccanismi trovati. mech_list: plain login # Per autenticarsi utilizzando il demone saslauthd separato, (ad es. per # utenti di sistema o ldap). Vedi anche /etc/sysconfig/saslauthd. pwcheck_method: saslauthd saslauthd_path: /var/lib/sasl2/mux # Per autenticarsi contro gli utenti memorizzati in sasldb. #pwcheck_method: auxprop #auxprop_plugin: sasldb #sasldb_path: /var/lib/sasl2/sasl.db |

Crea il certificato SSL necessario per TLS:

mkdir /etc/postfix/ssl  
cd /etc/postfix/ssl/  
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key  
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key  
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650

… e configura Postfix per TLS:

postconf -e 'smtpd_tls_auth_only = no'  
postconf -e 'smtp_use_tls = yes'  
postconf -e 'smtpd_use_tls = yes'  
postconf -e 'smtp_tls_note_starttls_offer = yes'  
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'  
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'  
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'  
postconf -e 'smtpd_tls_loglevel = 1'  
postconf -e 'smtpd_tls_received_header = yes'  
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'  
postconf -e 'tls_random_source = dev:/dev/urandom'

Successivamente dobbiamo configurare Dovecot per servire i protocolli imap, imaps, pop3 e pop3s. Apri /etc/dovecot.conf e regola i seguenti valori:

vi /etc/dovecot.conf

| [...] protocols = imap imaps pop3 pop3s [...] disable_plaintext_auth = no [...] pop3_uidl_format = %08Xu%08Xv [...] |

Ora dobbiamo dire al sistema di avviare Dovecot solo dopo che ntpd è stato avviato perché Dovecot non è molto indulgente se l’orario del sistema si sposta all’indietro mentre Dovecot è in esecuzione (vedi http://wiki.dovecot.org/TimeMovedBackwards). Questo potrebbe causare errori come i seguenti nel tuo syslog:

Apr  9 19:29:18 server1 dovecot: Time just moved backwards by 17 seconds. This might  
cause a lot of problems, so I'll just kill myself now. http://wiki.dovecot.org/TimeMovedBackwards

Sfortunatamente, su Mandriva Dovecot viene avviato prima di ntpd, quindi lo cambiamo in questo modo:

cd /etc/rc3.d  
mv S99ntpd S98ntpd  
cd /etc/rc4.d  
mv S99ntpd S98ntpd  
cd /etc/rc5.d  
mv S99ntpd S98ntpd

Poi creiamo i collegamenti di avvio del sistema per Postfix…

chkconfig postfix on

… e (ri)avviamo Postfix, saslauthd e Dovecot:

/etc/init.d/postfix restart  
/etc/init.d/saslauthd restart  
/etc/init.d/dovecot restart

Per vedere se SMTP-AUTH e TLS funzionano correttamente ora esegui il seguente comando:

telnet localhost 25

Dopo aver stabilito la connessione al tuo server di posta Postfix digita

ehlo localhost

Se vedi le righe

250-STARTTLS

e

250-AUTH PLAIN LOGIN

tutto va bene:

[root@server1 ssl]# telnet localhost 25  
Trying 127.0.0.1...  
Connected to localhost.localdomain (127.0.0.1).  
Escape character is '^]'.  
220 server1.example.com ESMTP Postfix (2.5.6) (Mandriva Linux)  
ehlo localhost  
250-server1.example.com  
250-PIPELINING  
250-SIZE 10240000  
250-VRFY  
250-ETRN  
250-STARTTLS  
250-AUTH PLAIN LOGIN  
250-AUTH=PLAIN LOGIN  
250-ENHANCEDSTATUSCODES  
250-8BITMIME  
250 DSN  
quit  
221 2.0.0 Bye  
Connection closed by foreign host.  
[root@server1 ssl]#

Digita

quit

per tornare alla shell del sistema.

11.1 Maildir

Dovecot utilizza il formato Maildir (non mbox), quindi se installi ISPConfig sul server, assicurati di abilitare Maildir sotto Gestione -> Server -> Impostazioni -> Email. ISPConfig eseguirà quindi la configurazione necessaria.

Se non vuoi installare ISPConfig, allora devi configurare Postfix per consegnare le email alla Maildir di un utente (puoi anche farlo se usi ISPConfig - non fa male ;-)):

postconf -e 'home_mailbox = Maildir/'  
postconf -e 'mailbox_command ='  
/etc/init.d/postfix restart
Share: X/Twitter LinkedIn

Ricevi i nuovi post nella tua casella di posta.

Nessuno spam. Disiscriviti in qualsiasi momento.