Todd C. Miller [Fri, 2 Mar 2018 16:27:27 +0000 (09:27 -0700)]
Refactor the code that actually converts the role to sudoers format
into role_to_sudoers() now that it is more involved than just calling
sudo_ldap_role_to_priv().
Todd C. Miller [Fri, 2 Mar 2018 13:42:29 +0000 (06:42 -0700)]
When merging two privileges, use the runas lists of the previous
privilege when possible. Otherwise, the generated sudoers line
will include a runas list for commands that is not necessary.
Todd C. Miller [Fri, 2 Mar 2018 03:31:01 +0000 (20:31 -0700)]
Use a case-insensitive comparison when matching user and group names
in sudoers with the passwd or group database. This can be necessary
when users and groups are stored in AD or LDAP.
Todd C. Miller [Wed, 28 Feb 2018 21:02:50 +0000 (14:02 -0700)]
When converting from ldif to sudoers, sudoRole objects with the
same user if possible. If both user and host are the same, merge
into a single privilege. This makes it possible to convert a
sudoers entry like:
Todd C. Miller [Wed, 28 Feb 2018 14:05:36 +0000 (07:05 -0700)]
Restore line to set MODE_PRESERVE_ENV in flags when the -E command
line option is used. The caller doesn't check MODE_PRESERVE_ENV
these days but parse_args uses it to detect usage errors when -E
is used along with a mutually excusive option. Problem found by
Yuriy Vostrikov.
Todd C. Miller [Sun, 25 Feb 2018 13:30:32 +0000 (06:30 -0700)]
When converting from LDAP to sudoers, put negated hosts and commands
at the end of the list. Since LDAP doesn't guarantee attribute order
we need to make sure negated entries always override non-negated ones.
Todd C. Miller [Sat, 24 Feb 2018 16:23:14 +0000 (09:23 -0700)]
Add support for setting default options in a config file. In
addition to expand_aliases, input_format and output_format, both
the initial sudoOrder and the increment when updating sudoOrder for
subsequent sudoRole objects can be specified. Command line options
have also been added for the start order and increment.
Todd C. Miller [Thu, 22 Feb 2018 16:53:12 +0000 (09:53 -0700)]
Initial support for parsing sudoers LDIF files in cvtsudoers.
This makes it possible to convert from LDAP sudoers to a traditional
sudoers file. Semantic differences between file sudoers and LDAP
sudoers mean that LDIF -> sudoers is not completely equivalent.
Todd C. Miller [Tue, 20 Feb 2018 20:22:59 +0000 (13:22 -0700)]
Use setpassent() and setgroupent() on systems that support it to
keep the passwd and group database open. Sudo does a lot of passwd
and group lookups so it can be beneficial to just leave the file
open.
Todd C. Miller [Mon, 19 Feb 2018 18:00:12 +0000 (11:00 -0700)]
In pty_cleanup() we need to call sudo_term_restore() even if no I/O
plugins are present as long as /dev/tty exists. Fixes the use_pty
case with no I/O plugins.
Todd C. Miller [Mon, 29 Jan 2018 16:31:54 +0000 (09:31 -0700)]
Remove the C-style comment charactes from the getopt_long.c and
inet_pton.c license text as it was inconsistent with the rest of
the file and messed up the html formatting.
Todd C. Miller [Fri, 26 Jan 2018 20:15:10 +0000 (13:15 -0700)]
Use the built-in sudoers file location as the default sudoers file
for cvtsudoers and move parse_sudoers_options() to stubs.c since
it is shared between visudo.c and cvtsudoers.c.
Todd C. Miller [Tue, 23 Jan 2018 18:05:41 +0000 (11:05 -0700)]
Do not call the TIOCSETVERAUTH ioctl with a negative number of seconds.
Also cap the max number of seconds at 3600 to avoid getting EINVAL
from TIOCSETVERAUTH.
Todd C. Miller [Tue, 16 Jan 2018 17:27:58 +0000 (10:27 -0700)]
Add an approval function to the sudo auth API which is run after
the user's password has been verified. The approval function is
run even if no password is required. This is currently only used
for PAM (use pam_acct_mgmt) and BSD auth (auth_approval).