[16/54] samba: Log to syslog

Message ID 20201013160812.27754-16-michael.tremer@ipfire.org
State Accepted
Commit 13e455aec73b542a5cd96382df69e5ed2906b8b5
Headers show
Series [01/54] samba: Migrate configuration from Samba 3.6 to 4.x | expand

Commit Message

Michael Tremer Oct. 13, 2020, 4:07 p.m. UTC
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 config/rootfiles/core/152/filelists/files |  1 +
 config/rootfiles/packages/aarch64/samba   |  1 -
 config/rootfiles/packages/armv5tel/samba  |  1 -
 config/rootfiles/packages/i586/samba      |  1 -
 config/rootfiles/packages/x86_64/samba    |  1 -
 html/cgi-bin/logs.cgi/log.dat             |  2 +
 html/cgi-bin/samba.cgi                    | 46 +----------------------
 lfs/samba                                 |  1 -
 8 files changed, 5 insertions(+), 49 deletions(-)

Patch

diff --git a/config/rootfiles/core/152/filelists/files b/config/rootfiles/core/152/filelists/files
index ceb904c64..aaf469bce 100644
--- a/config/rootfiles/core/152/filelists/files
+++ b/config/rootfiles/core/152/filelists/files
@@ -9,5 +9,6 @@  etc/rc.d/helper/oci-setup
 etc/rc.d/init.d/networking/any
 etc/rc.d/init.d/networking/red
 srv/web/ipfire/cgi-bin/credits.cgi
+srv/web/ipfire/cgi-bin/logs.cgi/log.dat
 usr/local/bin/setaliases
 var/ipfire/graphs.pl
diff --git a/config/rootfiles/packages/aarch64/samba b/config/rootfiles/packages/aarch64/samba
index 630ec9da8..a707895d9 100644
--- a/config/rootfiles/packages/aarch64/samba
+++ b/config/rootfiles/packages/aarch64/samba
@@ -812,7 +812,6 @@  var/lib/samba
 var/lib/samba/bind-dns
 var/lib/samba/private
 var/lib/samba/winbindd_privileged
-var/log/samba
 var/nmbd
 srv/web/ipfire/cgi-bin/samba.cgi
 srv/web/ipfire/cgi-bin/sambahlp.cgi
diff --git a/config/rootfiles/packages/armv5tel/samba b/config/rootfiles/packages/armv5tel/samba
index 51349093b..885d9e154 100644
--- a/config/rootfiles/packages/armv5tel/samba
+++ b/config/rootfiles/packages/armv5tel/samba
@@ -812,7 +812,6 @@  var/lib/samba
 var/lib/samba/bind-dns
 var/lib/samba/private
 var/lib/samba/winbindd_privileged
-var/log/samba
 var/nmbd
 srv/web/ipfire/cgi-bin/samba.cgi
 srv/web/ipfire/cgi-bin/sambahlp.cgi
diff --git a/config/rootfiles/packages/i586/samba b/config/rootfiles/packages/i586/samba
index 089f6981d..e942471e2 100644
--- a/config/rootfiles/packages/i586/samba
+++ b/config/rootfiles/packages/i586/samba
@@ -812,7 +812,6 @@  var/lib/samba
 var/lib/samba/bind-dns
 var/lib/samba/private
 var/lib/samba/winbindd_privileged
-var/log/samba
 var/nmbd
 srv/web/ipfire/cgi-bin/samba.cgi
 srv/web/ipfire/cgi-bin/sambahlp.cgi
diff --git a/config/rootfiles/packages/x86_64/samba b/config/rootfiles/packages/x86_64/samba
index ff2b7d5c3..1c31256db 100644
--- a/config/rootfiles/packages/x86_64/samba
+++ b/config/rootfiles/packages/x86_64/samba
@@ -812,7 +812,6 @@  var/lib/samba
 var/lib/samba/bind-dns
 var/lib/samba/private
 var/lib/samba/winbindd_privileged
-var/log/samba
 var/nmbd
 srv/web/ipfire/cgi-bin/samba.cgi
 srv/web/ipfire/cgi-bin/sambahlp.cgi
diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat
index 8ca32d675..1fec05c35 100644
--- a/html/cgi-bin/logs.cgi/log.dat
+++ b/html/cgi-bin/logs.cgi/log.dat
@@ -67,6 +67,7 @@  my %sections = (
         'openvpn' => '(openvpnserver\[.*\]: |.*n2n\[.*\]: )',
         'pakfire' => '(pakfire:)',
         'red' => '(red:|pppd\[.*\]: |chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|dhcpcd\[.*\]|modem_run\[.*\])',
+	'samba' => '(nmbd|smbd|winbind)\[\d+\]:',
         'suricata' => '(suricata: )',
         'squid' => '(squid\[.*\]: |squid: )',
         'ssh' => '(sshd(?:\(.*\))?\[.*\]: )',
@@ -95,6 +96,7 @@  my %trsections = (
         'openvpn' => 'OpenVPN',
         'pakfire' => 'Pakfire',
         'red' => 'RED',
+	'samba' => $Lang::tr{'samba'},
         'suricata' => "$Lang::tr{'intrusion detection'}",
         'squid' => "$Lang::tr{'web proxy'}",
         'ssh' => 'SSH',
diff --git a/html/cgi-bin/samba.cgi b/html/cgi-bin/samba.cgi
index 4668cd253..0510f0f24 100644
--- a/html/cgi-bin/samba.cgi
+++ b/html/cgi-bin/samba.cgi
@@ -38,9 +38,6 @@  my %mainsettings = ();
 my $message = "";
 my $errormessage = "";
 
-my @Logs = qx(ls /var/log/samba/);
-my $Log =$Lang::tr{'no log selected'};
-
 my $Status = qx(/usr/local/bin/sambactrl smbstatus);
 $Status = &Header::cleanhtml($Status);
 
@@ -88,7 +85,6 @@  $sambasettings{'PASSWORDSYNC'} = 'off';
 $sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
 $sambasettings{'GUESTACCOUNT'} = 'samba';
 $sambasettings{'MAPTOGUEST'} = 'Bad User';
-$sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
 $sambasettings{'WIDELINKS'} = 'on';
 $sambasettings{'UNIXEXTENSION'} = 'off';
 ### Values that have to be initialized
@@ -149,7 +145,6 @@  if ($sambasettings{'ACTION'} eq 'globalresetyes')
 	$sambasettings{'OTHERINTERFACES'} = '127.0.0.1';
 	$sambasettings{'GUESTACCOUNT'} = 'samba';
 	$sambasettings{'MAPTOGUEST'} = 'Bad User';
-	$sambasettings{'LOGLEVEL'} = '3 passdb:5 auth:5 winbind:2';
 ### Samba CUPS Variablen
 	$sambasettings{'LOADPRINTERS'} = 'Yes';
 	$sambasettings{'PRINTING'} = 'cups';
@@ -278,8 +273,8 @@  winbind uid = 10000-20000
 winbind gid = 10000-20000
 winbind use default domain = yes
 
-log file  = /var/log/samba/samba-log.%m
-log level = $sambasettings{'LOGLEVEL'}
+# Log to syslog
+logging = syslog
 
 preferred master = $sambasettings{'PREFERREDMASTER'}
 domain master = $sambasettings{'DOMAINMASTER'}
@@ -427,7 +422,6 @@  print <<END
 <table width='95%' cellspacing='0'>
 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'basic options'}</b></td></tr>
 <tr><td align='left' width='40%'>$Lang::tr{'workgroup'}</td><td align='left'><input type='text' name='WORKGRP' value='$sambasettings{'WORKGRP'}' size="30" /></td></tr>
-<tr><td align='left' width='40%'>$Lang::tr{'log level'}</td><td align='left'><input type='text' name='LOGLEVEL' value='$sambasettings{'LOGLEVEL'}' size="30" /></td></tr>
 <tr><td align='left' width='40%'>$Lang::tr{'interfaces'}</td><td align='left'>on <input type='radio' name='VPN' value='on' $checked{'VPN'}{'on'} />/
 																						<input type='radio' name='VPN' value='off' $checked{'VPN'}{'off'} /> off |
 																						<font size='2' color='$Header::colourovpn'><b>   OpenVpn  -  $ovpnip[0].$ovpnip[1].$ovpnip[2].$ovpnip[3]/$ovpnnetwork[1]</b></font></td></tr>
@@ -1147,42 +1141,6 @@  END
 ;
 &Header::closebox();
 
-############################################################################################################################
-############################################### Anzeige der Sambalogs ######################################################
-
-
-if ($sambasettings{'ACTION'} eq 'showlog')
-{
-$Log = qx(tail -n $sambasettings{'LOGLINES'} /var/log/samba/$sambasettings{'LOG'});
-$Log=~s/\n/<br \/>/g;
-}
-
-&Header::openbox('100%', 'center', $Lang::tr{'log'});
-
-print <<END
-<a name="$Lang::tr{'log view'}"></a>
-<br />
-<form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'log view'}'>
-<table width='95%' cellspacing='0'>
-<tr><td bgcolor='$color{'color20'}' colspan='3' align='left'><b>$Lang::tr{'log view'}</b></td></tr>
-<tr><td colspan='3'  align='left'><br /></td></tr>
-<tr><td  align='left'><select name='LOG' style="width: 200px">
-END
-;
-foreach my $log (@Logs) {chomp $log;print"<option value='$log'>$log</option>";}
-print <<END
-
-</select></td><td  align='left'>$Lang::tr{'show last x lines'}<input type='text' name='LOGLINES' value='$LOGLINES' size="3" /></td>
-			<td  align='left'><input type='hidden' name='ACTION' value='showlog' /><input type='image' alt='view Log' title='view Log' src='/images/format-justify-fill.png' /></td></tr>
-<tr><td colspan='3'  align='left'><br /></td></tr>
-<tr><td colspan='3'  align='left'><font size=2>$Log</font></td></tr>
-<tr><td colspan='3'  align='left'><br /></td></tr>
-<tr><td colspan='3'  align='center'>$sambasettings{'LOG'}</td></tr>
-</table>
-</form>
-END
-;
-&Header::closebox();
 &Header::closebigbox();
 &Header::closepage();
 
diff --git a/lfs/samba b/lfs/samba
index 874166d2e..cd20baffc 100644
--- a/lfs/samba
+++ b/lfs/samba
@@ -109,7 +109,6 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	cat /var/ipfire/samba/global /var/ipfire/samba/shares > /var/ipfire/samba/smb.conf
 	rm -rf /var/lib/samba/private
 	ln -s /var/ipfire/samba/private /var/lib/samba/private
-	-mkdir -p /var/log/samba
 	install -v -m 644 $(DIR_SRC)/config/backup/includes/samba /var/ipfire/backup/addons/includes/samba
 
 	-mkdir -p /var/lib/samba/winbindd_privileged