Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1400407 - sos: Improve Samba plugin for sosreport to include missing logs
sos: Improve Samba plugin for sosreport to include missing logs
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sos (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Pavel Moravec
Miroslav Hradílek
: OtherQA
Depends On:
Blocks: 1388569 1373369
  Show dependency treegraph
 
Reported: 2016-12-01 01:27 EST by Atin Mukherjee
Modified: 2017-12-18 12:07 EST (History)
17 users (show)

See Also:
Fixed In Version: sos-3.4-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1373369
Environment:
Last Closed: 2017-08-01 19:08:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2203 normal SHIPPED_LIVE sos bug fix and enhancement update 2017-08-01 15:41:56 EDT

  None (edit)
Comment 1 Pavel Moravec 2016-12-01 03:28:29 EST
Hello,
could you please clarify:

- what other logs / directories with logs shall be collected (whole /var/log/samba ?)

- what is expected size of the logs / shall be some huge logs collected only when providing some option?

- can the files contain some customer secret (password, auth token,..) that we shall obfuscate first?

Thanks in advance.
Comment 2 Bryn M. Reeves 2016-12-01 05:28:06 EST
At the simplest, it really just means fixing the samba plugin to respect --all-logs; if there is a desire to have some portion of client logs captured even without --all-logs then a limiting scheme needs to be implemented (since the number of clients is potentially unbounded).

Afaik Samba does not spray any secrets into its log files (at least at default log levels) but it doesn't hurt to check.
Comment 3 Michael Adam 2016-12-01 05:54:17 EST
(In reply to Bryn M. Reeves from comment #2)
> At the simplest, it really just means fixing the samba plugin to respect
> --all-logs; if there is a desire to have some portion of client logs
> captured even without --all-logs then a limiting scheme needs to be
> implemented (since the number of clients is potentially unbounded).

--all-logs sounds reasonable to me

> Afaik Samba does not spray any secrets into its log files (at least at
> default log levels) but it doesn't hurt to check.

Correct ... except for when run with log level >= 100.
In that case there are some code paths that log secrets.
Comment 4 Michael Adam 2016-12-01 05:57:55 EST
(In reply to Pavel Moravec from comment #1)
> Hello,
> could you please clarify:
> 
> - what other logs / directories with logs shall be collected (whole
> /var/log/samba ?)

Usually all logs are under /var/log/samba, but it can be configured
in smb.conf. all of /var/log/samba seems a good first approximation though.

> - what is expected size of the logs / shall be some huge logs collected only
> when providing some option?

If debugging, e.g. running with log level 10, the logs can easily
become very large: 100s of MBs or even GBs.

> - can the files contain some customer secret (password, auth token,..) that
> we shall obfuscate first?

Can only happen in log level 100 which is rarely used at all.
But in oder to be safe, we'd need to handle this, I think.

"git grep DEBUG\(100" in samba.git shows what messages can appear.

- Michael
Comment 5 Michael Adam 2016-12-01 06:35:47 EST
FYI created a PR upstream:

https://github.com/sosreport/sos/pull/895
Comment 6 Michael Adam 2016-12-03 13:32:58 EST
(In reply to Michael Adam from comment #5)
> FYI created a PR upstream:
> 
> https://github.com/sosreport/sos/pull/895

This has been merged.
Comment 7 Atin Mukherjee 2016-12-04 00:26:48 EST
Given Michael has provided the details back, clearing the needinfo.
Comment 8 Pavel Moravec 2017-02-19 09:10:50 EST
Hello,
would you be able / are you willing to test the fix in candidate build for RHEL7.4 (once available)?

Note that the fix will appear in 7.4 due to sos rebase in bz1414879 either way.
Comment 13 Miroslav Hradílek 2017-05-24 10:25:24 EDT
I can confirm the changes in above mentioned PR are contained in the new plugin source. If there is no positive feedback from the customer I will verify this SanityOnly.

# diff -u old/BUILD/sos-3.3/sos/plugins/samba.py /usr/lib/python2.7/site-packages/sos/plugins/samba.py
--- old/BUILD/sos-3.3/sos/plugins/samba.py	2016-06-29 20:24:47.000000000 +0200
+++ /usr/lib/python2.7/site-packages/sos/plugins/samba.py	2017-05-22 22:40:13.000000000 +0200
@@ -23,16 +23,29 @@
     profiles = ('services',)
 
     def setup(self):
+        self.limit = self.get_option("log_size")
+
         self.add_copy_spec([
             "/etc/samba/smb.conf",
             "/etc/samba/lmhosts",
-            "/var/log/samba/log.smbd",
-            "/var/log/samba/log.nmbd"
         ])
+
+        self.add_copy_spec("/var/log/samba/log.smbd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.nmbd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd-idmap",
+                           sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd-dc-connet",
+                           sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.wb-*", sizelimit=self.limit)
+
+        if self.get_option("all_logs"):
+            self.add_copy_spec("/var/log/samba/", sizelimit=self.limit)
+
         self.add_cmd_output([
             "wbinfo --domain='.' -g",
             "wbinfo --domain='.' -u",
-            "testparm -s -v"
+            "testparm -s",
         ])
 
 
# rpm -qf /usr/lib/python2.7/site-packages/sos/plugins/samba.pysos-3.4-4.el7.noarch
Comment 14 Guenther Deschner 2017-05-29 08:29:49 EDT
(In reply to Miroslav Hradílek from comment #13)
> I can confirm the changes in above mentioned PR are contained in the new
> plugin source. If there is no positive feedback from the customer I will
> verify this SanityOnly.
> 
> # diff -u old/BUILD/sos-3.3/sos/plugins/samba.py
> /usr/lib/python2.7/site-packages/sos/plugins/samba.py
> --- old/BUILD/sos-3.3/sos/plugins/samba.py	2016-06-29 20:24:47.000000000
> +0200
> +++ /usr/lib/python2.7/site-packages/sos/plugins/samba.py	2017-05-22
> 22:40:13.000000000 +0200
> @@ -23,16 +23,29 @@
>      profiles = ('services',)
>  
>      def setup(self):
> +        self.limit = self.get_option("log_size")
> +
>          self.add_copy_spec([
>              "/etc/samba/smb.conf",
>              "/etc/samba/lmhosts",
> -            "/var/log/samba/log.smbd",
> -            "/var/log/samba/log.nmbd"
>          ])
> +
> +        self.add_copy_spec("/var/log/samba/log.smbd", sizelimit=self.limit)
> +        self.add_copy_spec("/var/log/samba/log.nmbd", sizelimit=self.limit)
> +        self.add_copy_spec("/var/log/samba/log.winbindd",
> sizelimit=self.limit)
> +        self.add_copy_spec("/var/log/samba/log.winbindd-idmap",
> +                           sizelimit=self.limit)
> +        self.add_copy_spec("/var/log/samba/log.winbindd-dc-connet",

This looks wrong, that last path needs to be:

/var/log/samba/log.winbindd-dc-connect
Comment 15 Guenther Deschner 2017-05-29 09:54:47 EDT
I created a new pull request for this change:

https://github.com/sosreport/sos/pull/1018
Comment 16 Pavel Moravec 2017-05-30 07:18:46 EDT
(In reply to Guenther Deschner from comment #15)
> I created a new pull request for this change:
> 
> https://github.com/sosreport/sos/pull/1018

Thanks for spotting it, already in sos downstream / sos-3.4-5.
Comment 17 Miroslav Hradílek 2017-05-31 07:49:19 EDT
I can confirm the changes in above mentioned PR are contained in the new plugin source including the fixed typo (log.winbindd-dc-connect). If there is no positive feedback from the customer I will verify this SanityOnly.

# diff -u old/BUILD/sos-3.3/sos/plugins/samba.py /usr/lib/python2.7/site-packages/sos/plugins/samba.py
--- old/BUILD/sos-3.3/sos/plugins/samba.py	2016-06-29 20:24:47.000000000 +0200
+++ /usr/lib/python2.7/site-packages/sos/plugins/samba.py	2017-05-30 13:07:18.000000000 +0200
@@ -23,16 +23,29 @@
     profiles = ('services',)
 
     def setup(self):
+        self.limit = self.get_option("log_size")
+
         self.add_copy_spec([
             "/etc/samba/smb.conf",
             "/etc/samba/lmhosts",
-            "/var/log/samba/log.smbd",
-            "/var/log/samba/log.nmbd"
         ])
+
+        self.add_copy_spec("/var/log/samba/log.smbd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.nmbd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd", sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd-idmap",
+                           sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.winbindd-dc-connect",
+                           sizelimit=self.limit)
+        self.add_copy_spec("/var/log/samba/log.wb-*", sizelimit=self.limit)
+
+        if self.get_option("all_logs"):
+            self.add_copy_spec("/var/log/samba/", sizelimit=self.limit)
+
         self.add_cmd_output([
             "wbinfo --domain='.' -g",
             "wbinfo --domain='.' -u",
-            "testparm -s -v"
+            "testparm -s",
         ])
 
 
# rpm -qf /usr/lib/python2.7/site-packages/sos/plugins/samba.py
sos-3.4-5.el7.noarch
Comment 18 Miroslav Hradílek 2017-06-15 07:04:07 EDT
Verifying Sanity Only (based just on code). See comment 17.
Comment 19 errata-xmlrpc 2017-08-01 19:08:12 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2203

Note You need to log in before you can comment on or make changes to this bug.