Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package himmelblau for openSUSE:Factory checked in at 2026-12-03 13:57:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/himmelblau (Old) and /work/SRC/openSUSE:Factory/.himmelblau.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "himmelblau" Thu Dec 3 13:57:43 2026 rev:59 rq:1402559 version:4.0.9+git0.ed504443 Changes: -------- --- /work/SRC/openSUSE:Factory/himmelblau/himmelblau.changes 2026-11-27 19:47:01.177940503 +0100 +++ /work/SRC/openSUSE:Factory/.himmelblau.new.1340718/himmelblau.changes 2026-12-03 14:00:16.516775429 +0100 @@ -1,0 +2,114 @@ +Fri Nov 27 08:56:25 UTC 2026 - Samuel Cabrero <[email protected]> + +- Update to version 4.0.9+git0.ed504443: + * cargo vet + * Skip integration for single-pass cargo-vet reviews (#2025) + * cargo audit + * Set libhimmelblau to 0.8.45 in Cargo.toml + * Skip the account lookup without an allow list (#1932) + * Fix Nix builds by removing the portable-atomic mask + * Fix console builds with minimal Jiff-backed humantime shim + * cargo vet + * Fix CI installer failure + * Answer name service lookups without waiting on the network + * fix: use systemd HSM credential during startup + * [4.x] fix: use systemd HSM credential during startup + * feat(fedora): Add support for fedora45 + * Update to libhimmelblau 0.8.45 + * cargo vet + * cargo audit + * Version 4.0.9 + * selinux: allow sshd_t and confined admins to reach himmelblaud (#1962) + * broker, sso: fail fast on a locked screen and reply with errors (#1987) + * Isolate distro version compliance checks (#1961) + * Enable programs.chromium so the Chromium SSO extension is installed (#1937) + * Enable Intune SSO in the Nix o365 wrapper with auth.intune.enabled (#1936) + * selinux: give himmelblau.conf its own type so clients cannot read the token cache (#1966) + * Skip encrypted PIN helper on legacy systemd (#1967) + * Fix the NixOS try_unseal PAM rule's module path (#1939) + * fix: Authentication fails with TAP (#1925) + * Show Entra's reason when a new password is refused (#1904) + * fix: keep daemon tests in place + * deps(rust): bump the all-cargo-updates group across 1 directory with 6 updates + * chore: refresh cargo vet metadata + +------------------------------------------------------------------- +Fri Nov 27 08:55:41 UTC 2026 - Samuel Cabrero <[email protected]> + +- Remove the Debian family and Fedora/EL authselect handling from + the spec file. +- Build the SELinux policy module at build time and install it + with the standard SELinux RPM macros. himmelblau now requires + himmelblau-selinux if selinux-policy-base is installed. +- himmelblau-sshd-config: ship the sshd configuration as a drop-in + in /usr/etc/ssh/sshd_config.d if supported and do not + modify /etc/ssh/sshd_config anymore. +- Do not start himmelblaud and himmelblaud-tasks at install time + anymore and drop the live system detection. Enable them with + "systemctl enable --now himmelblaud.service himmelblaud-tasks.service". +- Drop the removal of unit files in /etc/systemd/system that were + only installed by upstream's own v1.4 packages. +- Move an old himmelblau.conf.rpmsave aside before the local + configuration of releases up to 3.x is restored on upgrade, so + a stale file is not restored by mistake. +- himmelblau-sso-policies: do not change the Firefox and Thunderbird + policies.json files at install time, as they are owned by the + administrator. Add /usr/libexec/himmelblau/sso-policies, which merges + the extension into them with the argument "add" and removes it with + "remove". The URLs are read from the example files. See README.SUSE. + Entries merged by previous versions are left in place. Betterbird is + not handled anymore. The Chrome and Chromium policies are not changed. +- himmelblau-qr-greeter: ship the dconf files enabling the extension + for the GDM login screen and for the lock screen in the package. The + scriptlet creates /etc/dconf/profile/gdm and /etc/dconf/profile/user + if they do not exist, as the profile of gdm has no system database, + and runs "dconf update". The Debian handling is dropped. See + README.SUSE. + Install all files of the extension, except the test files, so new + files like enrollmentqr.js are not missed. +- Keep the state and the caches on uninstall, like sssd does. Do not + delete /var/lib/himmelblaud, the caches or the AccountsService + entries of Entra ID users anymore. +- Do not ship the rchimmelblaud, rchimmelblaud_tasks and + rchimmelblau_broker symlinks. They pointed to the daemon binaries + and not to a service. +- Do not strip the binaries by hand, so the debuginfo and debugsource + packages are generated. +- Use the systemd and ldconfig RPM macros, drop the desktop database + and icon cache scriptlets handled by file triggers and drop the + runtime requirements on make, man and policycoreutils. +- Drop the Group tag, the conditionals for other distributions and + unused build requirements. +- Do not ship the empty himmelblaud.if SELinux interface file. +- Mark the configuration files in /etc as %%config(noreplace), require + the same version of himmelblau in himmelblau-qr-greeter and do not + own directories of hicolor-icon-theme. +- Drop the Provides for names of other distributions and of + unrelated packages (aad-cli, aad-common, authd, authd-msentraid, + libpam-aad, libnss-aad, intune-portal, linux-entra-sso) and the + Recommends and Suggests for himmelblau-apparmor, himmelblau-orchestrator + and cron, which are not part of this package. Recommend + system-user-tss, as tpm2-tss is not a package name in openSUSE. +- Ship the license file in all packages, install the documentation + with the %%doc macro, group the install commands and use macros for + paths. README is now installed as README.md. +- Build with Python 3.11 on SLE 15, as the default python3 is too old + for the build scripts. Add himmelblau-python-env.patch to select the + interpreter with the PYTHON environment variable. +- himmelblau-qr-greeter: add himmelblau-qr-greeter-gnome51.patch to + list GNOME Shell 51 in the extension metadata, as Tumbleweed ships + it and the extension was rejected as incompatible. +- Use the tmpfiles RPM macro. +- Install the documentation in /usr/share/doc/packages. +- pam-himmelblau: enable the module with pam-config on the first + installation only, never on upgrades, and remove it when the + package is uninstalled. The authselect, aad-tool and manual edits + of the PAM configuration are dropped. See README.SUSE. +- libnss_himmelblau2 only uses nsswitch-config. It does not modify + /etc/nsswitch.conf with sed anymore. An nsswitch.conf managed by + the administrator is not changed, see README.SUSE. +- Only install the nsswitch snippet and run nsswitch-config where the + tool exists (Tumbleweed). On other distributions the NSS module is + not enabled by the package. + +------------------------------------------------------------------- Old: ---- himmelblau-4.0.8+git0.a969c748.tar.bz2 New: ---- 01-himmelblau-qr-greeter README.SUSE himmelblau-4.0.9+git0.ed504443.tar.bz2 himmelblau-python-env.patch himmelblau-qr-greeter-gnome51.patch himmelblau-sso-policies ----------(New B)---------- New:- Build with Python 3.11 on SLE 15, as the default python3 is too old for the build scripts. Add himmelblau-python-env.patch to select the interpreter with the PYTHON environment variable. New: interpreter with the PYTHON environment variable. - himmelblau-qr-greeter: add himmelblau-qr-greeter-gnome51.patch to list GNOME Shell 51 in the extension metadata, as Tumbleweed ships ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ himmelblau.spec ++++++ --- /var/tmp/diff_new_pack.7SK5hI/_old 2026-12-03 14:00:21.216974920 +0100 +++ /var/tmp/diff_new_pack.7SK5hI/_new 2026-12-03 14:00:21.221975132 +0100 @@ -16,131 +16,127 @@ # -%define chrome_nm_dir /etc/opt/chrome/native-messaging-hosts -%define chromium_nm_dir /etc/chromium/native-messaging-hosts -%define chrome_policy_dir /etc/opt/chrome/policies/managed -%define chromium_policy_dir /etc/chromium/policies/managed -%define chrome_ext_dir /usr/share/google-chrome/extensions - -# SELinux macros -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 -%define _selinux_sharedir /usr/share/selinux -%define _selinux_pkgdir %{_selinux_sharedir}/packages -%define _selinux_docdir %{_docdir}/himmelblau-selinux/selinux +%define chrome_nm_dir %{_sysconfdir}/opt/chrome/native-messaging-hosts +%define chromium_nm_dir %{_sysconfdir}/chromium/native-messaging-hosts +%define chrome_policy_dir %{_sysconfdir}/opt/chrome/policies/managed +%define chromium_policy_dir %{_sysconfdir}/chromium/policies/managed +%define chrome_ext_dir %{_datadir}/google-chrome/extensions + +%if %{defined _distconfdir} +%define sshd_config_dir %{_distconfdir}/ssh/sshd_config.d +%else +%define sshd_config_dir %{_sysconfdir}/ssh/sshd_config.d +%endif + +# nsswitch-config is only available in Tumbleweed +%if 0%{?suse_version} >= 1699 +%bcond_without nsswitch_config +%else +%bcond_with nsswitch_config +%endif + +%global selinuxtype targeted +%global modulename himmelblaud +# enable selinux for Tumbleweed, SLE-16 and Leap 16 +%if 0%{?suse_version} >= 1600 +%bcond_without selinux +%else +%bcond_with selinux %endif Name: himmelblau -Version: 4.0.8+git0.a969c748 +Version: 4.0.9+git0.ed504443 Release: 0 Summary: Interoperability suite for Microsoft Azure Entra Id License: GPL-3.0-or-later URL: https://github.com/himmelblau-idm/himmelblau -Group: Productivity/Networking/Security Source: %{name}-%{version}.tar.bz2 Source1: vendor.tar.zst Source2: cargo_config Source3: nsswitch-himmelblau.conf +Source4: README.SUSE +Source5: 01-himmelblau-qr-greeter Source6: himmelblau-rpmlintrc -BuildRequires: binutils -BuildRequires: cargo -BuildRequires: cargo-packaging -BuildRequires: clang-devel -BuildRequires: patchelf -BuildRequires: systemd-rpm-macros -%if 0%{?suse_version} -BuildRequires: ca-certificates-mozilla -BuildRequires: fdupes -BuildRequires: nodejs-default -%else -BuildRequires: nodejs -%endif +Source7: himmelblau-sso-policies +# Select the Python interpreter with the PYTHON environment variable +Patch0: himmelblau-python-env.patch +# PATCH-FIX-OPENSUSE himmelblau-qr-greeter-gnome51.patch -- Allow the QR greeter extension to load in GNOME Shell 51 +Patch1: himmelblau-qr-greeter-gnome51.patch BuildRequires: ca-certificates -%if !0%{?suse_version} -BuildRequires: authselect -%endif -BuildRequires: autoconf -BuildRequires: ca-certificates -BuildRequires: checkpolicy +BuildRequires: ca-certificates-mozilla +BuildRequires: cargo >= 1.93 +BuildRequires: cargo-packaging BuildRequires: clang +BuildRequires: clang-devel BuildRequires: cmake -BuildRequires: curl BuildRequires: dbus-1-devel +BuildRequires: dconf +BuildRequires: fdupes BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gettext -BuildRequires: git -BuildRequires: jq +BuildRequires: hicolor-icon-theme BuildRequires: krb5-devel BuildRequires: libcap-devel -BuildRequires: libtool BuildRequires: libudev-devel BuildRequires: libunistring-devel BuildRequires: make -BuildRequires: nsswitch-config +BuildRequires: nodejs-default +BuildRequires: openssh-server BuildRequires: openssl-devel BuildRequires: pam-devel +BuildRequires: patchelf BuildRequires: pcre2-devel BuildRequires: pkg-config -BuildRequires: policycoreutils -BuildRequires: policycoreutils-devel +%if 0%{?suse_version} < 1600 +# SLE 15.x ships Python 3.6; gen_param_code.py requires Python 3.9+ for dataclasses + PEP 585 +BuildRequires: python311-base +%define build_python %{_bindir}/python3.11 +%else BuildRequires: python3 -BuildRequires: rpm-build +%define build_python %{_bindir}/python3 +%endif BuildRequires: sqlite3-devel -BuildRequires: systemd-mini +BuildRequires: systemd-rpm-macros BuildRequires: tpm2-0-tss-devel -BuildRequires: wget -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 +%if %{with selinux} BuildRequires: selinux-policy-devel +BuildRequires: selinux-policy-targeted BuildRequires: selinux-tools +Requires: (%{name}-selinux if selinux-policy-base) %endif ExclusiveArch: %{rust_tier1_arches} -Requires: make -Requires: man -Requires: policycoreutils -Requires: systemd >= 235 -Provides: aad-cli -Provides: aad-common -Provides: authd -Provides: authd-msentraid -Recommends: cron -Recommends: himmelblau-apparmor -Recommends: himmelblau-selinux +%{?systemd_ordering} Recommends: krb5 Recommends: libnss_himmelblau2 Recommends: pam-himmelblau -Recommends: (system-user-tss or tpm2-tss) -Recommends: (tpm2-tools or tpm2.0-tools) +Recommends: system-user-tss +Recommends: tpm2.0-tools Suggests: himmelblau-sso -Suggests: himmelblau-orchestrator %description Himmelblau is an interoperability suite for Microsoft Azure Entra Id and Intune, which allows users to sign into a Linux machine using Azure Entra Id credentials. -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 +%if %{with selinux} %package -n himmelblau-selinux Summary: SELinux policy for Himmelblau Requires: %{name} = %{version} -Requires: make -Requires: policycoreutils -Requires: selinux-policy-devel BuildArch: noarch +%{selinux_requires} %description -n himmelblau-selinux -SELinux policy module sources for Himmelblau, an interoperability suite -for Microsoft Azure Entra Id and Intune. The policy module is compiled -and loaded on the host when the package is installed. +SELinux policy module for Himmelblau, an interoperability suite for +Microsoft Azure Entra Id and Intune. %endif %package -n pam-himmelblau Summary: Azure Entra Id authentication PAM module Requires: %{name} = %{version} -Provides: libpam-aad -Recommends: authselect -Recommends: (oddjob-mkhomedir if authselect) +Requires(post): pam-config >= 2.14 +Requires(preun): pam-config >= 2.14 Suggests: himmelblau-qr-greeter -Suggests: authselect %description -n pam-himmelblau Himmelblau is an interoperability suite for Microsoft Azure Entra Id @@ -150,11 +146,10 @@ %package -n libnss_himmelblau2 Summary: Azure Entra Id authentication NSS module Requires: %{name} = %{version} -Requires(post): /sbin/ldconfig -Requires(postun): /sbin/ldconfig +%if %{with nsswitch_config} Requires(post): nsswitch-config Requires(postun): nsswitch-config -Provides: libnss-aad +%endif Provides: nss-himmelblau %description -n libnss_himmelblau2 @@ -167,7 +162,6 @@ Requires: %{name} = %{version} Requires: openssh-server Supplements: (pam-himmelblau and openssh-server) -BuildRequires: openssh-server BuildArch: noarch %description -n himmelblau-sshd-config @@ -188,9 +182,8 @@ %package -n himmelblau-sso Summary: Azure Entra Id Browser SSO Requires: %{name} = %{version} +Requires: hicolor-icon-theme Requires: himmelblau-broker -Provides: intune-portal -Provides: linux-entra-sso Recommends: curl Recommends: himmelblau-sso-policies Recommends: jq @@ -208,24 +201,26 @@ %package -n himmelblau-sso-policies Summary: Browser policy files for Himmelblau SSO +Requires: jq Recommends: himmelblau-sso -Recommends: jq BuildArch: noarch %description -n himmelblau-sso-policies Browser policy configuration files for Himmelblau SSO. This package -installs policy files that automatically configure Chrome/Chromium and -Firefox to install the required browser extension for SSO functionality. +installs policy files that automatically configure Chrome and Chromium +to install the required browser extension for SSO functionality. -Install this package if you want automatic browser policy configuration. -If you prefer to manage browser policies manually, you can skip this -package and configure the extension installation yourself. +Firefox and Thunderbird read a single policies.json file. The script +himmelblau-sso-policies merges the extension into it, or removes it, when +run by the administrator. Examples are installed in the documentation +directory. %package -n himmelblau-qr-greeter Summary: Azure Entra Id DAG URL QR code GNOME Shell extension +Requires: %{name} = %{version} Requires: gnome-shell -Requires: himmelblau -Recommends: dconf +Requires(post): dconf +Requires(postun): dconf BuildArch: noarch %description -n himmelblau-qr-greeter @@ -233,99 +228,66 @@ when a MS DAG URL is detected. %prep -%autosetup -a1 +%autosetup -a1 -p1 +cp %{SOURCE4} . %build +export PYTHON=%{build_python} make rpm-servicefiles -%if !(0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000) +%if %{without selinux} export HIMMELBLAU_ALLOW_MISSING_SELINUX=1 %endif %{cargo_build} --workspace --exclude himmelblau-fuzz -scripts/i18n-compile --profile release -%if !0%{?suse_version} -make authselect +$PYTHON scripts/i18n-compile --profile release +%if %{with selinux} +make -C src/selinux/src -f %{_datadir}/selinux/devel/Makefile %{modulename}.pp +bzip2 -9 src/selinux/src/%{modulename}.pp %endif %check -%if !(0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000) +export PYTHON=%{build_python} +%if %{without selinux} export HIMMELBLAU_ALLOW_MISSING_SELINUX=1 %endif %{cargo_test} --workspace --exclude himmelblau-fuzz %install # NSS -install -D -d -m 0755 %{buildroot}/%{_libdir} -install -D -d -m 0755 %{buildroot}/%{_tmpfilesdir} -strip --strip-unneeded target/release/libnss_himmelblau.so patchelf --set-soname libnss_himmelblau.so.2 target/release/libnss_himmelblau.so -install -m 0755 target/release/libnss_himmelblau.so %{buildroot}/%{_libdir}/libnss_himmelblau.so.2 -install -m 0644 src/nss/src/nss-himmelblau.tmpfiles.conf %{buildroot}/%{_tmpfilesdir}/nss-himmelblau.conf -install -D -d -m 0755 %{buildroot}/%{_datadir}/nsswitch.conf.d -install -m 0644 %{SOURCE3} %{buildroot}/%{_datadir}/nsswitch.conf.d/50-himmelblau.conf +install -D -m 0755 target/release/libnss_himmelblau.so %{buildroot}%{_libdir}/libnss_himmelblau.so.2 +install -D -m 0644 src/nss/src/nss-himmelblau.tmpfiles.conf %{buildroot}%{_tmpfilesdir}/nss-himmelblau.conf +%if %{with nsswitch_config} +install -D -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/nsswitch.conf.d/50-himmelblau.conf +%endif # PAM -install -D -d -m 0755 %{buildroot}/%{_pam_moduledir} -install -D -d -m 0755 %{buildroot}/usr/lib/pam-config.d -strip --strip-unneeded target/release/libpam_himmelblau.so -install -m 0755 target/release/libpam_himmelblau.so %{buildroot}/%{_pam_moduledir}/pam_himmelblau.so -install -m 0644 platform/opensuse/pam-config %{buildroot}/usr/lib/pam-config.d/himmelblau.conf -install -m 0644 platform/opensuse/pam-config-unseal %{buildroot}/usr/lib/pam-config.d/himmelblau-unseal.conf -%if !0%{?suse_version} -install -D -d -m 0755 %{buildroot}/%{_datadir}/authselect/vendor/himmelblau/ -install -m 0755 platform/el/authselect/* %{buildroot}/%{_datadir}/authselect/vendor/himmelblau/ -%endif +install -D -m 0755 target/release/libpam_himmelblau.so %{buildroot}%{_pam_moduledir}/pam_himmelblau.so +install -D -m 0644 platform/opensuse/pam-config %{buildroot}%{_prefix}/lib/pam-config.d/himmelblau.conf +install -D -m 0644 platform/opensuse/pam-config-unseal %{buildroot}%{_prefix}/lib/pam-config.d/himmelblau-unseal.conf # Himmelblau -install -D -d -m 0755 %{buildroot}%{_sbindir} -install -D -d -m 0755 %{buildroot}%{_bindir} -install -D -d -m 0755 %{buildroot}%{_unitdir} -install -D -d -m 0755 %{buildroot}%{_userunitdir} -install -D -d -m 0755 %{buildroot}%{_prefix}/lib/himmelblau -install -D -d -m 0755 %{buildroot}%{_sysconfdir}/ssh/sshd_config.d -install -D -d -m 0755 %{buildroot}%{_sysconfdir}/krb5.conf.d -install -D -d -m 0755 %{buildroot}/%{_unitdir}/display-manager.service.d/ -install -D -d -m 0755 %{buildroot}%{_datadir}/doc/himmelblau/ -install -D -d -m 0755 %{buildroot}%{_datadir}/doc/himmelblau-sso-policies/ -install -D -d -m 0755 %{buildroot}/%{_tmpfilesdir}/ -install -D -d -m 0755 %{buildroot}%{_mandir}/man1 -install -D -d -m 0755 %{buildroot}%{_mandir}/man5 -install -D -d -m 0755 %{buildroot}%{_mandir}/man8 -install -D -d -m 0755 %{buildroot}%{_libexecdir} -strip --strip-unneeded target/release/himmelblaud -strip --strip-unneeded target/release/himmelblaud_tasks -strip --strip-unneeded target/release/aad-tool -install -m 0644 target/config/himmelblau.conf.example %{buildroot}/%{_prefix}/lib/himmelblau/himmelblau.conf -install -m 0644 src/config/gdm3_service_override.conf %{buildroot}/%{_unitdir}/display-manager.service.d/override.conf -install -m 0755 target/release/aad-tool %{buildroot}/%{_bindir}/ -install -m 0644 platform/opensuse/himmelblaud-tasks.service %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblaud.service %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblaud.socket %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblaud-tasks.socket %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblaud-broker.socket %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblau-hsm-pin-init.service %{buildroot}/%{_unitdir}/ -install -m 0644 platform/opensuse/himmelblau-compliance-check.service %{buildroot}/%{_userunitdir}/ -install -m 0644 platform/opensuse/himmelblau-compliance-check.timer %{buildroot}/%{_userunitdir}/ -install -m 0755 src/daemon/scripts/himmelblau-init-hsm-pin %{buildroot}/%{_libexecdir}/ -install -m 0755 target/release/himmelblaud %{buildroot}/%{_sbindir}/ -install -m 0755 target/release/himmelblaud_tasks %{buildroot}/%{_sbindir}/ -install -m 0644 README.md %{buildroot}/%{_datadir}/doc/himmelblau/README -install -m 0644 target/config/himmelblau.conf.example %{buildroot}/%{_datadir}/doc/himmelblau/ -install -m 0644 man/man1/aad-tool.1 %{buildroot}/%{_mandir}/man1/ -install -m 0644 man/man5/himmelblau.conf.5 %{buildroot}/%{_mandir}/man5/ -install -m 0644 man/man8/himmelblaud.8 %{buildroot}/%{_mandir}/man8/ -install -m 0644 man/man8/himmelblaud_tasks.8 %{buildroot}/%{_mandir}/man8/ -install -m 0644 src/daemon/src/himmelblau-policies.tmpfiles.conf %{buildroot}/%{_tmpfilesdir}/himmelblau-policies.conf -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 -install -D -d -m 0755 %{buildroot}/%{_selinux_pkgdir}/himmelblaud -install -D -d -m 0755 %{buildroot}/%{_selinux_docdir} -install -m 0644 src/selinux/src/himmelblaud.te %{buildroot}/%{_selinux_pkgdir}/himmelblaud/himmelblaud.te -install -m 0644 src/selinux/src/himmelblaud.fc %{buildroot}/%{_selinux_pkgdir}/himmelblaud/himmelblaud.fc -install -m 0644 src/selinux/src/himmelblaud.if %{buildroot}/%{_selinux_pkgdir}/himmelblaud/himmelblaud.if +install -D -m 0755 -t %{buildroot}%{_sbindir} target/release/himmelblaud target/release/himmelblaud_tasks +install -D -m 0755 -t %{buildroot}%{_bindir} target/release/aad-tool +install -D -m 0755 -t %{buildroot}%{_libexecdir} src/daemon/scripts/himmelblau-init-hsm-pin +install -D -m 0644 -t %{buildroot}%{_unitdir} \ + platform/opensuse/himmelblaud.service \ + platform/opensuse/himmelblaud-tasks.service \ + platform/opensuse/himmelblaud.socket \ + platform/opensuse/himmelblaud-tasks.socket \ + platform/opensuse/himmelblaud-broker.socket \ + platform/opensuse/himmelblau-hsm-pin-init.service +install -D -m 0644 -t %{buildroot}%{_userunitdir} \ + platform/opensuse/himmelblau-compliance-check.service \ + platform/opensuse/himmelblau-compliance-check.timer +install -D -m 0644 src/config/gdm3_service_override.conf %{buildroot}%{_unitdir}/display-manager.service.d/override.conf +install -D -m 0644 target/config/himmelblau.conf.example %{buildroot}%{_prefix}/lib/himmelblau/himmelblau.conf +install -D -m 0644 src/daemon/src/himmelblau-policies.tmpfiles.conf %{buildroot}%{_tmpfilesdir}/himmelblau-policies.conf +install -D -m 0644 -t %{buildroot}%{_mandir}/man1 man/man1/aad-tool.1 +install -D -m 0644 -t %{buildroot}%{_mandir}/man5 man/man5/himmelblau.conf.5 +install -D -m 0644 -t %{buildroot}%{_mandir}/man8 man/man8/himmelblaud.8 man/man8/himmelblaud_tasks.8 +%if %{with selinux} +install -D -m 0644 src/selinux/src/%{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 %endif -pushd %{buildroot}%{_sbindir} -ln -s himmelblaud rchimmelblaud -ln -s himmelblaud_tasks rchimmelblaud_tasks -popd install -d %{buildroot}%{_datadir}/locale cp -a target/release/locale/. %{buildroot}%{_datadir}/locale/ @@ -334,235 +296,80 @@ # Aliases for bare language codes that have no catalog of their own install -D -m 0644 target/release/locale/pt_BR/LC_MESSAGES/himmelblau.mo %{buildroot}%{_datadir}/locale/pt/LC_MESSAGES/himmelblau.mo install -D -m 0644 target/release/locale/sr@latin/LC_MESSAGES/himmelblau.mo %{buildroot}%{_datadir}/locale/sr/LC_MESSAGES/himmelblau.mo -%if 0%{?suse_version} %fdupes %{buildroot}%{_datadir}/locale -%endif %find_lang himmelblau # SSHD Config -install -D -d -m 0755 %{buildroot}%{_sysconfdir}/ssh/sshd_config.d -install -m 0644 platform/el/sshd_config %{buildroot}/%{_sysconfdir}/ssh/sshd_config.d/30-himmelblau.conf +install -D -m 0644 platform/el/sshd_config %{buildroot}%{sshd_config_dir}/30-himmelblau.conf # Broker -install -D -d -m 0755 %{buildroot}%{_datarootdir}/dbus-1/services -strip --strip-unneeded target/release/broker -install -m 0755 target/release/broker %{buildroot}/%{_sbindir}/himmelblau_broker -install -m 0644 src/broker/platform/com.microsoft.identity.broker1.service %{buildroot}/%{_datadir}/dbus-1/services/ -install -m 0644 src/broker/platform/himmelblau-broker.service %{buildroot}/%{_userunitdir}/ -pushd %{buildroot}%{_sbindir} -ln -s himmelblau_broker rchimmelblau_broker -popd +install -D -m 0755 target/release/broker %{buildroot}%{_sbindir}/himmelblau_broker +install -D -m 0644 -t %{buildroot}%{_datadir}/dbus-1/services src/broker/platform/com.microsoft.identity.broker1.service +install -D -m 0644 -t %{buildroot}%{_userunitdir} src/broker/platform/himmelblau-broker.service # Single Sign On -strip --strip-unneeded target/release/linux-entra-sso -install -D -d -m 0755 %{buildroot}%{_libdir}/mozilla/native-messaging-hosts -install -D -d -m 0755 %{buildroot}%{chrome_nm_dir} -install -D -d -m 0755 %{buildroot}%{chromium_nm_dir} -install -D -d -m 0755 %{buildroot}%{chrome_ext_dir} -install -D -d -m 0755 %{buildroot}%{_datadir}/applications/ -%{!?_iconsdir:%global _iconsdir %{_datadir}/icons} -install -D -d -m 0755 %{buildroot}%{_iconsdir}/hicolor/256x256/apps -install -m 0755 src/o365/src/o365.sh %{buildroot}/%{_bindir}/o365 -install -m 0755 src/o365/src/o365-multi.sh %{buildroot}/%{_bindir}/o365-multi -install -m 0755 src/o365/src/o365-url-handler.sh %{buildroot}/%{_bindir}/o365-url-handler -install -m 0644 src/o365/generated/*.desktop %{buildroot}/%{_datadir}/applications/ -install -m 0644 src/o365/src/*.png %{buildroot}/%{_iconsdir}/hicolor/256x256/apps/ -install -m 0755 target/release/linux-entra-sso %{buildroot}/%{_bindir}/linux-entra-sso -install -m 0644 src/sso/src/firefox/linux_entra_sso.json %{buildroot}/%{_libdir}/mozilla/native-messaging-hosts/ -install -m 0644 src/sso/src/chrome/linux_entra_sso.json %{buildroot}/%{chrome_nm_dir}/ -install -m 0644 src/sso/src/chrome/linux_entra_sso.json %{buildroot}/%{chromium_nm_dir}/ -install -m 0644 src/sso/src/chrome/extension.json %{buildroot}/%{chrome_ext_dir}/jlnfnnolkbjieggibinobhkjdfbpcohn.json +install -D -m 0755 target/release/linux-entra-sso %{buildroot}%{_bindir}/linux-entra-sso +install -D -m 0755 src/o365/src/o365.sh %{buildroot}%{_bindir}/o365 +install -D -m 0755 src/o365/src/o365-multi.sh %{buildroot}%{_bindir}/o365-multi +install -D -m 0755 src/o365/src/o365-url-handler.sh %{buildroot}%{_bindir}/o365-url-handler +install -D -m 0644 -t %{buildroot}%{_datadir}/applications src/o365/generated/*.desktop +install -D -m 0644 -t %{buildroot}%{_datadir}/icons/hicolor/256x256/apps src/o365/src/*.png +install -D -m 0644 -t %{buildroot}%{_libdir}/mozilla/native-messaging-hosts src/sso/src/firefox/linux_entra_sso.json +install -D -m 0644 -t %{buildroot}%{chrome_nm_dir} src/sso/src/chrome/linux_entra_sso.json +install -D -m 0644 -t %{buildroot}%{chromium_nm_dir} src/sso/src/chrome/linux_entra_sso.json +install -D -m 0644 src/sso/src/chrome/extension.json %{buildroot}%{chrome_ext_dir}/jlnfnnolkbjieggibinobhkjdfbpcohn.json # The dependency generator does not resolve the interpreter of "env" scripts sed -i '1s|^#!/usr/bin/env bash$|#!/bin/bash|' %{buildroot}%{_bindir}/o365 %{buildroot}%{_bindir}/o365-multi %{buildroot}%{_bindir}/o365-url-handler # SSO Policies -install -D -d -m 0755 %{buildroot}%{_sysconfdir}/firefox/policies -install -D -d -m 0755 %{buildroot}%{chrome_policy_dir} -install -D -d -m 0755 %{buildroot}%{chromium_policy_dir} -install -m 0644 src/sso-policies/src/chrome/policies.json %{buildroot}/%{chrome_policy_dir}/himmelblau.json -install -m 0644 src/sso-policies/src/chrome/policies.json %{buildroot}/%{chromium_policy_dir}/himmelblau.json -install -m 0644 src/sso-policies/src/firefox/policies.json %{buildroot}/%{_datadir}/doc/himmelblau-sso-policies/firefox-policies.json.example -install -m 0644 src/sso-policies/src/thunderbird/policies.json %{buildroot}/%{_datadir}/doc/himmelblau-sso-policies/thunderbird-policies.json.example +install -D -m 0644 src/sso-policies/src/chrome/policies.json %{buildroot}%{chrome_policy_dir}/himmelblau.json +install -D -m 0644 src/sso-policies/src/chrome/policies.json %{buildroot}%{chromium_policy_dir}/himmelblau.json +install -D -m 0644 src/sso-policies/src/firefox/policies.json %{buildroot}%{_docdir}/himmelblau-sso-policies/firefox-policies.json.example +install -D -m 0644 src/sso-policies/src/thunderbird/policies.json %{buildroot}%{_docdir}/himmelblau-sso-policies/thunderbird-policies.json.example +install -D -m 0755 %{SOURCE7} %{buildroot}%{_libexecdir}/himmelblau/sso-policies # QR Greeter -install -D -d -m 0755 %{buildroot}%{_datarootdir}/gnome-shell/extensions/[email protected] -install -m 0644 target/release/qr-greeter-build/[email protected]/extension.js %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/extension.js -install -m 0644 target/release/qr-greeter-build/[email protected]/qrcodegen.js %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/qrcodegen.js -install -m 0644 target/release/qr-greeter-build/[email protected]/qrselection.js %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/qrselection.js -install -m 0644 target/release/qr-greeter-build/[email protected]/metadata.json %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/metadata.json -install -m 0644 target/release/qr-greeter-build/[email protected]/stylesheet.css %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/stylesheet.css -install -m 0644 target/release/qr-greeter-build/[email protected]/security-key.svg %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/security-key.svg -install -m 0644 target/release/qr-greeter-build/[email protected]/security-key-touch.svg %{buildroot}/%{_datadir}/gnome-shell/extensions/[email protected]/security-key-touch.svg +install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/dconf/db/gdm.d/01-himmelblau-qr-greeter +install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/dconf/db/local.d/01-himmelblau-qr-greeter +install -D -m 0644 -t %{buildroot}%{_datadir}/gnome-shell/extensions/[email protected] \ + target/release/qr-greeter-build/[email protected]/* +# The build directory also contains the files used to test the extension +rm -f %{buildroot}%{_datadir}/gnome-shell/extensions/[email protected]/package.json \ + %{buildroot}%{_datadir}/gnome-shell/extensions/[email protected]/*.test.js %post -n libnss_himmelblau2 -/sbin/ldconfig +%ldconfig -handle_nsswitch_conf() { - conf=$1 - sed -i '/^passwd:/ {/himmelblau/! s/$/ himmelblau/}' $conf - sed -i '/^group:/ {/himmelblau/! s/$/ himmelblau/}' $conf - sed -i '/^shadow:/ {/himmelblau/! s/$/ himmelblau/}' $conf - sed -i '/^initgroups:/ {/himmelblau/! s/$/ himmelblau/}' $conf -} - -etc_nsswitch_conf="/etc/nsswitch.conf" -usr_etc_nsswitch_conf="/usr/etc/nsswitch.conf" -nsswitch_snippet="/usr/share/nsswitch.conf.d/50-himmelblau.conf" - -# Where the package ships a nsswitch.conf snippet (the nsswitch-config targets), -# nsswitch-config merges it into /etc/nsswitch.conf. That only works if the file -# is missing or was generated by nsswitch-config: an admin managed file is left -# untouched and the result is written to /etc/nsswitch.conf.rpmnew. -use_nsswitch_config() { - [ -f "$nsswitch_snippet" ] || return 1 - command -v nsswitch-config >/dev/null 2>&1 || return 1 - [ ! -e "$etc_nsswitch_conf" ] || nsswitch-config --is_generated >/dev/null 2>&1 -} - -configured=0 -if use_nsswitch_config && nsswitch-config >/dev/null 2>&1; then - configured=1 -fi +# Ensure cache directory is created immediately after installation +%tmpfiles_create %{_tmpfilesdir}/nss-himmelblau.conf -if [ "$configured" -eq 0 ]; then - if [ -f $etc_nsswitch_conf ]; then - handle_nsswitch_conf $etc_nsswitch_conf - elif [ -f $usr_etc_nsswitch_conf ]; then - cp $usr_etc_nsswitch_conf $etc_nsswitch_conf - handle_nsswitch_conf $etc_nsswitch_conf - fi +%if %{with nsswitch_config} +# Merge the snippet shipped by this package into /etc/nsswitch.conf. An nsswitch.conf +# managed by the administrator is left untouched. +if [ ! -e /etc/nsswitch.conf ] || nsswitch-config --is_generated >/dev/null 2>&1; then + nsswitch-config >/dev/null 2>&1 || : fi - -# Ensure cache directory is created immediately after installation, ignoring failures -systemd-tmpfiles --create /usr/lib/tmpfiles.d/nss-himmelblau.conf 2>/dev/null || systemd-tmpfiles --create /usr/lib/x86_64-linux-gnu/tmpfiles.d/nss-himmelblau.conf 2>/dev/null || true +%endif %postun -n libnss_himmelblau2 -/sbin/ldconfig +%ldconfig +%if %{with nsswitch_config} # Regenerate nsswitch.conf without the snippet of this package -if [ "${1:-1}" = "0" ] && command -v nsswitch-config >/dev/null 2>&1 && - [ -e /etc/nsswitch.conf ] && nsswitch-config --is_generated >/dev/null 2>&1; then +if [ "$1" -eq 0 ] && [ -e /etc/nsswitch.conf ] && nsswitch-config --is_generated >/dev/null 2>&1; then nsswitch-config >/dev/null 2>&1 || : fi +%endif %post -n pam-himmelblau -# Only create a symlink if it doesn't already exist -if [ ! -e /lib64/security/pam_himmelblau.so ]; then - mkdir -p /lib64/security - ln -s /usr/lib64/security/pam_himmelblau.so /lib64/security/pam_himmelblau.so -fi - -# Skip PAM configuration on upgrade ($1 >= 2) so admin customizations to -# /etc/pam.d/*, authselect profiles, or pam-config state aren't reset by -# a package update. Only the initial install wires PAM up. -if [ "${1:-1}" -le 1 ]; then - -# 1) authselect first (if available) -authselect_ok=0 -if command -v authselect >/dev/null 2>&1; then - feats="$(authselect current 2>/dev/null | awk '/Enabled features:/{f=1;next} f && /^-/{print $2}')" - if authselect select himmelblau $feats --force >/dev/null 2>&1; then - if authselect apply-changes >/dev/null 2>&1; then - authselect_ok=1 - fi - fi -fi - -# Helper: validate/fix pam-config account line for pam_himmelblau -fix_pam_config_account_line() { - local pc="/etc/pam.d/common-account-pc" - local plain="/etc/pam.d/common-account" - - [ -f "$pc" ] || return 1 - - # Detect legacy/simple pam-config output: - # account required|sufficient pam_himmelblau.so ignore_unknown_user - if ! grep -Eq '^[[:space:]]*account[[:space:]]+(required|sufficient)[[:space:]]+pam_himmelblau\.so([[:space:]]+|$).*ignore_unknown_user' "$pc"; then - return 0 - fi - - # Ensure we have a self-managed common-account - if [ ! -f "$plain" ]; then - sed '/^[[:space:]]*#/d' "$pc" >"$plain" || return 1 - chmod --reference="$pc" "$plain" || : - fi - - # Make explicit himmelblau account denials terminal while preserving - # PAM_IGNORE fall-through for local users. - sed -i -E \ - 's#^([[:space:]]*account[[:space:]]+)(required|sufficient)([[:space:]]+pam_himmelblau\.so([[:space:]]+|$).*ignore_unknown_user)#\1[success=ok auth_err=die default=ignore]\3#' \ - "$plain" || return 1 - - return 0 -} - -# 2) pam-config second (if available) -pam_config_ok=0 -if command -v pam-config >/dev/null 2>&1; then - # Attempt to add himmelblau via pam-config. Older pam-config may not recognize --himmelblau at all. - if pam-config --add --himmelblau >/dev/null 2>&1; then - pam_config_ok=1 - - # Validate/fix the known-bad older behavior (account required) - fix_pam_config_account_line >/dev/null 2>&1 || : - fi -fi - -pamconfig_optout_self_managed_common() { - # Convert pam-config-generated common-*-pc into self-managed common-* - # per pam-config’s own header instructions. - local i pc plain - - for i in account auth password session; do - pc="/etc/pam.d/common-${i}-pc" - plain="/etc/pam.d/common-${i}" - - [ -f "$pc" ] || continue - - # Only create/refresh common-* if it doesn't exist yet. - # (If it already exists, assume admin/system is already self-managed.) - if [ ! -f "$plain" ]; then - # Strip comment lines (pam-config’s suggestion) - sed '/^[[:space:]]*#/d' "$pc" >"$plain" || return 1 - chmod --reference="$pc" "$plain" 2>/dev/null || : - fi - done - - return 0 -} - -# 3) Final fallback: aad-tool configure-pam --really -# Only do this if neither authselect nor pam-config was used successfully. -if [ "$authselect_ok" -ne 1 ] && [ "$pam_config_ok" -ne 1 ]; then - if command -v aad-tool >/dev/null 2>&1; then - # Opt out of pam-config-managed common-*-pc so future pam-config runs - # don’t overwrite the configuration we’re about to install. - pamconfig_optout_self_managed_common >/dev/null 2>&1 || : - aad-tool configure-pam --really >/dev/null 2>&1 || : - fi -fi - -fi # end upgrade guard - -# If GDM is present, ensure keyring consumes the auth token so the keyring unlocks -# like a normal password login. -GDM_PAM="/etc/pam.d/gdm-password" -if [ -f "$GDM_PAM" ]; then - # If the keyring auth line exists without use_authtok, add it. - if grep -Eq '^[[:space:]]*auth[[:space:]]+optional[[:space:]]+pam_gnome_keyring\.so' "$GDM_PAM" && \ - ! grep -Eq '^[[:space:]]*auth[[:space:]]+optional[[:space:]]+pam_gnome_keyring\.so.*\buse_authtok\b' "$GDM_PAM"; then - sed -i -E '/^[[:space:]]*auth[[:space:]]+optional[[:space:]]+pam_gnome_keyring\.so/ {/use_authtok/! s/$/ use_authtok/;}' "$GDM_PAM" || : - fi +# Only enable on first install, to not overwrite changes done by the administrator +if [ "$1" -eq 1 ]; then + pam-config -a --himmelblau >/dev/null 2>&1 || : fi %postun -n pam-himmelblau if [ "${1:-1}" = "0" ]; then - # Only remove a symlink if it exists and is a symlink - if [ -L /lib64/security/pam_himmelblau.so ]; then - rm -f /lib64/security/pam_himmelblau.so - fi - SYSTEMD_USER_OVERRIDE="/etc/pam.d/systemd-user" SYSTEMD_USER_MARKER="# Managed by pam-himmelblau: systemd-user NSS account workaround" if [ -f "$SYSTEMD_USER_OVERRIDE" ] && grep -qxF "$SYSTEMD_USER_MARKER" "$SYSTEMD_USER_OVERRIDE"; then @@ -571,804 +378,134 @@ fi %preun -n pam-himmelblau -# $1 is set by RPM: 0=uninstall, 1=upgrade. If your packager doesn’t pass it, we default to 0. -if [ "${1:-0}" -ne 0 ]; then exit 0; fi # don’t switch on upgrade -if command -v authselect >/dev/null 2>&1; then - if authselect current 2>/dev/null | grep -qE "^Profile ID:\s+himmelblau$"; then - if [ -d /usr/share/authselect/default/local ]; then base=local - elif [ -d /usr/share/authselect/default/minimal ]; then base=minimal - else base=sssd; fi - feats="$(authselect current 2>/dev/null | awk '/Enabled features:/{f=1;next} f && /^-/{print $2}')" - authselect select "$base" $feats --force >/dev/null 2>&1 || : - authselect apply-changes >/dev/null 2>&1 || : - fi +# Remove the module from the PAM stacks on erase. This has to happen before the +# files are removed, as the pam-config module definitions are shipped in this package. +if [ "$1" -eq 0 ]; then + pam-config -d --himmelblau_unseal >/dev/null 2>&1 || : + pam-config -d --himmelblau >/dev/null 2>&1 || : fi %post -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "* | *" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -# Detect if running on a Live system where service start should be skipped -is_live_system() { - # Check common Live system indicators - grep -q 'boot=live' /proc/cmdline 2>/dev/null && return 0 - grep -q 'rd.live' /proc/cmdline 2>/dev/null && return 0 - [ -d /run/live ] && return 0 - [ -f /.live-installer ] && return 0 - # Check if running in a container (dracut/systemd-nspawn) - systemd-detect-virt -c -q 2>/dev/null && return 0 - return 1 -} - -# Determine if SELinux policy for himmelblaud is loaded. -# Returns success if SELinux is disabled or the policy is already loaded. -selinux_policy_loaded() { - if ! command -v selinuxenabled >/dev/null 2>&1; then - return 0 - fi - - if ! selinuxenabled; then - return 0 - fi - - # If the policy sources are not installed, don't block service start. - if [ ! -d /usr/share/selinux/packages/himmelblaud ]; then - return 0 - fi - - if ! command -v semodule >/dev/null 2>&1; then - return 1 - fi - - semodule -l 2>/dev/null | awk '{print $1}' | grep -qx himmelblaud -} - # Ensure cache directory is created with correct permissions -systemd-tmpfiles --create /usr/lib/tmpfiles.d/himmelblau-policies.conf 2>/dev/null || true - -if is_debian_family; then - if [ "$1" != "configure" ]; then - exit 0 - fi +%tmpfiles_create %{_tmpfilesdir}/himmelblau-policies.conf - # The following line should be removed in trixie or trixie+1 - deb-systemd-helper unmask himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service >/dev/null || true - - # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --quiet was-enabled himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service >/dev/null || true - else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service >/dev/null || true - fi - - if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then - if is_live_system; then - echo "Live system detected - skipping service start (HSM PIN will be initialized at first boot)" - else - deb-systemd-invoke daemon-reload --system >/dev/null || true - if ! selinux_policy_loaded; then - echo "SELinux enabled but himmelblaud policy not loaded yet; deferring service start" - else - deb-systemd-invoke restart himmelblaud.service himmelblaud-tasks.service >/dev/null || true - fi - fi - fi - - # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --user --quiet was-enabled himmelblau-compliance-check.timer; then - # Globally enable user timer for compliance checks (does not start existing sessions). - deb-systemd-helper --user enable himmelblau-compliance-check.timer >/dev/null || true - else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper --user update-state himmelblau-compliance-check.timer >/dev/null || true - fi -else - # Presets the units; the restart on upgrade is done in the postun scriptlet. - %systemd_post himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service - %systemd_user_post himmelblau-compliance-check.timer - - # The preset above never starts anything, so start the daemons on a fresh install. - if [ "$1" -eq 1 ] && [ -d /run/systemd/system ]; then - if is_live_system; then - echo "Live system detected - skipping service start (HSM PIN will be initialized at first boot)" - elif ! selinux_policy_loaded; then - echo "SELinux enabled but himmelblaud policy not loaded yet; deferring service start" - else - systemctl start himmelblaud.service himmelblaud-tasks.service >/dev/null 2>&1 || true - fi - fi -fi +# Presets the units; the restart on upgrade is done in the postun scriptlet. +%systemd_post himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service +%systemd_user_post himmelblau-compliance-check.timer %postun -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -# Detect if running on a Live system where service start should be skipped -is_live_system() { - # Check common Live system indicators - grep -q 'boot=live' /proc/cmdline 2>/dev/null && return 0 - grep -q 'rd.live' /proc/cmdline 2>/dev/null && return 0 - [ -d /run/live ] && return 0 - [ -f /.live-installer ] && return 0 - # Check if running in a container (dracut/systemd-nspawn) - systemd-detect-virt -c -q 2>/dev/null && return 0 - return 1 -} - -# Determine if SELinux policy for himmelblaud is loaded. -# Returns success if SELinux is disabled or the policy is already loaded. -selinux_policy_loaded() { - if ! command -v selinuxenabled >/dev/null 2>&1; then - return 0 - fi - - if ! selinuxenabled; then - return 0 - fi - - # If the policy sources are not installed, don't block service start. - if [ ! -d /usr/share/selinux/packages/himmelblaud ]; then - return 0 - fi - - if ! command -v semodule >/dev/null 2>&1; then - return 1 - fi - - semodule -l 2>/dev/null | awk '{print $1}' | grep -qx himmelblaud -} - -# On full uninstall (purge on Debian, $1=0 on RPM): remove all runtime data, -# caches, and AccountsService entries for Entra users so GDM stops listing them. -_is_full_remove=0 -if is_debian_family; then - if [ "${1:-}" = "purge" ]; then _is_full_remove=1; fi -else - if [ "${1:-1}" = "0" ]; then _is_full_remove=1; fi -fi - -if is_debian_family; then - if [ -d /run/systemd/system ] && [ -z "$DPKG_ROOT" ] && [ "$1" = remove ]; then - deb-systemd-invoke daemon-reload --system >/dev/null || true - fi - - if [ "$_is_full_remove" = "1" ] && [ -z "$DPKG_ROOT" ]; then - deb-systemd-helper purge himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service >/dev/null || true - deb-systemd-helper --user purge himmelblau-compliance-check.timer >/dev/null || true - fi -else - # Restarting on upgrade is done here (not in the post scriptlet) to avoid a double restart. - if is_live_system; then - echo "Live system detected - skipping service restart" - %systemd_postun himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service - elif ! selinux_policy_loaded; then - echo "SELinux enabled but himmelblaud policy not loaded yet; skipping service restart" - %systemd_postun himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service - else - %systemd_postun_with_restart himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service - fi -fi - -if [ "$_is_full_remove" = "1" ]; then - rm -rf /var/cache/himmelblaud/ - rm -rf /var/cache/nss-himmelblau/ - rm -rf /var/cache/himmelblau-policies/ - rm -rf /var/lib/himmelblaud - rm -rf /var/lib/private/himmelblaud/ - - # Remove AccountsService entries for Entra users (UPN contains @) - # so GDM stops showing them on the login screen. - if [ -d /var/lib/AccountsService/users ]; then - find /var/lib/AccountsService/users -maxdepth 1 -type f -name '*@*' -delete || true - fi -fi +# Restarting on upgrade is done here (not in the post scriptlet) to avoid a double restart. +%systemd_postun_with_restart himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service %pre -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} +%systemd_pre himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service -if ! is_debian_family; then - %systemd_pre himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service -fi - -# Remove old service files from /etc/systemd/system/ that were installed by v1.4.x -# These take precedence over the new files in /usr/lib/systemd/system/ and lack -# the LoadCredentialEncrypted directive needed for HSM pin handling. -# In order to avoid removing user overrides, check against the hashes of known old -# files shipped by the package. -for OLD_FILE in \ - "/etc/systemd/system/himmelblaud.service" \ - "/etc/systemd/system/himmelblaud-tasks.service" \ - "/etc/systemd/system/gdm3.service.d/override.conf"; do - if [ -f "$OLD_FILE" ]; then - hash="$(md5sum "$OLD_FILE" 2>/dev/null | awk '{print $1}')" - for KNOWN_HASH in \ - "e3b66fe76769d64610a353adf3dbc595" \ - "7b0f82a49b6be1c285de8549e611ab66" \ - "ed238618354f885a2b0c697278ea33e8" \ - "65b026cc5d5f0f4d600184b6190b8cb3" \ - "a40d5ca8aedba32f9399acc7e5fdd03d" \ - "7473a7bee9c4ebde099a658522f21203" \ - "5e0b319ec558849d4cd08e2d5eaf90e3" \ - "60ad28a9039e527aa709137fe1f3db00" \ - "95c442df9bd7c7d94d94292cdda14513" \ - "73b676e55c6979c601b6c2d93257410f" \ - "85ab21f2ac8b5c4b60451fa6540771db" \ - "15501a8e5db36b92eac8a965d544bae8" \ - "73fa66e462ff429076107e346d5ddbe8" \ - "f794aaa11243213f8de06f1416f16682" \ - "bde93199f6dc7b28d5e4e1d67504601b" \ - "d7e2800688c23d570230296e17b0e6c2" \ - "db8132b5813a3413b4647529cf7ea8f3" \ - "8cffb12270663febb99c61e5d013926f" \ - "ca442221291feb739fb0b078e036f6c9" \ - "b18d0e9861fc161aa3a4c093f140bdf1" \ - "337e41fad21375f4ee614caf3b07a2de" \ - ; do - if [ "$hash" = "$KNOWN_HASH" ]; then - echo "Removing old service file: $OLD_FILE" - rm -f "$OLD_FILE" - fi - done - fi -done +# Prepare for the migration of himmelblau.conf to /usr/lib/himmelblau: save any old .rpmsave +test -f /etc/himmelblau/himmelblau.conf.rpmsave && mv -v /etc/himmelblau/himmelblau.conf.rpmsave /etc/himmelblau/himmelblau.conf.rpmsave.old || : %preun -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -if is_debian_family; then - if [ -d /run/systemd/system ]; then - if [ -z "$DPKG_ROOT" ] && [ "$1" = remove ]; then - deb-systemd-invoke stop himmelblaud.service himmelblaud-tasks.service himmelblau-hsm-pin-init.service >/dev/null || true - fi - fi - - # Globally disable user timer on package removal (not during upgrades) - if [ "$1" = remove ] || [ "$1" = purge ]; then - deb-systemd-helper --user disable himmelblau-compliance-check.timer >/dev/null || true - fi -else - %systemd_preun himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service - %systemd_user_preun himmelblau-compliance-check.timer -fi +%systemd_preun himmelblaud.service himmelblaud.socket himmelblaud-tasks.service himmelblaud-tasks.socket himmelblaud-broker.socket himmelblau-hsm-pin-init.service +%systemd_user_preun himmelblau-compliance-check.timer %posttrans config_file="/etc/himmelblau/himmelblau.conf" saved_config="${config_file}.rpmsave" -# RPM creates .rpmsave after the post scriptlet when an owned config is removed during an -# upgrade, so recover the previous local configuration at transaction end. +# Versions up to 3.x owned /etc/himmelblau/himmelblau.conf. RPM creates .rpmsave after the +# post scriptlet when that modified config is removed during an upgrade, so recover the +# previous local configuration at transaction end. if [ -f "$saved_config" ] && [ ! -e "$config_file" ] && [ ! -L "$config_file" ]; then echo "Restoring Himmelblau configuration from $saved_config" - if ! mv -- "$saved_config" "$config_file"; then - echo "Failed to restore Himmelblau configuration from $saved_config" >&2 - exit 1 - fi - + if mv -- "$saved_config" "$config_file"; then if command -v systemctl >/dev/null 2>&1; then - systemctl try-restart himmelblaud.service himmelblaud-tasks.service 2>/dev/null || true - fi -fi - -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 -%posttrans -n himmelblau-selinux -# Detect if running on a Live system where service start should be skipped -is_live_system() { - # Check common Live system indicators - grep -q 'boot=live' /proc/cmdline 2>/dev/null && return 0 - grep -q 'rd.live' /proc/cmdline 2>/dev/null && return 0 - [ -d /run/live ] && return 0 - [ -f /.live-installer ] && return 0 - # Check if running in a container (dracut/systemd-nspawn) - systemd-detect-virt -c -q 2>/dev/null && return 0 - return 1 -} - -SELINUX_SRC_DIR="/usr/share/selinux/packages/himmelblaud" -SELINUX_MAKEFILE="/usr/share/selinux/devel/Makefile" -SELINUX_POLICYTYPE="targeted" - -if [ -e /etc/selinux/config ]; then - . /etc/selinux/config -fi - -selinux_configured() { - [ "${SELINUX:-}" = "disabled" ] && return 1 - [ -n "${SELINUXTYPE:-}" ] && [ "$SELINUXTYPE" != "$SELINUX_POLICYTYPE" ] && return 1 - command -v selinuxenabled >/dev/null 2>&1 && selinuxenabled && return 0 - [ -e /etc/selinux/config ] && [ "${SELINUXTYPE:-}" = "$SELINUX_POLICYTYPE" ] -} - -if selinux_configured; then - # Check if SELinux development tools are available - if [ ! -f "$SELINUX_MAKEFILE" ]; then - echo "Warning: SELinux development Makefile not found at $SELINUX_MAKEFILE" - echo "Please install selinux-policy-devel and re-run this script" - exit 0 - fi - - # Compile the policy module from source - if [ -d "$SELINUX_SRC_DIR" ]; then - echo "Compiling SELinux policy module..." - cd "$SELINUX_SRC_DIR" - if make -f "$SELINUX_MAKEFILE" himmelblaud.pp; then - echo "Installing SELinux policy module..." - if semodule -s "$SELINUX_POLICYTYPE" -i himmelblaud.pp; then - # Clean up compiled files (keep source for potential recompilation) - rm -f himmelblaud.pp tmp/*.* 2>/dev/null || : - rmdir tmp 2>/dev/null || : - - # Relabel installed binaries - restorecon -Fv /usr/sbin/himmelblaud /usr/sbin/himmelblaud_tasks 2>/dev/null || : - - # Relabel existing dirs (may not exist on fresh install) - [ -d /usr/lib/himmelblau ] && restorecon -RFv /usr/lib/himmelblau || : - [ -d /etc/himmelblau ] && restorecon -RFv /etc/himmelblau || : - [ -d /run/himmelblaud ] && restorecon -RFv /run/himmelblaud || : - [ -d /var/run/himmelblaud ] && restorecon -RFv /var/run/himmelblaud || : - [ -d /var/cache/private/himmelblaud ] && restorecon -RFv /var/cache/private/himmelblaud || : - [ -d /var/cache/himmelblaud ] && restorecon -RFv /var/cache/himmelblaud || : - [ -d /var/cache/nss-himmelblau ] && restorecon -RFv /var/cache/nss-himmelblau || : - [ -d /var/cache/himmelblau-policies ] && restorecon -RFv /var/cache/himmelblau-policies || : - [ -d /var/lib/private/himmelblaud ] && restorecon -RFv /var/lib/private/himmelblaud || : - [ -d /var/lib/himmelblaud ] && restorecon -RFv /var/lib/himmelblaud || : - - # Restart daemons now that the policy is loaded (if present) - if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ] && ! is_live_system; then - systemctl daemon-reload >/dev/null 2>&1 || : - systemctl restart himmelblaud.service himmelblaud-tasks.service >/dev/null 2>&1 || : - fi - - echo "SELinux policy module installed successfully" - else - echo "Warning: Failed to install SELinux policy module" + systemctl try-restart himmelblaud.service himmelblaud-tasks.service 2>/dev/null || : fi else - echo "Warning: Failed to compile SELinux policy module" - fi - else - echo "Warning: SELinux source directory not found at $SELINUX_SRC_DIR" + echo "Failed to restore Himmelblau configuration from $saved_config" >&2 fi fi +%if %{with selinux} +%pre -n himmelblau-selinux +%selinux_relabel_pre -s %{selinuxtype} + +%post -n himmelblau-selinux +%selinux_modules_install -s %{selinuxtype} -p 200 %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 +%selinux_relabel_post -s %{selinuxtype} + +# The daemons need a restart to run in the himmelblaud_t domain. This is a +# no-op if the units are not installed or running yet. +if [ "$1" -le 1 ]; then + %systemd_postun_with_restart himmelblaud.service himmelblaud-tasks.service +fi + %postun -n himmelblau-selinux -if [ "$1" -eq 0 ]; then - if command -v selinuxenabled >/dev/null 2>&1 && selinuxenabled; then - semodule -r himmelblaud || : - fi +if [ $1 -eq 0 ]; then + %selinux_modules_uninstall -s %{selinuxtype} -p 200 %{modulename} + %selinux_relabel_post -s %{selinuxtype} fi %endif %post -n himmelblau-sshd-config -# Comment out the `KbdInteractiveAuthentication no` line if present -CONF="/etc/ssh/sshd_config" -if [ -f "$CONF" ]; then - sed -i 's/^KbdInteractiveAuthentication[[:space:]]\+no/#KbdInteractiveAuthentication no/' "$CONF" +# Make the drop-in take effect if sshd is running +if [ -d /run/systemd/system ]; then + systemctl try-reload-or-restart sshd.service >/dev/null 2>&1 || : fi -# Restart sshd if systemd is available, to make the config change take effect -if command -v systemctl >/dev/null 2>&1; then - echo "Restarting sshd service..." - systemctl restart ssh 2>/dev/null || systemctl restart sshd 2>/dev/null || true +%postun -n himmelblau-sshd-config +if [ "$1" -eq 0 ] && [ -d /run/systemd/system ]; then + systemctl try-reload-or-restart sshd.service >/dev/null 2>&1 || : fi %post -n himmelblau-broker -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -if is_debian_family; then - if [ "$1" != "configure" ]; then - exit 0 - fi - - if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then - deb-systemd-invoke daemon-reload --user >/dev/null || true - deb-systemd-invoke restart --user himmelblau-broker.service >/dev/null || true - fi -else - # Reload and restart of user managers is handled by the systemd file - # triggers at the end of the transaction. - %systemd_user_post himmelblau-broker.service -fi +# Reload and restart of user managers is handled by the systemd file +# triggers at the end of the transaction. +%systemd_user_post himmelblau-broker.service %postun -n himmelblau-broker -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -if is_debian_family; then - if [ -d /run/systemd/system ]; then - if [ -z "$DPKG_ROOT" ] && [ "$1" = remove ]; then - deb-systemd-invoke daemon-reload --user >/dev/null || true - fi - fi -else - # Restarting on upgrade is done here (not in the post scriptlet) to avoid a double restart. - %systemd_user_postun_with_restart himmelblau-broker.service -fi +# Restarting on upgrade is done here (not in the post scriptlet) to avoid a double restart. +%systemd_user_postun_with_restart himmelblau-broker.service %pre -n himmelblau-broker -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -if ! is_debian_family; then - %systemd_user_pre himmelblau-broker.service -fi +%systemd_user_pre himmelblau-broker.service %preun -n himmelblau-broker -is_debian_family() { - ( - for f in /etc/os-release /usr/lib/os-release; do - if [ -r "$f" ]; then - . "$f" - break - fi - done - case " ${ID:-} ${ID_LIKE:-} " in - *" debian "*|*" ubuntu "*) exit 0 ;; - esac - exit 1 - ) -} - -if is_debian_family; then - if [ -d /run/systemd/system ]; then - if [ -z "$DPKG_ROOT" ] && [ "$1" = remove ]; then - deb-systemd-invoke stop --user himmelblau-broker.service >/dev/null || true - fi - fi -else - %systemd_user_preun himmelblau-broker.service -fi - -%post -n himmelblau-sso -if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database -q || true; fi -if [ -d /usr/share/icons/hicolor ] && command -v gtk-update-icon-cache >/dev/null 2>&1; then gtk-update-icon-cache -q /usr/share/icons/hicolor || true; fi - -%postun -n himmelblau-sso -if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database -q || true; fi -if [ -d /usr/share/icons/hicolor ] && command -v gtk-update-icon-cache >/dev/null 2>&1; then gtk-update-icon-cache -q /usr/share/icons/hicolor || true; fi - -%post -n himmelblau-sso-policies -# Himmelblau SSO policies postinst script -# Merges Firefox/Thunderbird extension configuration into existing policies without overwriting -# (Chrome/Chromium use separate policy files per application, so no merging needed) - -FIREFOX_EXTENSION_URL="https://github.com/siemens/linux-entra-sso/releases/download/v1.9.1/linux_entra_sso-1.9.1.xpi" -THUNDERBIRD_EXTENSION_URL="https://github.com/siemens/linux-entra-sso/releases/download/v1.9.1/linux_entra_sso-1.9.1.thunderbird.xpi" - -# Function to merge a Mozilla extension into policies.json -merge_mozilla_policy() { - POLICY_FILE="$1" - EXTENSION_URL="$2" - APP_NAME="$3" - EXTENSION_PATTERN="$4" - POLICY_DIR=$(dirname "$POLICY_FILE") - - # Ensure directory exists - mkdir -p "$POLICY_DIR" - - if [ -f "$POLICY_FILE" ]; then - # Check if jq is available for proper JSON merging - if command -v jq >/dev/null 2>&1; then - # Check if the extension URL is already present and no old managed URL remains - if jq -e --arg url "$EXTENSION_URL" --arg pattern "$EXTENSION_PATTERN" ' - (.policies.Extensions.Install[]? | select(. == $url)) and - ([.policies.Extensions.Install[]? | select(type == "string" and test($pattern) and . != $url)] | length == 0) - ' "$POLICY_FILE" >/dev/null 2>&1; then - echo "$APP_NAME SSO extension already configured in $POLICY_FILE" - return 0 - fi - - # Replace old managed SSO extension URLs with the current one. - TEMP_FILE=$(mktemp) - jq --arg url "$EXTENSION_URL" --arg pattern "$EXTENSION_PATTERN" ' - .policies.Extensions.Install = ( - ([.policies.Extensions.Install[]? | select((type == "string" and test($pattern)) | not)] + [$url]) - | unique - ) - ' "$POLICY_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$POLICY_FILE" - echo "Merged $APP_NAME SSO extension into $POLICY_FILE" - else - # Without jq, check if our extension is already there - if grep -Fq "$EXTENSION_URL" "$POLICY_FILE" 2>/dev/null; then - echo "$APP_NAME SSO extension already configured in $POLICY_FILE" - return 0 - fi - echo "Warning: jq not found. Cannot safely merge into existing $POLICY_FILE" - echo "Please manually replace old linux_entra_sso URLs in policies.Extensions.Install with:" - echo " $EXTENSION_URL" - fi - else - # Create new policy file - cat > "$POLICY_FILE" << EOF -{ - "policies": { - "Extensions": { - "Install": [ - "$EXTENSION_URL" - ] - } - } -} -EOF - echo "Created $APP_NAME SSO policy at $POLICY_FILE" - fi -} - -# Merge Firefox and Thunderbird policies -merge_mozilla_policy "/etc/firefox/policies/policies.json" "$FIREFOX_EXTENSION_URL" "Firefox" "linux_entra_sso-[0-9][0-9.]*\\.xpi$" -merge_mozilla_policy "/etc/thunderbird/policies/policies.json" "$THUNDERBIRD_EXTENSION_URL" "Thunderbird" "linux_entra_sso-[0-9][0-9.]*\\.thunderbird\\.xpi$" -# Betterbird is a Thunderbird fork; it does not read /etc/thunderbird/policies. -merge_mozilla_policy "/etc/betterbird/policies/policies.json" "$THUNDERBIRD_EXTENSION_URL" "Betterbird" "linux_entra_sso-[0-9][0-9.]*\\.thunderbird\\.xpi$" -if [ -d /opt/betterbird ]; then - merge_mozilla_policy "/opt/betterbird/distribution/policies.json" "$THUNDERBIRD_EXTENSION_URL" "Betterbird" "linux_entra_sso-[0-9][0-9.]*\\.thunderbird\\.xpi$" -fi - -echo "Himmelblau SSO Mozilla policy configuration complete" - -%postun -n himmelblau-sso-policies -# Himmelblau SSO policies postrm script -# Removes Firefox/Thunderbird extension configuration that was merged during install -# (Chrome/Chromium policy files are handled by package manager directly) - -FIREFOX_EXTENSION_URL="https://github.com/siemens/linux-entra-sso/releases/download/v1.9.1/linux_entra_sso-1.9.1.xpi" -THUNDERBIRD_EXTENSION_URL="https://github.com/siemens/linux-entra-sso/releases/download/v1.9.1/linux_entra_sso-1.9.1.thunderbird.xpi" - -# Function to remove a Mozilla extension from policies.json -remove_mozilla_policy() { - POLICY_FILE="$1" - EXTENSION_URL="$2" - - if [ -f "$POLICY_FILE" ]; then - if command -v jq >/dev/null 2>&1; then - # Remove the extension URL from the Install array - TEMP_FILE=$(mktemp) - jq --arg url "$EXTENSION_URL" ' - if .policies.Extensions.Install then - .policies.Extensions.Install = [.policies.Extensions.Install[] | select(. != $url)] - else - . - end - ' "$POLICY_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$POLICY_FILE" - echo "Removed Mozilla SSO extension from $POLICY_FILE" - - # If the Install array is now empty, clean up the structure - if jq -e '.policies.Extensions.Install == []' "$POLICY_FILE" >/dev/null 2>&1; then - jq 'del(.policies.Extensions.Install)' "$POLICY_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$POLICY_FILE" - fi - # If Extensions is now empty, clean it up - if jq -e '.policies.Extensions == {}' "$POLICY_FILE" >/dev/null 2>&1; then - jq 'del(.policies.Extensions)' "$POLICY_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$POLICY_FILE" - fi - # If policies is now empty, remove the file - if jq -e '.policies == {}' "$POLICY_FILE" >/dev/null 2>&1; then - rm -f "$POLICY_FILE" - echo "Removed empty policy file $POLICY_FILE" - fi - else - echo "Warning: jq not found. Cannot safely remove SSO extension from $POLICY_FILE" - echo "Please manually remove the extension URL from policies.Extensions.Install:" - echo " $EXTENSION_URL" - fi - fi -} - -# Only run on Debian purge/remove or RPM erase ($1=0) -case "$1" in - remove|purge|0) - # Remove Firefox and Thunderbird policies - remove_mozilla_policy "/etc/firefox/policies/policies.json" "$FIREFOX_EXTENSION_URL" - remove_mozilla_policy "/etc/thunderbird/policies/policies.json" "$THUNDERBIRD_EXTENSION_URL" - remove_mozilla_policy "/etc/betterbird/policies/policies.json" "$THUNDERBIRD_EXTENSION_URL" - remove_mozilla_policy "/opt/betterbird/distribution/policies.json" "$THUNDERBIRD_EXTENSION_URL" - - echo "Himmelblau SSO Mozilla policy configuration removed" - ;; -esac +%systemd_user_preun himmelblau-broker.service %post -n himmelblau-qr-greeter -if command -v dconf >/dev/null 2>&1; then - # Enable extension for GDM user (login screen) - if getent passwd Debian-gdm >/dev/null 2>&1; then - echo "Enabling Himmelblau QR Greeter GNOME Shell extension for Debian GDM greeter..." - - if [ -x /usr/share/gdm/generate-config ]; then - mkdir -p /usr/share/gdm/dconf - - cat > /usr/share/gdm/dconf/01-himmelblau-qr-greeter << 'EOF' -[org/gnome/shell] -enabled-extensions=['[email protected]'] -EOF - echo "Created /usr/share/gdm/dconf/01-himmelblau-qr-greeter" - - if /usr/share/gdm/generate-config; then - echo "Regenerated Debian GDM greeter dconf defaults." - else - echo 'Warning: Debian GDM greeter dconf generation failed' >&2 - fi - else - echo 'Info: Debian-gdm user is available but /usr/share/gdm/generate-config is not executable; skipping Debian GDM extension enable.' >&2 - fi - elif getent passwd gdm >/dev/null 2>&1; then - echo "Enabling Himmelblau QR Greeter GNOME Shell extension for GDM user..." - - # Create /etc/dconf/profile/gdm if it doesn't exist - if [ ! -f /etc/dconf/profile/gdm ]; then +# The profile of gdm shipped by gdm has no system database. Add one for the login +# screen. The database files are packaged, the profiles may be owned by the admin. +if [ ! -f /etc/dconf/profile/gdm ]; then mkdir -p /etc/dconf/profile cat > /etc/dconf/profile/gdm << 'EOF' user-db:user system-db:gdm file-db:/usr/share/gdm/greeter-dconf-defaults EOF - echo "Created /etc/dconf/profile/gdm" - fi - - # Create dconf database directory if it doesn't exist - mkdir -p /etc/dconf/db/gdm.d - - # Create the extension enablement configuration - cat > /etc/dconf/db/gdm.d/01-himmelblau-qr-greeter << 'EOF' -[org/gnome/shell] -enabled-extensions=['[email protected]'] -EOF - echo "Created /etc/dconf/db/gdm.d/01-himmelblau-qr-greeter" - else - echo 'Info: neither Debian-gdm nor gdm user is available; skipping GDM extension enable.' >&2 - fi - - # Enable extension for regular users (lockscreen) - echo "Enabling Himmelblau QR Greeter GNOME Shell extension for regular users..." +fi - # Create /etc/dconf/profile/user if it doesn't exist - if [ ! -f /etc/dconf/profile/user ]; then +# Enable the extension for the lock screen, which runs in the session of the user +if [ ! -f /etc/dconf/profile/user ]; then mkdir -p /etc/dconf/profile cat > /etc/dconf/profile/user << 'EOF' user-db:user system-db:local EOF - echo "Created /etc/dconf/profile/user" - fi - - # Create dconf database directory if it doesn't exist - mkdir -p /etc/dconf/db/local.d - - # Create the extension enablement configuration for regular users - cat > /etc/dconf/db/local.d/01-himmelblau-qr-greeter << 'EOF' -[org/gnome/shell] -enabled-extensions=['[email protected]'] -EOF - echo "Created /etc/dconf/db/local.d/01-himmelblau-qr-greeter" - - # Update dconf database - if dconf update; then - echo "Himmelblau QR Greeter GNOME Shell extension enabled for all users. You must restart GDM or log out and log in for the changes to take effect." - else - echo 'Warning: dconf update failed' >&2 - fi -else - echo 'Info: dconf not available; skipping automatic extension enable.' >&2 fi -%postun -n himmelblau-qr-greeter -case "${1:-}" in - remove|purge|0) - rm -f /usr/share/gdm/dconf/01-himmelblau-qr-greeter - rm -f /etc/dconf/db/gdm.d/01-himmelblau-qr-greeter - rm -f /etc/dconf/db/local.d/01-himmelblau-qr-greeter - - if [ -x /usr/share/gdm/generate-config ]; then - if /usr/share/gdm/generate-config; then - echo "Regenerated Debian GDM greeter dconf defaults." - else - echo 'Warning: Debian GDM greeter dconf generation failed' >&2 - fi - fi +dconf update || : - if command -v dconf >/dev/null 2>&1; then - if dconf update; then - echo "Himmelblau QR Greeter GNOME Shell extension dconf settings removed." - else - echo 'Warning: dconf update failed' >&2 - fi - fi - ;; -esac +%postun -n himmelblau-qr-greeter +if [ "$1" -eq 0 ]; then + dconf update || : +fi %files -f himmelblau.lang +%license LICENSE +%doc README.md README.SUSE target/config/himmelblau.conf.example %dir %{_prefix}/lib/himmelblau -%dir %ghost %dir %attr(0600,root,root) %{_localstatedir}/cache/himmelblau-policies +%ghost %dir %attr(0600,root,root) %{_localstatedir}/cache/himmelblau-policies %dir %{_unitdir}/display-manager.service.d -%dir %{_datadir}/doc/himmelblau %{_prefix}/lib/himmelblau/himmelblau.conf %{_unitdir}/display-manager.service.d/override.conf %{_bindir}/aad-tool @@ -1383,103 +520,92 @@ %{_libexecdir}/himmelblau-init-hsm-pin %{_sbindir}/himmelblaud %{_sbindir}/himmelblaud_tasks -%{_datadir}/doc/himmelblau/README -%{_datadir}/doc/himmelblau/himmelblau.conf.example %{_mandir}/man1/aad-tool.1* %{_mandir}/man5/himmelblau.conf.5* %{_mandir}/man8/himmelblaud.8* %{_mandir}/man8/himmelblaud_tasks.8* %{_tmpfilesdir}/himmelblau-policies.conf -%{_sbindir}/rchimmelblaud -%{_sbindir}/rchimmelblaud_tasks -%if 0%{?suse_version} > 1600 || 0%{?sle_version} >= 160000 +%if %{with selinux} %files -n himmelblau-selinux -%dir %{_docdir}/himmelblau-selinux -%dir %{_selinux_docdir} -%dir %{_selinux_pkgdir} -%dir %{_selinux_pkgdir}/himmelblaud -%{_selinux_pkgdir}/himmelblaud/himmelblaud.te -%{_selinux_pkgdir}/himmelblaud/himmelblaud.fc -%{_selinux_pkgdir}/himmelblaud/himmelblaud.if +%license LICENSE +%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 +%ghost %verify(not md5 size mtime) %{_selinux_store_path}/%{selinuxtype}/active/modules/200/%{modulename} %endif %files -n libnss_himmelblau2 +%license LICENSE %dir %{_tmpfilesdir} %{_libdir}/libnss_himmelblau.so.2 %{_tmpfilesdir}/nss-himmelblau.conf +%if %{with nsswitch_config} %{_datadir}/nsswitch.conf.d/50-himmelblau.conf -%ghost %dir %attr(0755,root,root) /var/cache/nss-himmelblau +%endif +%ghost %dir %attr(0755,root,root) %{_localstatedir}/cache/nss-himmelblau %files -n pam-himmelblau -%dir /usr/lib/pam-config.d +%license LICENSE +%dir %{_prefix}/lib/pam-config.d %{_pam_moduledir}/pam_himmelblau.so -/usr/lib/pam-config.d/himmelblau.conf -/usr/lib/pam-config.d/himmelblau-unseal.conf -%if !0%{?suse_version} -%dir %{_datadir}/authselect -%dir %{_datadir}/authselect/vendor -%dir %{_datadir}/authselect/vendor/himmelblau -%{_datadir}/authselect/vendor/himmelblau/* -%endif +%{_prefix}/lib/pam-config.d/himmelblau.conf +%{_prefix}/lib/pam-config.d/himmelblau-unseal.conf %files -n himmelblau-sshd-config -%config %{_sysconfdir}/ssh/sshd_config.d/30-himmelblau.conf -%if 0%{?sle_version} <= 150500 -%dir %{_sysconfdir}/ssh/sshd_config.d +%license LICENSE +%if %{defined _distconfdir} +%{sshd_config_dir}/30-himmelblau.conf +%else +%config(noreplace) %{sshd_config_dir}/30-himmelblau.conf %endif %files -n himmelblau-broker +%license LICENSE %{_sbindir}/himmelblau_broker %{_datadir}/dbus-1/services/com.microsoft.identity.broker1.service %{_userunitdir}/himmelblau-broker.service -%{_sbindir}/rchimmelblau_broker %files -n himmelblau-sso +%license LICENSE %dir %{_libdir}/mozilla %dir %{_libdir}/mozilla/native-messaging-hosts -%dir /etc/chromium -%dir /usr/share/google-chrome +%dir %{_sysconfdir}/chromium +%dir %{_datadir}/google-chrome %dir %{chrome_nm_dir} %dir %{chromium_nm_dir} %dir %{chrome_ext_dir} -%dir %{_iconsdir}/hicolor -%dir %{_iconsdir}/hicolor/256x256 -%dir %{_iconsdir}/hicolor/256x256/apps %{_bindir}/o365 %{_bindir}/o365-multi %{_bindir}/o365-url-handler %{_datadir}/applications/*.desktop -%{_iconsdir}/hicolor/256x256/apps/*.png +%{_datadir}/icons/hicolor/256x256/apps/*.png %{_bindir}/linux-entra-sso %{_libdir}/mozilla/native-messaging-hosts/linux_entra_sso.json -%config %{chrome_nm_dir}/linux_entra_sso.json -%config %{chromium_nm_dir}/linux_entra_sso.json +%config(noreplace) %{chrome_nm_dir}/linux_entra_sso.json +%config(noreplace) %{chromium_nm_dir}/linux_entra_sso.json %{chrome_ext_dir}/jlnfnnolkbjieggibinobhkjdfbpcohn.json %files -n himmelblau-sso-policies -%dir /etc/firefox -%dir /etc/firefox/policies -%dir /etc/chromium/policies -%dir /etc/opt/chrome -%dir /etc/opt/chrome/policies +%license LICENSE +%dir %{_sysconfdir}/chromium/policies +%dir %{_sysconfdir}/opt/chrome +%dir %{_sysconfdir}/opt/chrome/policies %dir %attr(0555,root,root) %{chrome_policy_dir} %dir %attr(0555,root,root) %{chromium_policy_dir} -%dir %{_datadir}/doc/himmelblau-sso-policies -%config %{chrome_policy_dir}/himmelblau.json -%config %{chromium_policy_dir}/himmelblau.json -%{_datadir}/doc/himmelblau-sso-policies/firefox-policies.json.example -%{_datadir}/doc/himmelblau-sso-policies/thunderbird-policies.json.example +%dir %{_docdir}/himmelblau-sso-policies +%dir %{_libexecdir}/himmelblau +%{_libexecdir}/himmelblau/sso-policies +%config(noreplace) %{chrome_policy_dir}/himmelblau.json +%config(noreplace) %{chromium_policy_dir}/himmelblau.json +%{_docdir}/himmelblau-sso-policies/firefox-policies.json.example +%{_docdir}/himmelblau-sso-policies/thunderbird-policies.json.example %files -n himmelblau-qr-greeter -%dir %{_datarootdir}/gnome-shell -%dir %{_datarootdir}/gnome-shell/extensions -%dir %{_datarootdir}/gnome-shell/extensions/[email protected] -%{_datadir}/gnome-shell/extensions/[email protected]/extension.js -%{_datadir}/gnome-shell/extensions/[email protected]/qrcodegen.js -%{_datadir}/gnome-shell/extensions/[email protected]/qrselection.js -%{_datadir}/gnome-shell/extensions/[email protected]/metadata.json -%{_datadir}/gnome-shell/extensions/[email protected]/stylesheet.css -%{_datadir}/gnome-shell/extensions/[email protected]/security-key.svg -%{_datadir}/gnome-shell/extensions/[email protected]/security-key-touch.svg +%license LICENSE +%dir %{_sysconfdir}/dconf/db/gdm.d +%config(noreplace) %{_sysconfdir}/dconf/db/gdm.d/01-himmelblau-qr-greeter +%dir %{_sysconfdir}/dconf/db/local.d +%config(noreplace) %{_sysconfdir}/dconf/db/local.d/01-himmelblau-qr-greeter +%dir %{_datadir}/gnome-shell +%dir %{_datadir}/gnome-shell/extensions +%{_datadir}/gnome-shell/extensions/[email protected]/ ++++++ 01-himmelblau-qr-greeter ++++++ [org/gnome/shell] enabled-extensions=['[email protected]'] ++++++ README.SUSE ++++++ Himmelblau on openSUSE ====================== Installing the packages enables the PAM module, and the NSS module where nsswitch-config is available. Himmelblau still has to be configured and the daemons have to be enabled. 1. Configure the domain ----------------------- The package ships /usr/lib/himmelblau/himmelblau.conf. Do not edit it. Either copy it to /etc/himmelblau/himmelblau.conf and edit the copy, which replaces the shipped file completely, or put your settings in drop-in files in /etc/himmelblau/himmelblau.conf.d/*.conf. Set the "domains" option. Without it no user can authenticate. See himmelblau.conf(5) and himmelblau.conf.example in this directory. The daemons are not started when the package is installed. Enable and start them once the configuration is done: systemctl enable --now himmelblaud.service himmelblaud-tasks.service Restart them after changing the configuration. Check the journal for errors. On the first start the HSM PIN is created and stored in /var/lib/himmelblaud. If /var does not survive a reboot, as on a live system without persistence, the device enrollment is lost with it. In that case remove the stale device object in Entra ID. 2. NSS module (package libnss_himmelblau2) ------------------------------------------ On systems with the tool nsswitch-config (Tumbleweed) the package installs the snippet /usr/share/nsswitch.conf.d/50-himmelblau.conf and runs nsswitch-config, which merges all snippets into /etc/nsswitch.conf. Himmelblau is added to the "passwd", "group" and "shadow" databases after "compat" and "systemd". Nothing has to be done if /etc/nsswitch.conf is generated by nsswitch-config. On other systems, and if /etc/nsswitch.conf is managed by hand, nsswitch-config does not change it and "himmelblau" has to be appended to the "passwd", "group" and "shadow" lines manually. This is not done by the package: passwd: compat systemd himmelblau group: compat systemd himmelblau shadow: compat systemd himmelblau To disable the module on a system with a generated nsswitch.conf, mask the snippet and run nsswitch-config. On other systems remove "himmelblau" from nsswitch.conf: mkdir -p /etc/nsswitch.conf.d touch /etc/nsswitch.conf.d/50-himmelblau.conf nsswitch-config Do not run nscd together with Himmelblau, as it caches the lookups: systemctl disable --now nscd systemctl mask nscd Check that a user can be resolved: getent passwd <user>@<domain> 3. PAM module (package pam-himmelblau) --------------------------------------- On the first installation the package enables the module with pam-config. The module definitions are installed in /usr/lib/pam-config.d. Upgrades do not change the PAM configuration. Use "pam-config -q --himmelblau" to query the state. To disable the module, or to enable it again: pam-config -d --himmelblau pam-config -a --himmelblau The module is removed from the PAM stacks when the package is uninstalled. To also try to unseal the Hello key with the login password, so no second PIN prompt is needed, add: pam-config -a --himmelblau_unseal The changes are active immediately, so keep a root shell open until a login has been tested. To unlock the GNOME keyring at login with the same password, the pam_gnome_keyring.so "auth" line of the display manager has to use the password entered for the login. For GDM, add "use_authtok" to that line in /etc/pam.d/gdm-password: auth optional pam_gnome_keyring.so use_authtok 4. Optional: SSH ---------------- Install himmelblau-sshd-config to enable keyboard-interactive authentication in sshd. The setting is shipped as a drop-in file in /usr/etc/ssh/sshd_config.d, or in /etc/ssh/sshd_config.d on systems without /usr/etc support. 5. Optional: browser SSO ------------------------ Install himmelblau-sso for the native messaging hosts and himmelblau-broker for the broker service. Chrome and Chromium support drop-in policies, so himmelblau-sso-policies installs its policy files in their managed policy directories and the SSO extension is force-installed by default. Nothing has to be done for them. Firefox and Thunderbird read a single policies.json, which is owned by the administrator, so the package does not change it. To add the extension to /etc/firefox/policies/policies.json and /etc/thunderbird/policies/policies.json run as root: /usr/libexec/himmelblau/sso-policies add The script creates the files if needed, merges the extension into the existing ones, keeps all other policies and replaces the entry of an older version of the extension. Run it again after updating the package. Before uninstalling the package, remove the extension again: /usr/libexec/himmelblau/sso-policies remove A file is deleted if nothing else is left in it. The script needs jq, which is required by the package. The URLs are taken from the examples in /usr/share/doc/packages/himmelblau-sso-policies/. Betterbird is not handled. 6. Optional: QR code on the login and lock screen -------------------------------------------------- The package himmelblau-qr-greeter adds a QR code to the authentication prompt when a device code URL is shown. It enables the GNOME Shell extension for the GDM login screen and for the lock screen of all users with the dconf files /etc/dconf/db/gdm.d/01-himmelblau-qr-greeter and /etc/dconf/db/local.d/01-himmelblau-qr-greeter. The profile of GDM shipped by gdm does not read a system database, and there is no profile for the users. When the package is installed, it creates /etc/dconf/profile/gdm (with "system-db:gdm") and /etc/dconf/profile/user (with "system-db:local"), if they do not exist yet, and runs "dconf update". The profiles are not removed when the package is uninstalled. If you already have these profiles, add the "system-db" lines yourself and run "dconf update". The login screen shows the QR code after GDM was restarted. Users have to log in again for the lock screen. A user who changed the list of enabled extensions keeps their own list and can enable the extension with: gnome-extensions enable [email protected] SELinux ------- On systems using SELinux, the package himmelblau-selinux is installed automatically and provides the policy module for the daemons. ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.7SK5hI/_old 2026-12-03 14:00:21.410983155 +0100 +++ /var/tmp/diff_new_pack.7SK5hI/_new 2026-12-03 14:00:21.417983452 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/himmelblau-idm/himmelblau.git</param> - <param name="changesrevision">a969c7488164dc67e6159c9ecc5eaa6329eb7664</param></service></servicedata> + <param name="changesrevision">ed5044433e2b3bcb704174d3957cb713bf2d039f</param></service></servicedata> (No newline at EOF) ++++++ himmelblau-4.0.8+git0.a969c748.tar.bz2 -> himmelblau-4.0.9+git0.ed504443.tar.bz2 ++++++ ++++ 8601 lines of diff (skipped) ++++++ himmelblau-python-env.patch ++++++ From: Samuel Cabrero <[email protected]> Subject: Select the Python interpreter with the PYTHON environment variable The helper scripts need a newer Python than the default python3 on some distributions, for example SLE 15 where python3 is 3.6 and the scripts import dataclasses. Read the interpreter from PYTHON in the build scripts and in the Makefiles. It defaults to python3, so nothing changes if PYTHON is not set. --- diff --git a/Makefile b/Makefile index dd08690..18ede26 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ SHELL := /usr/bin/env bash +# Python interpreter used by the helper scripts +PYTHON ?= python3 + all: .packaging dockerfiles ## Auto-detect host distro and build packages just for this host @set -euo pipefail; \ . /etc/os-release; \ @@ -154,7 +157,7 @@ install: ## Install packages from ./packaging onto this host (apt/dnf/yum/zypper (command -v yum >/dev/null && yum -y localinstall ./packaging/*.rpm) || \ (command -v zypper >/dev/null && zypper --non-interactive --no-gpg-checks in ./packaging/*.rpm)';; \ gentoo) \ - PKGTYPE="gentoo"; INSTALL_CMD='python3 scripts/install_local.py --no-build --destdir $(DESTDIR)/';; \ + PKGTYPE="gentoo"; INSTALL_CMD='$(PYTHON) scripts/install_local.py --no-build --destdir $(DESTDIR)/';; \ arch|archlinux|manjaro|cachyos) \ PKGTYPE="arch"; INSTALL_CMD='pacman -U --noconfirm ./packaging/himmelblau-*.pkg.tar.zst';; \ esac; \ @@ -199,22 +202,22 @@ uninstall: ## Uninstall Himmelblau packages from this host (apt/dnf/yum/zypper/p echo "Uninstall complete." dockerfiles: - python3 scripts/gen_dockerfiles.py --out ./images/ $(PATCH_LIBHIMMELBLAU) + $(PYTHON) scripts/gen_dockerfiles.py --out ./images/ $(PATCH_LIBHIMMELBLAU) dockerfiles-arm64: - python3 scripts/gen_dockerfiles.py --out ./images/ --arch arm64 $(PATCH_LIBHIMMELBLAU) + $(PYTHON) scripts/gen_dockerfiles.py --out ./images/ --arch arm64 $(PATCH_LIBHIMMELBLAU) orchestrator-container: ## Build the local orchestrator Playwright container image pushd $(ORCHESTRATOR_CONTAINER_DIRECTORY) && $(DOCKER) build -t $(ORCHESTRATOR_CONTAINER_IMAGE) . deb-servicefiles: - python3 ./scripts/gen_servicefiles.py --out ./platform/debian/ --orchestrator-apparmor-profile himmelblau-orchestrator-container + $(PYTHON) ./scripts/gen_servicefiles.py --out ./platform/debian/ --orchestrator-apparmor-profile himmelblau-orchestrator-container rpm-servicefiles: - python3 ./scripts/gen_servicefiles.py --out ./platform/opensuse/ $(if $(ORCHESTRATOR_APPARMOR_PROFILE),--orchestrator-apparmor-profile $(ORCHESTRATOR_APPARMOR_PROFILE),) + $(PYTHON) ./scripts/gen_servicefiles.py --out ./platform/opensuse/ $(if $(ORCHESTRATOR_APPARMOR_PROFILE),--orchestrator-apparmor-profile $(ORCHESTRATOR_APPARMOR_PROFILE),) authselect: - python3 ./scripts/gen_authselect.py --root=./ --aad-tool=./target/release/aad-tool --output-dir=./platform/el/authselect/ + $(PYTHON) ./scripts/gen_authselect.py --root=./ --aad-tool=./target/release/aad-tool --output-dir=./platform/el/authselect/ .PHONY: package deb rpm $(DEB_TARGETS) $(RPM_TARGETS) ${SLE_TARGETS} $(GENTOO_TARGETS) $(ARCH_TARGETS) dockerfiles dockerfiles-arm64 orchestrator-container deb-servicefiles rpm-servicefiles authselect conf-examples install uninstall help sbom man arm64 deb-arm64 rpm-arm64 $(ALL_ARM64_TARGETS) @@ -225,7 +228,7 @@ check-licenses: ## Validate dependant licenses comply with GPLv3 vet: ## Interactive dependency review with AI analysis cargo vet -V >/dev/null || (echo "cargo-vet required" && cargo install cargo-vet) cargo vet regenerate imports - @python3 scripts/cargo_vet_review.py --auto-exempt + @$(PYTHON) scripts/cargo_vet_review.py --auto-exempt sbom: .packaging ## Generate a Software Bill of Materials cargo sbom -V >/dev/null || (echo "cargo-sbom required" && cargo install cargo-sbom) @@ -235,26 +238,26 @@ check-barely-used: ## Detect barely-used dependencies (high-cost + shallow-usage @cargo bloat -V >/dev/null 2>&1 || (echo "cargo-bloat required" && cargo install cargo-bloat) @cargo-diet --version >/dev/null 2>&1 || (echo "cargo-diet required" && cargo install cargo-diet) @echo "Analyzing dependency usage patterns..." - @PATH="$$HOME/.cargo/bin:$$PATH" python3 scripts/check_barely_used_deps.py --format=human --mode=both + @PATH="$$HOME/.cargo/bin:$$PATH" $(PYTHON) scripts/check_barely_used_deps.py --format=human --mode=both check-shallow: ## Detect shallow-usage dependencies only @echo "Analyzing shallow usage patterns..." - @PATH="$$HOME/.cargo/bin:$$PATH" python3 scripts/check_barely_used_deps.py --format=human --mode=shallow-usage + @PATH="$$HOME/.cargo/bin:$$PATH" $(PYTHON) scripts/check_barely_used_deps.py --format=human --mode=shallow-usage check-high-cost: ## Detect high-cost dependencies only (original analysis) @cargo bloat -V >/dev/null 2>&1 || (echo "cargo-bloat required" && cargo install cargo-bloat) @cargo-diet --version >/dev/null 2>&1 || (echo "cargo-diet required" && cargo install cargo-diet) @echo "Analyzing high-cost dependencies..." - @PATH="$$HOME/.cargo/bin:$$PATH" python3 scripts/check_barely_used_deps.py --format=human --mode=high-cost + @PATH="$$HOME/.cargo/bin:$$PATH" $(PYTHON) scripts/check_barely_used_deps.py --format=human --mode=high-cost package: deb rpm sbom ## Build packages for all supported distros (DEB+RPM) ls ./packaging/ man: ## Generate the himmelblau.conf man page - python3 src/common/scripts/gen_param_code.py --gen-man --man-output man/man5/himmelblau.conf.5 + $(PYTHON) src/common/scripts/gen_param_code.py --gen-man --man-output man/man5/himmelblau.conf.5 conf-examples: ## Generate himmelblau.conf example files - python3 src/common/scripts/gen_param_code.py \ + $(PYTHON) src/common/scripts/gen_param_code.py \ --gen-conf-example --conf-example-output target/config/himmelblau.conf.example \ --gen-debian-conf-example --debian-conf-example-output target/debian/himmelblau.conf.example @@ -399,7 +402,7 @@ $(GENTOO_TARGETS): %: .packaging dockerfiles -v $(CURDIR):/himmelblau \ himmelblau-$@-build @echo "Building from local sources..." - python3 scripts/gen_servicefiles.py --out ./platform/opensuse/ + $(PYTHON) scripts/gen_servicefiles.py --out ./platform/opensuse/ cargo build --release --features tpm strip -s target/release/*.so 2>/dev/null || true strip -s target/release/aad-tool target/release/himmelblaud target/release/himmelblaud_tasks target/release/broker target/release/linux-entra-sso 2>/dev/null || true diff --git a/man/Makefile b/man/Makefile index b2136c3..3e17660 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,7 +1,9 @@ +PYTHON ?= python3 + all: himmelblau.conf rm -rf ./data && ./aad-tool-help2man && ./combine.py pandoc -s -t man -o man8/pam_himmelblau.8 ./pam_himmelblau.md # Generate himmelblau.conf(5) man page from XML parameter definitions himmelblau.conf: - python3 ../src/common/scripts/gen_param_code.py --gen-man --man-output man5/himmelblau.conf.5 + $(PYTHON) ../src/common/scripts/gen_param_code.py --gen-man --man-output man5/himmelblau.conf.5 diff --git a/src/common/build.rs b/src/common/build.rs index 5772458..24639c2 100644 --- a/src/common/build.rs +++ b/src/common/build.rs @@ -30,8 +30,11 @@ fn main() { println!("cargo:rerun-if-changed={}", entry.display()); } - // Call the Python script to generate Rust code - let status = Command::new("python3") + // Call the Python script to generate Rust code. The interpreter can be + // selected with the PYTHON environment variable. + println!("cargo:rerun-if-env-changed=PYTHON"); + let python = env::var("PYTHON").unwrap_or_else(|_| "python3".to_string()); + let status = Command::new(&python) .arg(&script_path) .arg("--gen-rust") .arg("--rust-output") @@ -49,8 +52,8 @@ fn main() { } Err(e) => { panic!( - "Failed to run gen_param_code.py: {}. Make sure python3 is installed.", - e + "Failed to run gen_param_code.py: {}. Make sure {} is installed.", + e, python ); } } diff --git a/src/daemon/build.rs b/src/daemon/build.rs index 818e6d7..66f409b 100644 --- a/src/daemon/build.rs +++ b/src/daemon/build.rs @@ -26,7 +26,10 @@ fn main() { println!("cargo:rerun-if-changed={}", entry.display()); } - let status = Command::new("python3") + // The interpreter can be selected with the PYTHON environment variable + println!("cargo:rerun-if-env-changed=PYTHON"); + let python = env::var("PYTHON").unwrap_or_else(|_| "python3".to_string()); + let status = Command::new(&python) .arg(&script_path) .arg("--gen-conf-example") .arg("--conf-example-output") @@ -45,13 +48,14 @@ fn main() { } Err(e) if e.kind() == ErrorKind::NotFound => { println!( - "cargo:warning=python3 not found; skipping himmelblau.conf.example generation" + "cargo:warning={} not found; skipping himmelblau.conf.example generation", + python ); } Err(e) => { panic!( - "Failed to run gen_param_code.py: {}. Make sure python3 is installed.", - e + "Failed to run gen_param_code.py: {}. Make sure {} is installed.", + e, python ); } } diff --git a/src/qr-greeter/build.rs b/src/qr-greeter/build.rs index 89c3632..99f5854 100644 --- a/src/qr-greeter/build.rs +++ b/src/qr-greeter/build.rs @@ -476,7 +476,10 @@ fn main() { // Run the transpiler let transpiler = manifest_path.join("scripts/transpile-legacy.py"); - let status = Command::new("python3") + // The interpreter can be selected with the PYTHON environment variable + println!("cargo:rerun-if-env-changed=PYTHON"); + let python = env::var("PYTHON").unwrap_or_else(|_| "python3".to_string()); + let status = Command::new(&python) .arg(&transpiler) .current_dir(workspace_root) .status() ++++++ himmelblau-qr-greeter-gnome51.patch ++++++ >From 5383699683ff26feaa4d7a46d30597f36a361273 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero <[email protected]> Date: Fri, 27 Nov 2026 17:18:27 +0100 Subject: [PATCH 1/2] Fix QR greeter compatibility with GNOME Shell 51 GNOME Shell 51 changed authentication prompt layout and widget APIs, causing the QR greeter to fail or leave device-login messages clipped after repeated authentication attempts. Device-flow URLs enclosed in backticks also prevented QR generation, and unsupported CSS values produced warnings. Preserve readable sign-in instructions and QR rendering without disrupting older prompt layouts. Signed-off-by: Samuel Cabrero <[email protected]> Assisted-By: GPT-6 (cherry picked from commit eb2d56e3b6ed80d81a048d2ce6a80193ebed03e0) --- .../extension.js | 56 ++++++++----- .../extension.test.js | 79 +++++++++++++++++++ .../metadata.json | 2 +- .../qrselection.js | 2 +- .../qrselection.test.js | 5 ++ .../stylesheet.css | 8 +- 6 files changed, 125 insertions(+), 27 deletions(-) create mode 100644 src/qr-greeter/src/[email protected]/extension.test.js diff --git a/src/qr-greeter/src/[email protected]/extension.js b/src/qr-greeter/src/[email protected]/extension.js index 57f8156e..de43e1f0 100644 --- a/src/qr-greeter/src/[email protected]/extension.js +++ b/src/qr-greeter/src/[email protected]/extension.js @@ -1,14 +1,15 @@ import St from 'gi://St'; import Clutter from 'gi://Clutter'; import GLib from 'gi://GLib'; -import Pango from 'gi://Pango'; import Gio from 'gi://Gio'; import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; import * as AuthPromptModule from 'resource:///org/gnome/shell/gdm/authPrompt.js'; +import * as Config from 'resource:///org/gnome/shell/misc/config.js'; import { QrCode, Ecc } from './qrcodegen.js'; import { selectDeviceFlowUrl, URL_RE } from './qrselection.js'; const GdmAuthPrompt = AuthPromptModule.AuthPrompt; +const shellMajorVersion = Number.parseInt(Config.PACKAGE_VERSION, 10); // Track active temp files for cleanup let activeTotpTempFiles = new Set(); @@ -236,28 +237,35 @@ export default class QrGreeterExtension extends Extension { } origSetMessage.call(this, displayMessage, styleClass); - if (this._message) { - this._message.clutter_text.line_wrap = true; - this._message.clutter_text.set_line_alignment(Pango.Alignment.CENTER); - this._message.set_width(-1); - this._message.set_x_expand(false); - this._message.set_x_align(Clutter.ActorAlign.CENTER); + // GNOME 51 may retain the previous message's allocated height on + // retries. Reserve enough height for all wrapped lines. + if (shellMajorVersion >= 51 && this._message) { + const label = this._message; + label.set_height(-1); + if (displayMessage) { + const width = label.get_width(); + if (width > 0) { + const [, naturalHeight] = label.get_preferred_height(width); + label.set_height(naturalHeight); + } + } } if (!this._qrVBox) { - const parent = this._message.get_parent(); - parent.remove_child(this._message); + // GNOME 51 owns the message label in _inputWell. Do not + // reparent it: attach our content to the same container. + const parent = this._message?.get_parent() || this._inputWell; + if (!parent) return; const vbox = new St.BoxLayout({ - vertical: true, + orientation: Clutter.Orientation.VERTICAL, x_expand: false, y_expand: false, x_align: Clutter.ActorAlign.CENTER, style_class: 'qr-vbox' }); this._qrVBox = vbox; - - vbox.add_child(this._message); + vbox.hide(); const qrContainer = new St.Widget({ style_class: 'qr-code-container', @@ -284,7 +292,10 @@ export default class QrGreeterExtension extends Extension { this._qrLabel = qrLabel; vbox.add_child(qrLabel); - parent.add_child(vbox); + if (this._message?.get_parent() === parent) + parent.insert_child_above(vbox, this._message); + else + parent.add_child(vbox); } // Clean up any previous TOTP temp file @@ -302,8 +313,9 @@ export default class QrGreeterExtension extends Extension { this._totpTempFile = tempFilePath; activeTotpTempFiles.add(tempFilePath); const fileUri = `file://${tempFilePath}`; - this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: contain; background-repeat: no-repeat; background-position: center;`); + this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: 128px 128px; background-repeat: no-repeat;`); this._qrContainer.show(); + this._qrVBox.show(); if (this._qrCodeLabel) this._qrCodeLabel.hide(); this._qrLabel.set_text(this._qrBtLabel || "Scan with your authenticator app"); this._qrLabel.show(); @@ -312,6 +324,7 @@ export default class QrGreeterExtension extends Extension { if (this._qrContainer) this._qrContainer.hide(); if (this._qrCodeLabel) this._qrCodeLabel.hide(); if (this._qrLabel) this._qrLabel.hide(); + if (!this._fidoIcon?.visible) this._qrVBox.hide(); } this._qrBtActive = true; return; @@ -333,21 +346,21 @@ export default class QrGreeterExtension extends Extension { const baseLayer = new St.Widget({ width: 160, height: 80, - style: `background-image: url('file://${svgPath}'); background-size: contain; background-repeat: no-repeat; background-position: center;`, + style: `background-image: url('file://${svgPath}'); background-size: 160px 80px; background-repeat: no-repeat;`, }); const touchLayer = new St.Widget({ width: 160, height: 80, opacity: 0, - style: `background-image: url('file://${touchSvgPath}'); background-size: contain; background-repeat: no-repeat; background-position: center;`, + style: `background-image: url('file://${touchSvgPath}'); background-size: 160px 80px; background-repeat: no-repeat;`, }); container.add_child(baseLayer); container.add_child(touchLayer); this._fidoIcon = container; this._fidoTouchLayer = touchLayer; - this._qrVBox.insert_child_below(this._fidoIcon, this._message); + this._qrVBox.insert_child_at_index(this._fidoIcon, 0); this.connect('destroy', () => { if (this._fidoPulseTimer) { @@ -379,6 +392,7 @@ export default class QrGreeterExtension extends Extension { }); } this._fidoIcon.show(); + this._qrVBox.show(); if (!this._qrBtActive) { if (this._qrContainer) this._qrContainer.hide(); if (this._qrCodeLabel) this._qrCodeLabel.hide(); @@ -408,8 +422,9 @@ export default class QrGreeterExtension extends Extension { this._totpTempFile = tempFilePath; // Track for cleanup on this instance activeTotpTempFiles.add(tempFilePath); // Track globally for extension disable const fileUri = `file://${tempFilePath}`; - this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: contain; background-repeat: no-repeat; background-position: center;`); + this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: 128px 128px; background-repeat: no-repeat;`); this._qrContainer.show(); + this._qrVBox.show(); if (this._qrCodeLabel) this._qrCodeLabel.hide(); this._qrLabel.set_text(isTotpQr ? "Scan with your phone to set up TOTP" : "Scan with your phone to set up Hello TOTP"); this._qrLabel.show(); @@ -445,8 +460,9 @@ export default class QrGreeterExtension extends Extension { this._totpTempFile = tempFilePath; activeTotpTempFiles.add(tempFilePath); const fileUri = `file://${tempFilePath}`; - this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: contain; background-repeat: no-repeat; background-position: center;`); + this._qrContainer.set_style(`background-image: url('${fileUri}'); background-size: 128px 128px; background-repeat: no-repeat;`); this._qrContainer.show(); + this._qrVBox.show(); if (this._qrCodeLabel) { if (userCode) { this._qrCodeLabel.set_text(userCode); @@ -474,6 +490,8 @@ export default class QrGreeterExtension extends Extension { if (this._qrLabel) this._qrLabel.hide(); } } + if (!this._qrContainer.visible && !this._fidoIcon?.visible) + this._qrVBox.hide(); }; console.log("Himmelblau QR Greeter: GdmAuthPrompt.setMessage patched."); diff --git a/src/qr-greeter/src/[email protected]/extension.test.js b/src/qr-greeter/src/[email protected]/extension.test.js new file mode 100644 index 00000000..a2598689 --- /dev/null +++ b/src/qr-greeter/src/[email protected]/extension.test.js @@ -0,0 +1,79 @@ +/** Regression tests for the QR greeter's GNOME authentication prompt layout. */ +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; +import {test} from 'node:test'; +import {runInNewContext} from 'node:vm'; + +const source = readFileSync(new URL('./extension.js', import.meta.url), 'utf8'); +const start = source.indexOf(' if (!this._qrVBox) {'); +const end = source.indexOf(' // Clean up any previous TOTP temp file', start); +const createLayout = source.slice(start, end); + +class Actor { + constructor(props = {}) { + Object.assign(this, props); + this.children = []; + this.parent = null; + this.visible = true; + } + + add_child(child) { + assert.equal(child.parent, null); + child.parent = this; + this.children.push(child); + } + + insert_child_above(child, sibling) { + const index = this.children.indexOf(sibling); + assert.notEqual(index, -1); + assert.equal(child.parent, null); + child.parent = this; + this.children.splice(index + 1, 0, child); + } + + get_parent() { + return this.parent; + } + + hide() { this.visible = false; } + show() { this.visible = true; } +} + +// Verify GNOME 51's input well retains ownership of its message label. +test('QR container is attached beside the GNOME 51 message label', () => { + const well = new Actor(); + const message = new Actor(); + well.add_child(message); + const prompt = {_inputWell: well, _message: message}; + const context = { + St: {BoxLayout: Actor, Widget: Actor, Label: Actor}, + Clutter: {ActorAlign: {CENTER: 1}, Orientation: {VERTICAL: 1}}, + }; + + runInNewContext(`(function () { ${createLayout} })`, context).call(prompt); + + assert.equal(message.get_parent(), well); + assert.equal(prompt._qrVBox.get_parent(), well); + assert.equal(prompt._qrVBox.orientation, context.Clutter.Orientation.VERTICAL); + assert.deepEqual(well.children, [message, prompt._qrVBox]); + assert.equal(prompt._qrContainer.get_parent(), prompt._qrVBox); + assert.equal(prompt._qrLabel.get_parent(), prompt._qrVBox); + assert.equal(prompt._qrVBox.visible, false); + assert.equal(message.visible, true); +}); + +// Verify QR layout initialization works even when GNOME's label is temporarily unparented. +test('QR container initializes when the message label has no parent', () => { + const well = new Actor(); + const prompt = {_inputWell: well, _message: new Actor()}; + const context = { + St: {BoxLayout: Actor, Widget: Actor, Label: Actor}, + Clutter: {ActorAlign: {CENTER: 1}, Orientation: {VERTICAL: 1}}, + }; + + runInNewContext(`(function () { ${createLayout} })`, context).call(prompt); + + assert.equal(prompt._qrVBox.get_parent(), well); + assert.equal(prompt._qrContainer.get_parent(), prompt._qrVBox); + assert.equal(prompt._qrVBox.visible, false); +}); diff --git a/src/qr-greeter/src/[email protected]/metadata.json b/src/qr-greeter/src/[email protected]/metadata.json index 0ff63a56..efe2ea1c 100644 --- a/src/qr-greeter/src/[email protected]/metadata.json +++ b/src/qr-greeter/src/[email protected]/metadata.json @@ -3,7 +3,7 @@ "name": "Himmelblau QR Greeter", "description": "Adds a QR code to authentication prompts when a URL is detected.", "version": 1, - "shell-version": ["45", "46", "47", "48", "49", "50"], + "shell-version": ["45", "46", "47", "48", "49", "50", "51"], "session-modes": ["gdm", "unlock-dialog"], "donations": { "opencollective" : "himmelblau" } } diff --git a/src/qr-greeter/src/[email protected]/qrselection.js b/src/qr-greeter/src/[email protected]/qrselection.js index c9de0a10..80d71712 100644 --- a/src/qr-greeter/src/[email protected]/qrselection.js +++ b/src/qr-greeter/src/[email protected]/qrselection.js @@ -1,4 +1,4 @@ -const URL_RE = /https?:\/\/[^\s<>"')\]]+/g; +const URL_RE = /https?:\/\/[^\s<>"'`)\]]+/g; function extractUrls(message, urlRegex = URL_RE) { if (!message) { diff --git a/src/qr-greeter/src/[email protected]/qrselection.test.js b/src/qr-greeter/src/[email protected]/qrselection.test.js index 8cf434c7..60d0c789 100644 --- a/src/qr-greeter/src/[email protected]/qrselection.test.js +++ b/src/qr-greeter/src/[email protected]/qrselection.test.js @@ -34,6 +34,11 @@ function run() { }); assertEqual(selectionBase.url, baseUrl, 'falls back to base url'); assertFalse(selectionBase.usedComplete, 'marks base url used'); + + // Broker messages wrap device-login URLs in Markdown backticks. + const brokerMessage = 'To sign in, use a web browser to open the page `https://login.microsoft.com/device` and enter the code `BESBK78A2`.'; + const selectionBroker = selectDeviceFlowUrl(brokerMessage); + assertEqual(selectionBroker.url, 'https://login.microsoft.com/device', 'extracts backtick-quoted URL'); } run(); diff --git a/src/qr-greeter/src/[email protected]/stylesheet.css b/src/qr-greeter/src/[email protected]/stylesheet.css index 58976a9c..aa38ca42 100644 --- a/src/qr-greeter/src/[email protected]/stylesheet.css +++ b/src/qr-greeter/src/[email protected]/stylesheet.css @@ -1,5 +1,6 @@ .qr-vbox { spacing: 10px; + padding-top: 8px; } .qr-code-container { @@ -7,13 +8,10 @@ height: 128px; max-width: 128px; max-height: 128px; - margin-left: auto; - margin-right: auto; background-color: #ffffff; background-repeat: no-repeat; - background-size: contain; - background-position: center; + background-size: 128px 128px; border-radius: 6px; box-shadow: 0 0 8px rgba(0,0,0,0.3); @@ -22,8 +20,6 @@ .qr-user-code { width: 128px; - margin-left: auto; - margin-right: auto; padding: 3px 0; background-color: #000000; -- 2.56.1 >From 2eb7dbd00eb3540c5965051b204e818a9621e0e0 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero <[email protected]> Date: Fri, 27 Nov 2026 18:37:34 +0100 Subject: [PATCH 2/2] Include enrollment QR dependency in stable greeter packages The GNOME 51 compatibility patch imports enrollmentqr.js unconditionally. Without the module in the stable branch and its package assets, GNOME Shell fails to load the extension before any authentication message can be displayed. Signed-off-by: Samuel Cabrero <[email protected]> Assisted-By: GPT-6 --- src/qr-greeter/Cargo.toml | 2 + src/qr-greeter/scripts/transpile-legacy.py | 10 +++ .../enrollmentqr.js | 60 ++++++++++++++ .../enrollmentqr.test.js | 81 +++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 src/qr-greeter/src/[email protected]/enrollmentqr.js create mode 100644 src/qr-greeter/src/[email protected]/enrollmentqr.test.js diff --git a/src/qr-greeter/Cargo.toml b/src/qr-greeter/Cargo.toml index 97b58141..88867bad 100644 --- a/src/qr-greeter/Cargo.toml +++ b/src/qr-greeter/Cargo.toml @@ -25,6 +25,7 @@ assets = [ ["target/release/qr-greeter-build/[email protected]/extension.js", "usr/share/gnome-shell/extensions/[email protected]/extension.js", "644"], ["target/release/qr-greeter-build/[email protected]/qrcodegen.js", "usr/share/gnome-shell/extensions/[email protected]/qrcodegen.js", "644"], ["target/release/qr-greeter-build/[email protected]/qrselection.js", "usr/share/gnome-shell/extensions/[email protected]/qrselection.js", "644"], + ["target/release/qr-greeter-build/[email protected]/enrollmentqr.js", "usr/share/gnome-shell/extensions/[email protected]/enrollmentqr.js", "644"], ["target/release/qr-greeter-build/[email protected]/metadata.json", "usr/share/gnome-shell/extensions/[email protected]/metadata.json", "644"], ["target/release/qr-greeter-build/[email protected]/stylesheet.css", "usr/share/gnome-shell/extensions/[email protected]/stylesheet.css", "644"], ["target/release/qr-greeter-build/[email protected]/security-key.svg", "usr/share/gnome-shell/extensions/[email protected]/security-key.svg", "644"], @@ -38,6 +39,7 @@ assets = [ { source = "target/release/qr-greeter-build/[email protected]/extension.js", dest = "/usr/share/gnome-shell/extensions/[email protected]/extension.js", mode = "644" }, { source = "target/release/qr-greeter-build/[email protected]/qrcodegen.js", dest = "/usr/share/gnome-shell/extensions/[email protected]/qrcodegen.js", mode = "644" }, { source = "target/release/qr-greeter-build/[email protected]/qrselection.js", dest = "/usr/share/gnome-shell/extensions/[email protected]/qrselection.js", mode = "644" }, + { source = "target/release/qr-greeter-build/[email protected]/enrollmentqr.js", dest = "/usr/share/gnome-shell/extensions/[email protected]/enrollmentqr.js", mode = "644" }, { source = "target/release/qr-greeter-build/[email protected]/metadata.json", dest = "/usr/share/gnome-shell/extensions/[email protected]/metadata.json", mode = "644" }, { source = "target/release/qr-greeter-build/[email protected]/stylesheet.css", dest = "/usr/share/gnome-shell/extensions/[email protected]/stylesheet.css", mode = "644" }, { source = "target/release/qr-greeter-build/[email protected]/security-key.svg", dest = "/usr/share/gnome-shell/extensions/[email protected]/security-key.svg", mode = "644" }, diff --git a/src/qr-greeter/scripts/transpile-legacy.py b/src/qr-greeter/scripts/transpile-legacy.py index 20d22d9d..4b9f14f6 100644 --- a/src/qr-greeter/scripts/transpile-legacy.py +++ b/src/qr-greeter/scripts/transpile-legacy.py @@ -286,6 +286,16 @@ def main(): with open(qrselection_dst, 'w') as f: f.write(transpiled) + # The extension imports enrollmentqr.js on startup, including in legacy GJS. + enrollment_src = src_dir / "enrollmentqr.js" + enrollment = enrollment_src.read_text().replace( + "import { QrCode, Ecc } from './qrcodegen.js';", + "const Me = imports.misc.extensionUtils.getCurrentExtension();\n" + "const QrCode = Me.imports.qrcodegen.QrCode;\n" + "const Ecc = Me.imports.qrcodegen.Ecc;", + ).replace("export function ", "function ") + (legacy_dir / "enrollmentqr.js").write_text(enrollment) + # Transpile qrcodegen.js qrcodegen_src = src_dir / "qrcodegen.js" qrcodegen_dst = legacy_dir / "qrcodegen.js" diff --git a/src/qr-greeter/src/[email protected]/enrollmentqr.js b/src/qr-greeter/src/[email protected]/enrollmentqr.js new file mode 100644 index 00000000..84a2b82e --- /dev/null +++ b/src/qr-greeter/src/[email protected]/enrollmentqr.js @@ -0,0 +1,60 @@ +import { QrCode, Ecc } from './qrcodegen.js'; + +// This payload comes from the bounded PNG decoder in the PAM client. Keep the +// same bounds here because PAM messages are also a presentation boundary. +export function enrollmentQr(encoded, decodeBase64) { + if (!encoded || encoded.length > 2732 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) + throw new Error('Invalid enrollment QR'); + const bytes = decodeBase64(encoded); + if (bytes.length === 0 || bytes.length > 2048) + throw new Error('Invalid enrollment QR'); + // Strict UTF-8 decoding also works in legacy GJS without TextDecoder. + const payload = decodeURIComponent(Array.from(bytes, byte => + '%' + byte.toString(16).padStart(2, '0')).join('')); + if (/[\u0000-\u001f\u007f-\u009f]/.test(payload)) + throw new Error('Invalid enrollment QR'); + return QrCode.encodeText(payload, Ecc.MEDIUM); +} + +export function paintEnrollmentQr(cr, width, height, qr) { + const border = 4; + const scale = Math.floor(Math.min(width, height) / (qr.size + border * 2)); + if (scale < 1) throw new Error('Enrollment QR area is too small'); + const left = Math.floor((width - qr.size * scale) / 2); + const top = Math.floor((height - qr.size * scale) / 2); + cr.setSourceRGB(1, 1, 1); + cr.paint(); + cr.setSourceRGB(0, 0, 0); + for (let y = 0; y < qr.size; y++) { + for (let x = 0; x < qr.size; x++) { + if (qr.getModule(x, y)) + cr.rectangle(left + x * scale, top + y * scale, scale, scale); + } + } + cr.fill(); +} + +// The prompt is reused between attempts; its extra children are not reset by GDM. +export function bindEnrollmentQrLifetime(prompt, area) { + const connections = []; + const connect = (object, signal, callback) => { + connections.push([object, object.connect(signal, callback)]); + }; + const clear = () => area.destroy(); + for (const signal of ['reset', 'cancelled', 'failed', 'destroy']) + connect(prompt, signal, clear); + connect(prompt, 'notify::visible', () => { + if (!prompt.visible) clear(); + }); + connect(prompt._userVerifier, 'verification-failed', (_verifier, service) => { + if (service === 'gdm-password') clear(); + }); + connect(prompt._userVerifier, 'verification-complete', clear); + area.connect('destroy', () => { + for (const [object, id] of connections) { + // GDM may have already disposed the verifier during prompt destruction. + try { object.disconnect(id); } catch (_) { } + } + connections.length = 0; + }); +} diff --git a/src/qr-greeter/src/[email protected]/enrollmentqr.test.js b/src/qr-greeter/src/[email protected]/enrollmentqr.test.js new file mode 100644 index 00000000..45d920bd --- /dev/null +++ b/src/qr-greeter/src/[email protected]/enrollmentqr.test.js @@ -0,0 +1,81 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { enrollmentQr, paintEnrollmentQr, bindEnrollmentQrLifetime } from './enrollmentqr.js'; + +const encode = text => Buffer.from(text).toString('base64'); +const decode = text => new Uint8Array(Buffer.from(text, 'base64')); + +test('enrollment QR accepts UTF-8 payloads and draws an opaque quiet border', () => { + const qr = enrollmentQr(encode('otpauth://totp/Exemple:élise?secret=JBSWY3DPEHPK3PXP'), decode); + const rectangles = []; + const colors = []; + let painted = false; + let filled = false; + paintEnrollmentQr({ + setSourceRGB: (...rgb) => colors.push(rgb), + paint: () => { painted = true; }, + rectangle: (...rect) => rectangles.push(rect), + fill: () => { filled = true; }, + }, 256, 256, qr); + assert.equal(painted && filled, true); + assert.deepEqual(colors, [[1, 1, 1], [0, 0, 0]]); + assert.ok(rectangles.length > 0); + for (const [x, y, w, h] of rectangles) { + assert.ok(Number.isInteger(x) && Number.isInteger(y)); + assert.ok(x >= w * 4 && y >= h * 4); + assert.ok(x + w <= 256 - w * 4 && y + h <= 256 - h * 4); + } +}); + +test('enrollment QR rejects malformed, control-bearing, and oversized data', () => { + for (const encoded of ['', '!!!!', encode('hello\nworld'), encode('x'.repeat(2049)), '/w==']) + assert.throws(() => enrollmentQr(encoded, decode)); +}); + +class Signals { + constructor() { this.handlers = new Map(); this.nextId = 0; this.visible = true; } + connect(signal, callback) { this.handlers.set(++this.nextId, [signal, callback]); return this.nextId; } + disconnect(id) { this.handlers.delete(id); } + emit(signal, ...args) { + for (const [id, [name, callback]] of [...this.handlers]) { + if (name === signal && this.handlers.has(id)) callback(this, ...args); + } + } + destroy() { this.destroyed = true; this.emit('destroy'); this.handlers.clear(); } +} + +test('enrollment QR is removed on every auth teardown and disconnects its handlers', () => { + for (const signal of ['reset', 'cancelled', 'failed', 'destroy', 'notify::visible', + 'verification-failed', 'verification-complete', 'replacement', 'disable']) { + const prompt = new Signals(); + prompt._userVerifier = new Signals(); + const area = new Signals(); + bindEnrollmentQrLifetime(prompt, area); + if (signal.startsWith('verification-')) prompt._userVerifier.emit(signal, 'gdm-password'); + else if (['replacement', 'disable'].includes(signal)) area.destroy(); + else { + prompt.visible = false; + prompt.emit(signal); + } + assert.equal(area.destroyed, true, signal); + assert.equal(prompt.handlers.size, 0, signal); + assert.equal(prompt._userVerifier.handlers.size, 0, signal); + prompt.emit('reset'); + } +}); + +test('QR survives prompts and polling, and a reused prompt cleans up the next QR', () => { + const prompt = new Signals(); + prompt._userVerifier = new Signals(); + for (let attempt = 0; attempt < 2; attempt++) { + const area = new Signals(); + bindEnrollmentQrLifetime(prompt, area); + for (const signal of ['prompted', 'next', 'notify::visible']) prompt.emit(signal); + prompt._userVerifier.emit('show-message'); + prompt._userVerifier.emit('verification-failed', 'gdm-fingerprint'); + assert.equal(area.destroyed, undefined); + prompt.emit('reset'); + assert.equal(area.destroyed, true); + assert.equal(prompt.handlers.size, 0); + } +}); -- 2.56.1 ++++++ himmelblau-rpmlintrc ++++++ --- /var/tmp/diff_new_pack.7SK5hI/_old 2026-12-03 14:00:22.633035022 +0100 +++ /var/tmp/diff_new_pack.7SK5hI/_new 2026-12-03 14:00:22.637035192 +0100 @@ -22,9 +22,3 @@ # suggests would not help: nothing else uses the library, nsswitch does. addFilter("libnss_himmelblau2.*: W: shlib-fixed-dependency") -# himmelblau-selinux requires selinux-policy-devel on purpose: the policy module -# is compiled from the shipped sources at install time (posttrans), against the -# policy installed on the host, as there is no prebuilt module that fits every -# distribution's base policy. -addFilter("himmelblau.*: E: devel-dependency selinux-policy-devel") - ++++++ himmelblau-sso-policies ++++++ #!/bin/sh # # Add or remove the Himmelblau SSO extension in the policies.json files of # Firefox and Thunderbird. These applications read a single policies.json, so # the extension is merged into the existing file instead of replacing it. # Run it as root after installing the package himmelblau-sso-policies, and # with "remove" before uninstalling it. # # Usage: /usr/libexec/himmelblau/sso-policies add|remove # # The URLs of the extensions are taken from the example files installed by the # package. ETCDIR and DOCDIR can be set to test the script. set -eu ETCDIR="${ETCDIR:-/etc}" DOCDIR="${DOCDIR:-/usr/share/doc/packages/himmelblau-sso-policies}" # Matches the URLs of the extension of any version, so old ones are replaced FIREFOX_PATTERN='linux_entra_sso-[0-9][0-9.]*\.xpi$' THUNDERBIRD_PATTERN='linux_entra_sso-[0-9][0-9.]*\.thunderbird\.xpi$' action="${1:-}" case "$action" in add | remove) ;; *) echo "Usage: $0 add|remove" >&2 exit 1 ;; esac command -v jq >/dev/null 2>&1 || { echo "jq not found, the SSO extension has to be configured manually" >&2 exit 0 } tmp="$(mktemp)" trap 'rm -f "$tmp"' EXIT # Add the extension of the example file to the policies file. The file is only # written if jq succeeded, so an invalid file is never overwritten. add_policy() { file="$1" example="$2" pattern="$3" [ -f "$example" ] || return 1 url="$(jq -r '.policies.Extensions.Install[0] // empty' "$example")" || return 1 [ -n "$url" ] || return 1 if [ ! -f "$file" ]; then mkdir -p "$(dirname "$file")" install -m 0644 "$example" "$file" return fi # Nothing to do if the extension is there and no other version of it is left if jq -e --arg url "$url" --arg pattern "$pattern" ' (.policies.Extensions.Install[]? | select(. == $url)) and ([.policies.Extensions.Install[]? | select(type == "string" and test($pattern) and . != $url)] | length == 0) ' "$file" >/dev/null 2>&1; then return fi jq --arg url "$url" --arg pattern "$pattern" ' .policies.Extensions.Install = ( ([.policies.Extensions.Install[]? | select((type == "string" and test($pattern)) | not)] + [$url]) | unique )' "$file" >"$tmp" || return 1 # Write in place to keep the owner and the mode of the file cat "$tmp" >"$file" } # Remove the extension from the policies file and clean up what is left empty remove_policy() { file="$1" pattern="$2" [ -f "$file" ] || return 0 jq --arg pattern "$pattern" ' if .policies.Extensions.Install then .policies.Extensions.Install |= map(select((type == "string" and test($pattern)) | not)) else . end | if .policies.Extensions.Install == [] then del(.policies.Extensions.Install) else . end | if .policies.Extensions == {} then del(.policies.Extensions) else . end' "$file" >"$tmp" || return 1 if jq -e '.policies == {}' "$tmp" >/dev/null 2>&1; then rm -f "$file" else cat "$tmp" >"$file" fi } status=0 for app in firefox thunderbird; do failed=0 case "$app" in firefox) pattern="$FIREFOX_PATTERN" ;; thunderbird) pattern="$THUNDERBIRD_PATTERN" ;; esac file="$ETCDIR/$app/policies/policies.json" if [ "$action" = add ]; then add_policy "$file" "$DOCDIR/$app-policies.json.example" "$pattern" || failed=1 else remove_policy "$file" "$pattern" || failed=1 fi if [ "$failed" -ne 0 ]; then echo "Failed to update $file" >&2 status=1 fi done exit "$status" ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/himmelblau/vendor.tar.zst /work/SRC/openSUSE:Factory/.himmelblau.new.1340718/vendor.tar.zst differ: char 7, line 1
