Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Remove non-root directory logic #3234

Closed
wants to merge 2,621 commits into from

Conversation

Glutexo
Copy link
Collaborator

@Glutexo Glutexo commented Sep 24, 2021

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

The Insights Client can only be run as root. There is a condition that prevents it from running for non-root users. The logic determining log and lib directories for a non-root user is never used.

bfahr and others added 30 commits August 18, 2021 15:00
* The code utilizing the iter/next functions in the lsof parser changed
  in python 3.5 based on PEP 479
* This change makes the code compliant with that PEP and removes the
  deprecation warning for tests

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Fix the LsPci combiner for full format of 'Slot'

- In case the `lspci -k` sometimes outputs the `Slot` in the full format of
  `domain:bus:device.function`, the combiner will take the `Slot` of the
  `lspci -k` as the key.

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* Fix the doc

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* Fix the doc error

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

Co-authored-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Apply validation to IP addresses and MAC addresses to ensure that
  unexpected values are not present
* Add tests

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
…sion-reporting

fix(compliance): repair malformed SSG version in results
* Due to problems with netstat output formatting, ss is the best source
  for network information
* The ss command was restricted to only run if certain modules were
  already loaded since those modules were necessary for ss.  This change
  removes those restrictions. The side-effect is that the modules
  inet_diag, tcp_diag, and udp_diag may be loaded by execution of the ss
  command.

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Initialized tito, and set the props to allow tito tag to update the
  spec file and the VERSION file so we don't have to manually update
  each on release.
* Added rpm spec file and script to build the rpm locally.
* Added a new core rpm specific MANIFEST file that removes all the tests
  and examples directory.
* Updated the readme with instructions on how to build the rpm locally,
  and then install with dnf/yum.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
* consolidate network logging to core request function

* Remove duplicate timeout argument

* Use connection.get instead of session.get

Session is no longer available in InsightsClient.

* Mock client.connection.get, not client.session.get

* Fix fetch tests

* Remove unused variables

* Fix _get to _cached_get

Signed-off-by: Jeremy Crafts <jcrafts@redhat.com>

Signed-off-by: Štěpán Tomsa <stomsa@redhat.com>

Co-authored-by: Glutexo <stomsa@redhat.com>
* New spec to get if SCA is enabled on satellite

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Update docstring of property "sca_enabled"

Signed-off-by: Huanhuan Li <huali@redhat.com>
* Add parser cups_ppd

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Use dict base

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Add SkipException test

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update docstring

Signed-off-by: jiazhang <jiazhang@redhat.com>
* Add new parser lpstat_v

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Add new parser lpstat_v

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Use dict base and update datasource return docstring

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update docstring

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update docstring

Signed-off-by: jiazhang <jiazhang@redhat.com>
* Refactor code using iter/next to avoid functions deprecated by PEP 479
* Add tests

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Fix the regex to catch the various raid types raid0, raid1, etc.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
…#3206)

* Added in the missing attribute that is often set in the bond opts.
* Added in testing to confirm the attribute was set properly.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
* Moved the do_include and do_exclude to the top and added a check for
  excludes before importing path.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
Signed-off-by: jiazhang <jiazhang@redhat.com>
* Remove the unused datasource specs from default.py

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* Fix flake8 errors

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* Modify the pre-loaded component in collect.py

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>
Add a new option to shell "-k" to start an ipython kernel.
The ipykernel module is required to be installed separately for this
option to work.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
* Update validation code to fix python2 issue

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* remove prints & linting fixes

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* flake8

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* use six.PY3

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* remove non-needed check

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* remove unicode in favor of six.text_type

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* Update normalization to include the possibility of a CommentedSeq() being a sequence of strings

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* remove testing print statement

Signed-off-by: Alec Cohan <alcohan@redhat.com>
…2993)

Dynamically imports os-specific library for handling DNF/YUM interaction.
Performs a resolution of updateable packages, and outputs it as JSON.
Expected performance is on the order of seconds for both RHEL7 and RHEL8.

Signed-off-by: mhornick <mhornick@redhat.com>
* Enhance parser cups_ppd

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update format

Signed-off-by: jiazhang <jiazhang@redhat.com>
Signed-off-by: jiazhang <jiazhang@redhat.com>
* Enhance datasource lpstat

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update logic to check line

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update line filter

Signed-off-by: jiazhang <jiazhang@redhat.com>
RedHatInsights#3221)

* New specs and parsers for scsi_mod, lpfc driver and qla2xxx driver max luns

Signed-off-by: Qin Ping <piqin@redhat.com>

* Updata the doc of Ql2xMaxLUN, SCSIModMaxReportLUNs and LpfcMaxLUNs parsers

Signed-off-by: Qin Ping <piqin@redhat.com>
* We will no longer collect facter due to issues documented in Bugzilla
  1989655
* Update combiners to remove dependency
* Remove spec from HostContext collection
* Update tests

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
…edHatInsights#3226)

* Fixed the few flake8 errors thrown by the latest version of flake8 for
  the client only.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>

Co-authored-by: Jeremy Crafts <gravitypriest@users.noreply.github.com>
* Update verifier code to remove the Long suffix for python2 impl

Signed-off-by: Alec Cohan <alcohan@redhat.com>

* remove test file

Signed-off-by: Alec Cohan <alcohan@redhat.com>

Co-authored-by: Jeremy Crafts <gravitypriest@users.noreply.github.com>
…3222)

* Added W605, and W504 to the ignores since it would require a lot of
  trivial changes to a lot of files.
* Fixed any flake8 errors thrown, most were indention, missing blank
  lines, and a few print formatting related issues.
* Re-ordered imports to be in alphabetical order on any files that I had
  to fix a flake8 error on.
* Bumped the flake8 version in the setup.py file.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
* Update the requires entries in the rpm spec file to allow building it
  on el7. Since a lot of the packages start with python36 on el7.
* Added the missing CacheControl and pyyaml requirements.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
huali027 and others added 26 commits July 28, 2022 12:50
* fix: the parser "LvmConfig" raises exception

* It fails to parse the content when there is "umask=077" in the global configuration.

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Only fix "umask=077" and keep the other strings as integer

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Transfer the value first before storing

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Keep data as dict

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Add test for ParseException

Signed-off-by: Huanhuan Li <huali@redhat.com>
* Add datasource and parser for system_user_dirs (1st draft)

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>

* Add datasource and parser for system_user_dirs

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>

* Rename class attribute

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>

* Remove authors

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>
The current marker 'namespaces' matches RHCOS SOSReport archives. RHCOS SOS-Report archives are always identified as MustGatherContext instead of SosArchiveContext, thus no rule hits result when running rules against RHCOS SOS-Report. The commit changes the marker of MustGatherContext to 'cluster-scoped-resources' to avoid matching RHCOS SOSReport.

Signed-off-by: shzhou <shzhou@redhat.com>
* Some custom datasources were missing from the docs build those have been added

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Version 5.0.2 of flake8 detected some errors that needed
  to be fixed to allow CI/CD tests to pass

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Update aws specs to use IMDSv2

* AWS IMDSv2 uses sessions for metadata access which requires the extra step of collecting a token prior to accessing metadata
* Add a new datasource to get the IMDSv2 token
* Modifiy existing specs to use the token to access metadata
* Add datasource to docs
* This change resolves RedHatInsights#3485

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>

* Update aws specs to use IMDSv2

* AWS IMDSv2 uses sessions for metadata access which requires the extra step of collecting a token prior to accessing metadata
* Add a new datasource to get the IMDSv2 token
* Modifiy existing specs to use the token to access metadata
* Add datasource to docs
* This change resolves RedHatInsights#3485

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>

* Fix py2.6 test

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>

* Reduce token lifetime to 60 sec

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
…s#3467)

* Add new parser sys_fs_cgroup_memory_tasks_number

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update to use datasource

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update description from the parser

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Add new parser sys_fs_cgroup_memory_tasks_number

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Update datasource doc

Signed-off-by: jiazhang <jiazhang@redhat.com>

* Remove exception condition from parser and revert insights/core/archives.py file

Signed-off-by: jiazhang <jiazhang@redhat.com>
* Add the ability to pass a version to the deprecated function to print
  that it will be removed after that version.

Signed-off-by: Ryan Blakley <rblakley@redhat.com>
…ghts#3493)

* also, skip symlinks for the filesystem_scan_* options

Signed-off-by: Mark Huth <mhuth@redhat.com>

Signed-off-by: Mark Huth <mhuth@redhat.com>
* Feat: New grub2_editenv_list parser

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update default and init

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update __init__

Signed-off-by: Xinting Li <xintli@redhat.com>

* Correct docs-test error

Signed-off-by: Xinting Li <xintli@redhat.com>

* modify test content name

Signed-off-by: Xinting Li <xintli@redhat.com>

* Add doc entry

Signed-off-by: Xinting Li <xintli@redhat.com>

* Moving to grubenv

Signed-off-by: Xinting Li <xintli@redhat.com>

* Fix flake8 error

Signed-off-by: Xinting Li <xintli@redhat.com>

* Add base class

Signed-off-by: Xinting Li <xintli@redhat.com>

* modify self._error to self._errors

Signed-off-by: Xinting Li <xintli@redhat.com>

* Replace GrubEnv from handle ``/boot/grub2/grubenv`` file to ``grub2-editenv list`` command output

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update insights_archive

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update doc string

Signed-off-by: Xinting Li <xintli@redhat.com>

Signed-off-by: Xinting Li <xintli@redhat.com>
Co-authored-by: Xinting Li <xintli@redhat.com>
* feat: New spec "auditctl -l"

* Add a new module for all "auditctl" commands

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Replace the parent class "LegacyItemAccess" to "dict"

* Raise "ParseException" when the line isn't in expected format instead of pass it,
  maybe we need to enhance the parser.
  update the module docstring.
  raise SkipException when there is no known status output

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Rename "AuditdStatus" to "AuditStatus"

Signed-off-by: Huanhuan Li <huali@redhat.com>

Signed-off-by: Huanhuan Li <huali@redhat.com>
Signed-off-by: ahitacat <ahitacat@redhat.com>
The examples and the release timeline will help developer to plan the function
deprecation w.r.t the insights-core release cycle.

Signed-off-by: Sachin Patil <psachin@redhat.com>
Add a new spec for authselect current and its parser

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>
* Feat: New parser for 'ls -lanL /etc/ssh' command

New parser for 'ls -lanL /etc/ssh' command

Signed-off-by: Xinting Li <xintli@redhat.com>
…atInsights#3501)

* feat: New spec and parser to get the satellite provision params

* Currently it only collects the "package_upgrade" parameter for RHEL9
* Since more than one tables have columns in yaml format, move the yaml parsing
  part to the parent class.

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Update spec "satellite_provision_param_settings" to depend on "IsSatellite611"

* Add component "IsSatellite611"

Signed-off-by: Huanhuan Li <huali@redhat.com>

* Add "IsSatellite" and "IsCapsule" component

* Update all the satellite and capsule specs with new "IsSatellite"
  and "IsCapsule" component

Signed-off-by: Huanhuan Li <huali@redhat.com>

Signed-off-by: Huanhuan Li <huali@redhat.com>
* Feat: New parser for 'journalctl --header' command

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update doc string

Signed-off-by: Xinting Li <xintli@redhat.com>

* fix: change journalctl_header from parser to datasource

Signed-off-by: Xinting Li <xintli@redhat.com>

* move to parser and add filter

Signed-off-by: Xinting Li <xintli@redhat.com>

* Fix flake8 errors

Signed-off-by: Xinting Li <xintli@redhat.com>

* Fix python2 error

Signed-off-by: Xinting Li <xintli@redhat.com>

* fix python2 error

Signed-off-by: Xinting Li <xintli@redhat.com>

* Fix assert error

Signed-off-by: Xinting Li <xintli@redhat.com>

* Fix error

Signed-off-by: Xinting Li <xintli@redhat.com>

* Update doc string

Signed-off-by: Xinting Li <xintli@redhat.com>

* fix wrong doc string

Signed-off-by: Xinting Li <xintli@redhat.com>

* Change to journal_header

Signed-off-by: Xinting Li <xintli@redhat.com>

* change to 'from insights.core import Syslog'

Signed-off-by: Xinting Li <xintli@redhat.com>

* update doc string

Signed-off-by: Xinting Li <xintli@redhat.com>

Signed-off-by: Xinting Li <xintli@redhat.com>
Co-authored-by: Xinting Li <xintli@redhat.com>
* When collect is called from the cli, the malware datasource calls client configuration which parses the collect args and fails.
* This PR removes the args after parsing to avoid the failure.
* Fix RedHatInsights#3505

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* fix: Revert spec httpd_on_nfs
* use ProcMounts parser instead of Mounts combiner
* ensure vers can be checked
Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* fix test of py2
Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>
…hts#3484)

* fix: change cloud_cfg to Yaml and modify the filtering target

- fix: RedHatInsights#3482
- fix: RedHatInsights#3478

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* forget the tests
* fix doc test

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* for python26 - 2
* add more doc for specs

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* fix the doc tests

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>
…ghts#3507)

Resolves: rhbz#2065233

Signed-off-by: ahitacat <ahitacat@redhat.com>
* util/subproc was already using which to get the full path for timeout, but the command spec was not.  This change uses the which util to ensure the full path is obtained for the timeout command
* Fix RedHatInsights#1130

Signed-off-by: Bob Fahr <20520336+bfahr@users.noreply.github.com>
* Feat: add secure spec to default.py

Signed-off-by: Xinting Li <xintli@redhat.com>

* Delete secure = simple_file("/var/log/secure") in sos_archive.py

Signed-off-by: Xinting Li <xintli@redhat.com>
* feat: support InstanceType in saphostctrl

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* fix and test the full_type

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

* Use full_type only to check function_instances

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

- Add 'Diagnostic Agents'
* fix typos
* revert the test cases of .data
* revert the doc of attr 'instances'

Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>
@candlepin-bot
Copy link

Can one of the admins verify this patch?

@Glutexo Glutexo closed this Sep 10, 2024
@Glutexo Glutexo deleted the remove_non_root_dir_logic branch September 10, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client These issues represent work to be done by the "client" team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.