Skip to content

Instantly share code, notes, and snippets.

View alexalouit's full-sized avatar

Alexandre Alouit alexalouit

View GitHub Profile
@alexalouit
alexalouit / dkim.php
Last active August 29, 2015 14:06
(php) DKIM test using Google.
<?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 August 29, 2015 14:06
Collectd: Postfix, Docecot, 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"
@alexalouit
alexalouit / iostat-extended.conf
Created September 29, 2015 09:51 — forked from 4BitBen/iostat-extended.conf
logstash-iostat
# 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 October 5, 2015 14:28
Automatic purge compressed logs that are aged 7 days over
#!/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 February 5, 2016 15:06
Fail2ban: ISPConfig auth
[Definition]
failregex = Failed login for user .* from <HOST>
ignoreregex =
@alexalouit
alexalouit / vzdump-purge.sh
Last active February 16, 2016 09:50
Automatic purge of proxmox/vzdump that are aged 14 days over
#!/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 April 9, 2016 12:48
Connection status on ddwrt wrt54gsv4 led
#!/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 April 22, 2016 10:26
Connection status checker with iptables-conditions for dynamic routing, load balancing and failover
#!/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 November 4, 2016 16:34
Backup ISPConfig database (manual)
#!/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 December 4, 2016 23:47
Metronome XMPP isolation by vhost/domain

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 = {