prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  smartcard plugin is using tools removed/not available from rhel8 and newer
  The pam_pkcs11 was last available in RHEL7 and is no longer available in RHEL8 and newer so there is no point for checking it and its configuration files in:
  
  https://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L21-L22
  
  The `pcsc-tools` package above is not available in RHEL (only from EPEL). Instead, this list should contain `pcsc-lite` and `pcsc-lite-ccid` packages.
  
  Also the following commands/path do not have any significance so I propose to remove them (the `pklogin_finder` is part of pam_pkcs11`, which is not available in RHEL8 and newer). The respective replacement would be some command from sssd, but most of the sssd logs are already collected so I do not think we need a separate command:
  
  https://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L32-L33
  https://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L40
  
  The `pcsc_scan` is a tool that is shipped in `pcsc-tools` package, which is available in EPEL only so I suggest to remove it:
  
  https://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L34
  
  Let me know if this sounds ok to you or I should open a PR with the proposed changes.
  
  Note, that these are still needed for RHEL7, but I think for RHEL7 you have a different branch.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `sos/report/plugins/smartcard.py`
  Content:
  ```
  1 # Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
  2 
  3 # This file is part of the sos project: https://github.com/sosreport/sos
  4 #
  5 # This copyrighted material is made available to anyone wishing to use,
  6 # modify, copy, or redistribute it subject to the terms and conditions of
  7 # version 2 of the GNU General Public License.
  8 #
  9 # See the LICENSE file in the source distribution for further information.
  10 
  11 from sos.report.plugins import Plugin, RedHatPlugin
  12 
  13 
  14 class Smartcard(Plugin, RedHatPlugin):
  15 
  16     short_desc = 'PKCS#11 smart cards'
  17 
  18     plugin_name = 'smartcard'
  19     profiles = ('security', 'identity', 'hardware')
  20 
  21     files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)
  22     packages = ('pam_pkcs11', 'pcsc-tools', 'opensc')
  23 
  24     def setup(self):
  25         self.add_copy_spec([
  26             "/etc/reader.conf",
  27             "/etc/reader.conf.d/",
  28             "/etc/pam_pkcs11/",
  29             "/etc/opensc-*.conf"
  30         ])
  31         self.add_cmd_output([
  32             "pklogin_finder debug",
  33             "ls -nl /usr/lib*/pam_pkcs11/",
  34             "pcsc_scan",
  35             "pkcs11-tool --show-info",
  36             "pkcs11-tool --list-mechanisms",
  37             "pkcs11-tool --list-slots",
  38             "pkcs11-tool --list-objects"
  39         ])
  40         self.add_forbidden_path("/etc/pam_pkcs11/nssdb/key[3-4].db")
  41 
  42 # vim: set et ts=4 sw=4 :
  43
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/sos/report/plugins/smartcard.py b/sos/report/plugins/smartcard.py
  --- a/sos/report/plugins/smartcard.py
  +++ b/sos/report/plugins/smartcard.py
  @@ -19,14 +19,18 @@
       profiles = ('security', 'identity', 'hardware')
   
       files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)
  -    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc')
  +    # The pam_pkcs11 is available only in RHEL7
  +    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc', 'pcsc-lite',
  +                'pcsc-lite-ccid')
   
       def setup(self):
           self.add_copy_spec([
               "/etc/reader.conf",
               "/etc/reader.conf.d/",
               "/etc/pam_pkcs11/",
  -            "/etc/opensc-*.conf"
  +            "/etc/opensc-*.conf",
  +            "/etc/pkcs11/modules/*.module",
  +            "/usr/share/p11-kit/modules/*.module"
           ])
           self.add_cmd_output([
               "pklogin_finder debug",
  
verification_info: {"golden_diff": "diff --git a/sos/report/plugins/smartcard.py b/sos/report/plugins/smartcard.py\n--- a/sos/report/plugins/smartcard.py\n+++ b/sos/report/plugins/smartcard.py\n@@ -19,14 +19,18 @@\n     profiles = ('security', 'identity', 'hardware')\n \n     files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)\n-    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc')\n+    # The pam_pkcs11 is available only in RHEL7\n+    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc', 'pcsc-lite',\n+                'pcsc-lite-ccid')\n \n     def setup(self):\n         self.add_copy_spec([\n             \"/etc/reader.conf\",\n             \"/etc/reader.conf.d/\",\n             \"/etc/pam_pkcs11/\",\n-            \"/etc/opensc-*.conf\"\n+            \"/etc/opensc-*.conf\",\n+            \"/etc/pkcs11/modules/*.module\",\n+            \"/usr/share/p11-kit/modules/*.module\"\n         ])\n         self.add_cmd_output([\n             \"pklogin_finder debug\",\n", "issue": "smartcard plugin is using tools removed/not available from rhel8 and newer\nThe pam_pkcs11 was last available in RHEL7 and is no longer available in RHEL8 and newer so there is no point for checking it and its configuration files in:\r\n\r\nhttps://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L21-L22\r\n\r\nThe `pcsc-tools` package above is not available in RHEL (only from EPEL). Instead, this list should contain `pcsc-lite` and `pcsc-lite-ccid` packages.\r\n\r\nAlso the following commands/path do not have any significance so I propose to remove them (the `pklogin_finder` is part of pam_pkcs11`, which is not available in RHEL8 and newer). The respective replacement would be some command from sssd, but most of the sssd logs are already collected so I do not think we need a separate command:\r\n\r\nhttps://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L32-L33\r\nhttps://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L40\r\n\r\nThe `pcsc_scan` is a tool that is shipped in `pcsc-tools` package, which is available in EPEL only so I suggest to remove it:\r\n\r\nhttps://github.com/sosreport/sos/blob/b96926f151da984491de3082af7d06ecb07fc517/sos/report/plugins/smartcard.py#L34\r\n\r\nLet me know if this sounds ok to you or I should open a PR with the proposed changes.\r\n\r\nNote, that these are still needed for RHEL7, but I think for RHEL7 you have a different branch.\n", "before_files": [{"content": "# Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>\n\n# This file is part of the sos project: https://github.com/sosreport/sos\n#\n# This copyrighted material is made available to anyone wishing to use,\n# modify, copy, or redistribute it subject to the terms and conditions of\n# version 2 of the GNU General Public License.\n#\n# See the LICENSE file in the source distribution for further information.\n\nfrom sos.report.plugins import Plugin, RedHatPlugin\n\n\nclass Smartcard(Plugin, RedHatPlugin):\n\n    short_desc = 'PKCS#11 smart cards'\n\n    plugin_name = 'smartcard'\n    profiles = ('security', 'identity', 'hardware')\n\n    files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)\n    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc')\n\n    def setup(self):\n        self.add_copy_spec([\n            \"/etc/reader.conf\",\n            \"/etc/reader.conf.d/\",\n            \"/etc/pam_pkcs11/\",\n            \"/etc/opensc-*.conf\"\n        ])\n        self.add_cmd_output([\n            \"pklogin_finder debug\",\n            \"ls -nl /usr/lib*/pam_pkcs11/\",\n            \"pcsc_scan\",\n            \"pkcs11-tool --show-info\",\n            \"pkcs11-tool --list-mechanisms\",\n            \"pkcs11-tool --list-slots\",\n            \"pkcs11-tool --list-objects\"\n        ])\n        self.add_forbidden_path(\"/etc/pam_pkcs11/nssdb/key[3-4].db\")\n\n# vim: set et ts=4 sw=4 :\n", "path": "sos/report/plugins/smartcard.py"}], "after_files": [{"content": "# Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>\n\n# This file is part of the sos project: https://github.com/sosreport/sos\n#\n# This copyrighted material is made available to anyone wishing to use,\n# modify, copy, or redistribute it subject to the terms and conditions of\n# version 2 of the GNU General Public License.\n#\n# See the LICENSE file in the source distribution for further information.\n\nfrom sos.report.plugins import Plugin, RedHatPlugin\n\n\nclass Smartcard(Plugin, RedHatPlugin):\n\n    short_desc = 'PKCS#11 smart cards'\n\n    plugin_name = 'smartcard'\n    profiles = ('security', 'identity', 'hardware')\n\n    files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)\n    # The pam_pkcs11 is available only in RHEL7\n    packages = ('pam_pkcs11', 'pcsc-tools', 'opensc', 'pcsc-lite',\n                'pcsc-lite-ccid')\n\n    def setup(self):\n        self.add_copy_spec([\n            \"/etc/reader.conf\",\n            \"/etc/reader.conf.d/\",\n            \"/etc/pam_pkcs11/\",\n            \"/etc/opensc-*.conf\",\n            \"/etc/pkcs11/modules/*.module\",\n            \"/usr/share/p11-kit/modules/*.module\"\n        ])\n        self.add_cmd_output([\n            \"pklogin_finder debug\",\n            \"ls -nl /usr/lib*/pam_pkcs11/\",\n            \"pcsc_scan\",\n            \"pkcs11-tool --show-info\",\n            \"pkcs11-tool --list-mechanisms\",\n            \"pkcs11-tool --list-slots\",\n            \"pkcs11-tool --list-objects\"\n        ])\n        self.add_forbidden_path(\"/etc/pam_pkcs11/nssdb/key[3-4].db\")\n\n# vim: set et ts=4 sw=4 :\n", "path": "sos/report/plugins/smartcard.py"}]}