]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/suricata/convert-snort
convert-snort: Re-order steps at end of script
[ipfire-2.x.git] / config / suricata / convert-snort
index 20ba353109e5f95f45a0943ac8acd304b6e8ce21..0ad2942b13ddded97ca829f42209ddd1ecd8ed6d 100644 (file)
@@ -226,6 +226,17 @@ if (-f $snort_rules_tarball) {
 
        # Set correct ownership.
        &IDS::set_ownership("$IDS::rulestarball");
+
+# In case no tarball is present, try to download the ruleset.
+} else {
+       # Check if enought disk space is available.
+       if(&IDS::checkdiskspace()) {
+               # Print error message.
+               print "Could not download ruleset - Not enough free diskspace available.\n";
+       } else {
+               # Call the download function and grab the new ruleset.
+               &IDS::downloadruleset();
+       }
 }
 
 #
@@ -236,10 +247,30 @@ if (-f $snort_rules_tarball) {
 if (-f $IDS::rulestarball) {
        # Launch oinkmaster by calling the subfunction.
        &IDS::oinkmaster();
+
+       # Set correct ownership for the rulesdir and files.
+       &IDS::set_ownership("$IDS::rulespath");
+}
+
+#
+## Step 8: Generate file for the HOME Net.
+#
+
+# Call subfunction to generate the file.
+&IDS::generate_home_net_file();
+
+#
+## Step 9: Setup automatic ruleset updates.
+#
+
+# Check if a ruleset is configured.
+if($rulessettings{"RULES"}) {
+       # Call suricatactrl and setup the periodic update mechanism.
+       &IDS::call_suricatactrl("cron", $rulessettings{'AUTOUPDATE_INTERVAL'});
 }
 
 #
-## Step 8: Grab used ruleset files from snort config file and convert
+## Step 10: Grab used ruleset files from snort config file and convert
 ##         them into the new format.
 #
 
@@ -284,23 +315,6 @@ close(SNORTCONF);
 # Pass the array of enabled rule files to the subfunction and write the file.
 &IDS::write_used_rulefiles_file(@enabled_rule_files);
 
-#
-## Step 9: Generate file for the HOME Net.
-#
-
-# Call subfunction to generate the file.
-&IDS::generate_home_net_file();
-
-#
-## Step 10: Setup automatic ruleset updates.
-#
-
-# Check if a ruleset is configured.
-if($rulessettings{"RULES"}) {
-       # Call suricatactrl and setup the periodic update mechanism.
-       &IDS::call_suricatactrl("cron", $rulessettings{'AUTOUPDATE_INTERVAL'});
-}
-
 #
 ## Step 11: Start the IDS if enabled.
 #