Nuovo set su flickr: Ferrara by night

Ho creato un set con le ultime foto scattate, lo potete trovare sul mio account flickr.
Gmail SMTP e Sendmail su CentOS
Spesso capita di configurare dei servizi che necessitano di alert via mail, per esempio in caso di errore sul backup o di guasto ad un disco. L'SMTP di Gmail risulta uno dei più comodi da utilizzare, perchè accessibile da tutti i provider e supporta SSL. Per poterlo utilizzare correttamente su linux, per prima cosa installiamo sendamail sulla macchina
yum install sendmail sendmail-cf cyrus-sasl-plain cyrus-sasl-md5
poi configuriamo alcuni parametri
cd /etc/mail hostname -f > genericsdomain touch genericstable makemap -r hash genericstable.db < genericstable
Facciamo una copia di backup del file di configurazione originale
cp sendmail.mc sendmail.mc.original
e cambiamo il suo contenuto
divert(-1)dnl dnl # dnl # This is the sendmail macro config file for m4. If you make changes to dnl # /etc/mail/sendmail.mc, you will need to regenerate the dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is dnl # installed and then performing a dnl # dnl # make -C /etc/mail dnl # include(`/usr/share/sendmail-cf/m4/cf.m4')dnl VERSIONID(`setup for linux')dnl OSTYPE(`linux')dnl dnl # dnl # Do not advertize sendmail version. dnl # dnl define(`confSMTP_LOGIN_MSG', `$j Sendmail; $b')dnl dnl # dnl # default logging level is 9, you might want to set it higher to dnl # debug the configuration dnl # dnl define(`confLOG_LEVEL', `9')dnl dnl # dnl # Uncomment and edit the following line if your outgoing mail needs to dnl # be sent out through an external mail server: dnl # define(`SMART_HOST', `smtp.gmail.com')dnl define(`RELAY_MAILER_ARGS', `TCP $h 587') define(`ESMTP_MAILER_ARGS', `TCP $h 587') dnl # define(`confDEF_USER_ID', ``8:12'')dnl dnl define(`confAUTO_REBUILD')dnl define(`confTO_CONNECT', `1m')dnl define(`confTRY_NULL_MX_LIST', `True')dnl define(`confDONT_PROBE_INTERFACES', `True')dnl define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl define(`ALIAS_FILE', `/etc/aliases')dnl define(`STATUS_FILE', `/var/log/mail/statistics')dnl define(`UUCP_MAILER_MAX', `2000000')dnl define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl define(`confAUTH_OPTIONS', `A')dnl dnl # dnl # The following allows relaying if the user authenticates, and disallows dnl # plaintext authentication (PLAIN/LOGIN) on non-TLS links dnl # dnl define(`confAUTH_OPTIONS', `A p')dnl dnl # dnl # PLAIN is the preferred plaintext authentication method and used by dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do dnl # use LOGIN. Other mechanisms should be used if the connection is not dnl # guaranteed secure. dnl # Please remember that saslauthd needs to be running for AUTH. dnl # dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl dnl # dnl # Rudimentary information on creating certificates for sendmail TLS: dnl # cd /usr/share/ssl/certs; make sendmail.pem dnl # Complete usage: dnl # make -C /usr/share/ssl/certs usage dnl # dnl define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl dnl # dnl # This allows sendmail to use a keyfile that is shared with OpenLDAP's dnl # slapd, which requires the file to be readble by group ldap dnl # dnl define(`confDONT_BLAME_SENDMAIL', `groupreadablekeyfile')dnl dnl # dnl define(`confTO_QUEUEWARN', `4h')dnl dnl define(`confTO_QUEUERETURN', `5d')dnl dnl define(`confQUEUE_LA', `12')dnl dnl define(`confREFUSE_LA', `18')dnl define(`confTO_IDENT', `0')dnl dnl FEATURE(delay_checks)dnl FEATURE(`no_default_msa', `dnl')dnl FEATURE(`smrsh', `/usr/sbin/smrsh')dnl FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl FEATURE(redirect)dnl FEATURE(always_add_domain)dnl FEATURE(use_cw_file)dnl FEATURE(use_ct_file)dnl dnl # dnl # The following limits the number of processes sendmail can fork to accept dnl # incoming messages or process its message queues to 20.) sendmail refuses dnl # to accept connections once it has reached its quota of child processes. dnl # dnl define(`confMAX_DAEMON_CHILDREN', `20')dnl dnl # dnl # Limits the number of new connections per second. This caps the overhead dnl # incurred due to forking new sendmail processes. May be useful against dnl # DoS attacks or barrages of spam. (As mentioned below, a per-IP address dnl # limit would be useful but is not available as an option at this writing.) dnl # dnl define(`confCONNECTION_RATE_THROTTLE', `3')dnl dnl # dnl # The -t option will retry delivery if e.g. the user runs over his quota. dnl # FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl FEATURE(`access_db', `hash -T -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl EXPOSED_USER(`root')dnl dnl # dnl # For using Cyrus-IMAPd as POP3/IMAP server through LMTP delivery uncomment dnl # the following 2 definitions and activate below in the MAILER section the dnl # cyrusv2 mailer. dnl # dnl define(`confLOCAL_MAILER', `cyrusv2')dnl dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl dnl # dnl # The following causes sendmail to only listen on the IPv4 loopback address dnl # 127.0.0.1 and not on any other network devices. Remove the loopback dnl # address restriction to accept email from the internet or intranet. dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl dnl # dnl # The following causes sendmail to additionally listen to port 587 for dnl # mail from MUAs that authenticate. Roaming users who can't reach their dnl # preferred sendmail daemon due to port 25 being blocked or redirected find dnl # this useful. dnl # dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl dnl # dnl # The following causes sendmail to additionally listen to port 465, but dnl # starting immediately in TLS mode upon connecting. Port 25 or 587 followed dnl # by STARTTLS is preferred, but roaming clients using Outlook Express can't dnl # do STARTTLS on ports other than 25. Mozilla Mail can ONLY use STARTTLS dnl # and doesn't support the deprecated smtps; Evolution dnl # when SSL is enabled-- STARTTLS support is available in version 1.1.1. dnl # dnl # For this to work your OpenSSL certificates must be configured. dnl # dnl DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl dnl # dnl # The following causes sendmail to additionally listen on the IPv6 loopback dnl # device. Remove the loopback address restriction listen to the network. dnl # dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl dnl # dnl # enable both ipv6 and ipv4 in sendmail: dnl # dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6') dnl # dnl # We strongly recommend not accepting unresolvable domains if you want to dnl # protect yourself from spam. However, the laptop and users on computers dnl # that do not have 24x7 DNS do need this. dnl # FEATURE(`accept_unresolvable_domains')dnl dnl # dnl FEATURE(`relay_based_on_MX')dnl dnl # dnl # Also accept email sent to "localhost.localdomain" as local email. dnl # LOCAL_DOMAIN(`localhost.localdomain')dnl dnl # dnl # The following example makes mail from this host and any additional dnl # specified domains appear to be sent from mydomain.com dnl # MASQUERADE_AS(`dyndns.org')dnl dnl # dnl # masquerade not just the headers, but the envelope as well dnl # FEATURE(masquerade_envelope)dnl FEATURE(genericstable, `hash -o /etc/mail/genericstable') GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl dnl # dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well dnl # dnl FEATURE(masquerade_entire_domain)dnl dnl # dnl MASQUERADE_DOMAIN(localhost)dnl dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl dnl MASQUERADE_DOMAIN(dyndns.org)dnl MASQUERADE_DOMAIN(pbx.local)dnl MAILER(smtp)dnl MAILER(procmail)dnl dnl MAILER(cyrusv2)dnl
Creiamo la directory /etc/mail/auth con le credenziali dell'account
mkdir -p auth chmod 700 auth cd auth echo AuthInfo:smtp.gmail.com "U:root" "I:user_id" "P:password" "M:PLAIN" > client-info echo AuthInfo:smtp.gmail.com:587 "U:root" "I:user_id" "P:password" "M:PLAIN" >> client-info
dove
Uindica il nome del mittente;Iva impostato come email@dominio per le Google Apps mentre basta lo username in caso di account Gmail classico;Pcontiene la password in chiaro.
ed assicurarsi che nel file client-info compaiano le " ".
chmod 600 client-info makemap -r hash client-info.db < client-info
portarsi nella directory etc/mail e converire il file di configurazione nel file sendmail.cf
cd .. m4 sendmail.mc > sendmail.cf
Se non ci sono errori possiamo avviare il servizio di sendmail, impostarlo all'avvio e testare il tutto
service sendmail start chkconfig sendmail on echo "Subject: test" | /usr/lib/sendmail -v destinatario@dominio.com
Scegliere il mirror più veloce con CentOS
Per velocizzare il download dei pacchetti dai repository, c'è un ottimo plugin chiamato yum-plugin-fastestmirror. Per prima cosa si installa il plugin
yum install yum-plugin-fastestmirror
ed in seguito si configura il file /etc/yum/pluginconf.d/fastestmirror.conf
[main] verbose = 0 socket_timeout = 3 enabled = 1 hostfilepath = /var/cache/yum/timedhosts.txt maxhostfileage = 1
Configurare la scheda di rete su CentOS 6 in installazione minimal
Come riportato dalla FAQ ufficiale di CentOS 6, è stato cambiato da Red Hat il configuratore di default della rete in favore di NetworkManager. Questo significa che, se volete effettuare un'installazione minima per un server, quindi niente interfaccia grafica e niente NetworkManager, la scheda di rete sarà disabilitata di default. Per abilitarla, controllate le impostazioni del file /etc/sysconfig/network-scripts/ifcfg-eth0. In particolare:
ONBOOT="yes" NM_Controlled="no"
dove la prima riga attiva la scheda al boot mentre mentre la seconda indica che non è gestita da NetworkManager. Si può scegliere se impostare la scheda in DHCP o con IP statico aggiungendo rispettivamente:
BOOTPROTO=dhcp
oppure
BOOTPROTO=none IPADDR=192.168.0.33 NETMASK=255.255.255.0 DNS1=192.168.0.4 DNS2=192.168.0.5
Infine va impostato il gateway e gli altri parametri nel file /etc/sysconfig/network:
NETWORKING=yes HOSTNAME=server.localnetwork GATEWAY=192.168.0.1 GATEWAYDEV=eth0
Ulteriori riferimenti sui file di configurazione delle reti possono essere trovati sulla documentazione ufficiale di Red Hat.
Nuovo set su Flickr: Roma

on Flickr: http://www.flickr.com/photos/matteoruina/sets/72157629117284925
Windows 7 su Sony Vaio VGN-T1XP/L
IMPORTANTE: prima di fare qualsiasi altra operazione, dopo aver installato il sistema opertivo, procedete con l'installazione dei driver grafici!!
Recentemente ho dovuto formattare un Sony Vaio VGN-T1XP/L. Date le caratteristiche tecnice del notebook, ho optato per un Windows 7 Starter Edition. In questi casi, il problema maggiore è la compatibilità hardware ed il recuperto driver. Ecco le periferiche che hanno richiesto uno sforzo aggiuntivo:
- Scheda Wirelesss Intel 2200BG: dopo una breve ricerca su google, ho provato i driver ufficiali intel per Windows XP. Nessun problema.
- Scheda Video Intel 82852/82855 GM/GME: senza questa pagina web non ne sarei mai venuto fuori. Seguite le istruzioni riportate nel primo post, ma almeno nel caso mio caso, ho dovuto fare alcune modifiche. In particolare, seguite la guida fino ai comandi dos, poi lanciate solo
takeown /f c:\windows\system32\drivers\vgapnp.sys; dopo di che, andate a cercare il file inC:\Windows\system32\drivers, click con il destro,Proprietà -> Sicurezza -> Modificae date la possibilità di modifica al gruppo Utenti. Aprite il file con il blocco note, aggiungete un paio di caratteri all'inizio del file (per esempio xxMZ al posto di MZ) e salvate. Riavviate. Al riavvio dovreste trovare il punto esclamativo inComputer -> Gestione dispositivi -> Schede Video -> Controller compatibile VGA. Perfetto! Scompattate i driver che avete scaricato dalla guida e aggiornate la periferica. Al ravvio dovrebbe riconoscere correttamente la scheda video! Nel caso che il link nella guida non sia più disponibile, potete scaricare i driver qui (si, ho provato con la versione più aggiornata sul sito dell'Intel ma i 14.19.50 provocano un drammatico BSOD). L'unico problema che ho riscontrato è che attorno al puntatore del mouse rimane una specie di alone bianco. - Tasti funzione e tasti volume: andate sul sito di supporto della sony e installate le seguenti utilities per Windows Vista: Setting Utility Series, VAIO Control Center e VAIO Event Service. Riavviate a avrete tutti i vostri tasti funzionanti!
Integrare Twitter e WordPress
Proprio in questi giorni ho voluto dare un'occhiata alla possibilità di integrare il mio account Twitter con il blog. Per prima cosa, volevo un bel box da inserire nella sidebar, in stile Squarespace.
La mia scelta è caduta su Tweet Blender, perchè quello con la grafica più pulita e semplicità d'uso. Una volta installato ed attivo il plugin, nella sezione Appearence -> Widgets, si trova il componente Tweet Blender: le impostazioni sono tutte autoesplicative, ricordatevi solo che per avere tutti i vostri tweet è necessario inserire il nome utente preceduto da @ (per esempio, @ruio).
Sistemata la parte da Twitter a WordPress, mi sono dedicato al viceversa: come poter creare dei twitter per ogni nuovo post del blog. Dopo 5-6 plugin installati-provati-disintallati, ho scelto WordTwit, dal momento che possiede due features che considero imprescindibili: semplicità e supporto ai servizi di url shortening quali bit.ly, fondamentali per risparmiare caratteri abbreviando un url. Anche in questo caso, il procedimento di installazione è lo stesso: attivate il plugin e modificate la impostazioni in Settings -> WordTwit. Vi ricordo solo che per attivare bit.ly avete bisogno della API key, che potete recuperare loggandovi sul sito visitando la pagina http://bit.ly/a/account oppure in alto a destra Utente -> Settings.
Prestazioni Trascend JF300 8Gb
Ho da poco acquistato una penna USB; le sue caratteristiche dovevano essere: dimensioni, robustezza e, soprattutto, un prezzo basso. La scelta è ricaduta su questa penna usb della Trascend, la JF300 da 8Gb. Prima di usarla ho fatto qualche test, per tutti quelli che sono interessati all'acquisto. I risultati indicano una memoria uniforme nel comportamento ma non molto veloce.
VPN Site to Site e Roadwarriors con pfSense
In questa breve guida vedremo come realizzare una VPN site to site con 2 box pfSense. Per prima cosa, progettiamo la rete delle due sedi, nel nostro caso Sede A e Sede B:
Sede A:
Rete: 172.31.244.0
Subnet mask: 255.255.255.224
Broadcast: 172.31.244.31
CIDR: 172.31.244.0/27
IP WAN: 89.87.86.85
IP LAN (firewall): 172.31.244.1
Sede B:
Rete: 172.31.243.0
Subnet mask: 255.255.255.224
Broadcast: 172.31.243.31
CIDR: 172.31.243.0/27
IP WAN: 76.45.23.10
IP LAN (firewall): 172.31.243.1
A questo punto possiamo andare a configurare direttamente i router con pfSense 1.2.3. Il primo passo è quello di creare la shared key per i router: basta procurarsi un pc linux con openvpn installato e dalla shell digitare:
openvpn --genkey --secret sts.key
Ora colleghiamoci al router della Sede A, che farà da server per la nostra vpn: dal menu di pfsense, scegliamo la voce VPN -> OpenVPN e creiamo un nuovo server con le seguenti impostazioni:
Protocol: UDP Local port: 1195 Address pool: 10.11.12.0/24 Remote network: 172.31.243.0/27 Cryptography: BF-CBC (128 bit) Authentication method: Shared Key Shared key: sts.key LZO compression: Yes Description: Site to Site A<->B
A questo punto rimane solo da configurare il firewall per far passare il traffico della VPN. Sul pfSense della sede A andiamo in Firewall -> Rules e creiamo una nuova regola:
Action: Pass Interface: WAN Protocol: UDP Source type: Any Destination type: Any Destination port range: 1195 Description: VPN StS -> Any
Ora il nostro server è configurato e funzionante. Resta da configurare il firewall della sede B. Scegliamo la voce VPN -> OpenVPN e creiamo un nuovo client con le seguenti impostazioni:
Protocol: UDP Server address: 89.87.86.85 Local port: 1195 Interface IP: 172.31.243.0/27 Remote network: 172.31.244.0/27 Cryptography: BF-CBC (128 bit) Authentication method: Shared Key Shared key: sts.key LZO compression: Yes Description: Site to Site A<->B
Ora che abbiamo configurato il firewall nella sede B, la nostra VPN è attiva; potete verificarne il funzionamento con qualche ping.
Perfetto, ora come secondo step ci serve configurare la VPN per i roadwarriors. Per prima cosa, sfruttiamo sempre il nostro server Linux per la crazione delle chiavi VPN:
cd /etc/openvpn/certs source vars ./build-ca ./build-key-server pfsense-server ./build-dh ./build-key client-1 .................. ./build-key client-n
E andiamo a creare il nuovo server VPN:
Protocol: UDP Local port: 1194 Address pool: 10.99.254.0/24 Cryptography: BF-CBC (128 bit) Authentication method: PKI (Public Key Infrastructure) CA certificate: ca.crt Server certificate: pfsense-server.crt Server key: pfsense-server.key DH parameters: dh1024.pem LZO compression: Yes Description: Roadwarrior
Penultimo passo, creare una regola sul firewall: andiamo in Firewall -> Rules:
Action: Pass Interface: WAN Protocol: UDP Source type: Any Destination type: Any Destination port range: 1194 Description: VPN StS -> Any
Ora possiamo installare OpenVPN su qualsiasi computer. Basterà copiarsi i file ca.crt, client-n.crt e client-n.key e usare questo file di configurazione:
# Specify that we are a client and that we # will be pulling certain config file directives # from the server. client # Use the same setting as you are using on # the server. # On most systems, the VPN will not function # unless you partially or fully disable # the firewall for the TUN/TAP interface. ;dev tap dev tun # Windows needs the TAP-Win32 adapter name # from the Network Connections panel # if you have more than one. On XP SP2, # you may need to disable the firewall # for the TAP adapter. ;dev-node MyTap # Are we connecting to a TCP or # UDP server? Use the same setting as # on the server. ;proto tcp proto udp # The hostname/IP and port of the server. # You can have multiple remote entries # to load balance between the servers. ;remote 192.168.1.1 1194 remote 89.87.86.85 1194 # Choose a random host from the remote # list for load-balancing. Otherwise # try hosts in the order specified. ;remote-random # Keep trying indefinitely to resolve the # host name of the OpenVPN server. Very useful # on machines which are not permanently connected # to the internet such as laptops. resolv-retry infinite # Most clients don't need to bind to # a specific local port number. nobind # Downgrade privileges after initialization (non-Windows only) ;user nobody ;group nobody # Try to preserve some state across restarts. persist-key persist-tun # If you are connecting through an # HTTP proxy to reach the actual OpenVPN # server, put the proxy server/IP and # port number here. See the man page # if your proxy server requires # authentication. ;http-proxy-retry # retry on connection failures ;http-proxy [proxy server] [proxy port #] # Wireless networks often produce a lot # of duplicate packets. Set this flag # to silence duplicate packet warnings. ;mute-replay-warnings # SSL/TLS parms. # See the server config file for more # description. It's best to use # a separate .crt/.key file pair # for each client. A single ca # file can be used for all clients. ca C:\\path_to\\ca.crt cert C:\\path_to\\client-n.crt key C:\\path_to\\client-n.key # Verify server certificate by checking # that the certicate has the nsCertType # field set to "server". This is an # important precaution to protect against # a potential attack discussed here: # http://openvpn.net/howto.html#mitm # # To use this feature, you will need to generate # your server certificates with the nsCertType # field set to "server". The build-key-server # script in the easy-rsa folder will do this. ;ns-cert-type server # If a tls-auth key is used on the server # then every client must also have the key. ;tls-auth ta.key 1 # Select a cryptographic cipher. # If the cipher option is used on the server # then you must also specify it here. cipher aes-256-cbc # Enable compression on the VPN link. # Don't enable this unless it is also # enabled in the server config file. comp-lzo # Set log file verbosity. verb 3 # Silence repeating messages ;mute 20 pull
Possiamo verificare il funzionamento della nostra VPN sempre tramite qualche ping. Ora, se ne abbiamo la necessità, possiamo anche fare in modo che i roadwarriors raggiungano gli hosts della sede B. Per fare ciò, bisogna specificare due regole di routing, entrambe nella sezione Custom options:
- Sul server VPN roadwarrior va aggiunta la seguente regola
push "route 172.31.243.0 255.255.255.224"
in questo modo i roadwarrior sanno che per arrivare alla sede B devono passare per il firewall della sede A.
- Sul client VPN site to site della sede B
route 10.99.254.0 255.255.255.0
così il firewall della sede B saprà come rimandare indietro i pacchetti ai client roadwarriors.
Si ringrazia Mario per la segnalazione e correzione sul routing roadwarriors <-> sede B.

























