Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions meta-edgeos/recipes-connectivity/openssh/openssh_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# meta-edgeos/recipes-connectivity/openssh/openssh_%.bbappend

do_install:append() {
if [ "${EDGEOS_DISABLE_ROOT_SSH}" = "1" ]; then
install -d ${D}${sysconfdir}/ssh/sshd_config.d
cat > ${D}${sysconfdir}/ssh/sshd_config.d/10-disable-root.conf <<'EOF'
PermitRootLogin no
PasswordAuthentication yes
PermitEmptyPasswords yes
UsePAM no
EOF
fi
}

# The file is only installed when the flag is "1",
# but it's safe to declare it in FILES regardless.
FILES:${PN}-sshd += "${sysconfdir}/ssh/sshd_config.d/10-disable-root.conf"
15 changes: 15 additions & 0 deletions meta-edgeos/recipes-core/edgeos-user/edgeos-user_1.0.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SUMMARY = "Create 'admin' user (UID 1000) with home directory"
DESCRIPTION = "Adds a non-root 'admin' user and /home/admin. Password is cleared at image time via EXTRA_USERS_PARAMS when EDGEOS_DISABLE_ROOT_SSH=1."
LICENSE = "CLOSED"
PR = "r0"

inherit useradd

USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "-u 1000 -d /home/admin -m -s /bin/bash admin"
FILES:${PN} += "/home/admin"

do_install() {
install -d ${D}/home/admin
chown -R 1000:1000 ${D}/home/admin || true
}
9 changes: 9 additions & 0 deletions meta-edgeos/recipes-core/images/edgeos-image.bb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ BUILDCFG_VARS += " \
# Disable WIC's automatic fstab updates
WIC_CREATE_EXTRA_ARGS = "--no-fstab-update"

IMAGE_INSTALL += "${@bb.utils.contains('EDGEOS_DISABLE_ROOT_SSH', '1', 'edgeos-user', '', d)}"

ROOTFS_POSTPROCESS_COMMAND += "edgeos_make_admin_nopass;"

edgeos_make_admin_nopass () {
if [ "${EDGEOS_DISABLE_ROOT_SSH}" = "1" ] && [ -f ${IMAGE_ROOTFS}/etc/shadow ]; then
sed -i 's/^admin:[^:]*:/admin::/' ${IMAGE_ROOTFS}/etc/shadow || true
fi
}
# Provider for 'hostname' required by avahi-daemon
IMAGE_INSTALL:append = " inetutils-hostname"

Expand Down