Sudoers - files /etc/sudoers or /etc/sudoers.d/*
Module for combining the parsing results of /etc/sudoers and
/etc/sudoers.d/* files.
- class insights.combiners.sudoers.Sudoers(sudoers)[source]
Bases:
SudoersBaseClass to combiner the
/etc/sudoersand/etc/sudoers.d/*- lines
The list of RAW lines of all the
/etc/sudoersand/etc/sudoers.d/*files. The order of lines keeps their original order them in files. And the files are read with “filename” alphabetical order.- Type:
list
- data
The dict of RAW lines of
/etc/sudoersand each file under/etc/sudoers.d/, The keys are the filename and values are RAW lines of each file.- Type:
dict
Note
If there is not “#includedir /etc/sudoers.d” line in the entry file
/etc/sudoers, the/etc/sudoers.d/*files will be skipped.Two helper functions
insights.parsers.sudoers.SudoersBase.get()andinsights.parsers.sudoers.SudoersBase.last()are also provided to quickly get the specified line(s). For details, see the super-class:insights.parsers.sudoers.SudoersBase.
Examples
>>> type(sudo) <class 'insights.combiners.sudoers.Sudoers'> >>> sudo.get(['wheel', 'ALL=(ALL)', 'ALL']) ['%wheel ALL=(ALL) ALL'] >>> sudo.last("#includedir") '#includedir /etc/sudoers.d'