changeset 457:dde1d7e2309b

Set right log ownership/permissions for Ubuntu vs CentOS
author IBBoard <dev@ibboard.co.uk>
date Sat, 02 Sep 2023 19:58:24 +0100
parents 66e0e8f9e82a
children d7ad78f128b1
files modules/fail2ban/manifests/init.pp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/fail2ban/manifests/init.pp	Tue Aug 29 11:08:28 2023 +0100
+++ b/modules/fail2ban/manifests/init.pp	Sat Sep 02 19:58:24 2023 +0100
@@ -19,10 +19,14 @@
 	if $osfamily == 'RedHat' {
 		$ssh_log = '/var/log/secure'
 		$mail_log = '/var/log/maillog'
+		$log_group = 'root'
+		$log_mode = '0600'
 	}
 	elsif $osfamily == 'Debian' {
 		$ssh_log = '/var/log/auth.log'
 		$mail_log = '/var/log/mail.log'
+		$log_group = 'adm'
+		$log_mode = '0640'
 	}
 	file { '/etc/fail2ban/jail.local':
 		content => epp('fail2ban/jail.local.epp', {'ssh_log' => $ssh_log, 'mail_log' => $mail_log})
@@ -583,7 +587,7 @@
 	file { '/var/log/fail2ban.log':
 		ensure => present,
 		owner => 'root',
-		group => 'root',
-		mode => '0600',
+		group => $log_group,
+		mode => $log_mode,
 	}
 }
\ No newline at end of file