Jan-24-2022, 11:55 PM
Are you not overly complicating a simple matter?
Admittedly, I am the only user on my laptop and I don't know much about this, but you are dealing with a simple text file.
My /etc/sudoers file looks like this in nano:
What do you want to get from this?
You could theoretically have 1 column for DEFAULTS and 5 columns for user, host, user_alias, group_alias, command in your db
Can't you just parse the text file to a dictionary and put in your db?
Admittedly, I am the only user on my laptop and I don't know much about this, but you are dealing with a simple text file.
My /etc/sudoers file looks like this in nano:
Quote:#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/>
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
What do you want to get from this?
You could theoretically have 1 column for DEFAULTS and 5 columns for user, host, user_alias, group_alias, command in your db
Quote:root ALL=(ALL:ALL) ALL
The first field indicates the username that the rule will apply to (root).
root ALL=(ALL:ALL) ALL
The first “ALL” indicates that this rule applies to all hosts.
root ALL=(ALL:ALL) ALL
This “ALL” indicates that the root user can run commands as all users.
root ALL=(ALL:ALL) ALL
This “ALL” indicates that the root user can run commands as all groups.
root ALL=(ALL:ALL) ALL
The last “ALL” indicates these rules apply to all commands.
Can't you just parse the text file to a dictionary and put in your db?