mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-16 17:36:59 +02:00
sys-apps/shadow: Apply Flatcar modifications
- Carry over our custom tmpfiles and securetty files - Remove /etc files and install them to /usr, use tmpfiles - Switch /etc/login.defs edits to /usr/share/shadow/login.defs - Drop moving passwd out of /usr since we don't have split-usr - Drop pkg_postinst
This commit is contained in:
parent
ecf9249a70
commit
94b296e9a2
33
sdk_container/src/third_party/coreos-overlay/sys-apps/shadow/files/securetty
vendored
Normal file
33
sdk_container/src/third_party/coreos-overlay/sys-apps/shadow/files/securetty
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# /etc/securetty: list of terminals on which root is allowed to login.
|
||||||
|
# See securetty(5) and login(1).
|
||||||
|
console
|
||||||
|
|
||||||
|
vc/0
|
||||||
|
vc/1
|
||||||
|
vc/2
|
||||||
|
vc/3
|
||||||
|
vc/4
|
||||||
|
vc/5
|
||||||
|
vc/6
|
||||||
|
vc/7
|
||||||
|
vc/8
|
||||||
|
vc/9
|
||||||
|
vc/10
|
||||||
|
vc/11
|
||||||
|
vc/12
|
||||||
|
tty0
|
||||||
|
tty1
|
||||||
|
tty2
|
||||||
|
tty3
|
||||||
|
tty4
|
||||||
|
tty5
|
||||||
|
tty6
|
||||||
|
tty7
|
||||||
|
tty8
|
||||||
|
tty9
|
||||||
|
tty10
|
||||||
|
tty11
|
||||||
|
tty12
|
||||||
|
|
||||||
|
tts/0
|
||||||
|
ttyS0
|
@ -0,0 +1,5 @@
|
|||||||
|
L /etc/login.defs - - - - ../usr/share/shadow/login.defs
|
||||||
|
L /etc/securetty - - - - ../usr/share/shadow/securetty
|
||||||
|
|
||||||
|
d /etc/default - - - - -
|
||||||
|
L /etc/default/useradd - - - - ../../usr/share/shadow/useradd
|
@ -0,0 +1 @@
|
|||||||
|
f /var/log/faillog - - - - -
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
EAPI=8
|
EAPI=8
|
||||||
|
|
||||||
|
TMPFILES_OPTIONAL=1
|
||||||
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/sergehallyn.asc
|
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/sergehallyn.asc
|
||||||
inherit libtool pam verify-sig
|
inherit libtool pam verify-sig systemd tmpfiles
|
||||||
|
|
||||||
DESCRIPTION="Utilities to deal with user accounts"
|
DESCRIPTION="Utilities to deal with user accounts"
|
||||||
HOMEPAGE="https://github.com/shadow-maint/shadow"
|
HOMEPAGE="https://github.com/shadow-maint/shadow"
|
||||||
@ -14,7 +15,7 @@ SRC_URI+=" verify-sig? ( https://github.com/shadow-maint/shadow/releases/downloa
|
|||||||
LICENSE="BSD GPL-2"
|
LICENSE="BSD GPL-2"
|
||||||
# Subslot is for libsubid's SONAME.
|
# Subslot is for libsubid's SONAME.
|
||||||
SLOT="0/4"
|
SLOT="0/4"
|
||||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||||
IUSE="acl audit bcrypt cracklib nls pam selinux skey split-usr su xattr"
|
IUSE="acl audit bcrypt cracklib nls pam selinux skey split-usr su xattr"
|
||||||
# Taken from the man/Makefile.am file.
|
# Taken from the man/Makefile.am file.
|
||||||
LANGS=( cs da de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW )
|
LANGS=( cs da de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW )
|
||||||
@ -103,14 +104,14 @@ set_login_opt() {
|
|||||||
comment="#"
|
comment="#"
|
||||||
sed -i \
|
sed -i \
|
||||||
-e "/^${opt}\>/s:^:#:" \
|
-e "/^${opt}\>/s:^:#:" \
|
||||||
"${ED}"/etc/login.defs || die
|
"${ED}"/usr/share/shadow/login.defs || die
|
||||||
else
|
else
|
||||||
sed -i -r \
|
sed -i -r \
|
||||||
-e "/^#?${opt}\>/s:.*:${opt} ${val}:" \
|
-e "/^#?${opt}\>/s:.*:${opt} ${val}:" \
|
||||||
"${ED}"/etc/login.defs
|
"${ED}"/usr/share/shadow/login.defs
|
||||||
fi
|
fi
|
||||||
local res=$(grep "^${comment}${opt}\>" "${ED}"/etc/login.defs)
|
local res=$(grep "^${comment}${opt}\>" "${ED}"/usr/share/shadow/login.defs)
|
||||||
einfo "${res:-Unable to find ${opt} in /etc/login.defs}"
|
einfo "${res:-Unable to find ${opt} in /usr/share/shadow/login.defs}"
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
@ -121,29 +122,41 @@ src_install() {
|
|||||||
|
|
||||||
find "${ED}" -name '*.la' -type f -delete || die
|
find "${ED}" -name '*.la' -type f -delete || die
|
||||||
|
|
||||||
insinto /etc
|
# Remove files from /etc, they will be symlinks to /usr instead.
|
||||||
|
rm -f "${ED}"/etc/{limits,login.access,login.defs,securetty,default/useradd}
|
||||||
|
|
||||||
|
# CoreOS: break shadow.conf into two files so that we only have to apply
|
||||||
|
# etc-shadow.conf in the initrd.
|
||||||
|
dotmpfiles "${FILESDIR}"/tmpfiles.d/etc-shadow.conf
|
||||||
|
dotmpfiles "${FILESDIR}"/tmpfiles.d/var-shadow.conf
|
||||||
|
# Package the symlinks for the SDK and containers.
|
||||||
|
systemd-tmpfiles --create --root="${ED}" "${FILESDIR}"/tmpfiles.d/*
|
||||||
|
|
||||||
|
insinto /usr/share/shadow
|
||||||
if ! use pam ; then
|
if ! use pam ; then
|
||||||
insopts -m0600
|
insopts -m0600
|
||||||
doins etc/login.access etc/limits
|
doins etc/login.access etc/limits
|
||||||
fi
|
fi
|
||||||
|
# Using a securetty with devfs device names added
|
||||||
|
# (compat names kept for non-devfs compatibility)
|
||||||
|
insopts -m0600 ; doins "${FILESDIR}"/securetty
|
||||||
|
# Output arch-specific cruft
|
||||||
|
local devs
|
||||||
|
case $(tc-arch) in
|
||||||
|
ppc*) devs="hvc0 hvsi0 ttyPSC0";;
|
||||||
|
hppa) devs="ttyB0";;
|
||||||
|
arm) devs="ttyFB0 ttySAC0 ttySAC1 ttySAC2 ttySAC3 ttymxc0 ttymxc1 ttymxc2 ttymxc3 ttyO0 ttyO1 ttyO2";;
|
||||||
|
sh) devs="ttySC0 ttySC1";;
|
||||||
|
amd64|x86) devs="hvc0";;
|
||||||
|
esac
|
||||||
|
if [[ -n ${devs} ]]; then
|
||||||
|
printf '%s\n' ${devs} >> "${ED}"/usr/share/shadow/securetty
|
||||||
|
fi
|
||||||
|
|
||||||
# needed for 'useradd -D'
|
# needed for 'useradd -D'
|
||||||
insinto /etc/default
|
|
||||||
insopts -m0600
|
insopts -m0600
|
||||||
doins "${FILESDIR}"/default/useradd
|
doins "${FILESDIR}"/default/useradd
|
||||||
|
|
||||||
if use split-usr ; then
|
|
||||||
# move passwd to / to help recover broke systems #64441
|
|
||||||
# We cannot simply remove this or else net-misc/scponly
|
|
||||||
# and other tools will break because of hardcoded passwd
|
|
||||||
# location
|
|
||||||
dodir /bin
|
|
||||||
mv "${ED}"/usr/bin/passwd "${ED}"/bin/ || die
|
|
||||||
dosym ../../bin/passwd /usr/bin/passwd
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "${S}" || die
|
|
||||||
insinto /etc
|
|
||||||
insopts -m0644
|
insopts -m0644
|
||||||
newins etc/login.defs login.defs
|
newins etc/login.defs login.defs
|
||||||
|
|
||||||
@ -197,7 +210,7 @@ src_install() {
|
|||||||
-e 'b exit' \
|
-e 'b exit' \
|
||||||
-e ': pamnote; i# NOTE: This setting should be configured via /etc/pam.d/ and not in this file.' \
|
-e ': pamnote; i# NOTE: This setting should be configured via /etc/pam.d/ and not in this file.' \
|
||||||
-e ': exit' \
|
-e ': exit' \
|
||||||
"${ED}"/etc/login.defs || die
|
"${ED}"/usr/share/shadow/login.defs || die
|
||||||
|
|
||||||
# Remove manpages that pam will install for us
|
# Remove manpages that pam will install for us
|
||||||
# and/or don't apply when using pam
|
# and/or don't apply when using pam
|
||||||
|
Loading…
Reference in New Issue
Block a user