Commit Graph

273 Commits

Author SHA1 Message Date
Stefan Schantl
b59cdbeea5 ids-functions.pl: Add private function to cleanup the rules directory.
This private function is used to remove any files which are stored in the
IDS rules directory and prevent from any old (unneeded or conflicting) files
after an update or complete change of the ruleset source.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-10-12 15:12:10 +02:00
Stefan Schantl
ed06bc811f ids-functions.pl: Add backend code to handle the "cron" function of suricatactrl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-26 14:09:53 +02:00
Stefan Schantl
21cab141ec suricata: Rule files are now located in /var/lib/suricata
Place the rulefiles from now in "/var/lib/suricata".

Fixes #11834

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-29 12:37:44 +02:00
Stefan Schantl
be52c68a2d ids-functions.pl: Early abort downloadruleset() if no ruleset is configured
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-27 15:11:28 +02:00
Stefan Schantl
e568796bb0 ids-functions.pl: Also check and fix the permissions of rulespath
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-25 15:48:58 +02:00
Stefan Schantl
330759d88a ids-functions.pl: Add priviate function _check_rulesdir_permissions()
This function checks if all files located in /etc/suricata/rules are
writable by the effective user and group (nobody:nobody) and if not
calls suricatactl to fix it.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-24 14:55:40 +02:00
Stefan Schantl
308ba5e74c ids-functions.pl: Add function to create empty files
This generic function can be used to create any kind of emtpy files -
it just requires the full path and filename to work.

If the specified file exists at calltime, the function will abort
to prevent from overwriting existing files and content.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-24 07:37:10 +02:00
Stefan Schantl
d9711d91ef ids-functions.pl: Display error if oinkmaster cannot be executed
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-18 10:01:14 +02:00
Stefan Schantl
88daf7eb3a ids-functions.pl: Log correct error message if download fails
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-17 08:49:06 +02:00
Stefan Schantl
5240a80987 ids-functions.pl: Add function to call suricatactrl binary
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-11 22:10:29 +02:00
Stefan Schantl
796eea2154 ids-functions.pl: Add function to check if the IDS is running
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-05 14:23:45 +02:00
Stefan Schantl
1cae702c22 ids-functions.pl: Add function to get the available network zones
The get_available_network_zones() function uses the /var/ipfire/ethernet/settings
file and translates the configured mode into an array, which contains the names
of the configured network zones.

The array will be returned and easily can be used to loop over this list of
available network zones and perform any kind of actions in other scripts.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-05 10:33:46 +02:00
Stefan Schantl
bce84f3975 ids-functions.pl: Rename ruleset-sources.list to ruleset-sources
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-02 19:31:52 +02:00
Stefan Schantl
164eab6627 ids-functions.pl: Move path details from snort to suricata
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-30 21:36:07 +02:00
Stefan Schantl
434001d0a0 IDS: Rework error and log handling in ids-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-28 16:34:50 +02:00
Stefan Schantl
02844177af IDS: Introduce settingsdir variable
The $settingsdir variable is declared in the ids-functions.pl and used to to
store the path where the various files which contains the settings for the IDS and
oinkmaster is located.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-27 07:58:23 +02:00
Stefan Schantl
298ef5bafa IDS: Move rulepath declaration to ids-functions.pl
This will help if the path ever changed. Also remove hard coded rulepath
from oinkmaster call.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 15:56:47 +02:00
Stefan Schantl
eb5592c1ce ids-functions.pl: Also log errors to syslog
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:59:15 +02:00
Stefan Schantl
0e40e1e772 ids-functions.pl: Use pure perl to log oinkmaster result to syslog
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:58:54 +02:00
Stefan Schantl
7791079275 ids-functions.pl: Make variables globally accessible
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:58:39 +02:00
Stefan Schantl
3983aebdec ids.cgi: Rework CGI logic to download a new ruleset
* Drop function to show a notice about snort is working.
* Introduce the log_error function which is responsible for log any
  error messages. Currently it writes it to a tempory file, which will
  be read by the WUI, the message will be displayed and the temporary file
  will be released again.
* Introduce a tiny function to easily perform a reload of the generated
  webpage.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:58:01 +02:00
Stefan Schantl
25f5cb0d4b ids.cgi: Move function to call oinkmaster to ids-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:56:45 +02:00
Stefan Schantl
eea2670b39 ids.cgi: Move downloader code to ids-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:56:28 +02:00
Stefan Schantl
8dcebe5342 IDS: Introduce ids-functions.pl.
This library will contain a set of functions used by the IDS CGI script
and the planned update script for auto-updating the snort ruleset.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:54:25 +02:00
Stefan Schantl
9f5247f60c general-functions.pl: readhash() Add code to handle optional comments in files
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:49:56 +02:00
Michael Tremer
080e79f149 Don't show proxy configuration pages when GREEN is not available
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-07-01 12:21:59 +01:00
Michael Tremer
dc845b6c81 AWS: Hide certain things on the web UI
Those are practically unusable on AWS.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-07-01 12:15:00 +01:00
Michael Tremer
0009de91e8 Ship default settings for language, theme, etc. in all images
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-06-27 09:59:47 +01:00
Michael Tremer
3483602929 ssh: Update default configuration
This patch removes an old switch to enable SSH 1 and
makes port 22 the default port.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-06-25 10:53:53 +01:00
Michael Tremer
00793c27c9 GeoIP: Add lookup function for convenience
Instead of opening the database again for each lookup,
we will read it into memory on first use and every lookup
after that will be coming from cache.

Reviewed-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-11-13 22:37:19 +00:00
Michael Tremer
b1ad5b8b6c geoip-functions.pl: Fix typos and formatting
Reviewed-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-11-13 22:37:03 +00:00
Alexander Marx
3f3974b711 Network-functions: add check if variables are defined
in function network_equal and network2bin a check for undefined variables were missing.
added them.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-11-07 16:19:23 +00:00
Alexander Marx
1047805dba BUG11466: Fix network_equal function
The network_equal function only tested the subnet addresses of two given networks which lead to
errormessages saying "This is the green network"
The fix tests netwok and subnet IP's to fix this

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-11-07 16:16:18 +00:00
Michael Tremer
5f1b951102 captive: Show access page in browser language
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Daniel Weismüller <daniel.weismüller@ipfire.org>
2017-09-22 19:00:04 +01:00
Michael Tremer
a0b271e474 captive: Redesign generated coupons table
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-09-22 18:56:04 +01:00
Michael Tremer
dbfd2622f5 captive: Get MAC address of a device without calling arp
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-09-22 18:55:27 +01:00
Alexander Marx
b7ab17ad83 BUG11278: It is not possible to create subnets of internal networks in firewallgroups
Fixes: #11278

When creating networks which are part of an internal network, there was an errormessage displayed and the creation was prohibited.
Now it is possible to create such subnets. This is used at own risk! Users have to take care of the firewallrule sequence.
It is possible to create situations that are not wanted.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-06-07 17:19:30 +01:00
Michael Tremer
c335b0cd8e index.cgi: Show WiFi properties on front page
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-05-16 16:02:25 +02:00
Michael Tremer
7cbdd31d6e graphs.pl: Fix HTML syntax error
The missing ' caused that a different URL was called

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-04-11 14:26:57 +01:00
Michael Tremer
183b23b5ca DNS: Show DNSSEC status on index page if deavtivated
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-04-02 19:48:20 +01:00
Michael Tremer
65c3b7c913 Revert "BUG11278: enable creation from subnets of internal networks"
This reverts commit ff6cc71107.

This patch causes that no new networks can be created and
an error message is shown that the created network is the GREEN
network which is incorrect.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-03-22 11:15:44 +00:00
Michael Tremer
a249ccd2e4 Improve graphs
The graphs are using an iframe and PNG images where the resolution
did often not fit and the browser had to resize the image. That
led to blurred fonts and hard to read graphs.

This patch increases the size of the box and the image. With that
higher resolution resizing should not be too much of an issue, but
since the sizes of the iframe and image have been aligned should
not even be necessary.

Reported-by: Marcel Lorenz <marcel.lorenz@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-03-15 13:45:05 +00:00
Michael Tremer
3713af1e27 network-functions.pl: Add tests for the new equals function
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:18:46 +00:00
Michael Tremer
8f23ce8e53 network-functions.pl: Fix code formatting
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:09:42 +00:00
Alexander Marx
ff6cc71107 BUG11278: enable creation from subnets of internal networks
In firewallgroups it was not possible to create new networks that are subnets of
IPFire internal networks. Now this is possible for all internal networks.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:05:53 +00:00
Alexander Marx
4f857eea41 BUG11278: Cleanup function for network check
Deleted some code which is also used in another function

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:05:12 +00:00
Michael Tremer
5edc06b701 Remove IPAC stuff
This is unused for a very very very long time and serves
no purpose any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-10-02 15:13:55 +01:00
Heino Gutschmidt
ecc9c73bb5 BUG11131: fix errormessage when more ipsec subnets defined
When having more than one subnet in an ipsec connection it is not
possible to create a new openvpn static subnet.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Heino Gutschmidt <heino.gutschmidt@managedhosting.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-06-03 16:19:49 +01:00
Michael Tremer
03306ff6a2 general-functions.pl: Allow underscores in domain names
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-05-03 22:50:53 +01:00
Alexander Marx
b00797e260 BUG10963: implement a better email verification
We now check all allowed chars in the address before the @ sign.
The domainpart after the '@' sign is just checked for valid chars, so that user@ipfire is valid, too

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2015-11-19 12:53:28 +00:00