From patchwork Tue Nov 5 09:31:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2573 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 476kvt2B6Mz420M for ; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 476kvs08CGz4XM; Tue, 5 Nov 2019 09:32:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 476kvr4Mtyz2yjx; Tue, 5 Nov 2019 09:32:08 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 476kvq3Vnyz2yWt for ; Tue, 5 Nov 2019 09:32:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 476kvp41x4z2dx; Tue, 5 Nov 2019 09:32:06 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1572946327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5Az5hmIoVJcl/WpRpfDhovRX8uskBhw96cFkG61IhG8=; b=xK+UE7z3bcyEgu+oB7k7kfzbl8f90VAIFWpneqwkPPJZVXt41tGTm/wznlv3aGe5qRvqL5 f7FlJFJi8tJ/ALDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1572946327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5Az5hmIoVJcl/WpRpfDhovRX8uskBhw96cFkG61IhG8=; b=Xe/ruCVErR7IkrB2eJpt76RVpMhUc51SZL9yzh1t6of0BZNTm05dplzSPdavHOHld8xajh IPevtzknoXo/EFeJY9QrCrCxqh6nRuCnOgyK9IZoI7ktzVdJcn3+g2numqYCMII1a75+8Z H2IV7//WjDhCYCS+ZsdBAO8NZyEugkZ566xBxmaJZpDgBMVATNimJUlZUf/A0nGRCIPh0q qDamPA+3bXdWz3er06b8XcsNrEBU6+GmHaazEozr3EO1rV+RpeU+h7uuo8LXij4S9zi/zg nzcIKvwkIGf7G+ae1IBlzrAJdlLHo6bt2SErwfnoF2gOPu6GKyRzzVDmootXXQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 1/5] ids-functions.pl: Introduce generate_dns_servers_file() Date: Tue, 5 Nov 2019 10:31:58 +0100 Message-Id: <20191105093202.4488-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This function is used to generate a yaml file which take care of the current used DNS configuration and should be included in the main suricata config file. Signed-off-by: Stefan Schantl --- config/cfgroot/ids-functions.pl | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 94de1373c..54d86f70f 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -34,6 +34,9 @@ our $used_rulefiles_file = "$settingsdir/suricata-used-rulefiles.yaml"; # File where the addresses of the homenet are stored. our $homenet_file = "$settingsdir/suricata-homenet.yaml"; +# File where the addresses of the used DNS servers are stored. +our $dns_servers_file = "$settingsdir/suricata-dns-servers.yaml"; + # File which contains the enabled sids. our $enabled_sids_file = "$settingsdir/oinkmaster-enabled-sids.conf"; @@ -695,6 +698,65 @@ sub generate_home_net_file() { close(FILE); } +# +# Function to generate and write the file which contains the configured and used DNS servers. +# +sub generate_dns_servers_file() { + # Open file which contains the current used DNS configuration. + open (FILE, "${General::swroot}/red/dns") or die "Could not read DNS configuration from ${General::swroot}/red/dns. $!\n"; + + # Read-in whole file content and store it in a temporary array. + my @file_content = ; + + # Close file handle. + close(FILE); + + # Format dns servers declaration. + my $line = "\"\["; + + # Loop through the array which contains the file content. + foreach my $server (@file_content) { + # Remove newlines. + chomp($server); + + # Check if the current DNS configuration is using the local recursor mode. + if ($server eq "local recursor") { + # The responsible DNS servers on red are directly used, and because we are not able + # to specify each single DNS server address here, we currently have to thread each + # address which is not part of the HOME_NET as possible DNS server. + $line = "$line" . "!\$HOME_NET"; + } else { + # Add the DNS server to the line. + $line = "$line" . "$server"; + } + + # Check if the current DNS server was the last in the array. + if ($server eq $file_content[-1]) { + # Close the line. + $line = "$line" . "\]\""; + } else { + # Add "," for the next DNS server. + $line = "$line" . "\,"; + } + } + + # Open file to store the used DNS server addresses. + open(FILE, ">$dns_servers_file") or die "Could not open $dns_servers_file. $!\n"; + + # Print yaml header. + print FILE "%YAML 1.1\n"; + print FILE "---\n\n"; + + # Print notice about autogenerated file. + print FILE "#Autogenerated file. Any custom changes will be overwritten!\n"; + + # Print the generated DNS declaration to the file. + print FILE "DNS_SERVERS:\t$line\n"; + + # Close file handle. + close(FILE); +} + # ## Function to generate and write the file for used rulefiles. # From patchwork Tue Nov 5 09:31:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2574 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 476kvv3vpXz43Tc for ; Tue, 5 Nov 2019 09:32:11 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 476kvt2TZpz6BZ; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 476kvt0g4jz2yN3; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 476kvr1LGRz2ybb for ; Tue, 5 Nov 2019 09:32:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 476kvq3Zjfz3xV; Tue, 5 Nov 2019 09:32:07 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1572946327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OKVN5vzg50WTokEYA/8f0fIx1/maahua9dAEtfpl+ww=; b=2JNP0CXayKNYyyN8THJEC089xPlE1UlaLuNOKViHo4QZ9jJjeyJMzONUgc+OjKzfbub3+u HMdmnh//UaWIzRAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1572946327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OKVN5vzg50WTokEYA/8f0fIx1/maahua9dAEtfpl+ww=; b=ROcEjnFHbddh9woJOVjSTtdwK+eQ+SC8d/uuchbVgb8X/ttygYGE/NntZxUodhn98rB6tv IhPL5Fdv3ZkmXerjpLVH6vC75ze88Tj+j4e0n1sSNWOCffKJRzU71+cRLtdFV0r1gG+OzV rDHidD+6YAAD9MlsBOK0aaCBR3z6EZnkZEgLaumpWcRmAmhkiAjbFzNPkj9ZAbU4XHM23G nQArXCyVM8ShTubfGK5rg0cX5S7yFHJcSv7eQGCZrOAV4nBF3zGrvzm86/qIIN/E9lHMCK FqBZZs5rjJJSyBBGP3+fsykb1JIFgNvMJMxfKQPvY+fnT68z2PGltSlpXVF0ng== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 2/5] ids.cgi: Generate and store the DNS server configuration. Date: Tue, 5 Nov 2019 10:31:59 +0100 Message-Id: <20191105093202.4488-2-stefan.schantl@ipfire.org> In-Reply-To: <20191105093202.4488-1-stefan.schantl@ipfire.org> References: <20191105093202.4488-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This will be done by the recently added generate_dns_servers_file() function from ids-functions.pl. Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index 74f5ca223..da009f891 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -601,6 +601,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'save'}) { # Generate file to store the home net. &IDS::generate_home_net_file(); + # Generate file to the store the DNS servers. + &IDS::generate_dns_servers_file(); + # Write the modify sid's file and pass the taken ruleaction. &IDS::write_modify_sids_file(); From patchwork Tue Nov 5 09:32:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2575 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 476kvw2V3Lz420M for ; Tue, 5 Nov 2019 09:32:12 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 476kvt64Krz6Cg; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 476kvt34lgz2yrM; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 476kvr611vz2yWt for ; Tue, 5 Nov 2019 09:32:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 476kvr3sHRz4V9; Tue, 5 Nov 2019 09:32:08 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1572946328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+TC2u13ry+C5oG8lg95EblCvvP/PB6BWjKQcas/9o18=; b=FFOajr+NWNFdd4sFwQpmwQFtve/TkR/PpCNpWGg1cI6z72EK3sMIt0hxiUw+SjtxxL9QLp OCehSe8rc/TGV1Bg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1572946328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+TC2u13ry+C5oG8lg95EblCvvP/PB6BWjKQcas/9o18=; b=ReudGTIk8foREFRpp6WFfDfJ8qLRrTAysMrhhlWc8liq2cY+2FtNCtm0t0detb4DWRJXqg mp7dlOVFUSarhA7NuTvXJR1zxCzu72TU46B6bUGI9Ent0LbjGHGVAKWraArHQ4iPgWzOpa x6kkFFJlmf3RB24DdCZqaEyjZ1nNhrFztzL1kuus7ivzQ4Ht+zByxgz6njjevujxq6XPrJ g5HF9r9eQWuiz42kfsrlTjFZR7CY3ifGvLDTc+2l6GD6DL7D9RmSLJc4h42mFwQBog3KHG U1RxbNDgMeGqxFZ4mfIc7VhjmsuMI4Uqg0og3UXR1CKbm9jZ42sRdYiRFGFdDQ== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 3/5] convert-snort: Generate DNS servers file. Date: Tue, 5 Nov 2019 10:32:00 +0100 Message-Id: <20191105093202.4488-3-stefan.schantl@ipfire.org> In-Reply-To: <20191105093202.4488-1-stefan.schantl@ipfire.org> References: <20191105093202.4488-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- config/suricata/convert-snort | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/config/suricata/convert-snort b/config/suricata/convert-snort index 5ed36954f..64b6e8b6a 100644 --- a/config/suricata/convert-snort +++ b/config/suricata/convert-snort @@ -253,7 +253,17 @@ if (-f $IDS::rulestarball) { &IDS::set_ownership("$IDS::homenet_file"); # -## Step 9: Setup automatic ruleset updates. +## Step 9: Generate file for the DNS servers. +# + +# Call subfunction to generate the file. +&IDS::generate_dns_servers_file(); + +# Set correct ownership for the dns_servers_file. +&IDS::set_ownership("$IDS::dns_servers_file"); + +# +## Step 10: Setup automatic ruleset updates. # # Check if a ruleset is configured. @@ -263,7 +273,7 @@ if($rulessettings{"RULES"}) { } # -## Step 10: Grab used ruleset files from snort config file and convert +## Step 11: Grab used ruleset files from snort config file and convert ## them into the new format. # @@ -309,7 +319,7 @@ close(SNORTCONF); &IDS::write_used_rulefiles_file(@enabled_rule_files); # -## Step 11: Start the IDS if enabled. +## Step 12: Start the IDS if enabled. # # Check if the IDS should be started. From patchwork Tue Nov 5 09:32:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2576 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 476kvx2Bgsz43Tc for ; Tue, 5 Nov 2019 09:32:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 476kvv3t42z6Cw; Tue, 5 Nov 2019 09:32:11 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 476kvv0RpWz2ycb; Tue, 5 Nov 2019 09:32:11 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 476kvs2L4Nz2yrD for ; Tue, 5 Nov 2019 09:32:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 476kvs0P5xz4XP; Tue, 5 Nov 2019 09:32:09 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1572946329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RWWzpjvFyw1lXgHPzO5QzsMRAk5gt30YWePb5vUx9FU=; b=d0Q1pgmoKE3h1d4mrj57pH64YeV0APjUhqALIULUS9/jFxjYEmH+0MI7+DDuogHeqHCw81 rUYWzUcjhwgZt6AQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1572946329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RWWzpjvFyw1lXgHPzO5QzsMRAk5gt30YWePb5vUx9FU=; b=Ecwj2qwifBKCkUknCvdVu1i0ByHQ4UbomXk3pvXpNASlM7QS3yrctTBuskZj6GybnsXqfH wsMscgNfBbqotimKcb0yL3KjjBvpJxGEPVVNdv7iaCVx6YrMO9F05etbWEmB99Ps5QXw/8 k0iKJD3gZCk4pYamGjhQc+JNHsouw2cHUtxhI1xqImSkZMU7qUU7XmzQjYz/ZLhtt7YiE+ DhjaQ/5V2tFeFdtm1aSiuJH0jtzRWkrzZ32LVCaCDlD9ThyygBnB/mibVow2VpF0FVvls0 rW3VRPLL2oBqLPHINgv9RUqWjK2Oqk1OHhdOyjPWN4tDs9NS8ZAJcAfG3vO0Zw== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 4/5] red.up: Generate Suricata DNS servers file on reconnect. Date: Tue, 5 Nov 2019 10:32:01 +0100 Message-Id: <20191105093202.4488-4-stefan.schantl@ipfire.org> In-Reply-To: <20191105093202.4488-1-stefan.schantl@ipfire.org> References: <20191105093202.4488-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- src/initscripts/networking/red.up/23-suricata | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/initscripts/networking/red.up/23-suricata b/src/initscripts/networking/red.up/23-suricata index 1514909ee..c0628e9f9 100644 --- a/src/initscripts/networking/red.up/23-suricata +++ b/src/initscripts/networking/red.up/23-suricata @@ -19,8 +19,12 @@ if($ids_settings{'ENABLE_IDS'} eq "on") { # Regenerate the file with HOME_NET details. &IDS::generate_home_net_file(); - # Set correct ownership. + # Regenerate the file with DNS_SERVERS details. + &IDS::generate_dns_servers_file(); + + # Set correct ownerships. &IDS::set_ownership("$IDS::homenet_file"); + &IDS::set_ownership("$IDS::dns_servers_file"); # Check if suricata is running. if(&IDS::ids_is_running()) { From patchwork Tue Nov 5 09:32:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2577 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 476kvx3Fv8z43Tf for ; Tue, 5 Nov 2019 09:32:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 476kvv4jYtz6Cy; Tue, 5 Nov 2019 09:32:11 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 476kvv2TVPz2yqy; Tue, 5 Nov 2019 09:32:11 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 476kvt1gsYz2xZd for ; Tue, 5 Nov 2019 09:32:10 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 476kvs4Jj6z639; Tue, 5 Nov 2019 09:32:09 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1572946329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuZUDGgEMTPp5dRwBIQfKwIEOqAX+j0zVtk6FgoPVrI=; b=GtlIR3y0wuXHQxUMwFe3+JwCU0RBL9F15yU0jaT8ZzGvryTN8kL0SyFX6RZF8eR4kwxwUd f+Hq06+rRTsIWaDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1572946329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OuZUDGgEMTPp5dRwBIQfKwIEOqAX+j0zVtk6FgoPVrI=; b=h0WWt5BUbeaTgvhzhzGWa5MEmGK7thjfDGe3GSB6vYLnY8ny7BPzUar4oZkTx1LMeVlQ4/ f3Ez12RVrpDQ1W+JBX0uTNmuuot9daF+R0Ezjnd4BhH0jC8LjpCjcWaoV0+pyn/+JrymlY OdQtGweXld7In8ShxxMDo9V3ie2xpYQ0qBCWHg1krABfPdgOBa0yQUBpBIGNg+MVpFciKi YM2MOZsqwUrr/WQZuoMBrUTmMHg5eLn36Jyr+BFSqFVG6LvQzTmC6p6mjAuamg1+SVLhlz t8m+q3sr/l2113PDY/NDC47eSN8pbfoEUiFg062Pj7aiBaztomLeBonb6Jp8RA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 5/5] suricata: Use DNS_SERVERS declaration from external file. Date: Tue, 5 Nov 2019 10:32:02 +0100 Message-Id: <20191105093202.4488-5-stefan.schantl@ipfire.org> In-Reply-To: <20191105093202.4488-1-stefan.schantl@ipfire.org> References: <20191105093202.4488-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=stevee smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" These settings now will be read from /var/ipfire/suricata/suricata-dns-servers.yaml, which will be generated by the generate_dns_servers_file() function, located in ids-functions.pl and called by various scripts. Fixes #12166. Signed-off-by: Stefan Schantl --- config/suricata/suricata.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/suricata/suricata.yaml b/config/suricata/suricata.yaml index e921781cf..af9cb75a9 100644 --- a/config/suricata/suricata.yaml +++ b/config/suricata/suricata.yaml @@ -11,12 +11,14 @@ vars: # Include HOME_NET declaration from external file. include: /var/ipfire/suricata/suricata-homenet.yaml + # Include DNS_SERVERS declaration from external file. + include: /var/ipfire/suricata/suricata-dns-servers.yaml + EXTERNAL_NET: "any" HTTP_SERVERS: "$HOME_NET" SMTP_SERVERS: "$HOME_NET" SQL_SERVERS: "$HOME_NET" - DNS_SERVERS: "$HOME_NET" TELNET_SERVERS: "$HOME_NET" AIM_SERVERS: "$EXTERNAL_NET" DC_SERVERS: "$HOME_NET"