[PATCHv2] suricata: Use device ppp0 if PPPoE dialin is used.

Message ID 20190423192753.5524-1-stefan.schantl@ipfire.org
State Accepted
Commit 372975ed0c9f1a32d673d6f34217af530375354f
Headers
Series [PATCHv2] suricata: Use device ppp0 if PPPoE dialin is used. |

Commit Message

Stefan Schantl April 24, 2019, 5:27 a.m. UTC
  Fixes #12058.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/initscripts/system/suricata | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
  

Comments

Michael Tremer April 24, 2019, 8:53 p.m. UTC | #1
Thanks. I have merged this yesterday evening and we will rebuild the update for this.

> On 23 Apr 2019, at 20:27, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> Fixes #12058.
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> src/initscripts/system/suricata | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata
> index 16548753e..ecd693054 100644
> --- a/src/initscripts/system/suricata
> +++ b/src/initscripts/system/suricata
> @@ -18,6 +18,7 @@
> PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin; export PATH
> 
> eval $(/usr/local/bin/readhash /var/ipfire/suricata/settings)
> +eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
> 
> # Name of the firewall chain.
> FW_CHAIN="IPS"
> @@ -65,9 +66,18 @@ function generate_fw_rules {
> 
> 		# Check if the IDS is enabled for this network zone.
> 		if [ "${!enable_ids_zone}" == "on" ]; then
> -			# Generate name of the network interface.
> -			network_device=$zone
> -			network_device+="0"
> +			# Check if the current processed zone is "red" and the configured type is PPPoE dialin.
> +			if [ "$zone" == "red" ] && [ "$RED_TYPE" == "PPPOE" ]; then
> +				# Set device name to ppp0.
> +				network_device="ppp0"
> +			else
> +				# Generate variable name which contains the device name.
> +				zone_name="$zone_upper"
> +				zone_name+="_DEV"
> +
> +				# Grab device name.
> +				network_device=${!zone_name}
> +			fi
> 
> 			# Assign NFQ_OPTS
> 			NFQ_OPTIONS=$NFQ_OPTS
> -- 
> 2.20.1
>
  

Patch

diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata
index 16548753e..ecd693054 100644
--- a/src/initscripts/system/suricata
+++ b/src/initscripts/system/suricata
@@ -18,6 +18,7 @@ 
 PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin; export PATH
 
 eval $(/usr/local/bin/readhash /var/ipfire/suricata/settings)
+eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
 
 # Name of the firewall chain.
 FW_CHAIN="IPS"
@@ -65,9 +66,18 @@  function generate_fw_rules {
 
 		# Check if the IDS is enabled for this network zone.
 		if [ "${!enable_ids_zone}" == "on" ]; then
-			# Generate name of the network interface.
-			network_device=$zone
-			network_device+="0"
+			# Check if the current processed zone is "red" and the configured type is PPPoE dialin.
+			if [ "$zone" == "red" ] && [ "$RED_TYPE" == "PPPOE" ]; then
+				# Set device name to ppp0.
+				network_device="ppp0"
+			else
+				# Generate variable name which contains the device name.
+				zone_name="$zone_upper"
+				zone_name+="_DEV"
+
+				# Grab device name.
+				network_device=${!zone_name}
+			fi
 
 			# Assign NFQ_OPTS
 			NFQ_OPTIONS=$NFQ_OPTS