Skip to content

Commit

Permalink
[NetworkManager] Get system-connections files from other locations
Browse files Browse the repository at this point in the history
system-connections files can be found not only under
/etc/NetworkManager, but also /usr/lib/NetworkManager and
/run/NetworkManager, so we need to capture and post process
these locations as well.

Resolves: sosreport#3875

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill committed Dec 13, 2024
1 parent add55ea commit cd7ba2f
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions sos/report/plugins/networkmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin):
packages = ('NetworkManager', 'network-manager')

def setup(self):
self.system_connection_files = [
"/etc/NetworkManager/system-connections/",
"/usr/lib/NetworkManager/system-connections/",
"/run/NetworkManager/system-connections/",
]

self.add_copy_spec(self.system_connection_files)

self.add_copy_spec([
"/etc/NetworkManager/NetworkManager.conf",
"/etc/NetworkManager/system-connections",
"/etc/NetworkManager/dispatcher.d",
"/etc/NetworkManager/conf.d",
"/usr/lib/NetworkManager/conf.d",
"/run/NetworkManager/conf.d",
"/var/lib/NetworkManager/NetworkManager-intern.conf"
"/var/lib/NetworkManager/NetworkManager-intern.conf",
])

self.add_journal(units="NetworkManager")
Expand Down Expand Up @@ -110,16 +117,18 @@ def test_nm_status(version=1):
"nmcli dev show .*": "nmcli_dev_show_sos"
})

def postproc_system_connections(self, sc_path):

self.do_path_regex_sub(
f"{sc_path}",
r"(password|psk|mka-cak|password-raw|pin|preshared-key"
r"|private-key|secrets|wep-key[0-9])=(.*)",
r"\1=***",
)

def postproc(self):
for _, _, files in os.walk(
"/etc/NetworkManager/system-connections"):
for net_conf in files:
self.do_file_sub(
"/etc/NetworkManager/system-connections/"+net_conf,
r"(password|psk|mka-cak|password-raw|pin|preshared-key"
r"|private-key|secrets|wep-key[0-9])=(.*)",
r"\1=***",
)
for sc_file in self.system_connection_files:
self.postproc_system_connections(sc_file)


# vim: set et ts=4 sw=4 :

0 comments on commit cd7ba2f

Please sign in to comment.