Skip to content

Commit

Permalink
system.inc - improve package info to syslog.conf
Browse files Browse the repository at this point in the history
packages like postfix needs some custom settings to syslog.conf. As it is dangerous to be done by file hacking.(pfsense/FreeBSD-ports#23) I'm sending this code change to improve system.inc tests on package logging config.
  • Loading branch information
marcelloc committed Apr 5, 2016
1 parent c7445ef commit 2d6a9c9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/etc/inc/system.inc
Original file line number Diff line number Diff line change
Expand Up @@ -899,14 +899,23 @@ function system_syslogd_start() {
if (isset($syslogcfg)) {
$separatelogfacilities = array('ntp', 'ntpd', 'ntpdate', 'charon', 'ipsec_starter', 'openvpn', 'pptps', 'poes', 'l2tps', 'relayd', 'hostapd', 'dnsmasq', 'filterdns', 'unbound', 'dhcpd', 'dhcrelay', 'dhclient', 'dhcp6c', 'dpinger', 'radvd', 'routed', 'olsrd', 'zebra', 'ospfd', 'bgpd', 'miniupnpd', 'filterlog');
$syslogconf = "";
$default_mail_info="mail.crit";
if ($config['installedpackages']['package']) {
foreach ($config['installedpackages']['package'] as $package) {
if ($package['logging']) {
array_push($separatelogfacilities, $package['logging']['facilityname']);
if (!is_file($g['varlog_path'].'/'.$package['logging']['logfilename'])) {
mwexec("{$log_create_directive} {$log_size} {$g['varlog_path']}/{$package['logging']['logfilename']}");
// check if package needs to change default mail info on syslog
if (preg_match ("/mail/",$package['logging']['default_mail_info'])) {
$default_mail_info=$package['logging']['default_mail_info'];
}
if ($package['logging']['clog'] == 'no') {
$noclog_directives.="{$package['logging']['facilityname']}.*\t\t\t\t\t\t {$g['varlog_path']}/{$package['logging']['logfilename']}\n";
} else {
array_push($separatelogfacilities, $package['logging']['facilityname']);
if (!is_file($g['varlog_path'].'/'.$package['logging']['logfilename'])) {
mwexec("{$log_create_directive} {$log_size} {$g['varlog_path']}/{$package['logging']['logfilename']}");
}
$syslogconf .= "!{$package['logging']['facilityname']}\n*.*\t\t\t\t\t\t {$log_directive}{$g['varlog_path']}/{$package['logging']['logfilename']}\n";
}
$syslogconf .= "!{$package['logging']['facilityname']}\n*.*\t\t\t\t\t\t {$log_directive}{$g['varlog_path']}/{$package['logging']['logfilename']}\n";
}
}
}
Expand Down Expand Up @@ -1010,7 +1019,8 @@ local3.* {$log_directive}{$g['varlog_path']}/vpn.log
local4.* {$log_directive}{$g['varlog_path']}/portalauth.log
local5.* {$log_directive}{$g['varlog_path']}/nginx.log
local7.* {$log_directive}{$g['varlog_path']}/dhcpd.log
*.notice;kern.debug;lpr.info;mail.crit;daemon.none;news.err;local0.none;local3.none;local4.none;local7.none;security.*;auth.info;authpriv.info;daemon.info {$log_directive}{$g['varlog_path']}/system.log
{$noclog_directives}
*.notice;kern.debug;lpr.info;{$default_mail_info};daemon.none;news.err;local0.none;local3.none;local4.none;local7.none;security.*;auth.info;authpriv.info;daemon.info {$log_directive}{$g['varlog_path']}/system.log
auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15
*.emerg *
Expand Down

0 comments on commit 2d6a9c9

Please sign in to comment.