aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [utilities] Switch locale to C.UTF-8Jake Hunsaker2022-06-241-1/+1
| | | | | | | | | | | | Changes the `LC_ALL` locale env var used for all command collections from `C` to `C.UTF-8` which should provide safer/more reliable output from non-English localizations. This is backed up by PEP-538: https://peps.python.org/pep-0538/ Closes: #2946 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [clean] Refactor handling of symlink obfuscationJake Hunsaker2022-06-242-20/+68
| | | | | | | | | | | | | | | | | | | | Previously, there was a small but not impossible situation for a race condition within `clean`'s handling of symlinks where a symlink name could be obfuscated differently than what the link's target could be obfuscated too. Fix this by handling symlinks separately than the rest of the archive, like what we do for directory names. When obfuscating files, archives will now skip over symlinks and yield file names for iteration, rather than generating and returning full file lists. Once the obfuscation of "real" files is complete, then separately iterate over symlinks. Since the file obfuscation also includes file names, this means that link targets are already known to the mappings and we eliminate the potential race condition. Closes: #2852 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sosnode] Properly pass `--namespaces` to nodesJake Hunsaker2022-06-151-0/+4
| | | | | | | | | | The `namespaces` option was presented to `sos collect`, but was not actually being passed to nodes. Fix this, and gate the usage of the option to version 4.3, or the relevant RHEL backport version like we do for `--container-runtime`. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cleaner] Allow disabling specific parsers individuallyJake Hunsaker2022-06-155-0/+100
| | | | | | | | | | | Adds a new `--disable-parsers` option that allows users to selectively disable parsers for a given execution of `sos clean`. This may be useful in specific scenarios where obfuscation is not strictly needed for all the types of data we obfuscate, and where the user trusts whomever may be receiving the archive for review. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [InitSystem] Allow toggle of default `is_running` resultJake Hunsaker2022-06-153-7/+13
| | | | | | | | | | | | | | | | | | | The base `InitSystem` used when systemd is not present (or at least functional), defaults to returning `True` for all probes, in an effort to not inadvertantly block service queries. This works well for most scenarios, however it backfires when checking for runlevel-analogous systemd targets for items such as the `cantboot` preset - in that the base `InitSystem` will always enable that preset. Fix that by allowing calls to `InitSystem.is_running()` to specify a default value to return, instead of blindly always returning `True`. Similarly, update the preset check to default to `False` to avoid improperly enabling that preset when systemd is unavailable. Closes: #2913 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [host] Add collection of "top-level" symlinks and their targetsJake Hunsaker2022-06-151-0/+11
| | | | | | | | | | | | | | | Adds collection of a `find` command that shows symlinks from /, or one subdirectory below, that lists all symlinks and their targets in `ls` output format. This is by request from a RH support team for situations where problematic systems have directories underneathe / that are solely symlinks, and this information is relevant to problem investigation. While the `host` plugin may not be the most intuitive place for this collection, there are no other existing plugins that would be "more correct", and adding a new "symlinks" plugin would likely only serve to confuse authors and maintainers going forward. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ostree] Add services enablement triggerJake Hunsaker2022-06-141-0/+1
| | | | | | | | | | | | | | Adds two services to the `services` tuple for this plugin to both serve as an enablement trigger, and to capture the status and journals of these services automatically. This is an update/replacement to #2919 originally proposed by Colin Walters. Closes: #2919 Co-authored-by: Colin Walters <walters@verbum.org> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Make forbidden path checks more efficientJake Hunsaker2022-06-084-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | Forbidden path checks have up until now worked by taking a given file path (potentially with globs), expanding that against all discovered files that actually exist on the system, and then comparing a potential collection path against that list. While this works, and works reasonably fast for most scenarios, it isn't very efficient and causes significant slow downs when a non-standard configuration is in play - e.g. thousands of block devices which sos would individually have to compare against tens of thousands of paths for every path the `block` plugin wants to collect. Improve this by first not expanding the forbidden path globs, but taking them as distinct patterns, translating from shell-style (to maintain historical precedent of using globs to specify paths to be skipped) to python regex patterns as needed. Second, use `re` to handle our pattern matching for comparison against the distinct patterns provided by a plugin to skip. Closes: #2938 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [vdsm] Set LVM option use_devicesfile=0Juan Orti Alcaine2022-06-071-1/+3
| | | | | | | | | | | | Since RHV 4.4 SP1, vdsm configures LVM to use devicesfile, causing that the LVM filter configuration used by sos is ignored. This change disables the use of the devicesfile, so that the information of the devices used for RHV storage domains can be collected. Fixes: RHBZ#2093993 Signed-off-by: Juan Orti <jortialc@redhat.com>
* [libvirt] Collect swtpm logs from host/containerBogdan Dobrelya2022-06-071-0/+2
| | | | | | | Update the libvirt plugin to collect swtpm logs from hosts, and certain containerized environments, like OpenStack TripleO Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
* [systemtap] Correct enable trigger to `commands`Jake Hunsaker2022-06-061-1/+1
| | | | | | | | | | The enablement trigger of `files` in this plugin was incorrect, and should have been `commands` given we're checking for an executable. Fix that, so that this plugin can properly enable on more than just the package names. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* crio: switch from parsing output in table format to jsonNadia Pinaeva2022-06-061-10/+20
| | | | Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
* [ovirt] answer files: Filter out all password keysYedidyah Bar David2022-06-061-10/+13
| | | | | | | | | | | | | | | | | | | | Instead of hard-coding specific keys and having to maintain them over time, replace the values of all keys that have 'password' in their name. I think this covers all our current and hopefully future keys. It might add "false positives" - keys that are not passwords but have 'password' in their name - and I think that's a risk worth taking. Sadly, the engine admin password prompt's name is 'OVESETUP_CONFIG_ADMIN_SETUP', which does not include 'password', so has to be listed specifically. A partial list of keys added since the replaced code was written: - grafana-related stuff - keycloak-related stuff - otopi-style answer files Signed-off-by: Yedidyah Bar David <didi@redhat.com> Change-Id: I416c6e4078e7c3638493eb271d08d73a0c22b5ba
* [component] Adjust loglevel setting to be more transparentJan Jansky2022-06-061-6/+5
| | | | | | | | | | Changed loglevel logic to be more transparent. Setting file loglevel (flog) on DEBUG when any verbosity is set. If not leave it to INFO. Signed-off-by: Jan Jansky <jjansky@redhat.com>
* [arcconf]: Update arcconf plugin to collect UART logsMamatha Inamdar2022-05-241-2/+5
| | | | | | | | | This patch is to update arcconf plugin to collect UART logs Signed-off-by: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com> Reported-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com> Tested-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com>
* [shmcli] Make matching 'DELL' case insentitive.Nikhil Kakade2022-05-231-1/+1
| | | | Signed-off-by: Nikhil Kakade <nikhilkaka1@gmail.com>
* [fibrchannel]: Update fibrechannel plugin to collect HBA logsMamatha Inamdar2022-05-231-0/+16
| | | | | | | | | | | | | | | | This patch is to update fibrechannel plugin to collect HBA device logs following commands are added hbacmd listhbas hbacmd HbaAttributes <WWPN | MAC> hbacmd PortAttributes <WWPN | MAC> hbacmd ServerAttributes Signed-off-by: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com> Reported-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com> Reported-by: Toni Gibson <cajun1@us.ibm.com> Tested-by: Borislav Stoymirski <borislav.stoymirski@bg.ibm.com>
* [sos] Fix unhandled exception when concurrently removing temp dirJose Castillo2022-05-231-3/+8
| | | | | | | | | | This patch tries to capture the exception when running the sosreport at the same time the temp directory specified as an option is deleted. Resolves: #2806 Signed-off-by: Jose Castillo <jcastillo@redhat.com>
* [shmcli] Added new plugin to get information from PowerVault/DellNikhil Kakade2022-05-161-0/+110
| | | | | | | | | | shmcli provides information of the adapters, emms, drives, enclosures, fans, and power supplies. And the sensing data of temp, voltage, and current sensors. [1] https://dl.dell.com/topicspdf/powertools-shm-ag_en-us.pdf Signed-off-by: Nikhil Kakade <nikhilkaka1@gmail.com>
* [ceph_mon/ceph_osd] Collect ceph-mon backend typePonnuvel Palaniyappan2022-05-162-13/+5
| | | | | | | | | | | Ceph uses leveldb (old versions) or rocksdb (current ones) for metadata. The older filestore backend is deprecated since Quincy (17.2.0) which uses leveldb. So it's useful to know if, for example, ceph-mon is still using leveldb for metadata. This can happen even after upgrading to newer Ceph versions if the leveldb isn't migrated to leveldb. Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
* use --image option for oc-based sos collectNadia Pinaeva2022-05-091-1/+2
| | | | Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
* [postgresql] Simplify val_type for dbportJose Castillo2022-05-091-1/+1
| | | | | | | | | | | | After the change introduced via PR #2935 (Allow 'str' PlugOpt type to accept any value) the postgresql plugin was the only one specifying both str and int as possible values. This patch simplifies the val_type field to be in line with the rest of plugins where only one value is used. Signed-off-by: Jose Castillo <jcastillo@redhat.com>
* [collect] Add cluster profile for RHOSPJake Hunsaker2022-05-095-2/+72
| | | | | | | | | | | | Adds a cluster profile for Red Hat OpenStack Platform to identify controller and (optionally) compute nodes to collect sos reports from. Note that this adds a dependency on pyyaml to sos. This should be considered a weak dependency by downstreams. As such, it is added as a 'Recommends' in `sos.spec`. pip does not have the concept of 'weak dependencies', and so is added as a regular requirement in `setup.py`. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [plugins] Allow 'str' PlugOpt type to accept any valuePavel Moravec2022-05-091-0/+4
| | | | | | | | | | For PlugOpt type 'str', we should allow any content including e.g. numbers, and interpret it as a string. Resolves: #2922 Closes: #2935 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [ocp] Standardize use of formatted `oc` commandsJake Hunsaker2022-05-091-11/+43
| | | | | | | | | | | | | There were a few specific places where the `ocp` cluster was always calling `oc` directly, rather than trying to account for an `oc` binary that may be in a non-standard location, such as when executing from a container. Fix that, by making sure every `oc` command run by the cluster profile uses the discovered location of `oc` and any (optionally) provided config file. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [GenericPolicy] Fix execution when GenericPolicy is loadedJake Hunsaker2022-05-042-9/+21
| | | | | | | | | | | | | | | | | | | | | | | Over time a lot has changed with `Policy()` implementation. Along with that, the functionality of `GenericPolicy` broke at some point, thus preventing any form of execution of SoS on distributions without explicit policies. Fix this by changing `GenericPolicy` to `GenericLinuxPolicy` (to be more explicit in case we re-add non-Linux support in the future) and having it subclass `LinuxPolicy` instead of the top-level `Policy`. Further, add a platform check to ensure we are not inadvertently loading a Linux-based policy on a non-Linux platform which would likely result in failure to do anything useful. The `GenericLinuxPolicy` will only load `IndependentPlugin`-tagged plugins, does not leverage an init system, and does not provide any default upload functionality. Related: #2928 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [networkmanager] filter out more passwords from NetworkManager keyfilesThomas Haller2022-05-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NetworkManager's keyfiles (*.nmconnection) can contain secrets in plain text. Let's try harder to filter them out. The files are in GKeyFile format ([1]), so a naive regex doesn't really cut it, because the meaning of the key also depends on the group (keyfile section) it is in. But this probably still helps in many cases. The current list (1.39.2) of NetworkManager secret properties in the various keyfile groups is: mka-cak password-raw pin private-key psk secrets wep-key0 wep-key1 wep-key2 wep-key3 plus several ending in /password/: ca-cert-password client-cert-password leap-password password phase2-ca-cert-password phase2-client-cert-password phase2-private-key-password private-key-password Additionally, and what this patch does not cover, vpn secrets are in a [vpn-secrets] groups, but those keys have their name depending on the VPN plugin. In the future, we would filter out the entire [vpn-secrets] group. [1] https://developer-old.gnome.org/glib/unstable/glib-Key-value-file-parser.html Signed-off-by: Thomas Haller <thaller@redhat.com>
* [pulpcore] Collect db_tables_sizesPavel Moravec2022-05-041-2/+34
| | | | | | | | | Additionally, utilize the auxiliary build_query_cmd method for some other psql query commands. Resolves: #2931 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [candlepin] Unify/extend db_tables_sizes format with foremanPavel Moravec2022-05-041-14/+15
| | | | | | | | | Candlepin shall collect db_tables_sizes in the extended/unified format like foreman plugin does now. Related to: #2931 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sos] Fix typo in po filesJose Castillo2022-05-0479-79/+79
| | | | | | | There was a missing space between two words in one of the strings in all po files. Signed-off-by: Jose Castillo <jcastillo@redhat.com>
* [report] --list-plugins should report used, not default, option valuesJake Hunsaker2022-05-041-7/+15
| | | | | | | | | | | | | | When using `--list-plugins`, sos should report the values that will be used in a given command, or with a given config file, not what the default values are. By reporting the set value, users can be sure their configuration or commandline settings are being honored correctly before executing a report collection. Closes: #2921 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [fibrechannel] collect Cisco fnic statisticsPavel Moravec2022-05-041-1/+2
| | | | | | | | | Collect /sys/kernel/debug/fnic statistics about Cisco UCS fibre channel fNIC connection. Resolves: #2926 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [scsi.py] Updated scsi plugin to collect more informationBhushan Kale2022-05-031-1/+8
| | | | | | Now collecting ses page 2 information of scsi devices using sg_ses command Signed-off-by: Bhushan Kale bhushanskale@hotmail.com
* [utilities] Close file only when storing to filePavel Moravec2022-05-031-1/+2
| | | | | | | | Call _output.close() only when to_file=true. Closes: #2925 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [pacemaker,corosync] Collect rotated logsJake Hunsaker2022-04-282-3/+4
| | | | | | | | Modifies the collection specs for pacemaker and corosync logs to also include rotated copies. Additionally add collections of `pengine` files for pacemaker. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin,Policy] Make a base tagging class, minor docstring fixesJake Hunsaker2022-04-282-44/+71
| | | | | | | | | | | | | | | | Fixing the sphinx documentation warnings with the previous commit unearthed a few inconsistencies with the docstrings for various bits of `Plugin()` and `Policy()`. Fix those so that docs can be properly formatted and cross-reference each other. Related to this, add a new `PluginDistroTag` base class that tagging classes will now subclass. At the moment, this only serves to enhance the generate docs however this may prove useful in the future if we ever want to leverage these taggings classes more directly. Closes: #2917 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [docs] Correct automodule definitions for sphinx docsJake Hunsaker2022-04-287-6/+12
| | | | | | | | | | | | | | | | | Building sphinx docs was generating warnings for several locations about sphinx being unable to reference certain classes. This was found to be due to the `automodule` definitions for each section including the `:noindex:` setting. Removing this configuration resolved the vast majority of cross-referencing warnings that sphinx would report on during a build of the docs. Note that a single warning will remain, referencing threading.Thread, after this change. Closes: #2917 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [policies] Simplify flow in _container_init()Jake Hunsaker2022-04-261-7/+9
| | | | | | | | | Simplifies the logic and flow of `LinuxPolicy._container_init()` so that it is both easier to follow and less prone to edge cases that could break in-container collections that are not setup to capture from the host system. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report,collect] Add env var and prompt options for encryptionJake Hunsaker2022-04-264-0/+86
| | | | | | | | | | | | | | | Adds a new `--encrypt` option that may be used in place of the existing encrypt-related options. If used alongside `--batch`, this new option will cause sos to set encryption options based on the `SOSENCRYPTKEY` or `SOSENCRYPTPASS` environment variables. This allows users to leverage this functionality without potentially leaking the values into `ps`-like output inside the archive. If `--batch` is not used, then this option prompts the user to select the type of method to use and then provide the value in-line, or to use the env var option. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [plugin/ceph_mon]: collect crush hierarchy infoPonnuvel Palaniyappan2022-04-221-1/+2
| | | | Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
* [rpm] Capture directory listing for /var/lib/rpmJake Hunsaker2022-04-221-0/+1
| | | | | | Adds collection of directory listing output for `/var/lib/rpm`. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [seagate_ses] Add new plugin to get Seagate JBOD statusNikhil Kakade2022-04-221-0/+65
| | | | | | | SES Monitoring tool "getstatus" is used to information of Seagate storage products. Signed-off-by: Nikhil Kakade <nikhilkaka1@gmail.com>
* [Plugin] Don't tail binary files for `add_copy_spec()`Jake Hunsaker2022-04-122-14/+8
| | | | | | | | | When a file collection will reach its sizelimit, don't tail the file if it has binary content, as this will be useless collection. Closes: #2851 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [utilities] Better detect binary files with python3-magicJake Hunsaker2022-04-126-30/+41
| | | | | | | | | | Adds a new `file_is_binary()` method to `sos.utilities` to serve as a single point to determine if a file is binary or not, relying on the python3-magic module. Closes: #2839 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cirrus] Update CentOS Stream 8 image, add Stream 9 testingJake Hunsaker2022-04-121-6/+16
| | | | | | | Updates the CentOS Stream 8 image used to run the CI tests, and adds testing on CentOS Stream 9 now that those images are available. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ocp, openshift] Re-align API collection options and rename optionJake Hunsaker2022-04-082-21/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, in #2888, the `openshift` plugin was extended to allow API collections by using a default-available kubeconfig file rather than relying on user-provided tokens. This also included flipping the default value of the `no-oc` plugin option to `True` (meaning do not collect API output by default). This worked for the plugin, but it introduced a gap in `sos collect` whereby the cluster profile could no longer reliably enable API collections when trying to leverage the new functionality of not requiring a user token. Fix this by updating the cluster profile to align with the new default-off approach of API collections. Along with this, add a toggle to the cluster profile directly to allow users to toggle API collections on or off (default off) directly. This is done via a new `with-api` cluster option (e.g. `-c ocp.with-api`). Further, rename the `openshift` plugin option from `no-oc` to `with-api`. This change not only makes the option use case far more obvious, it will also align the use of the option to both `collect` and `report` so that users need only be aware of a single option for either method. The cluster profile also has logic to detect which plugin option, `no-oc` or `with-api` to use based on the (RHEL) sos version installed on the nodes being inspected by the `ocp` cluster profile. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [dnf,yum] Merge plugins into dnf, remove yum pluginJake Hunsaker2022-04-072-138/+47
| | | | | | | | | | | | | | | | | | | | | | | `dnf` has long been the successor to `yum` for RPM based distributions, with the latter remaining as a legacy feature. In fact, in most cases `yum` is now simply a symlink to `dnf`. As such, merge missing collections from `yum` into the `dnf` plugin where appropriate, and then remove the `yum` plugin. Collections still referencing yum locations, such as `/etc/yum.repos.d/` that are still used by `dnf` are brought forward and retain their `yum_*` tags in the manifest in addition to new `dnf_*` tags. The `history` plugin option has been removed and this is now a default collection - previously it was gated to avoid duplication with the `yum` plugin. The `history-info` option has also been slightly changed to only capture the last 50 transactions instead of potentially up to hundreds retained by `dnf`. Closes: #1954 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* Use --force-pull-image option for pods created with oc.Nadia Pinaeva2022-04-074-15/+32
| | | | | | | Set --force-pull-image=True by default, can be turned off with --force-pull-image=False Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
* Use /etc/os-release instead of /etc/redhat-release as the mostNadia Pinaeva2022-04-061-3/+2
| | | | | | compatible way to find host release Signed-off-by: Nadia Pinaeva <npinaeva@redhat.com>
* [presets] Adjust OCP preset optionsJake Hunsaker2022-04-061-4/+9
| | | | | | | | | | | | | | Adjust the options used by the 'ocp' preset to better reflect the current collection needs and approach. This includes disabling the `cgroups` plugin due to the large amount of mostly irrelevant data captured due to the high number of containers present on OCP nodes, ensuring the `--container-runtime` option is set to `crio` to align container-based collections, disabling HTML report generation and increasing the base log size rather than blindly enabling all-logs. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>