aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [cirrus|foreman] Expand Foreman testing matrix, automate installJake Hunsaker2022-09-262-13/+56
| | | | | | | | | | | | | | | Foreman has since made several releases since we initially added integration testing for it. Rebuilding the images is maintenance overhead we can reduce by automating the installation of foreman on images. Provide this scripted installation, and expand our testing matrix to additional versions of Foreman. As of this commit, we will be testing versions 2.5 and 3.1 on CentOS Stream 8 to cover Red Hat Satellite features, as well as Foreman version 3.4 (the latest current upstream) for CentOS 8 and Debian 11. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [clean,username_parser] Handle usernames with domain prefixesJake Hunsaker2022-09-262-3/+5
| | | | | | | | | | | | | | | | | | | | | | | In some configurations, we can expect usernames to be written as `DOMAIN\user`, as well as the plain `user` form. Previously, the domain-prefixed format would throw an exception in our obfuscation if the letter after the `\` would cause the interpreter to regard that as a special character. Fix this by escaping the values passed to `get_regex_result()` so that we can successfully compile a regex pattern object for domain-prefixed usernames as well. Further, when we encounter one of these usernames, the username parser should automatically add an entry for the non-prefixed username as well. While this will result in a secondary obfuscation match (due to the current design of `sos clean`), this is preferable to potentially leaving non-prefixed usernames in plaintext, if they happen to appear in logs but not in any of our sourced files. Related: RHBZ#2127977 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [dnf] Obfuscate all passwords from all varsPavel Moravec2022-09-211-2/+3
| | | | | | | | | - obfuscate also "password=.." variable values - apply the obfuscation also to global vars dir Resolves: #3031 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [dnf] Collect legacy yum config and dnf global varsPavel Moravec2022-09-211-1/+6
| | | | | | | | | | | Some systems might rely on legacy yum config with default symlinks to dnf config - sos should collect the symlinks. Additionally, collect dnf global vars. Related: #3031 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [utilities] Relax from hard dependency of python3-magicPavel Moravec2022-09-214-16/+39
| | | | | | | | | | | | For compatibility reasons on some distros, sos should not have a hard dependency on 'magic' python library. It should attempt to use it for detection of binary file content, but should fall back to previous "read the very first byte" method otherwise. Resolves: #3025 Relates: #3021 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [ocp] Add newly required labels to temp OCP namespaceJake Hunsaker2022-09-211-1/+22
| | | | | | | | Newer OCP versions have a more restrictive default deployment configuration. As such, add the required labels to the temporary namespace/project we use for collections. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cleaner] Replace encoding errors when opening filesJake Hunsaker2022-09-194-1/+60
| | | | | | | | | | | | | | | A scenario was found that if a file had encoding issues when `sos clean` went to open the file for obfuscation, we would stop processing the file but leave it in the archive, which had the potential to leave unobfuscated information in that file in the archive. Fix this, by using the `errors='replace'` parameter when opening archive files. This allows us to continue parsing the file normally, while replacing the problematic characters with `?`s. Closes: #3015 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Add a test for stripping '_' by hostname parserPavel Moravec2022-09-151-1/+7
| | | | | | | | | - test for #3022 . - fixup of opt_parser being a tuple with a string Relates: #3022 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [cleaner] Prevent stripping '_' on no match in hostname parserPavel Moravec2022-09-151-1/+3
| | | | | | | | | | Hostname parser works with stripped leading/trailing '.' and '_' characters for a match. When no pattern match is found, we must return the original unstripped item. Resolves: #3022 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [COS] add-CosPlugin to valid subclass during initVarsha Teratipally2022-09-121-0/+7
| | | | Signed-off-by: Varsha Teratipally <teratipally@google.com>
* [fapolicyd] Add plugin for Fapolicyd frameworkPavel Moravec2022-09-081-0/+42
| | | | | | | | | Collect all relevant config files, a logfile and a few CLI check outputs. Resolves: #3020 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [cleaner] Check --domains values for validityJake Hunsaker2022-09-061-0/+14
| | | | | | | | | | | | The domain parser is built to understand actual names, e.g. 'example.com', and not operate off of just 'example' despite the fact that the parser handles TLDs separately. To safeguard against potential errors when trying to parse the latter example above as an actual domain, validate any values passed to `--domains` during cleaner initialization. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cirrus] Update Fedora images used in CI testsJake Hunsaker2022-08-314-13/+9
| | | | | | | | The Fedora 36 image is now available on GCP, so update our testing matrix to use it. Accordingly, this means we no longer need to build or maintain our own Fedora images going forward. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [policies] Add Anolis OS policymahailiang2022-08-311-0/+46
| | | | Signed-off-by: mahailiang <mahailiang@uniontech.com>
* add crio plugin support for CosVarsha Teratipally2022-08-313-3/+31
| | | | Signed-off-by: Varsha Teratipally <teratipally@google.com>
* add support for logs, kdump, release in CosPluginVarsha Teratipally2022-08-303-5/+36
| | | | Signed-off-by: Varsha Teratipally <teratipally@google.com>
* [mysql] Capture mysqlrouter config and logsJake Hunsaker2022-08-301-5/+11
| | | | | | | | | Adds collection of mysqlrouter config and log files to the `mysql` plugin. Closes: #2987 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cirrus] Use built packages for testing tasksJake Hunsaker2022-08-291-59/+74
| | | | | | | Updates our testing posture with Cirrus to use the generated sos packages from early tasks in the later stageone and stagetwo tasks. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Allow test suite to use locally installed sosJake Hunsaker2022-08-292-5/+10
| | | | | | | | | | | | | | | Up until now, the test suite was forced to be run using the git checkout. While this is useful for on-the-fly testing, it does miss an important use case of building a test package from the checkout, and running it using that as the system installation of sos. This commit allows the use of an installed version of sos to test against. This may be leveraged by adding `-p TESTLOCAL=true` in the `avocado run` command used to launch the test suite. Setting this parameter to any other value, or omitting it entirely, will continue the current behavior or using the git checkout for running tests. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [elastic] Add the command output for /_cat/indicesscality-trevorbenson2022-08-291-1/+2
| | | | Signed-off-by: Trevor Benson <trevor.benson@scality.com>m>
* [hpssm] Per array and slot show detail subcommands.scality-trevorbenson2022-08-291-1/+3
| | | | Signed-off-by: Trevor Benson <trevor.benson@scality.com>
* [ceph_mon] Add ceph log CLI commandsPrashant D2022-08-251-1/+3
| | | | | | | | | | | | | | | Add following commands to ceph mon plugin: - Collect ceph cluster log for 'cluster' channel ceph log last 10000 debug cluster - Collect ceph cluster log for 'audit' channel ceph log last 10000 debug audit NOTE: Here number 10000 is default value of mon_log_max ceph config variable. Signed-off-by: Prashant D <pdhange@redhat.com>
* [boot] run lsinitramfs for /boot/initrd.img-* filesMauricio Faria de Oliveira2022-08-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the boot plugin captures `lsinitrd` for `/boot/initr*.img`, which doesn't help on Debian/Ubuntu with template `/boot/initrd.img-*`. Well, there is a `[/boot]/initrd.img` symlink to the current kernel, but then `lsinitrd` isn't installed by default, just `lsinitramfs`. (Note: the symlink might be in /, /boot, or both, and even point to different files, depending on the distro and release upgrades.) Let's expand the glob (backward compatible, see 'initrd.img' in test) and run `lsinitramfs -l` (goes back to good and _old_ Ubuntu 14.04), to improve the plugin on other distros. $ lsinitrd Command 'lsinitrd' not found, but can be installed with: sudo apt install dracut-core $ dpkg -S $(which lsinitramfs) initramfs-tools-core: /usr/bin/lsinitramfs Test steps: $ sudo ./bin/sos report --batch --quiet -o boot $ sudo ./bin/sos report --batch --quiet -o boot \ -k boot.all-images=on Before: $ sudo tar tf /tmp/sosreport-*.tar.xz | grep lsinitramfs $ After: $ sudo tar tf /tmp/sosreport-*.tar.xz | grep lsinitramfs .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img After (boot.all-images=on): $ sudo tar tf /tmp/sosreport-*.tar.xz | grep lsinitramfs .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img-5.15.0-41-... .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img-5.15.0-43-... .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img.old The contents of `lsinitramfs_-l_.boot.initrd.img-*` are correct. And they include 'modprobe.d/*.conf' files: # tar xf /tmp/sosreport-*.tar.xz # grep -ch '/modprobe\.d/.*\.conf' \ sosreport-*/sos_commands/boot/lsinitramfs* 19 19 19 19 Checking `lsinitramfs -l` option on Ubuntu 14.04: $ lsb_release -cs trusty $ man lsinitramfs | grep -w -- -l -l Display long and more verbose listing of initramfs... And an example of a release upgrade leftover, a broken symlink: # cat sosreport-*/sos_commands/boot/ls_-l_.initrd.img_.boot.initrd.img ... Aug 12 10:02 /boot/initrd.img -> initrd.img-5.15.0-46-generic ... Jan 1 2020 /initrd.img -> boot/initrd.img-5.0.0-37-generic # head -n1 sosreport-*/sos_commands/boot/lsinitramfs* ==> .../sos_commands/boot/lsinitramfs_-l_.boot.initrd.img <== drwxr-xr-x 3 root root 0 Dec 17 2019 . ==> .../sos_commands/boot/lsinitramfs_-l_.initrd.img <== /usr/bin/unmkinitramfs: 64: cannot open /initrd.img: No such file Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
* [kernel] copy modprobe.d/*.conf from other possible locationsMauricio Faria de Oliveira2022-08-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There might be module configuration files (modprobe.d/*.conf) not only in /etc, but also in /lib, /run, and /usr/local/lib, per modprobe.d(5) [1]. Let's copy those too. P.S.: /lib is correct for distros with distinct /usr/lib too (checked on Ubuntu 14.04/16.04/18.04 and 20.04/22.04). [1] https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/tree/man/ modprobe.d.xml?h=v30#n42 Test steps: $ for dir in /etc /lib /run /usr/local/lib do dir=$dir/modprobe.d sudo mkdir -p $dir sudo touch $dir/test.conf done $ sudo ./bin/sos report -o kernel --batch --quiet $ sudo tar tf /tmp/sosreport-*.tar.xz \ | grep -o '/.*/modprobe.d/test.conf' $ sudo rm -f /tmp/sosreport-* $ for dir in /etc /lib /run /usr/local/lib do sudo rm -f $dir/modprobe.d/test.conf done Before: $ sudo tar tf /tmp/sosreport-*.tar.xz \ | grep -o '/.*/modprobe.d/test.conf' /etc/modprobe.d/test.conf After: $ sudo tar tf /tmp/sosreport-*.tar.xz \ | grep -o '/.*/modprobe.d/test.conf' /etc/modprobe.d/test.conf /run/modprobe.d/test.conf /usr/lib/modprobe.d/test.conf /usr/local/lib/modprobe.d/test.conf Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
* [testing] Test building of snapArif Ali2022-08-171-0/+19
| | | | Signed-off-by: Arif Ali <arif.ali@canonical.com>
* [build] Bump version to sos-4.44.4Jake Hunsaker2022-08-153-4/+10
| | | | | | This commit marks the release of sos-4.4. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [snap] Further fixes in snapcraft.yaml for build and runArif Ali2022-08-151-3/+5
| | | | | | | | * Previous commit for dist was wrong, and required site-packages instead * sos report was unablt to run in bionic, and required python3-magic as dependancy Signed-off-by: Arif Ali <arif.ali@canonical.com>
* Update hpssm.py to work on all enumerated controllers. Including new ↵scality-trevorbenson2022-08-151-10/+45
| | | | | | | docstring and style adjustments. Signed-off-by: Trevor Benson <trevor.benson@scality.com> Signed-off-by: scality-trevorbenson <trevor.benson@scality.com>
* [ceph_mgr] Add orchestrator CLI commandsJose Castillo2022-08-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the following commands to the Ceph Manager plugin: - To list hosts: ceph orch host ls - To list devices on a host: ceph orch device ls - To check the curent specification file/List services known to orchestrator: ceph orch ls --export - To list daemons known to orchestrator: ceph orch ps - To check the configured backend and its status: ceph orch status --detail - To check service versions vs available and target containers: ceph orch upgrade status - To see the recent activities/log from cephadm: ceph log last cephadm Resolves: RHBZ#2116602 Signed-off-by: Jose Castillo <jcastillo@redhat.com>
* [stratis] Update plugin commands for 3.xBryn M. Reeves2022-08-111-1/+3
| | | | | | | | | Update the stratis plugin commands to unclude stopped pools, the stopped pools and managed object reports, and remove the collection of the daemon redundancy command which is no longer supported. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [teamd,tests] Add a test for teamd plugin and device enumerationJake Hunsaker2022-08-102-5/+61
| | | | | | | | | | | | | Adds a new test case for the `teamd` plugin that also inherently acts to test team device enumeration. Included with this test case is an addition to the base test classes that allows for tests to define a `post_test_tear_down()` method that will be run at the end of each test execution to allow for manual cleanup - in this case deleting a 'fake' team device created for the test. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [policies] ensure Policy.dist_version returns int and not strPavel Moravec2022-08-092-3/+3
| | | | | | | | | Int is more intuitive and already used in some plugins (foreman, python). Resolves: #2997 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [snap] Update snapcraft.yaml to fix PYTHONPATHArif Ali2022-08-081-3/+3
| | | | | Closes: #2994 Signed-off-by: Arif Ali <arif.ali@canonical.com>
* [nvme]: Update nvme plugin to collect nvme logsmamatha2022-08-041-1/+1
| | | | | | | | This patch is to update nvme plugin to collect /dev/nvme data Signed-off-by: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com> Tested-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com>
* [auditd] Capture log files when configured to a non default locationJose Castillo2022-08-021-2/+16
| | | | | | | | | | The location of the audit.log files can be changed in the configuration file /etc/audit/audit.conf. This change ensures that we capture the log files when the user specifies a different location via log_file. Signed-off-by: Jose Castillo <jcastillo@redhat.com>
* [Plugin] Don't log content of captured stringsJake Hunsaker2022-08-011-15/+4
| | | | | | | | | Stop logging the contents of strings added via `add_string_as_file()`. This can ultimately be used via sizelimiting mechanisms, which means we effectively are writing the entire sizelimited content twice, which can make the logs needlessly bloated and harder to quickly navigate. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [flake8] Fix new style alertsJake Hunsaker2022-08-012-2/+2
| | | | | | | Fix two new alerts from `flake8` that appear to have gone unnoticed until a recent update. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [collect] Standardize use of `exit()`Jake Hunsaker2022-07-291-46/+65
| | | | | | | | | | | | | | | | | | There were multiple exit paths and behaviors within sos collect, that were not the easiest to logically follow. Fix this by standardizing on leveraging `self.exit()` to exit in all situations. If a message is provided to this call, it is regarded as an error message and logged as such. This method will still set the exit code according to the `error` parameter, however that has been changed to default to 0 to signify a "clean" end of execution. Finally, there is a new `force` parameter which is meant to be used when exiting from within a child thread when the entire process needs to exit (and thus needs to leverage the lower-level `os._exit()` instead). Closes: #2882 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [python] Update version-dependent command for installed versionJake Hunsaker2022-07-281-3/+17
| | | | | | | | | | Updates the python plugin to use `python3` for Ubuntu and Debian distributions, and locks the use of `platform-python` to RHEL 8 as RHEL 9 does not continue to use of this interpreter executable. Closes: #2502 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [redhat] Simplify `dist_version()` logicJake Hunsaker2022-07-281-10/+4
| | | | | | | | | | | | | | Simplifies the logic in `dist_version()` to just return the major version of the `redhat-release` package. This will not only remove a requirement to update this check for new major version releases, but also makes the call meaningful on RH-family distros aside from RHEL, such as Fedora. Note that this may fail on RHEL 5, but that is not a valid concern as RHEL 5 does not support python3 and thus should never be in a situation where sos-4.x+ is installed on such a system. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [openstack] Ensure memcache_secret_key is maskedTakashi Kajinami2022-07-279-7/+22
| | | | | | | | The memcache_secret_key parameter from the keystonemiddleware library takes the secret key used to encrypt data stored in memcache, so it is considered as sensitive information. Signed-off-by: Takashi Kajinami <tkajinam@redhat.com>
* [tests] Update networking test in suiteJake Hunsaker2022-07-251-0/+7
| | | | | Adds a new test to the networking plugin test to ensure we iterate correctly over network devices.
* [NetworkManager] Update plugin to use add_device_cmd()Jake Hunsaker2022-07-251-9/+3
| | | | | | | Updates the plugin to use `add_device_cmd()` for the iteration of `nmcli dev` commands, rather than enumerating them directly within the plugin. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [teamd] Update teamd plugin to use add_device_cmd()Jake Hunsaker2022-07-251-20/+8
| | | | | | | | | Updates the plugin to use `add_device_cmd()`, leveraging the list of team devices discovered during intialization, rather than discovering them in the plugin (which seemed to be outdated/broken for at least a few newer versions of Fedora). Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [networking] Update plugin to use `add_device_cmd()` for device iterationJake Hunsaker2022-07-251-42/+29
| | | | | | | | | Updates the `networking` plugin to leverage `add_device_cmd()` for various command collections, like ethtool, against discovered ethernet devices so that the plugin does not have to directly discover/validate these devices. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Allow add_device_cmd() to handle `subdir` parameterJake Hunsaker2022-07-251-4/+9
| | | | | | | | | Previously, `add_device_cmd()` did not support the `subdir` parameter which is used to place command output into a subdir within the calling plugin's own directory. Fix this by allowing this parameter to be passed on to the eventual `add_cmd_output()` call. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Add network device enumerationJake Hunsaker2022-07-251-8/+137
| | | | | | | | | | | | | | | | | | | Adds network device enumeration to the generated `devices` dict that gets handed to plugins, and used for iteration by `add_device_cmd()`. For the moment, this enumeration is limited to ethernet and bridge devices, though this is expected to be expanded on later. These devices are added to the top-level `network` element within the `devices` dict, so both can be referenced at once using that key. Additionally, namespaced network interfaces are added under a `namespaced_network` key, which contains sub-dicts for each namespace which in turn contain ethernet device lists. Note that these namespaced device lists must be referenced specifically rather than via their key strings, and this is done to avoid overlapping namespaced devices with non-namespaced devices. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [openstack_aodh] Mask more sensitive valuesTakashi Kajinami2022-07-251-18/+21
| | | | | | | This change ensures a few more sensitive values are masked when gathering the config file for the Aodh service. Signed-off-by: Takashi Kajinami <tkajinam@redhat.com>
* Georgian translationNorwayFun2022-07-251-35/+37
| | | | Signed-off-by: Temuri Doghonadze <temuri dot doghonadze at gmail dot com>
* [logging] Safeguard against attempting to log non-UTF charactersJake Hunsaker2022-07-212-1/+6
| | | | | | | | | | | | | | The `logging` module does not support non UTF-8 characters, and as such there was an exception being thrown when trying to log for example a copied file that has such characters in the file name. Safeguard against this by converting all messages logged via `Plugin._format_msg()` to UTF-8, and replace any problematic characters with `?`s to attempt to preserve context within the logs. Closes: #2790 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>