From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Thu, 30 Oct 2025 10:45:42 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-ej1-f61.google.com (mail-ej1-f61.google.com [209.85.218.61]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 59U9jfGE005665 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 30 Oct 2025 10:45:41 +0100 Received: by mail-ej1-f61.google.com with SMTP id a640c23a62f3a-b4635c413a7sf119487566b.1 for ; Thu, 30 Oct 2025 02:45:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1761817533; cv=pass; d=google.com; s=arc-20240605; b=Rxs+g35aROs/3gEOaLy9j82h+qKGkNQjLuGq3gIEYHxxAK688IlD5kreOw6uQRTZUE Ty/5RGevQdDX/UwO1VEgNuqz6XOfG9fZZuu5TkYbsu/kV9l60RM+gqst+4lWWv20EhG8 mAf+JOt0iriMnR4+QOO0jv7Tzdg9HLr6vtibwROP9ycjvS20dtbmvCOG2MVmf9bqxn3j wgOpSV6F6GT3yxICkpkAYOuhSTZe5K80TSEkJk3KrbjLPQnsVt03jD/0qkmos0HAsf/B ydUfwkgSpVt2sYkabq9S/6lRG1p04Zi/LzlgUO8CCPPjKuwqtNBdbHa1eO8JljCwWdqq P2Lw== 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=3Fni9q2iu6tB9zJq7eSn5ELoZSPBul+R+NuUcBU6Gp8=; fh=LX511lCpDHy0yzIiSyfi3b/AxIriPWQzix3jbUSyCZI=; b=cvjDX0ItTaekStLQ0rtmQFrVHQhmY1jtVsaGgt/dO5vmIQgWkcExqMztgi4eILIhri DQ60rGxyC/iWLqvM2kzHxCOgqqyPL5qNrVPz8X+zjLBwLq+8UWQQmGXT1ursvKPT4qQw OoSbTEncb7I2ZxYWNgR8gyBTAUdSj5LZvlRJhhpsViNexyKmq4eCzY6nCtxcmQVcZgcK 5cz5kBTZZWWxmRetiDCVa6dMwXn/TiohQkMADXPUBYS1GwnYW0bMgb0U+uBZI8exXNVU j7hXRbjkdlxk9C9Rih+E9f4GRtIyS7cHQ6tWFjIcwHnoIqcicGrX4ZClfPGXjz4gvpEV acdQ==; darn=ilbers.de ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=Ilt7+ar4; spf=pass (google.com: domain of fm-51332-202510300945294205f8d66b0002072d-khpg4e@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-51332-202510300945294205f8d66b0002072d-KhPg4e@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=1761817533; x=1762422333; darn=ilbers.de; 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=3Fni9q2iu6tB9zJq7eSn5ELoZSPBul+R+NuUcBU6Gp8=; b=vbHovh64ZLBu7FRnasqdO6tiB9gi6GQNSmr1LxzGem95U/ADgwlY8VfWHfMMli6/hQ Elef419qmjXCpX20wSamsm5SZI15zT8ddl1JWI+d2cxvuGrjr4GmvI7sfm7SikujDXPK sGIRRwCL79ar2H1ZxRu6NXaikyvY866OYzrtuMoshlAQ5SaEU9VOZoHOQb91RvuJ4xUV gan+6rsfoIxSL9VMFgS0bwEMJsbyRE/JD5iT5P5CXA5hgLRGu4lprPZ55FgsryCn0D/d uWCB/r/C49ZUUfjIY/tRvZhRLvmrUBG/8bOu4oA64g4XIwNiIR0jqnAOje/2UeoQvcgv +Shw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761817533; x=1762422333; 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=3Fni9q2iu6tB9zJq7eSn5ELoZSPBul+R+NuUcBU6Gp8=; b=o6yK6QebjipLeUO5EGfwh4ofBQEayUYCad2Mx27fSNigPBo2EH6xodU68OGCGE658d 9lplQMg469M9FL6oz9YD7f3Y3W1I6hv5DmR2eOjHay+z6UvFVTMuDRbUrRtfZ2DqcWnO rC6pBnDhy0N7BXubG7oOKQUM3dARl4NvBcb8JGkpJNV5Es8dwCNiLZ0z5ZtCNyENXTzc GAaFVFIVJnKvvfYXdrd3jm23gdiIi6I6yhY/9Dz9UNx9TIhWpo0dyp5BtUtyuwa+0tS0 nbjJX6TEhSEfg33Orjg4GPCqto39LoVz05pfaIeQYzb2Y9WtFrA52ZAamkspjHnGr7lH 68/g== X-Forwarded-Encrypted: i=2; AJvYcCXybFV5ULqEG0CJ4eCGEp7edJI2EoQhSSJCkXlBdWWb57TkXgfLXij3T1oB65hx+53nxmLP@ilbers.de X-Gm-Message-State: AOJu0YypiuUoDQmxHyVOTcNcAb74Vlp5eGC4vbge/jWVcDgu5fnUw80X +RX9WGWe2v7xKvaI5qI61f2mcLnZmvD3fl5bZOkzVyqJjayhdRunALNv X-Google-Smtp-Source: AGHT+IHHHJQs/4ix09MdB8LpAr8bYvpI6yIb474FmUGAmnkusY9LILmA8ca6UmyUkCOZzan6dY7obw== X-Received: by 2002:a17:907:702:b0:b5f:d46c:4b7 with SMTP id a640c23a62f3a-b703d5dff64mr609597766b.55.1761817532785; Thu, 30 Oct 2025 02:45:32 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com; h="Ae8XA+bQLJsSvKVA/LBrqCYKRLySjfn/g5qhXz7jL0VjFEGk6A==" Received: by 2002:a50:9f61:0:b0:63b:f5ce:2fff with SMTP id 4fb4d7f45d1cf-640604779cbls1036546a12.1.-pod-prod-02-eu; Thu, 30 Oct 2025 02:45:29 -0700 (PDT) X-Received: by 2002:a17:907:7253:b0:b6d:2c70:4542 with SMTP id a640c23a62f3a-b703d4f7dfemr599848566b.30.1761817529637; Thu, 30 Oct 2025 02:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1761817529; cv=none; d=google.com; s=arc-20240605; b=jUIeBN6OHAb5IjSNR2d2CzX6sK4JA5mqLtRpJKjBdXJfgNsNOuF01tWkzNCLfVN1gw 3DtwExRDhGKYWmpu6QxLDLCNlh1zfoSSU8BIwS9idcJUQ750Dt5qY5CmqQMwK847WX/k MuKBV3yCtBwxqE7RpRrmLyKuU0MUWo0w9j9K8kDCWPk9zwRhNSlmjIZjLcygalb9pySC 0zk+y3LvW0eji9iO1oJpub17g9ODYMvPXAGuW/f5kyZa64aNs0zuAkwTPXnwDyStPgCT YKrtXffRsUXRFJS7Fvq2Q+6+h2zoULpgqVbZpty415OMiM1oWmEEk4quBqytdgDJzchb hsDg== 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=v4tkbqK/Alb0ZAegbbxvaDCKpyK2p0DrELQKyTnuuJk=; fh=pD9NMAE6punlmxDz2SM7DMFwkWrKOHAvTYxfub7CxRs=; b=IEAy1b7gQz8/Fi2It7Mz8vLW3pzIrHNQToGJjSl/UMWFO3dkgUzGhZzYZzrxB2zKb4 Lp3zqh6x71MThCmzhEMFvR76XiMOV1XQv0QXjepED3ATcjWKYK1dGrMaPYVpCO9C+xyN gpxvEyLpsvolHhZaJ2ziFr/kC8lW6vvGiifgOt3jawNG2EyKiFi+WqxuhlYTww024XYt j+WRwe/AlNS2paMuDOaQUuCIWzS0rqPiPCZyYGugzZj3hm/xwFQqF29ouMjMaCHlLPLs N67e9AndcdDXr2q18i/qOSf1IMuYc8ru94T2ZFxCPLsM/EefCGX9EHogdTjzLeV2fieW S6OA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=Ilt7+ar4; spf=pass (google.com: domain of fm-51332-202510300945294205f8d66b0002072d-khpg4e@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-51332-202510300945294205f8d66b0002072d-KhPg4e@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net. [185.136.64.227]) by gmr-mx.google.com with ESMTPS id a640c23a62f3a-b6d8728c76asi26455366b.1.2025.10.30.02.45.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2025 02:45:29 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-51332-202510300945294205f8d66b0002072d-khpg4e@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) client-ip=185.136.64.227; Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 202510300945294205f8d66b0002072d for ; Thu, 30 Oct 2025 10:45:29 +0100 From: "'Quirin Gylstorff' via isar-users" To: isar-users@googlegroups.com, jan.kiszka@siemens.com, felix.moessbauer@siemens.com, cedric.hombourger@siemens.com Subject: [PATCH v5 11/12] Use lighttpd as a example how to add a dracut module Date: Thu, 30 Oct 2025 10:44:45 +0100 Message-ID: <20251030094451.1303871-12-Quirin.Gylstorff@siemens.com> In-Reply-To: <20251030094451.1303871-1-Quirin.Gylstorff@siemens.com> References: <20251030094451.1303871-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=fm1 header.b=Ilt7+ar4; spf=pass (google.com: domain of fm-51332-202510300945294205f8d66b0002072d-khpg4e@rts-flowmailer.siemens.com designates 185.136.64.227 as permitted sender) smtp.mailfrom=fm-51332-202510300945294205f8d66b0002072d-KhPg4e@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 Content-Type: text/plain; charset="UTF-8" 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-TUID: GggmkCX5435Z From: Quirin Gylstorff This example allows to add the lighttpd webserver to the initrd. The example shows the following use cases: - add a own service to the initrd - add a user via systemd - add file to configure a service Signed-off-by: Quirin Gylstorff --- .../dracut-example-lighttpd_0.1.bb | 44 ++++++++++++++++ .../dracut-example-lighttpd/files/install.sh | 20 +++++++ .../files/lighttpd.conf | 52 +++++++++++++++++++ .../files/lighttpd.service | 13 +++++ .../files/sysuser-lighttpd.conf | 2 + .../recipes-initramfs/images/isar-dracut.bb | 8 +++ 6 files changed, 139 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..5889a5ed --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb @@ -0,0 +1,44 @@ +# +# Copyright (c) Siemens AG, 2025 +# +# Authors: +# Quirin Gylstorff +# +# SPDX-License-Identifier: MIT +# +# This example adds the lighttpd server to the dracut initrd + +require recipes-initramfs/dracut-module/dracut-module.inc + +# Additional install instructions +DRACUT_INSTALL_CONTENT_FILE_NAME = "install.sh" + +DEBIAN_DEPENDS:append = ",lighttpd, kbd, passwd, \ + dracut-network, dbus-daemon, iproute2, \ + dracut-example-lighttpd, systemd-sysv, systemd-resolved, systemd-timesyncd" + +DEBIAN_DEPENDS:append:trixie = ", systemd-cryptsetup" + + +SRC_URI += "file://lighttpd.conf \ + file://lighttpd.service \ + file://sysuser-lighttpd.conf \ + " + +# lighttpd binaries +DRACUT_REQUIRED_BINARIES = "lighttpd \ + lighttpd-angel \ + lighttpd-disable-mod \ + lighttpd-enable-mod \ + lighty-enable-mod \ + " +# we need networking +DRACUT_MODULE_DEPENDENCIES = "systemd-network-management" + +do_install[cleandirs] += "${D}/usr/lib/sysusers.d/" +do_install() { + install -m 666 ${WORKDIR}/lighttpd.conf ${DRACUT_MODULE_PATH} + install -m 666 ${WORKDIR}/lighttpd.service ${DRACUT_MODULE_PATH} + # install sysuser to be used by dracut + 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..b7295b94 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh @@ -0,0 +1,20 @@ +inst_multiple -o /usr/lib/lighttpd/*.so +inst_multiple -o /usr/share/lighttpd/* + +inst_simple "${moddir}/lighttpd.service" "$systemdsystemunitdir/lighttpd.service" +inst_simple "${moddir}/lighttpd.conf" /etc/lighttpd/lighttpd.conf + +# use the sysuser lighttpd config to create the necessary user +inst_sysusers lighttpd.conf + +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/" +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..37060a65 --- /dev/null +++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf @@ -0,0 +1,2 @@ +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..aa55e360 100644 --- a/meta-isar/recipes-initramfs/images/isar-dracut.bb +++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb @@ -14,4 +14,12 @@ INITRAMFS_PREINSTALL += " \ # Recipes that should be installed into the initramfs build rootfs. INITRAMFS_INSTALL += " \ + dracut-example-lighttpd \ " + +# This option does not work with some of the dracut modules in Debian +# as there is no standardized mapping between module name and package name +DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES = "True" + +# Alternative is to add the example module manually +#DRACUT_EXTRA_MODULES += "example-lighttpd" -- 2.51.0 -- You received this message because you are subscribed to the Google Groups "isar-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251030094451.1303871-12-Quirin.Gylstorff%40siemens.com.