diff options
Diffstat (limited to 'packages/cortexa57-poky-linux/openssh/openssh-sshd')
4 files changed, 184 insertions, 0 deletions
diff --git a/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest new file mode 100644 index 000000000000..150f8248de40 --- /dev/null +++ b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest @@ -0,0 +1,9 @@ +PV = 9.0p1 +PR = r0 +RPROVIDES = sshd +RDEPENDS = base-files base-passwd glibc (>= 2.36) libcrypto (>= 3.0.8) libpam (>= 1.5.2) libxcrypt (>= 4.4.30) openssh-keygen pam-plugin-keyinit pam-plugin-loginuid shadow zlib (>= 1.2.13) +RRECOMMENDS = +RCONFLICTS = dropbear +PKGSIZE = 1763662 +FILES = /usr/sbin/sshd /etc/init.d/sshd /lib/systemd/system /etc/ssh/moduli /etc/ssh/sshd_config /etc/ssh/sshd_config_readonly /etc/default/volatiles/99_sshd /etc/pam.d/sshd /usr/libexec/openssh/sshd_check_keys /lib/systemd/system-preset/98-openssh-sshd.preset /lib/systemd/system/sshd.socket /lib/systemd/system/sshd@.service +FILELIST = /etc/default/volatiles/99_sshd /etc/pam.d/sshd /etc/ssh/moduli /etc/ssh/sshd_config /etc/ssh/sshd_config_readonly /lib/systemd/system-preset/98-openssh-sshd.preset /lib/systemd/system/sshd.socket /lib/systemd/system/sshd@.service /lib/systemd/system/sshdgenkeys.service /usr/libexec/openssh/sshd_check_keys /usr/sbin/sshd diff --git a/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_postinst b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_postinst new file mode 100644 index 000000000000..9fad95745be9 --- /dev/null +++ b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_postinst @@ -0,0 +1,24 @@ +#!/bin/sh +set -e +if systemctl >/dev/null 2>/dev/null; then + OPTS="" + + if [ -n "$D" ]; then + OPTS="--root=$D" + fi + + if [ "enable" = "enable" ]; then + for service in sshd.socket; do + systemctl ${OPTS} enable "$service" + done + fi + + if [ -z "$D" ]; then + systemctl daemon-reload + systemctl preset sshd.socket + + if [ "enable" = "enable" ]; then + systemctl --no-block restart sshd.socket + fi + fi +fi diff --git a/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_preinst b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_preinst new file mode 100644 index 000000000000..8c8512c5b970 --- /dev/null +++ b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_preinst @@ -0,0 +1,142 @@ +#!/bin/sh +set -e +bbnote () { + echo "NOTE: $*" +} +bbwarn () { + echo "WARNING: $*" +} +bbfatal () { + echo "ERROR: $*" + exit 1 +} +perform_groupadd () { + local rootdir="$1" + local opts="$2" + bbnote "openssh: Performing groupadd with [$opts]" + local groupname=`echo "$opts" | awk '{ print $NF }'` + local group_exists="`grep "^$groupname:" $rootdir/etc/group || true`" + if test "x$group_exists" = "x"; then + eval flock -x $rootdir/etc -c \"$PSEUDO groupadd \$opts\" || true + group_exists="`grep "^$groupname:" $rootdir/etc/group || true`" + if test "x$group_exists" = "x"; then + bbfatal "openssh: groupadd command did not succeed." + fi + else + bbnote "openssh: group $groupname already exists, not re-creating it" + fi +} +perform_useradd () { + local rootdir="$1" + local opts="$2" + bbnote "openssh: Performing useradd with [$opts]" + local username=`echo "$opts" | awk '{ print $NF }'` + local user_exists="`grep "^$username:" $rootdir/etc/passwd || true`" + if test "x$user_exists" = "x"; then + eval flock -x $rootdir/etc -c \"$PSEUDO useradd \$opts\" || true + user_exists="`grep "^$username:" $rootdir/etc/passwd || true`" + if test "x$user_exists" = "x"; then + bbfatal "openssh: useradd command did not succeed." + fi + else + bbnote "openssh: user $username already exists, not re-creating it" + fi +} +perform_groupmems () { + local rootdir="$1" + local opts="$2" + bbnote "openssh: Performing groupmems with [$opts]" + local groupname=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-g" || $i == "--group") print $(i+1) }'` + local username=`echo "$opts" | awk '{ for (i = 1; i < NF; i++) if ($i == "-a" || $i == "--add") print $(i+1) }'` + bbnote "openssh: Running groupmems command with group $groupname and user $username" + local mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`" + if test "x$mem_exists" = "x"; then + eval flock -x $rootdir/etc -c \"$PSEUDO groupmems \$opts\" || true + mem_exists="`grep "^$groupname:[^:]*:[^:]*:\([^,]*,\)*$username\(,[^,]*\)*$" $rootdir/etc/group || true`" + if test "x$mem_exists" = "x"; then + bbfatal "openssh: groupmems command did not succeed." + fi + else + bbnote "openssh: group $groupname already contains $username, not re-adding it" + fi +} +OPT="" +SYSROOT="" + +if test "x$D" != "x"; then + # Installing into a sysroot + SYSROOT="$D" + OPT="--root $D" + + # Make sure login.defs is there, this is to make debian package backend work + # correctly while doing rootfs. + # The problem here is that if /etc/login.defs is treated as a config file for + # shadow package, then while performing preinsts for packages that depend on + # shadow, there might only be /etc/login.def.dpkg-new there in root filesystem. + if [ ! -e $D/etc/login.defs -a -e $D/etc/login.defs.dpkg-new ]; then + cp $D/etc/login.defs.dpkg-new $D/etc/login.defs + fi + + # user/group lookups should match useradd/groupadd --root + export PSEUDO_PASSWD="$SYSROOT" +fi + +# If we're not doing a special SSTATE/SYSROOT install +# then set the values, otherwise use the environment +if test "x$UA_SYSROOT" = "x"; then + # Installing onto a target + # Add groups and users defined only for this package + GROUPADD_PARAM="" + USERADD_PARAM="--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd" + GROUPMEMS_PARAM="" +fi + +# Perform group additions first, since user additions may depend +# on these groups existing +if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then + echo "Running groupadd commands..." + # Invoke multiple instances of groupadd for parameter lists + # separated by ';' + opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + while test "x$opts" != "x"; do + perform_groupadd "$SYSROOT" "$OPT $opts" + if test "x$opts" = "x$remaining"; then + break + fi + opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + done +fi + +if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then + echo "Running useradd commands..." + # Invoke multiple instances of useradd for parameter lists + # separated by ';' + opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + while test "x$opts" != "x"; do + perform_useradd "$SYSROOT" "$OPT $opts" + if test "x$opts" = "x$remaining"; then + break + fi + opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + done +fi + +if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then + echo "Running groupmems commands..." + # Invoke multiple instances of groupmems for parameter lists + # separated by ';' + opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + while test "x$opts" != "x"; do + perform_groupmems "$SYSROOT" "$OPT $opts" + if test "x$opts" = "x$remaining"; then + break + fi + opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'` + remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'` + done +fi diff --git a/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_prerm b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_prerm new file mode 100644 index 000000000000..d95a0f2eba8c --- /dev/null +++ b/packages/cortexa57-poky-linux/openssh/openssh-sshd/latest.pkg_prerm @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +if systemctl >/dev/null 2>/dev/null; then + if [ -z "$D" ]; then + systemctl stop sshd.socket + + systemctl disable sshd.socket + fi +fi |