pawelko.net

Astuces Exim

Le 18-02-09 à 21:27, par Cyril Pawelko Permalien

Simuler le routage d'un mail :

exim -bt cyril@domain.com


Voir la file d'attente

exim -bp


Supprimer un mail donné:

exim -Mrm id_mail


Débloquer un mail donné:

exim -M id_mail


Utiliser un smarthost:

Certaines listes de spam (notamment spamhaus) considèrent les IP résidentielles comme source de spam, et blacklistent donc ces adresses IP : "This IP range has been identified by Spamhaus as not meeting our policy for IPs which should deliver 'direct-to-mx' mail to PBL users."

La solution la plus simple consiste à renvoyer les mails à destination des domaines concernés vers le smtp du FAI, ce dernier n'étant pas (toujours) blacklisté

Ajouter dans exim4.conf, au début de la section "begin routers"

send_to_smarthost:
       driver = manualroute
       domains = gmail.com : netcourrier.com
       transport = remote_smtp
       route_list = * smtp.free.fr

Cacti simple oid

Le 01-02-09 à 22:23, par Cyril Pawelko Permalien

I used to play with cacti, creating my own scripts, data input methods, data sources, graphs items and then graphs, but it was long way to obtain a single graph.

A smarter way is to use "SNMP - Generic OID Template" that appeared in cacti. Let's see an example : I want to graph the number of spams I've received during the last 24 hours. Counting is easy, I've just to find all files more recent than 24 hours in my IMAP folder "spam" (spamassassin does a very good job !). But I had to face security considerations, because apache user had to access my maildir !

It's much simpler to expose this number via snmp, and then to create a simple graph based on Cacti "Generic OID" template. Note that SNMP is only accessible from my LAN, and the number of spams I've received is not very sensitive data. So let's go:

  • Create the script /usr/local/bin/countspam.sh
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
find /home/cyril/Maildir/.SPAM/cur/ -ctime -1 | wc -l
  • Configure snmpd.conf to run this script and return the result
# Extensible sections.
exec .1.3.6.1.4.1.15555.1 countspam.sh /usr/local/bin/countspam.sh
  • Test the query. Note that the interesting value is .1.3.6.1.4.1.15555.101.1
root:/etc # snmpwalk -c public -v2c localhost .1.3.6.1.4.1.15555.1
SNMPv2-SMI::enterprises.15555.1.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.15555.1.2.1 = STRING: "countspam.sh"
SNMPv2-SMI::enterprises.15555.1.3.1 = STRING: "/usr/local/bin/countspam.sh"
SNMPv2-SMI::enterprises.15555.1.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.15555.1.101.1 = STRING: "40"
SNMPv2-SMI::enterprises.15555.1.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.15555.1.103.1 = ""
  • Connect to cacti console, click "New graph", select your host and "SNMP - Generic OID Template"
  • Enter the title, OID .1.3.6.1.4.1.15555.101.1 and choose a (fun) color
  • Your graph is now ready :

kvm 0.72 backport for debian etch amd64

Le 13-01-09 à 23:34, par Cyril Pawelko Permalien

I started playing with kvm 28-4~bpo.1 on my etch. I installed Fedora Core 9, but during boot I had a lot of messages like
ata2.00: status: { DRDY ERR }
and
HSM violation

So I backported kvm 72+dfsg-4 from lenny and got rid of this error.
Download : /xmedia/divers/kvm_72+dfsg-4_amd64.deb

AWStats : Byte order is not compatible

Le 30-12-08 à 18:35, par Cyril Pawelko Permalien

After migrating awstats data from debian i386 to debian amd64, awstat gives me the following error:

/usr/lib/cgi-bin/awstats.pl -config=awstats -update
Update for config "/etc/awstats/awstats.conf"
With data in log file "/var/log/apache2/access.log"...
Warning: Error while retrieving hashfile: Byte order is not compatible at 
../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) 
line 331, at (eval 5) line 1

Explanation is here : hashes are not stored in the same way by Perl Storable on debian 32 bit and 64 bit. The workaround is pretty simple: delete all hashes files, awstats will rebuild them

rm /var/lib/awstats/*.hash

A propos

Le 28-05-08 à 21:38, par Cyril Pawelko Permalien

Ce site a pour vocation de partager des informations concernant essentiellement les logiciels libres, dont je suis un fervent utilisateur.

Me contacter: cyril@pawelko.net