Skip to content

Instantly share code, notes, and snippets.

@killbus
Last active March 6, 2021 18:20
Show Gist options
  • Save killbus/503b0b42877e773d3c801f62e1771598 to your computer and use it in GitHub Desktop.
Save killbus/503b0b42877e773d3c801f62e1771598 to your computer and use it in GitHub Desktop.

iptables_quota.sh

#!/bin/bash
iptables -F quota33g
iptables -N quota33g
iptables -A quota33g -m quota --quota 35433480192 -j RETURN
iptables -A quota33g -d <bastion_server_ip> -j ACCEPT
iptables -A quota33g -j DROP

iptables -F OUTPUT
iptables -P OUTPUT ACCEPT
iptables -A OUTPUT -o eth0+ -j quota33g
echo done

crontab

0 0 * * * /sbin/iptables -Z quota33g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment