optionsfw.cgi: Add default settings for newly added options.

Message ID 20220305181339.4389-1-stefan.schantl@ipfire.org
State Accepted
Commit e895c2de72a79feda5a653bf4fd569c36c2d94da
Headers
Series optionsfw.cgi: Add default settings for newly added options. |

Commit Message

Stefan Schantl March 5, 2022, 6:13 p.m. UTC
  If no settings for those features can be obtained from the settings
file, set them to the following defaults.

* DROPSPOOFEDMARTIAN -> on (yes)
* DROPHOSTILE -> off (no - because only fresh installed systems should
                     do this)
* LOGDROPCTINVALID -> on (yes)

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 html/cgi-bin/optionsfw.cgi | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Peter Müller March 5, 2022, 7:32 p.m. UTC | #1
Looks good to me.

Also, fixes: #12791

Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> If no settings for those features can be obtained from the settings
> file, set them to the following defaults.
> 
> * DROPSPOOFEDMARTIAN -> on (yes)
> * DROPHOSTILE -> off (no - because only fresh installed systems should
>                      do this)
> * LOGDROPCTINVALID -> on (yes)
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
>  html/cgi-bin/optionsfw.cgi | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/html/cgi-bin/optionsfw.cgi b/html/cgi-bin/optionsfw.cgi
> index 5611b71b7..fbff67b2f 100644
> --- a/html/cgi-bin/optionsfw.cgi
> +++ b/html/cgi-bin/optionsfw.cgi
> @@ -88,6 +88,15 @@ if (!$settings{'MASQUERADE_ORANGE'}) {
>  if (!$settings{'MASQUERADE_BLUE'}) {
>  	$settings{'MASQUERADE_BLUE'} = 'on';
>  }
> +if (!$settings{'DROPSPOOFEDMARTIAN'}) {
> +	$settings{'DROPSPOOFEDMARTIAN'} = 'on';
> +}
> +if (!$settings{'DROPHOSTILE'}) {
> +	$settings{'DROPHOSTILE'} = 'off';
> +}
> +if (!$settings{'LOGDROPCTINVALID'}) {
> +	$settings{'LOGDROPCTINVALID'} = 'on';
> +}
>  
>  $checked{'DROPNEWNOTSYN'}{'off'} = '';
>  $checked{'DROPNEWNOTSYN'}{'on'} = '';
  

Patch

diff --git a/html/cgi-bin/optionsfw.cgi b/html/cgi-bin/optionsfw.cgi
index 5611b71b7..fbff67b2f 100644
--- a/html/cgi-bin/optionsfw.cgi
+++ b/html/cgi-bin/optionsfw.cgi
@@ -88,6 +88,15 @@  if (!$settings{'MASQUERADE_ORANGE'}) {
 if (!$settings{'MASQUERADE_BLUE'}) {
 	$settings{'MASQUERADE_BLUE'} = 'on';
 }
+if (!$settings{'DROPSPOOFEDMARTIAN'}) {
+	$settings{'DROPSPOOFEDMARTIAN'} = 'on';
+}
+if (!$settings{'DROPHOSTILE'}) {
+	$settings{'DROPHOSTILE'} = 'off';
+}
+if (!$settings{'LOGDROPCTINVALID'}) {
+	$settings{'LOGDROPCTINVALID'} = 'on';
+}
 
 $checked{'DROPNEWNOTSYN'}{'off'} = '';
 $checked{'DROPNEWNOTSYN'}{'on'} = '';