]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
convert-snort: Always create directory and filelayout
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 14 Feb 2019 11:37:13 +0000 (12:37 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 14 Feb 2019 11:37:13 +0000 (12:37 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/suricata/convert-snort

index fabf70ee77bc08358889c89c5d2037ded17f7c6f..0df5a451afdf7f15e2b1eb3d02e55b9e2a1ab273 100644 (file)
@@ -33,18 +33,6 @@ my $snort_config_file = "/etc/snort/snort.conf";
 # Snort rules tarball.
 my $snort_rules_tarball = "/var/tmp/snortrules.tar.gz";
 
-# Check if a snort settings file exists.
-unless( -f "$snort_settings_file") {
-        print "$snort_settings_file not found - Nothing to do. Exiting!\n";
-        exit(0);
-}
-
-# Check if the snort settings file is empty.
-if (-z "$snort_settings_file") {
-       print "$snort_settings_file is empty - Nothing to do. Exiting!\n";
-       exit(0);
-}
-
 #
 ## Step 1: Setup directory and file layout, if not present and set correct
 ##         ownership. The converter runs as a privileged user, but the files
@@ -70,6 +58,18 @@ unless (-d $IDS::rulespath) {
 &IDS::set_ownership("$IDS::settingsdir");
 &IDS::set_ownership("$IDS::rulespath");
 
+# Check if a snort settings file exists.
+unless( -f "$snort_settings_file") {
+       print "$snort_settings_file not found - Nothing to do. Exiting!\n";
+       exit(0);
+}
+
+# Check if the snort settings file is empty.
+if (-z "$snort_settings_file") {
+       print "$snort_settings_file is empty - Nothing to do. Exiting!\n";
+       exit(0);
+}
+
 #
 ## Step 2: Import snort settings and convert to the required format for the new IDS
 ##         (suricata).