Skip to content

Instantly share code, notes, and snippets.

@freeminder
freeminder / ddos.conf
Created March 19, 2020 21:38 — forked from mattia-beta/ddos.conf
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@freeminder
freeminder / security.conf
Created March 19, 2020 21:37 — forked from mattia-beta/security.conf
NGINX Security Config
## Block SQL injections
set $block_sql_injections 0;
if ($query_string ~ "union.*select.*\(") {
set $block_sql_injections 1;
}
if ($query_string ~ "union.*all.*select.*") {
set $block_sql_injections 1;
}
@freeminder
freeminder / zabbix_agent_install.sh
Created January 13, 2016 12:32
Zabbix Agent installation script
#!/bin/bash -e
if [ "$UID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
# Only run it if we can (ie. on Ubuntu/Debian)
if [ -x /usr/bin/apt-get ]; then
apt-get update