Skip to content

Commit

Permalink
added validation for the SYSLOG_FACILITY and SYSLOG_PRIORITY vars
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/mbr/svn/psad_repos/psad/trunk@2077 91a0a83b-1414-0410-bf9a-c3dbc33e90b6
  • Loading branch information
mrash committed Jun 29, 2007
1 parent 91af474 commit 7de83cb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 24 additions & 2 deletions psad
Expand Up @@ -2872,7 +2872,7 @@ sub validate_config() {
unless ($fw_block_ip =~ m|^\s*$ip_re\s*$|
or $fw_block_ip =~ m|^\s*$ip_re/\d+\s*$|
or $fw_block_ip =~ m|^\s*$ip_re/$ip_re\s*$|) {
die '[-] The --fw-block-ip argument accepts ' .
die '[*] The --fw-block-ip argument accepts ' .
'an IP address or network.';
}
}
Expand All @@ -2881,11 +2881,33 @@ sub validate_config() {
unless ($fw_rm_block_ip =~ m|^\s*$ip_re\s*$|
or $fw_rm_block_ip =~ m|^\s*$ip_re/\d+\s*$|
or $fw_rm_block_ip =~ m|^\s*$ip_re/$ip_re\s*$|) {
die '[-] The --fw-rm-block-ip argument accepts ' .
die '[*] The --fw-rm-block-ip argument accepts ' .
'an IP address or network.';
}
}

unless ($config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL7/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL6/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL5/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL4/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL3/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL2/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL1/i
or $config{'SYSLOG_FACILITY'} =~ /LOG_LOCAL0/i) {
die "[*] Unrecognized SYSLOG_FACILITY, see psad.conf";
}

unless ($config{'SYSLOG_PRIORITY'} =~ /LOG_INFO/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_DEBUG/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_NOTICE/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_WARNING/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_ERR/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_CRIT/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_ALERT/i
or $config{'SYSLOG_PRIORITY'} =~ /LOG_EMERG/i) {
die "[*] Unrecognized SYSLOG_PRIORITY, see psad.conf";
}

return;
}

Expand Down
3 changes: 3 additions & 0 deletions psad.conf
Expand Up @@ -199,6 +199,9 @@ ALERT_ALL Y;
IMPORT_OLD_SCANS N;

### syslog facility and priority (the defaults are usually ok)
### The SYSLOG_FACILITY variable can be set to one of LOG_LOCAL{0-7}, and
### SYSLOG_PRIORITY can be set to one of LOG_INFO, LOG_DEBUG, LOG_NOTICE,
### LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_ALERT, or LOG_EMERG
SYSLOG_IDENTITY psad;
SYSLOG_FACILITY LOG_LOCAL7;
SYSLOG_PRIORITY LOG_INFO;
Expand Down

0 comments on commit 7de83cb

Please sign in to comment.