mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-26 16:11:56 +02:00
overlay net-misc/openssh: Apply Flatcar modifications
None of these modifications are Flatcar-specific. We are trying to upstream them in https://github.com/gentoo/gentoo/pull/31615. When they reach Gentoo, we can move net-misc/openssh to portage-stable.
This commit is contained in:
parent
21c3c57ce9
commit
51e1bd31b5
@ -229,6 +229,37 @@ src_test() {
|
|||||||
emake -j1 "${tests[@]}" </dev/null
|
emake -j1 "${tests[@]}" </dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insert_include() {
|
||||||
|
local src_config="${1}" options="${2}" includedir="${3}"
|
||||||
|
local name copy regexp_options regexp lineno comment_options
|
||||||
|
|
||||||
|
name=${src_config##*/}
|
||||||
|
copy="${T}/${name}"
|
||||||
|
cp -a "${src_config}" "${copy}" || die
|
||||||
|
|
||||||
|
# Catch "Option ", "#Option " or "# Option ".
|
||||||
|
regexp_options=${options//,/'\|'}
|
||||||
|
regexp='^[[:space:]]*#\?[[:space:]]*\('"${regexp_options}"'\)[[:space:]]'
|
||||||
|
lineno=$(set -o pipefail; grep -ne "${regexp}" -m 1 "${copy}" | cut -d : -f 1 || die)
|
||||||
|
# We have found a first line with the option, now find a first
|
||||||
|
# non-comment line just above the comments of the option. The
|
||||||
|
# lineno - 2 is here to ignore the line just above the option
|
||||||
|
# in case the comment block is separated by an empty line.
|
||||||
|
lineno=$(set -o pipefail; head -n $((lineno - 2)) "${copy}" | grep -ne '^[[:space:]]*\([^#]\|$\)' | tail -n 1 | cut -d : -f 1 || die)
|
||||||
|
|
||||||
|
comment_options=${options//,/ or }
|
||||||
|
{
|
||||||
|
head -n "${lineno}" "${copy}" || die
|
||||||
|
cat <<-EOF || die
|
||||||
|
# Make sure that all ${comment_options} options are below this Include!
|
||||||
|
Include "${EPREFIX}/${includedir}/*.conf"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
tail -n "+${lineno}" "${copy}" || die
|
||||||
|
} >"${src_config}"
|
||||||
|
rm -f "${copy}" || die
|
||||||
|
}
|
||||||
|
|
||||||
# Gentoo tweaks to default config files.
|
# Gentoo tweaks to default config files.
|
||||||
tweak_ssh_configs() {
|
tweak_ssh_configs() {
|
||||||
local locale_vars=(
|
local locale_vars=(
|
||||||
@ -242,12 +273,9 @@ tweak_ssh_configs() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
dodir /etc/ssh/ssh_config.d /etc/ssh/sshd_config.d
|
dodir /etc/ssh/ssh_config.d /etc/ssh/sshd_config.d
|
||||||
cat <<-EOF >> "${ED}"/etc/ssh/ssh_config || die
|
|
||||||
Include "${EPREFIX}/etc/ssh/ssh_config.d/*.conf"
|
insert_include "${ED}"/etc/ssh/ssh_config 'Host,Match' '/etc/ssh/ssh_config.d'
|
||||||
EOF
|
insert_include "${ED}"/etc/ssh/sshd_config 'Match' '/etc/ssh/sshd_config.d'
|
||||||
cat <<-EOF >> "${ED}"/etc/ssh/sshd_config || die
|
|
||||||
Include "${EPREFIX}/etc/ssh/sshd_config.d/*.conf"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<-EOF >> "${ED}"/etc/ssh/ssh_config.d/9999999gentoo.conf || die
|
cat <<-EOF >> "${ED}"/etc/ssh/ssh_config.d/9999999gentoo.conf || die
|
||||||
# Send locale environment variables (bug #367017)
|
# Send locale environment variables (bug #367017)
|
||||||
@ -266,6 +294,10 @@ tweak_ssh_configs() {
|
|||||||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Move sshd's Subsystem option to a drop-in file.
|
||||||
|
grep -ie 'subsystem' "${ED}"/etc/ssh/sshd_config >"${ED}"/etc/ssh/sshd_config.d/9999999gentoo-subsystem.conf || die
|
||||||
|
sed -i -e '/[Ss]ubsystem/d' "${ED}"/etc/ssh/sshd_config
|
||||||
|
|
||||||
cat <<-EOF >> "${ED}"/etc/ssh/sshd_config.d/9999999gentoo.conf || die
|
cat <<-EOF >> "${ED}"/etc/ssh/sshd_config.d/9999999gentoo.conf || die
|
||||||
# Allow client to pass locale environment variables (bug #367017)
|
# Allow client to pass locale environment variables (bug #367017)
|
||||||
AcceptEnv ${locale_vars[*]}
|
AcceptEnv ${locale_vars[*]}
|
||||||
@ -291,6 +323,10 @@ tweak_ssh_configs() {
|
|||||||
PermitRootLogin Yes
|
PermitRootLogin Yes
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local sshd_drop_ins=("${ED}"/etc/ssh/sshd_config.d/*.conf)
|
||||||
|
fperms 0700 /etc/ssh/sshd_config.d
|
||||||
|
fperms 0600 "${sshd_drop_ins[@]#${ED}}"
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user