From patchwork Mon Oct 6 18:31:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quirin Gylstorff X-Patchwork-Id: 4392 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 06 Oct 2025 20:32:29 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-qt1-f184.google.com (mail-qt1-f184.google.com [209.85.160.184]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 596IWRvF029588 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 6 Oct 2025 20:32:27 +0200 Received: by mail-qt1-f184.google.com with SMTP id d75a77b69052e-4de2c597a6esf193271451cf.1 for ; Mon, 06 Oct 2025 11:32:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1759775539; cv=pass; d=google.com; s=arc-20240605; b=DDgXA/LY472gPhztMd7Qs8+9jpTyjwvgGztuaKzw7rusyuImmSZir72Yoi6HLaNPpS l1mP1SYdzyQYKGbeFzBqcqSIa1Gzwh1/DWdYDWXppw0WI7XuTlJ1MuemcpQjZnMUlPhL HphF0UzcbauFAOiKBM4QG6PxdlEJqIhowRuqbl1HGrHRr3zasL/uOh0nVs3xd0OsDpbA IgXqb04x08oLAJF73+gqAAU9JnhS6ORuSl427+BEU/9lr0gQHF6FF1G4zn0qhDsS0ETD YEVuW4mfNSjD3oM95+hJNvSu1iC00tZIB40qe1bhe3UqoHfCqHh4F3TUb8XWUvWmiGOi 065w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5mdpFuzdi09NNabtTZjlRtITK2YUvNHC7P9k6k/Tpoo=; fh=tdvCMZzCzacIDBM6bUITiFfrfLWBYfszz3bgOYxLnFU=; b=UHeY1hYj013hEGHgqz04oAPUz7vuNufqobRW67At52OMKxP6S8u43ggcSXuAo6HGKw cHmsATgYfWxwQK2MjErPlAZuDF8zfTwmLhvTtNOmNf4drsH2YAgzcqtu/GHTLnqaa8SN eqQ4QzVLuppEKxpTu9jhU9vbtdLtQsv+dxxrDRREgumD3k78YVZwyJog6diQoEilKrfZ /lAr/N/687f2evzmX2cizvhckYnhg9fUcp/i3oVbPnrCT42p+AAcoJAQ6U2eve/POGJp /SwuCUCoaG1YJZPIAC7oGiQ9MFhuiBNPsGpS7y9XIY7FSe/VLRkGLb0IFoamKDt2Pzm6 DUtg==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=NziMGsGM; spf=pass (google.com: domain of fm-51332-20251006183217f1cb3878fe00020708-5pmw3p@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-51332-20251006183217f1cb3878fe00020708-5PmW3p@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1759775539; x=1760380339; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=5mdpFuzdi09NNabtTZjlRtITK2YUvNHC7P9k6k/Tpoo=; b=HjIj1tXO4DZi8ONzYaczjYCt2igQPSPmguRhbdBBsWZFmhmtEQrwA51VN4I1glIwiZ oUWApgqNFVs1enMenDp76T1u76CcXR2N642DeJmQQG3Reqy1fcABMnAVkmg2sZ0PJ+d4 WX5tyt07LWo8Baz4gHrEeyksgTv+Al0nEXoZq/5vn4upOt8NTzMe3rZUu3px7V3A9+Mg RX+WqeUCKspAoA4ahTuh4E830vTLs2WCMjzVW6Lk/POe44i2Tc/DAXlXol2TE1cMLAwD 3UCKrh6M2DULAWysAYyDKsQf9QW/ew4yUa9FUnm1QIATgm/hzZjMu6NMd1m/DvcTbtgT Mf4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759775539; x=1760380339; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5mdpFuzdi09NNabtTZjlRtITK2YUvNHC7P9k6k/Tpoo=; b=MBO+JwrEJkzL7nYQCMKNNzRRx9qd4VJnUqDl8DIOsK62uiy/KuUv3v8v3KpRdBk2OP h8wRBUuW7q9e2CfdP8lvprYTQ6W59nzQ6IMTDGfxhChgvLLp90BWQIgVC//9rnjB4/ld Z4S3hGrpcaFpQ1ULx6/gTyVOHtU1iIW89J9zC5Wyw4UxXW5JoUTAjgnbi9pUZGyOt12L SaNFnfM1jY1uSxmW4bkJRjKU6leFDCWye5uFF3gvW/j2ZR/dZ8e8Yc/UI0tAdSgLf+Dn yxHWEoXlFrlPJtfQswZXgN7UQo4B2aNE/ooB4W92IXJkNQ9835tx4VyAVs2ETUCFXXg0 imZQ== X-Forwarded-Encrypted: i=2; AJvYcCUQCJuGnyiUQZ8C/BIZitLFO59SlUve/ia8lE6MGkJuzD/CfKSw14ihMQaJc51t7OLE8axUkhg=@isar-build.org X-Gm-Message-State: AOJu0YyCp0qiXxnTdiJrunNT0SDMF8Daot+3cQa0QAdGHV7PDQdxtkma 0MpBsBvdQq2JTKJqtpSOcBpIztSraGlxdNW1PbO6BwdbpkFWEjIJ1ti9 X-Google-Smtp-Source: AGHT+IHCr7dvyvDf+NNcMZBYe/GO9yZhWF9QCtj0LHdXxssMWKyGVt1UbXvnupBtM86/20ngBT52mw== X-Received: by 2002:ac8:7d8e:0:b0:4d1:89c4:822 with SMTP id d75a77b69052e-4e576b09320mr156531801cf.41.1759775539261; Mon, 06 Oct 2025 11:32:19 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com; h="ARHlJd4UG6wa4eGtwh+yKuGy1vJVMZSbdofmtIGAmeIRlJ7aEQ==" Received: by 2002:a05:622a:831a:b0:4d6:c3a2:e1bd with SMTP id d75a77b69052e-4e557dc3436ls102031371cf.0.-pod-prod-04-us; Mon, 06 Oct 2025 11:32:18 -0700 (PDT) X-Received: by 2002:ac8:5a84:0:b0:4b7:a304:edee with SMTP id d75a77b69052e-4e576a5c9bamr159093351cf.3.1759775538184; Mon, 06 Oct 2025 11:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1759775538; cv=none; d=google.com; s=arc-20240605; b=OYaoQbCwkwso+/cGxb2ItSLGgvReEDO4BP8V17yQK+bfj02XXFCHrOD56lIDcqH+48 G4BDhaHxBfdc5jWtdwwIfFSKIv1zm5ew9XKm38Kpu4Xd+WEXvn5K49DKPsNPGogFxeJ0 yAqan0lPexZJMmWKd/BQfhN1Fm7Ug8b7cMUO3Ci3ib8V9htqGQreDjr5r8AG38lWJMgH GU3Lu6pv9ZBdFPWIrY0soI7YNXwEp6UWAVD8BQ4uF2tBeA2jMgDKZU8b8Ce1O98HAvbi Qwv4oCIP2tcOwaTT5aljNhSWnc02kGTcEb/tlodlrItfrxmED/I2lc8RvLiCFFU/nHkC 20Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:to:from:dkim-signature; bh=AKAAhGkyoS5+gX+oImFNyIiKnnkKzYWoSEoFUThYBMs=; fh=pD9NMAE6punlmxDz2SM7DMFwkWrKOHAvTYxfub7CxRs=; b=OVLOunmnJDfLCAiMKRY8w8BnlDVC4KC/j7RRU4L58HVfaKnpLJ0+qMRg9j26t5oj7d IDQhxfef+ZhmquhHlr88716f7P7TW/FA3rns8Of9OJKcThF660EyUR11Qf4BV3gbcGVZ R50rVHJYNz8NsFctjUr0MIuay4EkHq8dbaQPDbeeMorfMmTzCSo2sMnWa2t6tCjTTvJR Aof7wo9RJGCR4KmlfddJTfpBYaGtk5KBPPp/GZzlNGUgNy4kzVAr16WPfjz6X1b70gvF qlSF4nfw9LZpeNZBtwG5bQ3QR2ive/gDoorFEwurwCYnQzxzMoGW1IOCFyJFteWNE7XA IYXQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=NziMGsGM; spf=pass (google.com: domain of fm-51332-20251006183217f1cb3878fe00020708-5pmw3p@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-51332-20251006183217f1cb3878fe00020708-5PmW3p@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net. [185.136.65.225]) by gmr-mx.google.com with ESMTPS id d75a77b69052e-4e55e277614si282851cf.4.2025.10.06.11.32.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Oct 2025 11:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-51332-20251006183217f1cb3878fe00020708-5pmw3p@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) client-ip=185.136.65.225; Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20251006183217f1cb3878fe00020708 for ; Mon, 06 Oct 2025 20:32:17 +0200 X-Patchwork-Original-From: "'Quirin Gylstorff' via isar-users" From: Quirin Gylstorff To: isar-users@googlegroups.com, jan.kiszka@siemens.com, felix.moessbauer@siemens.com, cedric.hombourger@siemens.com Subject: [RFC PATCH v3 09/10] Use lighttpd as a example how to add a dracut module Date: Mon, 6 Oct 2025 20:31:11 +0200 Message-ID: <20251006183214.1593195-10-Quirin.Gylstorff@siemens.com> In-Reply-To: <20251006183214.1593195-1-Quirin.Gylstorff@siemens.com> References: <20251006183214.1593195-1-Quirin.Gylstorff@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-51332:519-21489:flowmailer X-Original-Sender: quirin.gylstorff@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=NziMGsGM; spf=pass (google.com: domain of fm-51332-20251006183217f1cb3878fe00020708-5pmw3p@rts-flowmailer.siemens.com designates 185.136.65.225 as permitted sender) smtp.mailfrom=fm-51332-20251006183217f1cb3878fe00020708-5PmW3p@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Quirin Gylstorff Reply-To: Quirin Gylstorff Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Quirin Gylstorff Signed-off-by: Quirin Gylstorff --- .../dracut-example-lighttpd_0.1.bb | 26 ++++++++++ .../dracut-example-lighttpd/files/install.sh | 21 ++++++++ .../files/lighttpd.conf | 52 +++++++++++++++++++ .../files/lighttpd.service | 13 +++++ .../files/sysuser-lighttpd.conf | 3 ++ .../recipes-initramfs/images/isar-dracut.bb | 3 ++ 6 files changed, 118 insertions(+) create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb new file mode 100644 index 00000000..7895e689 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb @@ -0,0 +1,26 @@ +# +# Copyright (c) Siemens AG, 2025 +# +# Authors: +# Quirin Gylstorff +# +# SPDX-License-Identifier: MIT +# +require recipes-initramfs/dracut-module/dracut-module.inc + +DEBIAN_DEPENDS:append = ",lighttpd" +SRC_URI += "file://install.sh \ + file://lighttpd.conf \ + file://lighttpd.service \ + file://sysuser-lighttpd.conf \ + " +DRACUT_REQUIRED_BINARIES = "lighttpd" +DRACUT_MODULE_DEPENDENCIES = "systemd-network-management" + +do_install[cleandirs] += "${D}/usr/lib/sysusers.d/" +do_install:append() { + install -m 666 ${WORKDIR}/lighttpd.conf ${DRACUT_MODULE_PATH} + install -m 666 ${WORKDIR}/lighttpd.service ${DRACUT_MODULE_PATH} + install -m 666 ${WORKDIR}/sysuser-lighttpd.conf ${D}/usr/lib/sysusers.d/lighttpd.conf +} + diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh new file mode 100644 index 00000000..e7e50ad4 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh @@ -0,0 +1,21 @@ +install() { + inst_binary /usr/sbin/lighttpd + inst_binary /usr/sbin/lighttpd-angel + inst_binary /usr/sbin/lighttpd-disable-mod + inst_binary /usr/sbin/lighttpd-enable-mod + inst_multiple -o /usr/lib/lighttpd/*.so + inst_multiple -o /usr/share/lighttpd/* + inst_simple "${moddir}/lighttpd.service" "$systemdsystemunitdir/lighttpd.service" + mkdir -p -m 0700 "$initdir/etc/lighttpd/" + mkdir -p -m 0700 "$initdir/var/cache/lighttpd/compress" + mkdir -p -m 0700 "$initdir/var/cache/lighttpd/uploads" + mkdir -p -m 0700 "$initdir/var/log/lighttpd/" + mkdir -p -m 0755 "$initdir/var/www/html" + /usr/bin/install -m 0644 /usr/share/lighttpd/index.html "$initdir/var/www/html/index.html" + touch "$moddir"/error.log + /usr/bin/install -m 0644 "$moddir"/error.log "$initdir/var/log/lighttpd/error.log" + chown -R www-data:www-data "$initdir/var/log/lighttpd/" + inst_simple "${moddir}/lighttpd.conf" /etc/lighttpd/lighttpd.conf + inst_sysusers lighttpd.conf + systemctl -q --root "$initdir" enable lighttpd +} diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf new file mode 100644 index 00000000..3a1bb351 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf @@ -0,0 +1,52 @@ +server.modules = ( + "mod_indexfile", + "mod_access", + "mod_alias", + "mod_redirect", +) + +server.document-root = "/var/www/html" +server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) +server.errorlog = "/var/log/lighttpd/error.log" +server.pid-file = "/run/lighttpd.pid" +server.username = "www-data" +server.groupname = "www-data" +server.port = 80 + +# features +#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails +server.feature-flags += ("server.h2proto" => "enable") +server.feature-flags += ("server.h2c" => "enable") +server.feature-flags += ("server.graceful-shutdown-timeout" => 5) +#server.feature-flags += ("server.graceful-restart-bg" => "enable") + +# strict parsing and normalization of URL for consistency and security +# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails +# (might need to explicitly set "url-path-2f-decode" = "disable" +# if a specific application is encoding URLs inside url-path) +server.http-parseopts = ( + "header-strict" => "enable",# default + "host-strict" => "enable",# default + "host-normalize" => "enable",# default + "url-normalize-unreserved"=> "enable",# recommended highly + "url-normalize-required" => "enable",# recommended + "url-ctrls-reject" => "enable",# recommended + "url-path-2f-decode" => "enable",# recommended highly (unless breaks app) + #"url-path-2f-reject" => "enable", + "url-path-dotseg-remove" => "enable",# recommended highly (unless breaks app) + #"url-path-dotseg-reject" => "enable", + #"url-query-20-plus" => "enable",# consistency in query string +) + +index-file.names = ( "index.php", "index.html" ) +url.access-deny = ( "~", ".inc" ) +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) + +# default listening port for IPv6 falls back to the IPv4 port +include "/etc/lighttpd/conf-enabled/*.conf" + +#server.compat-module-load = "disable" +server.modules += ( + "mod_dirlisting", + "mod_staticfile", +) diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service new file mode 100644 index 00000000..da8c9033 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Lighttpd Daemon +DefaultDependencies=no + +[Service] +Type=simple +PIDFile=/run/lighttpd.pid +ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf +ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf +ExecReload=/bin/kill -USR1 $MAINPID +Restart=on-failure +[Install] +WantedBy=sysinit.target diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf new file mode 100644 index 00000000..6507ccf3 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf @@ -0,0 +1,3 @@ +g www-data - - +u www-data - - /var/www /usr/sbin/nologin + diff --git a/meta-isar/recipes-initramfs/images/isar-dracut.bb b/meta-isar/recipes-initramfs/images/isar-dracut.bb index 226fdeaa..95739b12 100644 --- a/meta-isar/recipes-initramfs/images/isar-dracut.bb +++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb @@ -14,4 +14,7 @@ INITRAMFS_PREINSTALL += " \ # Recipes that should be installed into the initramfs build rootfs. INITRAMFS_INSTALL += " \ + dracut-example-lighttpd \ " + +DRACUT_EXTRA_MODULES += "example-lighttpd"