Skip to content

Commit

Permalink
Changed name of script that disable network offload on network cards …
Browse files Browse the repository at this point in the history
…to a

generic name, as now it may be used to act on several network interfaces.

Signed-off-by: KheOps <kheops@ceops.eu>
  • Loading branch information
kheops2713 committed Mar 16, 2015
1 parent 2660f6a commit 9369bfb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
command: rkhunter --propupd

- name: disable network offloading
command: /opt/disable-network-offload-{{ monitored_interface }}.sh
command: /opt/disable-network-offload.sh

- name: update suricata ET rules
command: oinkmaster -C /etc/oinkmaster/oinkmaster.conf -o /etc/snort/rules
Expand Down
4 changes: 2 additions & 2 deletions roles/common/tasks/ids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
tags: base

- name: Install script that disables network offloading (for Suricata to work properly)
template: src=disable-network-offload.sh.j2 dest=/opt/disable-network-offload-{{ monitored_interface }}.sh owner=root group=root mode=0755
template: src=disable-network-offload.sh.j2 dest=/opt/disable-network-offload.sh owner=root group=root mode=0755
notify:
- disable network offloading
tags: base

- name: Make sure network offloading disabling is executed at each reboot
template: src=disable-network-offload-cron.j2 dest=/etc/cron.d/disable-network-offload-{{ monitored_interface }} owner=root group=root mode=0644
template: src=disable-network-offload-cron.j2 dest=/etc/cron.d/disable-network-offload owner=root group=root mode=0644
tags: base

- name: Install log rotation for Suricata log files
Expand Down
2 changes: 1 addition & 1 deletion roles/common/templates/disable-network-offload-cron.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@reboot root /opt/disable-network-offload-{{ monitored_interface }}.sh
@reboot root /opt/disable-network-offload.sh
21 changes: 12 additions & 9 deletions roles/common/templates/disable-network-offload.sh.j2
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/bin/bash

/sbin/ethtool -K {{ monitored_interface }} tso off
/sbin/ethtool -K {{ monitored_interface }} gro off
/sbin/ethtool -K {{ monitored_interface }} lro off
/sbin/ethtool -K {{ monitored_interface }} gso off
/sbin/ethtool -K {{ monitored_interface }} rx off
/sbin/ethtool -K {{ monitored_interface }} tx off
/sbin/ethtool -K {{ monitored_interface }} sg off
/sbin/ethtool -K {{ monitored_interface }} rxvlan off
/sbin/ethtool -K {{ monitored_interface }} txvlan off
{% for ifcap in monitored_interfaces %}
/sbin/ethtool -K {{ ifcap }} tso off
/sbin/ethtool -K {{ ifcap }} gro off
/sbin/ethtool -K {{ ifcap }} lro off
/sbin/ethtool -K {{ ifcap }} gso off
/sbin/ethtool -K {{ ifcap }} rx off
/sbin/ethtool -K {{ ifcap }} tx off
/sbin/ethtool -K {{ ifcap }} sg off
/sbin/ethtool -K {{ ifcap }} rxvlan off
/sbin/ethtool -K {{ ifcap }} txvlan off

{% endfor %}

0 comments on commit 9369bfb

Please sign in to comment.