summaryrefslogtreecommitdiff
path: root/system/shadow/APKBUILD
blob: 12ec92b6f5ed9636ff2142491711c1bd4c4e65e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Contributor: Ariadne Conill <ariadne@dereferenced.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=shadow
pkgver=4.11.1
pkgrel=0
pkgdesc="Login and password management utilities"
url="https://github.com/shadow-maint/shadow"
arch="all"
options="suid"
license="BSD-3-Clause OR Artistic-1.0-Perl"
depends=""
makedepends_build="docbook-xml docbook-xsl itstool libxslt"
makedepends_host="linux-pam-dev utmps-dev"
subpackages="$pkgname-doc $pkgname-dbg $pkgname-lang $pkgname-uidmap"
source="https://github.com/shadow-maint/shadow/releases/download/v$pkgver/shadow-$pkgver.tar.xz
	login.pamd
	dots-in-usernames.patch
	useradd-defaults.patch
	pam-useradd.patch
	"
# secfixes:
#   4.5-r0:
#   - CVE-2017-12424
#   4.2.1-r11:
#   - CVE-2017-2616
#   4.2.1-r7:
#   - CVE-2016-6252

build() {
	LIBS="-lutmps -lskarnet" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-utmpx \
		--with-libpam \
		--without-audit \
		--without-selinux \
		--without-acl \
		--without-attr \
		--without-tcb \
		--without-nscd \
		--without-su \
		--without-group-name-max-length \
		--enable-man
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# Do not install these pam.d files they are broken and outdated.
	rm "$pkgdir"/etc/pam.d/*

	# However, install our own for login.
	cp "$srcdir"/login.pamd "$pkgdir"/etc/pam.d/login

	# install some pam.d files based on a patched useradd
	for pamf in groupadd groupdel groupmems groupmod \
		 useradd userdel usermod
	do
		install -m0644 etc/pam.d/useradd \
			"$pkgdir/etc/pam.d/$pamf"
	done

	# nologin is provided by util-linux.
	rm "$pkgdir"/sbin/nologin

	# /etc/login.defs is not very useful - replace it with an *almost* blank file.
	rm "$pkgdir"/etc/login.defs
	echo "USERGROUPS_ENAB yes" > "$pkgdir"/etc/login.defs

	# Avoid conflict with man-pages.
	rm "$pkgdir"/usr/share/man/man3/getspnam.3* \
		"$pkgdir"/usr/share/man/man5/passwd.5*
	# and util-linux-doc
	rm "$pkgdir"/usr/share/man/man8/nologin.8*
}

uidmap() {
	pkgdesc="Utilities for using subordinate UIDs and GIDs"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/new*idmap "$subpkgdir"/usr/bin/
	chmod 4711 "$subpkgdir"/usr/bin/new*idmap

	# Used e.g. for unprivileged LXC containers.
	mkdir "$subpkgdir"/etc
	touch "$subpkgdir"/etc/subuid "$subpkgdir"/etc/subgid
}

sha512sums="12fbe4d6ac929ad3c21525ed0f1026b5b678ccec9762f2ec7e611d9c180934def506325f2835fb750dd30af035b592f827ff151cd6e4c805aaaf8e01425c279f  shadow-4.11.1.tar.xz
46a6f83f3698e101b58b8682852da749619412f75dfa85cecad03d0847f6c3dc452d984510db7094220e4570a0565b83b0556e16198ad894a3ec84b3e513d58d  login.pamd
6492e8d07a595cbefedeb9009d39eef48195bc2e8caeb523827b83f243d872c912df95a9479d6fc274ff105d2902ebc5c74bdec04f82e7c0d1340d0ae8607f73  dots-in-usernames.patch
fb6b19b05a58f5200d4ad39c7393735ef8e0db853c50ba2ad29efb7bdd871bc8659f6845c9cc0660ce12372dbc78b7df9cfd8a06f6913036d905e5372f2ed99f  useradd-defaults.patch
0b4587e263cb6be12fa5ae6bc3b3fc4d3696dae355bc67d085dc58c52ff96edb4d163b95db2092b8c2f3310839430cac03c7af356641b42e24ee4aa6410f5cf1  pam-useradd.patch"