Skip to content

Instantly share code, notes, and snippets.

@hoggren
Last active June 23, 2022 18:14
Show Gist options
  • Save hoggren/0b0df7e200da317ef0f12366490e5f17 to your computer and use it in GitHub Desktop.
Save hoggren/0b0df7e200da317ef0f12366490e5f17 to your computer and use it in GitHub Desktop.
commands I dont remember

Bunch of commands

Static HTTP Server

Serve files over HTTP with python 🐭

# python2
python -m SimpleHTTPServer 8000

# python3
python -m http.server 8000

iptables

# default policies
iptables -P INPUT DROP

# ACCEPT chain
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 1337 -j ACCEPT
iptables -A INPUT -p tcp -s 10.0.1.0/8 --dport 8080 -j ACCEPT

# ACCEPT loopback/established/related connections
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT -m conntrack --ctstate ESTABLISHED -j ACCEPT

More about Docker and iptables

# Docker restricted to specific subdomain or IP address
iptables -I DOCKER-USER -i ext-if ! -s 10.0.1.0/8 -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment