script

Block tor traffic in cloudflare firewall

![tor logo] ({filename}/static/images/tor.png) If you don't want to allow access to your server through the tor network you can ask nicely or just add every malicious looking client to a list. I tried to come up with a better solution. I started with a script that blocked incomming connections on a loadbalancer (can also be used on a webserver) Then I realized that if you use cloudclare in front of that the tcp connections come from cloudare and not from the tor endpoints.

Block almost all tor traffic to your server

![tor logo] ({filename}/static/images/tor.png) If you don't want to allow access to your server through the tor network you can ask nicely or just add every malicious looking client to a list. I tried to come up with a better solution. This Script takes the known tor endpoints from torproject.org and adds it to a ipset list. The ipset is the dropped with iptables. #!/bin/bash echo "Tor endpoint list loading" TORLIST=$(curl -s https://check.

Copy mysql database to dev location

![db copy] ({filename}/static/images/db_copy.jpg) If you are just here for the script copy the script and have fun. If you want a bit more info read on this script is tweakable to some extend. #! /bin/bash TIMESTAMP=$(date +"%F") BACKUP_DIR="/tmp/db-dump/$TIMESTAMP" MYSQL_USER="root" MYSQL=/usr/bin/mysql MYSQL_PASSWORD="password" MYSQLDUMP=/usr/bin/mysqldump mkdir -p "$BACKUP_DIR" databases="live_db" for db in $databases; do test_db=$db"_test" $MYSQLDUMP --user=$MYSQL_USER -p$MYSQL_PASSWORD $db | gzip > "$BACKUP_DIR/$db.sql.gz" mysql --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "DROP DATABASE IF EXISTS $test_db;" mysql --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE $test_db;" zcat "$BACKUP_DIR/$db.