lunedì 25 novembre 2013

Filtro per contare le ricorrenze di un campo in un file di testo

$1 si riferisce alla prima colonna del file di testo. Utilizzare $2, $3, $4,.... per le colonne seguenti.
awk '{print $1}' |sort |uniq -c |sort -r -n

lunedì 4 novembre 2013

network-manager: non attivare default route su link OPENVPN

In NetworkManager: 
VPN Connections ->  (selezionare la connessione VPN da modificare) -> Edit -> Routes -> Selezionare la casella "Use this connection only for resources on its network"

giovedì 31 ottobre 2013

fail2ban: proteggere saslauthd

Debian 6.0.8
fail2ban 0.8.4-3+squeeze2
Debian 5.0.10
fail2ban 0.8.3-2sid1

failregex = (?i): warning: [-._\w]+\[\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [A-Za-z0-9+]*)?

Debian 5.0.10
fail2ban 0.8.3-2sid1

failregex = : warning: [-._\w]+\[\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed



mercoledì 30 ottobre 2013

postfix: attivare debug connessione con un mail server

Se vogliamo verificare come mai il mail server del dominio dominio.ext rifiuta le email dal nostro server possiamo attivare il debug specifico per quel dominio:
postconf -e debug_peer_list=dominio.ext
postconf -e debug_peer_level=3
postfix reload

Backuppc: cambiare la password dell'utente sull'interfaccia grafica

htpasswd /etc/backuppc/htpasswd $NOME_UTENTE

Backuppc: escludere directory su copia rsync

$Conf{RsyncShareName} = [
  '/home/user',
  '/etc',
  '/usr/local/bin'
];

$Conf{BackupFilesExclude} = {
  '/home/user' => [
    '/NOBACKUP/**',
    '/Music/**',
    '/Videos/**',
    '/.aMule/**'
  ]
};

mercoledì 23 ottobre 2013

PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.


Questo errore nei log di Apache:
FastCGI: server "/var/www/clients/client3/web4/cgi-bin/php5-fcgi-*-80-example.com" stderr: PHP message: PHP Warning:  strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
e' caratteristico di PHP 5.3 (pare sia sparito con la release 5.4).
Per risolverlo bisogna aggiungere al php.ini la riga:
date.timezone = "Europe/Rome"
personalizzando se occorre la timezone tra doppi apici