From 4f513522feeb88a447a861d414eead6432ce784f Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 15 Apr 2022 05:18:37 +0200 Subject: [PATCH] ids-functions.pl: Do not use a hard-code temporary download location. Signed-off-by: Stefan Schantl --- config/cfgroot/ids-functions.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index b81c63b675..ef79199b38 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -130,6 +130,9 @@ my $suricatactrl = "/usr/local/bin/suricatactrl"; # Prefix for each downloaded ruleset. my $dl_rulesfile_prefix = "idsrules"; +# Temporary directory to download the rules files. +my $tmp_dl_directory = "/var/tmp"; + # Temporary directory where the rulesets will be extracted. my $tmp_directory = "/tmp/ids_tmp"; @@ -371,9 +374,9 @@ sub downloadruleset ($) { # Pass the requested URL to the downloader. my $request = HTTP::Request->new(GET => $url); - # Generate temporary file name, located in "/var/tmp" and with a suffix of ".tmp". + # Generate temporary file name, located in the tempoary download directory and with a suffix of ".tmp". # The downloaded file will be stored there until some sanity checks are performed. - my $tmp = File::Temp->new( SUFFIX => ".tmp", DIR => "/var/tmp/", UNLINK => 0 ); + my $tmp = File::Temp->new( SUFFIX => ".tmp", DIR => "$tmp_dl_directory/", UNLINK => 0 ); my $tmpfile = $tmp->filename(); # Call function to get the final path and filename for the downloaded file. -- 2.39.2