Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre Alouit alexalouit

View GitHub Profile
@alexalouit
alexalouit / dkim.php
Last active Aug 29, 2015
(php) DKIM test using Google.
View dkim.php
<?php
$to = "youremail@gmail.com";
$subject = "DKIM test.";
$body = "Hi,\nThis is an DKIM test.\nGo check gmail header.;
if (mail($to, $subject, $body)) {
echo("<p>Successfully sent!</p>");
} else {
echo("<p>Failed!</p>");
}
?>
@alexalouit
alexalouit / collectd-postfix-dovecot-postgrey-spf
Last active Aug 29, 2015
Collectd: Postfix, Docecot, Postgrey, SPF
View collectd-postfix-dovecot-postgrey-spf
LoadPlugin tail
<Plugin "tail">
<File "/var/log/mail.log">
Instance "postfix"
# number of connections
# (incoming)
<Match>
Regex "\\<postfix\\/smtpd\\[[0-9]+\\]: connect from\\>"
DSType "CounterInc"
View iostat-extended.conf
# Processes iostat output
# >iostat -d -m -x sda sdb 1 | bin/logstash -f iostat.conf
#
# Sample Output:
#
# Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
# sda 3.36 174.28 9.64 183.71 65.17 1431.99 15.49 0.61 3.16 0.09 1.65
# sdb 0.00 0.00 742.87 4110.46 5830.48 16441.82 9.18 4.90 0.98 0.11 55.45
@alexalouit
alexalouit / gzed-log-purge.sh
Created Oct 5, 2015
Automatic purge compressed logs that are aged 7 days over
View gzed-log-purge.sh
#!/bin/bash
#
# cron ex: 25 5 * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/gzed-log-purge.sh >> /root/scripts/cron.log
# Search files more than 14 days with .gz extension and remove it
find /var/log -type f -ctime +7 -regex ".*\.gz$" -delete
@alexalouit
alexalouit / ISPConfig.filter
Last active Feb 5, 2016
Fail2ban: ISPConfig auth
View ISPConfig.filter
[Definition]
failregex = Failed login for user .* from <HOST>
ignoreregex =
@alexalouit
alexalouit / vzdump-purge.sh
Last active Feb 16, 2016
Automatic purge of proxmox/vzdump that are aged 14 days over
View vzdump-purge.sh
#!/bin/bash
#
# cron ex: 15 5 * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/vzdump-purge.sh >> /root/scripts/cron.log
path=''
# Search files more than 14 days and remove it
find $path -type f -ctime +14 -delete
@alexalouit
alexalouit / wrt54gsv4-watchguard.sh
Created Apr 9, 2016
Connection status on ddwrt wrt54gsv4 led
View wrt54gsv4-watchguard.sh
#!/bin/sh
# led is white if we have internet, turn orange if not.
while true ; do
if /bin/ping -qc 3 8.8.8.8 > /dev/null; then
/sbin/gpio disable 2
/sbin/gpio enable 3
else
/sbin/gpio disable 2
/sbin/gpio disable 3
fi
@alexalouit
alexalouit / _up.sh
Created Apr 22, 2016
Connection status checker with iptables-conditions for dynamic routing, load balancing and failover
View _up.sh
#!/bin/sh
#
# cron ex: @reboot /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/100_up.sh >> /root/scripts/cron.log
while true ; do
# do ping with interface
if /bin/ping -qc 3 8.8.8.8 -I eth0.100 > /dev/null; then
if /bin/grep -q 0 /proc/net/nf_condition/100_up; then /bin/echo 1 > /proc/net/nf_condition/100_up; fi
else
# do ping with fwmark, and to another target
if /bin/ping -qc 3 8.8.4.4 -m 100 > /dev/null; then
@alexalouit
alexalouit / backup-dbispconfig.sh
Last active Nov 4, 2016
Backup ISPConfig database (manual)
View backup-dbispconfig.sh
#!/bin/bash
#
# cron ex: 0 3 1 * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/backup-dbispconfig.sh >> /root/scripts/cron.log
DIR="/root/backup/"
MYSQLUSER="" # FOR SECURITY REASONS, CREATE AN READ ONLY USER FOR BACKUP!
# eg (as root): CREATE USER 'backup'@'localhost' IDENTIFIED BY 'RANDOMPASSWORD'; GRANT SELECT ON dbispconfig.* TO 'backup'@'localhost'; FLUSH PRIVILEGES;
MYSQLPASSWORD=""
MYSQLDATABASE="dbispconfig"
DATE=$(date +"%Y%m%d")
@alexalouit
alexalouit / README.md
Last active Dec 4, 2016
Metronome XMPP isolation by vhost/domain
View README.md

Adaptation of Prosody module from Exa Networks for Metronome

Configuration

To isolate all hosts by default, add the module to your global modules_enabled:

modules_enabled = {