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: SudoersBase

Class to combiner the /etc/sudoers and /etc/sudoers.d/*

lines

The list of RAW lines of all the /etc/sudoers and /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

Note

  1. If there is not “#includedir /etc/sudoers.d” line in the entry file /etc/sudoers, the /etc/sudoers.d/* files will be skipped.

  2. Two helper functions insights.parsers.sudoers.SudoersBase.get() and insights.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'