19 Commits

Author SHA1 Message Date
Stefan Schantl
e2f4f99e49 update-ids-ruleset: Silent script if no providers settings file exists.
Only try to read-in the providers settings file, in case it exists.
Otherwise the script produces an error message, about the missing file,
each time it gets executed.

Because of the fcron job this would be twice a day in most cases.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-05-13 20:38:45 +00:00
Stefan Schantl
7c4b8df716 update-ids-ruleset: Skip unsupported providers.
In case a configured provider is not longer supported, simply skip it
and do not try to perform an update.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-04-17 15:02:41 +02:00
Stefan Schantl
39b5adb940 update-ids-ruleset: Only regenerate and reload ruleset on at least one
successfull update.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-04-11 05:57:05 +02:00
Stefan Schantl
ff780d8b3f update-ids-ruleset: Fix typo in return code.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-26 11:27:01 +01:00
Stefan Schantl
74019d3044 update-ids-ruleset: Skip providers which are not enabled.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-26 11:23:44 +01:00
Stefan Schantl
9a3f9c2b23 update-ids-ruleset: Log and abort if to less free disk space is
available.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-26 11:22:50 +01:00
Stefan Schantl
c9c3eadbbf update-ids-ruleset: Add logging for various events.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-26 11:22:08 +01:00
Stefan Schantl
d1f7542659 update-ids-ruleset: Add function to iherit with the syslog daemon.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-26 11:19:31 +01:00
Stefan Schantl
a956712e75 update-ids-ruleset: Always drop the lock file if it has been created during runtime.
In some situations or if an error happened, the lock file could be
keep on the system. In such a case the IDS page would be locked forever
until user interaction or reboot of the system.

Now the script checks if it has created such a lock and release it when
the script exists.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
2022-03-05 14:30:06 +00:00
Peter Müller
66c3619872 Early spring clean: Remove trailing whitespaces, and correct licence headers
Bumping across one of our scripts with very long trailing whitespaces, I
thought it might be a good idea to clean these up. Doing so, some
missing or inconsistent licence headers were fixed.

There is no need in shipping all these files en bloc, as their
functionality won't change.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-18 23:54:57 +00:00
Stefan Schantl
27671216d5 update-ids-ruleset: Early exit script if lockfile exists.
This prevents from running the script while the WUI is performing
operations at the same time or to launch multiple instances of the
script.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:45 +01:00
Stefan Schantl
6875f9ce7c update-ids-ruleset: Port script to work with multiple providers.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
72ab71969f update-ids-ruleset: Run as unprivileged user.
Check if the script has been launched as privileged user (root) and drop all
permissions by switching to the "nobody" user and group.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 12:33:58 +01:00
Stefan Schantl
84227f7a1c update-ids-ruleset: Release ids_page_lock when the downloader fails.
Fixes #12085.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-20 19:09:47 +01:00
Stefan Schantl
50b35e0f8f update-ids-ruleset: Set correct ownership for the rulestarball.
The script usualy will be executed by cron which will start it with
root permissions, so the downloaded tarball is owned by this user.

This has to be changed to the user which runs the WUI (nobody:nobody) to
allow, changing the ruleset to an other one and to display the ruleset area.

Fixes #12066

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-05-01 18:03:11 +02:00
Stefan Schantl
5206a3358d update-ids-ruleset: Lock and Unlock the IDS page during runtime
Reference #11991

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 08:06:49 +01:00
Stefan Schantl
d6f725e185 update-ids-ruleset: Improve error reporting if the system is offline
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 10:57:31 +01:00
Stefan Schantl
ca8c92108a update-ids-ruleset: Set correct ownership for rulesdir and files
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-29 09:09:11 +01:00
Stefan Schantl
82979dec36 IDS: Introduce update-ids-ruleset
This script periodly will be called by fcron
and is responsible for downloading and altering
the ruleset, if autoupdate of the configured ruleset is
enabled.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-26 14:11:31 +02:00