diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-03-05 11:52:31 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-03-05 11:52:31 -0300 |
commit | 3bc3cca757448549c4973f499932b48aaea6f218 (patch) | |
tree | 15c47f94b20b0a30dbb47789d1a3958cea5b3822 /manifests/shaping.pp | |
parent | 6171b96c76116d1f1723f4ebb45f5b54cc36dad0 (diff) | |
download | puppet-firewall-3bc3cca757448549c4973f499932b48aaea6f218.tar.gz puppet-firewall-3bc3cca757448549c4973f499932b48aaea6f218.tar.bz2 |
Make traffic shaping optional
Diffstat (limited to 'manifests/shaping.pp')
-rw-r--r-- | manifests/shaping.pp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/manifests/shaping.pp b/manifests/shaping.pp new file mode 100644 index 0000000..63bd464 --- /dev/null +++ b/manifests/shaping.pp @@ -0,0 +1,46 @@ +class firewall::shaping( + $device = hiera('firewall::device', 'eth0'), + $in_bandwidth = hiera('firewall::in_bandwidth', '1000mbps'), + $out_bandwidth = hiera('firewall::out_bandwidth', '1000mbps') +) { + # + # Traffic shaping + # + shorewall::tcdevices { "${device}": + in_bandwidth => "$in_bandwidth", + out_bandwidth => "$out_bandwidth", + } + + shorewall::tcrules { "ssh-tcp": + order => "1", + source => "0.0.0.0/0", + destination => "0.0.0.0/0", + protocol => "tcp", + ports => "22", + } + + shorewall::tcrules { "ssh-udp": + order => "1", + source => "0.0.0.0/0", + destination => "0.0.0.0/0", + protocol => "udp", + ports => "22", + } + + shorewall::tcclasses { "ssh": + order => "1", + interface => "${device}", + rate => "4*full/100", + ceil => "full", + priority => "1", + } + + shorewall::tcclasses { "default": + order => "2", + interface => "${device}", + rate => "6*full/100", + ceil => "full", + priority => "2", + options => "default", + } +} |