CIP-dev archive mirror
 help / color / mirror / Atom feed
From: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>
To: jan.kiszka@siemens.com, cip-dev@lists.cip-project.org,
	venkata.pyla@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com,
	kazuhiro3.hayashi@toshiba.co.jp
Subject: [cip-dev][isar-cip-core][RFC v2 8/9] customization-kernelci: Add dependency to customizations
Date: Tue, 31 Oct 2023 09:37:42 +0100	[thread overview]
Message-ID: <20231031084943.3105056-9-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20231031084943.3105056-1-Quirin.Gylstorff@siemens.com>

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This is to simplify maintenance.

Also extract serial getty override and sshd_config
changes from postinstall to seperate files.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../kernelci-customizations/files/postinst     | 11 -----------
 .../files/serial-getty-kernelci-override.conf  |  3 +++
 .../files/ssh-permit-empty-passwords.conf      |  2 ++
 .../kernelci-customizations.bb                 | 18 ++++++++++++++----
 4 files changed, 19 insertions(+), 15 deletions(-)
 create mode 100644 recipes-core/kernelci-customizations/files/serial-getty-kernelci-override.conf
 create mode 100644 recipes-core/kernelci-customizations/files/ssh-permit-empty-passwords.conf

diff --git a/recipes-core/kernelci-customizations/files/postinst b/recipes-core/kernelci-customizations/files/postinst
index 7ae30e8..08544a4 100644
--- a/recipes-core/kernelci-customizations/files/postinst
+++ b/recipes-core/kernelci-customizations/files/postinst
@@ -15,20 +15,9 @@
 echo "CIP Core Demo & Test Image" > /etc/issue
 
 # permit root login without password
-echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
-echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
 passwd root -d
 
-# serial getty service for autologin
-mkdir -p /etc/systemd/system/serial-getty@.service.d/
-echo "[Service]" > /etc/systemd/system/serial-getty@.service.d/override.conf
-echo "ExecStart=" >> /etc/systemd/system/serial-getty@.service.d/override.conf
-echo "ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM" >> /etc/systemd/system/serial-getty@.service.d/override.conf
-
 # set the profile for KernelCI
 echo "PS1='\$(pwd) # '" > /root/.profile
 echo "cd /" >> /root/.profile
 
-HOSTNAME=demo
-echo "$HOSTNAME" > /etc/hostname
-echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
diff --git a/recipes-core/kernelci-customizations/files/serial-getty-kernelci-override.conf b/recipes-core/kernelci-customizations/files/serial-getty-kernelci-override.conf
new file mode 100644
index 0000000..a1472c5
--- /dev/null
+++ b/recipes-core/kernelci-customizations/files/serial-getty-kernelci-override.conf
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM
diff --git a/recipes-core/kernelci-customizations/files/ssh-permit-empty-passwords.conf b/recipes-core/kernelci-customizations/files/ssh-permit-empty-passwords.conf
new file mode 100644
index 0000000..b958fec
--- /dev/null
+++ b/recipes-core/kernelci-customizations/files/ssh-permit-empty-passwords.conf
@@ -0,0 +1,2 @@
+PermitEmptyPasswords yes
+
diff --git a/recipes-core/kernelci-customizations/kernelci-customizations.bb b/recipes-core/kernelci-customizations/kernelci-customizations.bb
index f972be5..3a99884 100644
--- a/recipes-core/kernelci-customizations/kernelci-customizations.bb
+++ b/recipes-core/kernelci-customizations/kernelci-customizations.bb
@@ -11,13 +11,23 @@
 # SPDX-License-Identifier: MIT
 #
 
-require recipes-core/customizations/common.inc
+inherit dpkg-raw
 
 DESCRIPTION = "CIP Core KernelCI image customizations"
 
-SRC_URI += "file://dmesg.sh"
+DEPENDS += "customizations"
+DEBIAN_DEPENDS += "customizations"
 
-do_install:append() {
-  install -v -d ${D}/opt/kernelci
+SRC_URI = "file://postinst \
+           file://dmesg.sh \
+           file://serial-getty-kernelci-override.conf \
+           file://ssh-permit-empty-passwords.conf"
+
+do_install[cleandirs] = "${D}/opt/kernelci/ \
+                         ${D}/etc/systemd/system/serial-getty@.service.d/ \
+                         ${D}/etc/ssh/sshd_config.d/"
+do_install() {
   install -v -m 744 ${WORKDIR}/dmesg.sh ${D}/opt/kernelci/
+  install -v -m 644 ${WORKDIR}/serial-getty-kernelci-override.conf ${D}/etc/systemd/system/serial-getty@.service.d/serial-getty-kernelci-override.conf
+  install -v -m 600 ${WORKDIR}/ssh-permit-empty-passwords.conf ${D}/etc/ssh/sshd_config.d/ssh-permit-empty-passwords.conf
 }
-- 
2.42.0



  parent reply	other threads:[~2023-10-31  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31  8:37 [cip-dev][isar-cip-core][RFC v2 0/9] cleanup of customizations Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 1/9] scripts/deploy-kernelci: Format python code and remove unused import Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 2/9] customizations: Add variable to set the HOSTNAME Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 3/9] customizations: Move ssh configuration from postinst to sshd_config.d Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 4/9] security-customizations: Add dependency to customizations Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 5/9] security-customizations: Fix shell error Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 6/9] security-customizations: Extract sshd config from postinst to files Quirin Gylstorff
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 7/9] cip-core-image-security: Move packages to security-customization Quirin Gylstorff
2023-10-31  8:37 ` Quirin Gylstorff [this message]
2023-10-31  8:37 ` [cip-dev][isar-cip-core][RFC v2 9/9] kas/opt/reproducible.yml: Move SOURCE_DATE_EPOCH to layer.conf Quirin Gylstorff
2024-04-04 11:08   ` MOESSBAUER, Felix
2023-11-03  9:11 ` [cip-dev][isar-cip-core][RFC v2 0/9] cleanup of customizations Venkata.Pyla
2023-11-03  9:38 ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231031084943.3105056-9-Quirin.Gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=dinesh.kumar@toshiba-tsip.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kazuhiro3.hayashi@toshiba.co.jp \
    --cc=venkata.pyla@toshiba-tsip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).