]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
5 years agoDon't auto-enable ACCT_TOOLS_SETUID if PAM is detected 199/head
Dave Reisner [Mon, 16 Dec 2019 19:11:23 +0000 (14:11 -0500)] 
Don't auto-enable ACCT_TOOLS_SETUID if PAM is detected

Here's a sad story:

70971457 is merged into shadow, allowing newgidmap/newuidmap to be
installed with file caps rather than setuid.
* https://bugs.archlinux.org/task/63248 is filed to take advantage of
this.
* The arch maintainer of the 'shadow' package notices that this doesn't
work, and submits a pull request to fix this in shadow.
edf7547ad5 is merged, fixing the post install hooks.

The problem here is that distros have been building shadow with PAM for
O(years), but the install hooks have silently failed due to the
combination of the directory mismatch (suidubins vs suidsbins) and later
success with setuid'ing newgidmap/newuidmap.

With the install hooks fixed, those of us (Arch[1] and Gentoo[2] so far)
who never built shadow explicitly with --enable-account-tools-setuid are
now getting setuid account tools, and don't have PAM configuration
suitable for use with setuid account management tools.

It's entirely unclear to me why you'd want this, but I assume there's
some reason out there for it existing. Regardless, setuid binaries are
dangerous and shouldn't be enabled by default without good reason.

[1] https://bugs.archlinux.org/task/64836
[2] https://bugs.gentoo.org/702252

5 years agoMerge pull request #197 from chutz/revert-bindir-sbindir-change
Serge Hallyn [Mon, 2 Dec 2019 02:28:21 +0000 (20:28 -0600)] 
Merge pull request #197 from chutz/revert-bindir-sbindir-change

Revert "Honor --sbindir and --bindir for binary installation"

5 years agoRevert "Honor --sbindir and --bindir for binary installation" 197/head
Patrick McLean [Sun, 1 Dec 2019 21:59:52 +0000 (13:59 -0800)] 
Revert "Honor --sbindir and --bindir for binary installation"

This reverts commit e293aa9cfca0619a63616af75532637dab60d49d.

See https://github.com/shadow-maint/shadow/issues/196

Some distros still care about `/bin` vs `/usr/bin`. This commit makes
it so all binaries are always installed to `/bin`/`/sbin`. The only way to
restore the previous behaviour of installing some binaries to
`/usr/bin`/`/usr/sbin` is to revert the patch.

5 years agoMerge pull request #194 from jubalh/contr
Serge Hallyn [Sun, 1 Dec 2019 17:46:13 +0000 (11:46 -0600)] 
Merge pull request #194 from jubalh/contr

Add myself to contributors

5 years agoAdd myself to contributors 194/head
Michael Vetter [Sun, 1 Dec 2019 17:37:38 +0000 (18:37 +0100)] 
Add myself to contributors

5 years agoRelease 4.8 4.8
Serge Hallyn [Sun, 1 Dec 2019 17:28:50 +0000 (11:28 -0600)] 
Release 4.8

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agofix type in po/POTFILES.in
Serge Hallyn [Sun, 1 Dec 2019 17:34:02 +0000 (11:34 -0600)] 
fix type in po/POTFILES.in

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agoMerge pull request #179 from seitokaichou/master
Serge Hallyn [Sun, 1 Dec 2019 17:02:23 +0000 (11:02 -0600)] 
Merge pull request #179 from seitokaichou/master

WIP: Initial bcrypt support

5 years agoInitial bcrypt support 179/head
prez [Mon, 16 Sep 2019 18:54:56 +0000 (20:54 +0200)] 
Initial bcrypt support

5 years agoMerge pull request #192 from Polynomial-C/optional_su
Serge Hallyn [Sun, 1 Dec 2019 16:51:21 +0000 (10:51 -0600)] 
Merge pull request #192 from Polynomial-C/optional_su

build: Make build/installation of su and its support files optional

5 years agobuild: Make build/installation of su and its support files optional 192/head
Lars Wendler [Tue, 19 Nov 2019 09:57:06 +0000 (10:57 +0100)] 
build: Make build/installation of su and its support files optional

Enabled by default
This is necessary because coreutils and util-linux can also provide su

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
5 years agoMerge pull request #191 from topimiettinen/sync-passwd-5-and-shadow-5
Christian Brauner [Sat, 16 Nov 2019 14:06:03 +0000 (15:06 +0100)] 
Merge pull request #191 from topimiettinen/sync-passwd-5-and-shadow-5

man: sync and reorder password field descriptions

5 years agoman: sync and reorder password field descriptions 191/head
Topi Miettinen [Sat, 16 Nov 2019 13:35:08 +0000 (15:35 +0200)] 
man: sync and reorder password field descriptions

Synchronize how passwd(5) and shadow(5) describe the password field.
Reorder the descriptions more logically.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
5 years agoMerge pull request #190 from jubalh/fixtypo
Serge Hallyn [Tue, 12 Nov 2019 13:12:06 +0000 (07:12 -0600)] 
Merge pull request #190 from jubalh/fixtypo

Fix typo in access of shell command

5 years agoFix typo in access of shell command 190/head
Michael Vetter [Tue, 12 Nov 2019 07:38:08 +0000 (08:38 +0100)] 
Fix typo in access of shell command

Fix typo in 88fa0651bfa4be0c819da0027456f5046a3b4967.
For some reason my git push -f seems not to have worked.

5 years agoMerge pull request #189 from hallyn/2019-11-11/vpiw
Serge Hallyn [Tue, 12 Nov 2019 02:22:49 +0000 (20:22 -0600)] 
Merge pull request #189 from hallyn/2019-11-11/vpiw

Fix vipw not resuming correctly when suspended

5 years agoFix vipw not resuming correctly when suspended 189/head
Todd C. Miller [Tue, 12 Nov 2019 02:08:10 +0000 (20:08 -0600)] 
Fix vipw not resuming correctly when suspended

Closes #185

If vipw is suspended (e.g. via control-Z) and then resumed, it often gets
immediately suspended. This is easier to reproduce on a multi-core system.

root@buster:~# /usr/sbin/vipw

[1]+  Stopped                 /usr/sbin/vipw
root@buster:~# fg
/usr/sbin/vipw

[1]+  Stopped                 /usr/sbin/vipw

root@buster:~# fg
[vipw resumes on the second fg]

The problem is that vipw forks a child process and calls waitpid() with the
WUNTRACED flag. When the child process (running the editor) is suspended, the
parent sends itself SIGSTOP to suspend the main vipw process. However, because
the main vipw is in the same process group as the editor which received the ^Z,
the kernel already sent the main vipw SIGTSTP.

If the main vipw receives SIGTSTP before the child, it will be suspended and
then, once resumed, will proceed to suspend itself again.

To fix this, run the child process in its own process group as the foreground
process group. That way, control-Z will only affect the child process and the
parent can use the existing logic to suspend the parent.

5 years agoMerge pull request #188 from rbalint/pot
Serge Hallyn [Tue, 12 Nov 2019 00:12:36 +0000 (18:12 -0600)] 
Merge pull request #188 from rbalint/pot

Allow translation of new strings by adding new files to POTFILES.in

5 years agoMerge pull request #187 from jubalh/useradd-s
Serge Hallyn [Tue, 12 Nov 2019 00:10:56 +0000 (18:10 -0600)] 
Merge pull request #187 from jubalh/useradd-s

useradd: check for valid shell argument

5 years ago[i18n] Allow translation of new strings by adding new files to POTFILES.in 188/head
Miroslav Kure [Mon, 11 Nov 2019 15:43:44 +0000 (16:43 +0100)] 
[i18n] Allow translation of new strings by adding new files to POTFILES.in

5 years agouseradd: check for valid shell argument 187/head
Michael Vetter [Mon, 11 Nov 2019 12:10:51 +0000 (13:10 +0100)] 
useradd: check for valid shell argument

Check whether shell argument given with `-s` is actually present and executable.
And is not a directory.

Fix https://github.com/shadow-maint/shadow/issues/186

5 years agoMerge pull request #184 from FRidh/itstool
Serge Hallyn [Tue, 5 Nov 2019 14:58:13 +0000 (08:58 -0600)] 
Merge pull request #184 from FRidh/itstool

man: generate translations using itstool instead of xml2po

5 years agoman: generate translations using itstool instead of xml2po 184/head
Frederik Rietdijk [Sun, 3 Nov 2019 08:51:07 +0000 (09:51 +0100)] 
man: generate translations using itstool instead of xml2po

This patch was taken from Fedora Rawhide
https://src.fedoraproject.org/rpms/shadow-utils/raw/b41cff195605b29af23d2ad62a60ddc5a2d89786/f/shadow-4.6-use-itstool.patch

5 years agoMerge pull request #183 from cgzones/selinux
Serge Hallyn [Tue, 29 Oct 2019 04:40:06 +0000 (23:40 -0500)] 
Merge pull request #183 from cgzones/selinux

migrate to new SELinux api

5 years agomigrate to new SELinux api 183/head
Christian Göttsche [Tue, 15 Oct 2019 21:33:54 +0000 (23:33 +0200)] 
migrate to new SELinux api

Using hard-coded access vector ids is deprecated and can lead to issues with custom SELinux policies.
Switch to `selinux_check_access()`.

Also use the libselinux log callback and log if available to audit.
This makes it easier for users to catch SELinux denials.

Drop legacy shortcut logic for passwd, which avoided a SELinux check if uid 0 changes a password of a user which username equals the current SELinux user identifier.
Nowadays usernames rarely match SELinux user identifiers and the benefit of skipping a SELinux check is negligible.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
5 years agoremove unused fn commonio_next
Serge Hallyn [Sun, 13 Oct 2019 01:00:17 +0000 (20:00 -0500)] 
remove unused fn commonio_next

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agocompile warnings: Zflg unused when !selinux
Serge Hallyn [Sun, 13 Oct 2019 00:58:11 +0000 (19:58 -0500)] 
compile warnings: Zflg unused when !selinux

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agoremove unused variables
Serge Hallyn [Sun, 13 Oct 2019 00:57:12 +0000 (19:57 -0500)] 
remove unused variables

parent, user_id, and group_id are unused.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agoMerge pull request #181 from pan93412/master
Serge Hallyn [Mon, 7 Oct 2019 14:00:19 +0000 (09:00 -0500)] 
Merge pull request #181 from pan93412/master

l10n(zh_TW): update translations

5 years agol10n(zh_TW): update translations 181/head
pan93412 [Mon, 7 Oct 2019 10:26:33 +0000 (18:26 +0800)] 
l10n(zh_TW): update translations

5 years agoMerge pull request #180 from thkukuk/libeconf
Serge Hallyn [Sun, 6 Oct 2019 03:34:29 +0000 (22:34 -0500)] 
Merge pull request #180 from thkukuk/libeconf

Add support for a vendor directory and libeconf

5 years agoAdd support for a vendor directory and libeconf 180/head
Thorsten Kukuk [Fri, 20 Sep 2019 08:27:31 +0000 (10:27 +0200)] 
Add support for a vendor directory and libeconf

With this, it is possible for Linux distributors to store their
supplied default configuration files somewhere below /usr, while
/etc only contains the changes made by the user. The new option
--enable-vendordir defines where the shadow suite should additional
look for login.defs if this file is not in /etc.
libeconf is a key/value configuration file reading library, which
handles the split of configuration files in different locations
and merges them transparently for the application.

5 years agoMerge pull request #177 from edneville/conflicts_between_system_users_useradd_and_pwck
Serge Hallyn [Sun, 6 Oct 2019 03:08:08 +0000 (22:08 -0500)] 
Merge pull request #177 from edneville/conflicts_between_system_users_useradd_and_pwck

pwck.c: only check home dirs if set and not a system user

5 years agopwck.c: only check home dirs if set and not a system user 177/head
ed [Sun, 25 Aug 2019 19:11:24 +0000 (20:11 +0100)] 
pwck.c: only check home dirs if set and not a system user

Closes #126

Changelog: pwck, better to look at array than to use strnlen.

5 years agoMerge pull request #176 from edneville/force_bad_name
Serge Hallyn [Fri, 4 Oct 2019 23:41:39 +0000 (16:41 -0700)] 
Merge pull request #176 from edneville/force_bad_name

chkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that…

5 years agochkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that do not conform... 176/head
ed [Fri, 23 Aug 2019 20:42:37 +0000 (21:42 +0100)] 
chkname.c, pwck.c, useradd.c, usermod.c, newusers.c: Allow names that do not conform to standards

Closes #121.

Changelog: squashed commits fixing tab style
Changelog: update 'return true' to match file's style (no parens).

5 years agolib/sgetgrent.c: change to warn when data remains
ed@s5h.net [Thu, 22 Aug 2019 17:18:31 +0000 (18:18 +0100)] 
lib/sgetgrent.c: change to warn when data remains

5 years agosgetpwent.c/sgetgrent.c: check for additional data at end of line
ed@s5h.net [Wed, 21 Aug 2019 19:47:11 +0000 (20:47 +0100)] 
sgetpwent.c/sgetgrent.c: check for additional data at end of line

5 years agoMerge branch 'master' of git+ssh://github.com/shadow-maint/shadow
Serge Hallyn [Fri, 4 Oct 2019 23:28:34 +0000 (18:28 -0500)] 
Merge branch 'master' of git+ssh://github.com/shadow-maint/shadow

5 years agoMerge pull request #173 from edneville/issue_105_106
Serge Hallyn [Thu, 8 Aug 2019 03:44:51 +0000 (22:44 -0500)] 
Merge pull request #173 from edneville/issue_105_106

useradd.c: including directory name in directory existence error message

5 years agoMerge pull request #172 from edneville/master
Serge Hallyn [Thu, 8 Aug 2019 03:42:03 +0000 (22:42 -0500)] 
Merge pull request #172 from edneville/master

chage.c: add support for YYYY-MM-DD date printing

5 years agoMerge pull request #171 from falconindy/master
Serge Hallyn [Thu, 8 Aug 2019 03:39:08 +0000 (22:39 -0500)] 
Merge pull request #171 from falconindy/master

Honor --sbindir and --bindir for binary installation

5 years agosrc/useradd.c: including directory name in dir existence error. Prefixing output... 173/head
ed [Wed, 7 Aug 2019 18:41:12 +0000 (19:41 +0100)] 
src/useradd.c: including directory name in dir existence error. Prefixing output lines with program name.

5 years agochage.c: add support for YYYY-MM-DD date printing 172/head
ed [Tue, 6 Aug 2019 18:36:42 +0000 (19:36 +0100)] 
chage.c: add support for YYYY-MM-DD date printing

5 years agoHonor --sbindir and --bindir for binary installation 171/head
Dave Reisner [Fri, 2 Aug 2019 22:45:19 +0000 (18:45 -0400)] 
Honor --sbindir and --bindir for binary installation

Some distros don't care about the split between /bin, /sbin, /usr/bin,
and /usr/sbin, so let them easily stuff binaries wherever they want.

5 years agoFix failing chmod calls on installation for suidubins
Dave Reisner [Wed, 31 Jul 2019 17:09:36 +0000 (13:09 -0400)] 
Fix failing chmod calls on installation for suidubins

suidubins should be suidusbins, since these binaries are installed
${prefix}/sbin. This historically hasn't broken the build because
chmod of newgidmap/newuidmap succeeds, causing make to think the command
succeeded. Configuring shadow with --with-fcaps removes these final two
entries and exposes the chmod failure to make.

5 years agoHonor --sbindir and --bindir for binary installation
Dave Reisner [Wed, 31 Jul 2019 17:09:36 +0000 (13:09 -0400)] 
Honor --sbindir and --bindir for binary installation

Some distros don't care about the split between /bin, /sbin, /usr/bin,
and /usr/sbin, so let them easily stuff binaries wherever they want.

This also fixes a problem during installation where-in a loop of 'chmod
4755' calls will mostly fail. However, because the last two succeed
(newuidmap/newgidmap), make considers the command to be a success.
Somewhat not-amusingly, configuring shadow with --with-fcaps will cause
installation to fail because the final chmod call is now a failing one.

5 years agoMerge pull request #170 from stanislav-brabec/master
Serge Hallyn [Wed, 31 Jul 2019 15:40:43 +0000 (10:40 -0500)] 
Merge pull request #170 from stanislav-brabec/master

Fixes of LASTLOG_UID_MAX and login.defs

5 years agologin.defs: Cosmetic space change 170/head
Stanislav Brabec [Fri, 26 Jul 2019 20:47:05 +0000 (22:47 +0200)] 
login.defs: Cosmetic space change

Fix formatting of login.defs comments. Variables are preceeded by "#"
without space, comments are preceeded by "# ". It makes the file machine
parseable again.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agologin.defs: Really add LASTLOG_UID_MAX
Stanislav Brabec [Fri, 26 Jul 2019 20:34:59 +0000 (22:34 +0200)] 
login.defs: Really add LASTLOG_UID_MAX

However 46331648 mentions adding of LASTLOG_UID_MAX to login.defs, it did
not happen.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agousermod.c: Fix invalid variable name
Stanislav Brabec [Fri, 26 Jul 2019 19:39:42 +0000 (21:39 +0200)] 
usermod.c: Fix invalid variable name

Fix invalid LASTLOG_MAX_UID variable name to correct LASTLOG_UID_MAX.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
6 years agoMerge pull request #167 from yizhao1/fix
Serge Hallyn [Mon, 17 Jun 2019 14:06:43 +0000 (09:06 -0500)] 
Merge pull request #167 from yizhao1/fix

configure.ac: fix configure error with dash

6 years agoconfigure.ac: fix configure error with dash 167/head
Yi Zhao [Mon, 17 Jun 2019 07:36:34 +0000 (15:36 +0800)] 
configure.ac: fix configure error with dash

A configure error occurs when /bin/sh -> dash:
  checking for is_selinux_enabled in -lselinux... yes
  checking for semanage_connect in -lsemanage... yes
  configure: 16322: test: yesyes: unexpected operator

Use "=" instead of "==" since dash doesn't support this operator.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
6 years agorelease 4.7 4.7
Serge Hallyn [Thu, 13 Jun 2019 16:38:49 +0000 (11:38 -0500)] 
release 4.7

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agogithub pages takes an index.html
Serge Hallyn [Sun, 9 Jun 2019 05:02:45 +0000 (00:02 -0500)] 
github pages takes an index.html

Signed-off-by: Serge Hallyn <serge@hallyn.com>
6 years agoadd README.md for the homepage
Serge Hallyn [Sun, 9 Jun 2019 04:51:32 +0000 (23:51 -0500)] 
add README.md for the homepage

Signed-off-by: Serge Hallyn <serge@hallyn.com>
6 years agoMerge pull request #161 from tabraham/master
Christian Brauner [Tue, 4 Jun 2019 11:31:08 +0000 (13:31 +0200)] 
Merge pull request #161 from tabraham/master

lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD

6 years agolib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD 161/head
Thomas Abraham [Mon, 6 May 2019 18:26:14 +0000 (14:26 -0400)] 
lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD

If SIGCHILD is being ignored, waitpid() will forever error with ECHILD and
this loop with never end, so don't loop if it errors with ECHILD.

6 years agoRevert "lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD"
Thomas Abraham [Mon, 6 May 2019 18:23:58 +0000 (14:23 -0400)] 
Revert "lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD"

This reverts commit 1697c192acc763682ee9883aa94fe871246403c0.

6 years agolibmisc/btrfs: no sense trying to calculate 'btrfs' string
Serge Hallyn [Sat, 4 May 2019 02:40:02 +0000 (19:40 -0700)] 
libmisc/btrfs: no sense trying to calculate 'btrfs' string

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agolibmisc/btrfs: find btrfs command
Serge Hallyn [Sat, 4 May 2019 02:33:23 +0000 (19:33 -0700)] 
libmisc/btrfs: find btrfs command

Ubuntu for instance keeps it in /bin, not /sbin.  So look
for it in our usual places.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoautoconf: fix cut-paste errors in btrfs detection
Serge Hallyn [Sat, 4 May 2019 02:09:58 +0000 (19:09 -0700)] 
autoconf: fix cut-paste errors in btrfs detection

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoAdd autotools support for BtrFS option
Adam Majer [Wed, 23 Jan 2019 15:17:05 +0000 (16:17 +0100)] 
Add autotools support for BtrFS option

Feature is enabled by default, if headers are available. It can be
turned off explictly.

6 years agoAdd support for btrfs subvolumes for user homes
Adam Majer [Mon, 21 Jan 2019 08:32:36 +0000 (09:32 +0100)] 
Add support for btrfs subvolumes for user homes

new switch added to useradd command, --btrfs-subvolume-home. When
specified *and* the filesystem is detected as btrfs, it will create a
subvolume for user's home instead of a plain directory. This is done via
`btrfs subvolume` command.  Specifying the new switch while trying to
create home on non-btrfs will result in an error.

userdel -r will handle and remove this subvolume transparently via
`btrfs subvolume` command. Previosuly this failed as you can't rmdir a
subvolume.

usermod, when moving user's home across devices, will detect if the home
is a subvolume and issue an error messages instead of copying it. Moving
user's home (as subvolume) on same btrfs works transparently.

6 years agoMerge pull request #164 from t8m/use-lckpwdf
Christian Brauner [Fri, 3 May 2019 08:43:41 +0000 (10:43 +0200)] 
Merge pull request #164 from t8m/use-lckpwdf

Use lckpwdf() again if prefix is not set and fix a possible DoS in locking

6 years agoDo not fail locking if there is a stale lockfile. 164/head
Tomas Mraz [Thu, 2 May 2019 12:39:01 +0000 (14:39 +0200)] 
Do not fail locking if there is a stale lockfile.

As the lockfiles have PID in the name, there can be no conflict
in the name with other process, so there is no point in using
O_EXCL and it only can fail if there is a stale lockfile from
previous execution that crashed for some reason.

6 years agoUse the lckpwdf() again if prefix is not set
Tomas Mraz [Thu, 2 May 2019 12:33:06 +0000 (14:33 +0200)] 
Use the lckpwdf() again if prefix is not set

The implementation of prefix option dropped the use of lckpwdf().
However that is incorrect as other tools manipulating the shadow passwords
such as PAM use lckpwdf() and do not know anything about the
shadow's own locking mechanism.

This reverts the implementation to use lckpwdf() if prefix option
is not used.

6 years agoMerge pull request #162 from jtojnar/check-correct-docbook
Christian Brauner [Tue, 30 Apr 2019 18:39:22 +0000 (20:39 +0200)] 
Merge pull request #162 from jtojnar/check-correct-docbook

build: Check correct DocBook version

6 years agobuild: Check correct DocBook version 162/head
Jan Tojnar [Tue, 30 Apr 2019 18:35:07 +0000 (20:35 +0200)] 
build: Check correct DocBook version

The documentation uses DocBook 4.5 DOCTYPE but the configure script
checked for 4.1.2.

6 years agolib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD
Thomas Abraham [Thu, 25 Apr 2019 18:56:22 +0000 (14:56 -0400)] 
lib/spawn.c run_command: don't loop forever if waitpid() is returning ECHILD

If SIGCHILD is being ignored, waitpid() will forever error with ECHILD and
this loop with never end, so don't loop if it erros with ECHILD.

6 years agousermod: print "no changes" to stdout, not stderr
Serge Hallyn [Sun, 21 Apr 2019 22:28:12 +0000 (17:28 -0500)] 
usermod: print "no changes" to stdout, not stderr

Closes #113

Signed-off-by: Serge Hallyn <serge@hallyn.com>
6 years agoMerge pull request #146 from lamby/reproducible-shadow-files
Serge Hallyn [Sun, 21 Apr 2019 22:13:58 +0000 (17:13 -0500)] 
Merge pull request #146 from lamby/reproducible-shadow-files

Make the sp_lstchg shadow field reproducible (re. #71)

6 years agoMerge pull request #143 from t8m/fedora
Serge Hallyn [Sun, 21 Apr 2019 21:56:36 +0000 (16:56 -0500)] 
Merge pull request #143 from t8m/fedora

usermod: Guard against unsafe change of ownership of home contents

6 years agoMerge pull request #158 from nathanruiz/master
Serge Hallyn [Sun, 21 Apr 2019 21:50:07 +0000 (16:50 -0500)] 
Merge pull request #158 from nathanruiz/master

Fix chpasswd long line handling

6 years agoMerge pull request #156 from cvuillemez/no_flush_in_read_only
Serge Hallyn [Mon, 15 Apr 2019 05:17:32 +0000 (00:17 -0500)] 
Merge pull request #156 from cvuillemez/no_flush_in_read_only

Do not flush nscd and sssd cache in read-only mode

6 years agoFix chpasswd long line handling 158/head
Nathan Ruiz [Fri, 16 Nov 2018 05:41:30 +0000 (16:41 +1100)] 
Fix chpasswd long line handling

6 years agogettime: Use secure_getenv over getenv. 146/head
Chris Lamb [Sun, 31 Mar 2019 14:59:45 +0000 (15:59 +0100)] 
gettime: Use secure_getenv over getenv.

6 years agoMake the sp_lstchg shadow field reproducible (re. #71)
Chris Lamb [Wed, 2 Jan 2019 18:06:16 +0000 (18:06 +0000)] 
Make the sp_lstchg shadow field reproducible (re. #71)

From <https://github.com/shadow-maint/shadow/pull/71>:

```
The third field in the /etc/shadow file (sp_lstchg) contains the date of
the last password change expressed as the number of days since Jan 1, 1970.
As this is a relative time, creating a user today will result in:

username:17238:0:99999:7:::
whilst creating the same user tomorrow will result in:

username:17239:0:99999:7:::
This has an impact for the Reproducible Builds[0] project where we aim to
be independent of as many elements the build environment as possible,
including the current date.

This patch changes the behaviour to use the SOURCE_DATE_EPOCH[1]
environment variable (instead of Jan 1, 1970) if valid.
```

This updated PR adds some missing calls to gettime (). This was originally
filed by Johannes Schauer in Debian as #917773 [2].

[0] https://reproducible-builds.org/
[1] https://reproducible-builds.org/specs/source-date-epoch/
[2] https://bugs.debian.org/917773

6 years agoMerge pull request #157 from t8m/close-crash
Christian Brauner [Mon, 25 Mar 2019 19:56:55 +0000 (12:56 -0700)] 
Merge pull request #157 from t8m/close-crash

Do not crash in commonio_close if database FILE not opened.

6 years agoDo not crash in commonio_close if database FILE not opened. 157/head
Tomas Mraz [Mon, 25 Mar 2019 13:51:26 +0000 (14:51 +0100)] 
Do not crash in commonio_close if database FILE not opened.

The db->fp can be NULL if commonio_unlock() is called when the
shadow file is opened but did not exist before.

6 years agoAdd Christian to maintainers list
Serge Hallyn [Mon, 18 Mar 2019 02:11:05 +0000 (21:11 -0500)] 
Add Christian to maintainers list

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoREADME: Update the homepage link
Serge Hallyn [Sun, 17 Mar 2019 16:43:07 +0000 (11:43 -0500)] 
README: Update the homepage link

and remove ftp.  Maybe i should run an ftp server for releases...

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoREADME: Add Eric to contributors list
Serge Hallyn [Sun, 17 Mar 2019 16:39:24 +0000 (11:39 -0500)] 
README: Add Eric to contributors list

subids were not a small amount of work.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoDo not flush nscd and sssd cache in read-only mode 156/head
Charlie Vuillemez [Wed, 27 Feb 2019 16:28:39 +0000 (17:28 +0100)] 
Do not flush nscd and sssd cache in read-only mode

Fix #155

signed-off-by: Charlie Vuillemez <cvuillemez@users.noreply.github.com>

6 years agoMerge pull request #153 from AlbanVidal/man-po-fr
Serge Hallyn [Tue, 19 Feb 2019 06:49:40 +0000 (00:49 -0600)] 
Merge pull request #153 from AlbanVidal/man-po-fr

French man translation update

6 years agoFrench man translation update 153/head
Alban VIDAL [Mon, 11 Feb 2019 06:02:52 +0000 (07:02 +0100)] 
French man translation update
- translated by Jean-Philippe MENGUAL
- proofread by the debian-l10n-french mailing list contributors

Signed-off-by: Alban VIDAL <alban.vidal@zordhak.fr>
6 years agoMerge pull request #151 from t8m/uid-count-default
Christian Brauner [Fri, 1 Feb 2019 08:11:27 +0000 (09:11 +0100)] 
Merge pull request #151 from t8m/uid-count-default

Fix the default mentioned in man page for SUB_UID/GID_COUNT variables.

6 years agoFix the default mentioned in man page for SUB_UID/GID_COUNT variables. 151/head
Tomas Mraz [Thu, 31 Jan 2019 12:30:59 +0000 (13:30 +0100)] 
Fix the default mentioned in man page for SUB_UID/GID_COUNT variables.

6 years agoMerge pull request #148 from AlbanVidal/master
Serge Hallyn [Sun, 27 Jan 2019 04:58:53 +0000 (22:58 -0600)] 
Merge pull request #148 from AlbanVidal/master

Sync po files from template "shadow.pot" file

6 years agoSync po files from pot shadow.pot file 148/head
Alban VIDAL [Sat, 19 Jan 2019 12:32:42 +0000 (13:32 +0100)] 
Sync po files from pot shadow.pot file

Signed-off-by: Alban VIDAL <alban.vidal@zordhak.fr>
6 years agousermod: Guard against unsafe change of ownership of home directory content 143/head
Tomas Mraz [Tue, 18 Dec 2018 15:32:13 +0000 (16:32 +0100)] 
usermod: Guard against unsafe change of ownership of home directory content

In case the home directory is not a real home directory
(owned by the user) but things like / or /var or similar,
it is unsafe to change ownership of home directory content.

The test checks whether the home directory is owned by the
user him/herself, if not no ownership modification of contents
is performed.

6 years agologin.defs: Add LASTLOG_UID_MAX variable to limit lastlog to small uids.
Tomas Mraz [Wed, 28 Nov 2018 13:57:16 +0000 (14:57 +0100)] 
login.defs: Add LASTLOG_UID_MAX variable to limit lastlog to small uids.

As the large uids are usually provided by remote user identity and
authentication service, which also provide user login tracking,
there is no need to create a huge sparse file for them on every local
machine.

fixup! login.defs: Add LASTLOG_UID_MAX variable to limit lastlog to small uids.

6 years agoidmap: always seteuid to the owner of the namespace
Giuseppe Scrivano [Tue, 20 Nov 2018 19:43:43 +0000 (20:43 +0100)] 
idmap: always seteuid to the owner of the namespace

simplify the condition for setting the euid of the process.  Now it is
always set when we are running as root, the issue was introduced with
the commit 52c081b02c4ca4432330ee336a60f6f803431e63

Changelog: 2018-11-24 - seh - enforce that euid only gets set to ruid if
   it currently == 0 (i.e. really was setuid-*root*).

Closes: https://github.com/genuinetools/img/issues/191
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Serge Hallyn <shallyn@cisco.com>
6 years agoMerge pull request #138 from brauner/2018-10-27/setuid_fscaps
Serge Hallyn [Sun, 28 Oct 2018 00:00:23 +0000 (19:00 -0500)] 
Merge pull request #138 from brauner/2018-10-27/setuid_fscaps

new{g,u}idmap: align setuid and fscaps behavior

6 years agonew{g,u}idmap: align setuid and fscaps behavior 138/head
Christian Brauner [Sat, 27 Oct 2018 16:23:50 +0000 (18:23 +0200)] 
new{g,u}idmap: align setuid and fscaps behavior

Commit 1ecca8439d5 ("new[ug]idmap: not require CAP_SYS_ADMIN in the parent userNS")
does contain a wrong commit message, is lacking an explanation of the
issue, misses some simplifications and hardening features. This commit
tries to rectify this.

In (crazy) environment where all capabilities are dropped from the
capability bounding set apart from CAP_SET{G,U}ID setuid- and
fscaps-based new{g,u}idmap binaries behave differently when writing
complex mappings for an unprivileged user:

1. newuidmap is setuid

unshare -U sleep infinity &
newuidmap $? 0 100000 65536

First file_ns_capable(file, ns, CAP_SYS_ADMIN) is hit. This calls into
cap_capable() and hits the loop

for (;;) {
        /* Do we have the necessary capabilities? */
        if (ns == cred->user_ns)
                return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;

        /*
         * If we're already at a lower level than we're looking for,
         * we're done searching.
         */
        if (ns->level <= cred->user_ns->level)
                return -EPERM;

        /*
         * The owner of the user namespace in the parent of the
         * user namespace has all caps.
        */
        if ((ns->parent == cred->user_ns) && uid_eq(ns->owner, cred->euid))
                return 0;

        /*
         * If you have a capability in a parent user ns, then you have
         * it over all children user namespaces as well.
        */
        ns = ns->parent;
}

The first check fails and falls through to the end of the loop and
retrieves the parent user namespace and checks whether CAP_SYS_ADMIN is
available there which isn't.

2. newuidmap has CAP_SETUID as fscaps set

unshare -U sleep infinity &
newuidmap $? 0 100000 65536

The first file_ns_capable() check for CAP_SYS_ADMIN is passed since the
euid has not been changed:

if ((ns->parent == cred->user_ns) && uid_eq(ns->owner, cred->euid))
        return 0;

Now new_idmap_permitted() is hit which calls ns_capable(ns->parent,
CAP_SET{G,U}ID). This check passes since CAP_SET{G,U}ID is available in
the parent user namespace.
Now file_ns_capable(file, ns->parent, CAP_SETUID) is hit and the
cap_capable() loop (see above) is entered again. This passes

if (ns == cred->user_ns)
        return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;

since CAP_SET{G,U}ID is available in the parent user namespace. Now the
mapping can be written.

There is no need for this descrepancy between setuid and fscaps based
new{g,u}idmap binaries. The solution is to do a
seteuid() back to the unprivileged uid and PR_SET_KEEPCAPS to keep
CAP_SET{G,U}ID. The seteuid() will cause the
file_ns_capable(file, ns, CAP_SYS_ADMIN) check to pass and the
PR_SET_KEEPCAPS for CAP_SET{G,U}ID will cause the CAP_SET{G,U}ID to
pass.

Fixes: 1ecca8439d5 ("new[ug]idmap: not require CAP_SYS_ADMIN in the parent userNS")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #136 from giuseppe/fcap-newuidmap-newgidmap
Serge Hallyn [Sat, 27 Oct 2018 16:26:31 +0000 (11:26 -0500)] 
Merge pull request #136 from giuseppe/fcap-newuidmap-newgidmap

newuidmap/newgidmap: install with file capabilities

6 years agoMerge pull request #132 from giuseppe/no-cap-sys-admin
Serge Hallyn [Sat, 27 Oct 2018 16:22:37 +0000 (11:22 -0500)] 
Merge pull request #132 from giuseppe/no-cap-sys-admin

newuidmap/newgidmap: do not require CAP_SYS_ADMIN in the parent user namespace

6 years agonewuidmap/newgidmap: install with file capabilities 136/head
Giuseppe Scrivano [Wed, 24 Oct 2018 09:08:28 +0000 (11:08 +0200)] 
newuidmap/newgidmap: install with file capabilities

do not install newuidmap/newgidmap as suid binaries.  Running these
tools with the same euid as the owner of the user namespace to
configure requires only CAP_SETUID and CAP_SETGID instead of requiring
CAP_SYS_ADMIN when it is installed as a suid binary.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
6 years agoMerge pull request #118 from AdelieLinux/utmpx-only-support
Serge Hallyn [Wed, 24 Oct 2018 03:35:19 +0000 (22:35 -0500)] 
Merge pull request #118 from AdelieLinux/utmpx-only-support

[WIP] Support systems that only have utmpx

6 years agoMerge pull request #133 from t8m/trivial
Serge Hallyn [Wed, 24 Oct 2018 03:21:12 +0000 (22:21 -0500)] 
Merge pull request #133 from t8m/trivial

Fix some issues found in Coverity scan.