RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1400407 - sos: Improve Samba plugin for sosreport to include missing logs
Summary: sos: Improve Samba plugin for sosreport to include missing logs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sos
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Pavel Moravec
QA Contact: Miroslav Hradílek
URL:
Whiteboard:
Depends On:
Blocks: 1373369 1388569
TreeView+ depends on / blocked
 
Reported: 2016-12-01 06:27 UTC by Atin Mukherjee
Modified: 2017-12-18 17:07 UTC (History)
17 users (show)

Fixed In Version: sos-3.4-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1373369
Environment:
Last Closed: 2017-08-01 23:08:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2203 0 normal SHIPPED_LIVE sos bug fix and enhancement update 2017-08-01 19:41:56 UTC

Comment 1 Pavel Moravec 2016-12-01 08:28:29 UTC
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 10:28:06 UTC
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 10:54:17 UTC
(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 10:57:55 UTC
(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 11:35:47 UTC
FYI created a PR upstream:

https://github.com/sosreport/sos/pull/895

Comment 6 Michael Adam 2016-12-03 18:32:58 UTC
(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 05:26:48 UTC
Given Michael has provided the details back, clearing the needinfo.

Comment 8 Pavel Moravec 2017-02-19 14:10:50 UTC
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 14:25:24 UTC
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 12:29:49 UTC
(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 13:54:47 UTC
I created a new pull request for this change:

https://github.com/sosreport/sos/pull/1018

Comment 16 Pavel Moravec 2017-05-30 11:18:46 UTC
(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 11:49:19 UTC
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 11:04:07 UTC
Verifying Sanity Only (based just on code). See comment 17.

Comment 19 errata-xmlrpc 2017-08-01 23:08:12 UTC
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.