{{Header}} {{title|title= ToDo for Developers (archived) }} {{#seo: |description=Archived TODOs }} {{devwiki}} {{intro| Archived TODOs }} = ARCHIVED 2 = == user-sysmaint-split - Qubes support == * Ensure template provides sudo access and allows normal system maintenance, while AppVM doesn't. * Ensure sysmaint-panel works properly * Workarounds may be needed so that the sysmaint account is used by default in sysmaint mode rather than user. * Qubes upstream PR needed for sysmaint-related changes to work: https://github.com/QubesOS/qubes-core-qrexec/pull/194 ** PR is merged upstream. * Changed packages: ** sysmaint-panel: https://github.com/ArrayBolt3/sysmaint-panel/tree/arraybolt3/qubes-sysmaint *** Patrick: Merged. ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/qubes-sysmaint *** Patrick: Merged. ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/qubes-sysmaint *** Patrick: Merged. ** dist-base-files: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/qubes-sysmaint *** Patrick: Merged. == user-sysmaint-split - advertise boot modes in Qubes OS == * Add needed files for advertising supported boot modes in Whonix-Workstation * Whonix-Gateway will not be using user-sysmaint-split by default and thus should NOT have these files unless the user manually installs the needed packages ** Code done in the same branches listed under https://www.kicksecure.com/wiki/Dev/todo#user-sysmaint-split_-_Qubes_support. == grml-debootstrap - review #332 == * https://github.com/grml/grml-debootstrap/pull/332 * please do a theoretic review if it might have adverse effects * Aaron: Thoroughly reviewed and tested with derivative-maker. Looks good, works just fine. == grml-debootstrap - dual grub-pc and grub-efi compatibility == * now default by grml-debootstrap? does above PR effect it? * Aaron: PR does not appear to affect hybrid BIOS+UEFI boot compatibility at all. I was able to build a Kicksecure VirtualBox VM that was both BIOS and UEFI-bootable using the zeha/grub-once branch the PR is in. == grml-debootstrap - GRUB installation refactoring == * https://github.com/grml/grml-debootstrap/issues/258 * The following line is very difficult to follow.
  # Has chroot-script installed GRUB to MBR using grub-install (successfully), already?
  # chroot-script skips installation for unset ${GRUB}
  if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v | grep -Fq GRUB; then
* Split into multiple conditions? * More informational output. * Possible to leave GRUB installation to grml-deboostrap and leave it out from chroot-script? * potential bug / difficult to follow cod paths: chroot-script seems to set up grub-pc in some cases only. But if it does, then --vmefi would be skipped. * Better code documentation? * Looked at the code, concluded the best way to refactor it out was to implement https://github.com/grml/grml-debootstrap/issues/320 since it didn't serve any useful purpose other than working around a needless redundancy anyway. ** PR: https://github.com/grml/grml-debootstrap/pull/331 ** Merged. == live-build - initramfs-tools is needlessly installed == * please avoid, if feasible, as this prolonged build times, specifically for cross builds (arm64 on amd64) * non-issue: initramfs-tools inside final ISO. In other words: initramfs-tools later gets replaced by dracut. initramfs-tools is just needlessly intermediately installed. * Reduced unnecessary initramfs rebuilds in https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads ** Patrick: merged * Got rid of initramfs-tools and installed dracut earlier in the build process in https://github.com/ArrayBolt3/derivative-maker/commit/8ce944308b767c328c443dcf15d5f6b1fba57dec ** Patrick: merged == GRUB - improve developer documentation == * see [[Dev/boot]] and related wiki pages in mininav (links on top of the wiki page) * document which tools are writing to important files such as /etc/default/grub * Documented all Kicksecure and Whonix packages that make meaningful changes to GRUB configuration or setup. == calamares - use /etc/default/grub.d drop-in folder instead of /etc/default/grub file == * This is to avoid the issue of multiple files attempting to write to /etc/default/grub, dpkg interactive conflict resolution dialogs, ucf. * if applicable * This feature already exists in Calamares, but is sadly broken. PR to fix at https://github.com/calamares/calamares/pull/2445 * This can be worked around in the short term using a shellprocess. Code with workaround: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/grubcfg Tested and appears to work on my end. * Patrick: Merged. == Qubes kloak-alike tickets == * please comment on https://github.com/QubesOS/qubes-issues/issues/1850 and other related tickets as sensible ** https://github.com/QubesOS/qubes-issues/issues/1850#issuecomment-2655357292 ** https://github.com/QubesOS/qubes-issues/issues/8541#issuecomment-2655358902 ** https://github.com/vmonaco/kloak/issues/74#issuecomment-2655362546 * What other steps are required to enable Qubes kloak-alike for Qubes-Whonix? Please create tickets. ** https://github.com/QubesOS/qubes-issues/issues/9771 *** Implemented in https://github.com/QubesOS/qubes-core-admin-addon-whonix/pull/20, handling in a separate task. ** https://github.com/QubesOS/qubes-issues/issues/9861 == calamares dual legacy + efi booting support == * as discussed * PR opened at https://github.com/calamares/calamares/pull/2422 * Merged. == Verified Boot 3mdeb Git == * please review and comment * Reviewed, commented where appropriate, will keep up-to-date with future changes. == pwchange migration packaging bug ==
dpkg -l | grep usability      
ii  usability-misc                                3:26.2-1                             all          Misc usability improvements
dpkg: error processing archive /var/cache/apt/archives/helper-scripts_3%3a27.8-1_all.deb (--unpack):
 trying to overwrite '/usr/sbin/pwchange', which is also in package usability-misc 3:26.2-1
Errors were encountered while processing:
 /var/cache/apt/archives/helper-scripts_3%3a27.8-1_all.deb
* Patrick renamed pwchange to pwchange_ as a stopgap. * Patrick made some improvements to pwchange_. * If this is difficult to fix, we can just move pwchange back to usability-misc perhaps until release upgrade (if that simplifies things). * Discussed cause and solution with Patrick, file shouldn't need to be moved back to usability-misc.
helper-scripts debian/changelog:

    helper-scripts (3:28.2-1) unstable; urgency=medium
    ...

usability-misc debian/changelog:

    usability-misc (3:26.4-1) unstable; urgency=medium
    ....

helper-scripts debian/control:

    Package: helper-scripts
    ...
    Breaks: usability-misc (<< 3:26.4-1)
    Replaces: usability-misc (<< 3:26.4-1)
    ...

usability-misc debian/control:

    Package: usability-misc
    ...
    Depends: ... helper-scripts (>= 3:28.2-1) ...
    ...
== systemcheck - improve login security output format == * current table format is confusing, rework as discussed * Improved in https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/autologin ** Patrick: Merged. * Also found an autologinchange bug (was trying to create /etc/sddm.conf.d without root privileges), fixed in https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/autologin ** Patrick: Merged. == user-sysmaint-split - GUI vs CLI == * GUI (login manager) versus CLI (tty login) * clarify autologinchange GUI vs CLI * clarify inside systemcheck ** Aaron: Implemented clarifications: *** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/autologin *** sysmaint-panel: https://github.com/ArrayBolt3/sysmaint-panel/tree/arraybolt3/autologin *** systemcheck: https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/autologin * check systemcheck CLI autologin in separate column, if feasible (separate columns for GUI vs CLI autologin) ** Aaron: This looks difficult, see https://unix.stackexchange.com/questions/401759/automatically-login-on-debian-9-2-1-command-line. Console autologin has details about things like serial terminals and the like that one has to be aware of, and depending on one's systemd configuration, determining when automatic login is enabled vs. when it isn't may be tricky. Should probably be split into a separate task if we want to pursue this, noting that it may end up a modestly large job. * test login (non-automatic) into sysmaint CLI tty1 ** Aaron: tty1 has boot messages and RADS messages still showing on it. Does not accept user input. I can however log into the sysmaint account on tty2 when booted in PERSISTENT mode SYSMAINT. All I need to do is type the username and press Enter, the account is passwordless in my VM so I'm granted access without a password prompt, similar to how account user behaves. * Patrick: all merged == privleap - pwd bug == * Qubes, sys-whonix
[gateway user ~]% leaprun tor-verify-config                
Mar 17 06:38:26.693 [notice] Tor 0.4.8.13 running on Linux with Libevent 2.1.12-stable, OpenSSL 3.0.15, Zlib 1.2.13, Liblzma 5.4.1, Libzstd 1.5.4 and Glibc 2.36 as libc.
Mar 17 06:38:26.693 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://support.torproject.org/faq/staying-anonymous/
Mar 17 06:38:26.693 [notice] Read configuration file "/etc/tor/torrc".
Mar 17 06:38:26.694 [notice] Processing configuration path "/etc/torrc.d/*.conf" at recursion level 1.
Mar 17 06:38:26.694 [notice] Including configuration file "/etc/torrc.d/60_network.conf".
Mar 17 06:38:26.694 [notice] Including configuration file "/etc/torrc.d/65_gateway.conf".
Mar 17 06:38:26.694 [notice] Including configuration file "/etc/torrc.d/65_leak_tests.conf".
Mar 17 06:38:26.694 [notice] Including configuration file "/etc/torrc.d/70_workstation.conf".
Mar 17 06:38:26.694 [notice] Processing configuration path "/usr/share/tor/tor-service-defaults-torrc.anondist" at recursion level 2.
Mar 17 06:38:26.694 [notice] Including configuration file "/usr/share/tor/tor-service-defaults-torrc.anondist".
Mar 17 06:38:26.694 [notice] Including configuration file "/etc/torrc.d/95_whonix.conf".
Mar 17 06:38:26.694 [notice] Processing configuration path "/usr/local/etc/torrc.d/*.conf" at recursion level 2.
Mar 17 06:38:26.694 [notice] Including configuration file "/usr/local/etc/torrc.d/40_tor_control_panel.conf".
Mar 17 06:38:26.694 [notice] Including configuration file "/usr/local/etc/torrc.d/50_user.conf".
Mar 17 06:38:26.695 [notice] You configured a non-loopback address '10.137.0.10:5300' for DNSPort. This allows everybody on your local network to use your machine as a proxy. Make sure this is what you wanted.
Mar 17 06:38:26.695 [notice] You configured a non-loopback address '10.137.0.10:9040' for TransPort. This allows everybody on your local network to use your machine as a proxy. Make sure this is what you wanted.
Mar 17 06:38:26.695 [warn] Directory /home/user/.tor cannot be read: Permission denied
Mar 17 06:38:26.695 [warn] Failed to parse/validate config: Couldn't access private data directory "/home/user/.tor"
Mar 17 06:38:26.695 [err] Reading config failed--see warnings above.
zsh: exit 1     leaprun tor-verify-config
* In file /usr/libexec/systemcheck/check-env I appended:
pwd
env
* result:
leaprun check-privleap-environment-variables
/home/user
SHELL=/usr/bin/bash
WATCHDOG_USEC=10000000
PWD=/home/user
LOGNAME=user
SYSTEMD_EXEC_PID=902
TEMPDIR=/tmp/user/0
HOME=/home/user
LANG=en_US.UTF-8
TMPDIR=/tmp/user/0
INVOCATION_ID=675ad997bbec4d37ad4ab6339af8a388
USER=user
WATCHDOG_PID=902
NOTIFY_SOCKET=/run/systemd/notify
TEMP=/tmp/user/0
SHLVL=1
JOURNAL_STREAM=8:3035
TMP=/tmp/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
* conclusions: ** output of pwd is wrong ** environment variables wrong: *** PWD *** HOME *** TMPDIR *** TEMP *** USER *** PATH * This happened when I refactored the PAM integration out into a separate shim - I got the calling user and target user mixed up and the regression tests didn't catch it. * Fixed in https://github.com/ArrayBolt3/privleap/commit/e8d7023b44d770d7b9c76ff217b975da0e9d0d05, regression tests added to catch similar bugs in the future. == user-sysmaint-split - systemcheck == * If user-sysmaint-split is installed, systemcheck function check_login_security cannot use
/usr/libexec/user-sysmaint-split/sysmaint-boot query-sysmaint-autologin
* Perhaps that function would be better if available in helper-scripts? Because it currently results in an error.
            if [ -x /usr/libexec/user-sysmaint-split/sysmaint-boot ]; then
               if [ "$(/usr/libexec/user-sysmaint-split/sysmaint-boot query-sysmaint-autologin 2>/dev/null)" = 'yes' ]; then
                  echo 'Enabled'
               else
                  echo 'Disabled'
               fi
            else
              echo 'Error'
            fi
* The problem is "echo 'Error'". * User sysmaint might exist but user-sysmaint-split might have been uninstalled using user-sysmaint-split. * Skip check_login_security inside Qubes? * Please avoid subshells because these interfere with error handling. (I did not do it to avoid merge conflicts.)
   readarray -t user_list < <(/usr/libexec/helper-scripts/get-user-list)
if ! output="$(/usr/libexec/helper-scripts/get-user-list)"; then
    echo "ERROR: Failed to get user list!" >&2
    exit 1
fi

readarray -t user_list <<< "$output"
* please use grep with end-of-options * All issues should now be fixed. Repos changed: ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/autologin *** Patrick: Merged. ** setup-wizard-dist: https://github.com/ArrayBolt3/setup-wizard-dist/tree/arraybolt3/autologin *** Patrick: Merged. ** systemcheck: https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/autologin *** Patrick: Merged. ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/autologin *** Patrick: Merged. == privleap - logging improvements == * please rewrite "user" -> "account" (This is to avoid phrases like "user user".)
Mar 14 09:05:56 host privleapd[18294]: handle_comm_session: INFO: Triggered action 'apt-get-update'
Mar 14 09:28:52 host privleapd[17481]: auth_signal_request: WARNING: Could not find action 'test'
* Should privleap mention which account triggered an action? By comparison, sudo does log this.
Mar 14 09:25:49 host sudo[24600]:     user : TTY=pts/2 ; PWD=/home/user ; USER=root ; COMMAND=/usr/bin/ls
Mar 14 09:25:49 host sudo[24600]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Mar 14 09:25:49 host sudo[24600]: pam_unix(sudo:session): session closed for user root
* Privacy should be alright because journal can only be accessible by root. (Unless systemcheck --verbose leaks it. But logging, able to find bugs/DOS seems more important than log privacy.) * We don't necessarily needs the same logging format as sudo. ** TTY: probably irrelevant. ** PWD: probably irrelevant. ** command: privleap already logs it. ** account: missing * Should be done in https://github.com/ArrayBolt3/privleap/commit/abf878dfe55d49bb930fdbba2ed9542db9d4aa93, may need a more careful audit to ensure all cases that need changed are changed * Audited, made another commit with missed bits caught: https://github.com/ArrayBolt3/privleap/commit/b9ea564089d3f825a2f08364807dfc1c7c278eb8 * Patrick: Merged. == privleap - post-review improvements == * https://github.com/ArrayBolt3/privleap/issues/1 * Discuss, implement as appropriate * Done, remaining issues on the bug tracker are very low priority and not blockers. == grml-debootstrap - fix UEFI bootloader updates == * https://github.com/grml/grml-debootstrap/issues/297 * please send a pull request upstream ** Pull request: https://github.com/grml/grml-debootstrap/pull/299 merged. ** This is specific to how grml-debootstrap works, Kicksecure will need some extra code of its own to work properly here since we use a different bootloader ID than Debian does (ours is kicksecure, theirs is debian). *** Patrick: Please make bootloader ID configurable in grml-debootstrap. (They'll probably accept that because grml is an independent Linux distribution, might have use for that too and are generally easy to work with.) **** Aaron: Done. *** Patrick: Please patch derivative-maker to make use of this new feature and set custom bootloader ID. **** Aaron: Will wait to do this until the patch is merged upstream, unless things take long enough that we have a good reason to fork. * Patrick: please use, review the following simplification, if sane
    if [ -z "$VMEFI" ]; then
      grub_pc_package_name=grub-pc
    else
      # We install grub-pc-bin instead of grub-pc when EFI is enabled, because
      # otherwise the EFI bootloader won't be automatically updated when GRUB
      # packages are uploaded. Doing this means that the BIOS bootloader won't
      # be automatically updated, which stinks, however the BIOS bootloader
      # doesn't have the same security concerns as the EFI bootloader (there's
      # no Secure Boot to grapple with when using legacy BIOS boot) so it's
      # better to let the BIOS bootloader lag behind and update the EFI one
      # than to let the EFI bootloader lag behind and update the BIOS one.
      grub_pc_package_name=grub-pc-bin
    fi

    if ! clean_chroot "${MNTPOINT}" dpkg --list "$grub_pc_package_name" 2>/dev/null | grep -q '^ii' ; then
      echo "Notice: '$grub_pc_package_name' package not present yet, installing it therefore."
      # shellcheck disable=SC2086
      clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS "$grub_pc_package_name"
    fi
** Integrated. * Patrick: Please consider using numbers and lowering priority. Since it's unlikely that any other configuration file changes EFI ID, specifically by the time grml-debootstrap runs, maximum priority is unnecessary. Always best to keep free space for hypothetical derivatives.
        echo "GRUB_DISTRIBUTOR='${EFI_ID}'" > "${MNTPOINT}"/etc/default/grub.d/z-grml-debootstrap-efi-id.cfg
** Discussed, elected not to do this. * Run clean_chroot "$MNTPOINT" debconf-set-selections <<< 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' unconditionally in all cases? That would make it easier to add an option in case upstream does not wish to enable that by default. ** Discussed, elected not to do this. * Avoid repetitive clean_chroot "$MNTPOINT" DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get -y --no-install-recommends install $DPKG_OPTIONS command in source code, only set package name so the source code has this command only once to install the GRUB package? Not sure it is a good idea to mix this refactoring into this pull request. Might be better to do that later in a follow-up pull request once that one was merged. ** Not done yet to avoid overcomplicating the PR. * ARM_EFI_TARGET: Assume that works similarly, use the new debconf-set-selections method? ** Done, actually I just removed ARM_EFI_TARGET entirely. * CI testing: https://github.com/Kicksecure/grml-debootstrap/pull/1 * related PR: https://github.com/grml/grml-debootstrap/pull/302 == user-sysmaint-split - Qubes - sysmaint boot features == * implement [https://github.com/QubesOS/qubes-issues/issues/9750 Polish support for booting qubes with custom kernel command line parameters] * related: [https://github.com/QubesOS/qubes-issues/issues/2238 Debian template: disable newly (all) installed services by default] ** Replied here with some relevant info. ** Does this obsolete selective sudo access? No, probably not. * Wrote several iterations of a spec, updating with input from Marek for each iteration. * Implemented, going back and forth with reviews with Marek. * PR list: ** qubes-core-admin: https://github.com/QubesOS/qubes-core-admin/pull/653 *** Also made https://github.com/QubesOS/qubes-core-admin/pull/666 to fix a bug after the above PR was merged slightly too early. ** qubes-manager: https://github.com/QubesOS/qubes-manager/pull/407 ** qubes-core-admin-client: https://github.com/QubesOS/qubes-core-admin-client/pull/342 * All PRs merged. == default password == * rationale: virtual console based login attempts. An attacker could connect a keyboard to a server to login. * review wiki: [[Default Passwords]] * helper-scripts: add a tool that looks user accounts with empty passwords, if feasible * GUI ISO: calamares. ** link to documentation ** choices: *** default: none (user must choose) *** passwordless *** set a password *** Aaron: We decided to skip doing this in calamares to reduce code duplication and maintenance burden. * CLI ISO: non-existent, therefore non-issue for now * GUI VM images: A setup-wizard-dist popup should explain this. ** Good for systems installed from ISO also. * CLI: an INFO message after login if there are any unlocked passwordless accounts * Implemented, ready for review, testing, ''maybe'' merge?: ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/autologin *** Rename variable file to file_name. (Because `file` is a utility.) *** Please simplify string parsing. Create a file /etc/user-sysmaint-split.d/40_autologin_username when enabling autologin. Point out that the file was auto generated by $SCRIPTNAME and might get deleted by the same. To enable autologin, create a file. To disable autologin, delete the file. **** Aaron: Currently this is not done because it would potentially cause severe bugs to do things this way, especially with the KDE desktop environment. Autologin configuration can get badly out of sync without the more complicated sting parsing. *** Lightweight self-document what the script is doing on a technical level. ("Created file ...") *** Drop if [ "${default_display_manager}" = 'lightdm' ]; then and elif [ "${default_display_manager}" = 'sddm' ]; then. Always apply all autologin enabling and disabling actions to all supported display manager configurations. *** What if there are user configured autologin settings? Detect these, point out the configuration file path and tell the user that the autologin script does not support that? Advice the user to keep manual configuration or delete the custom configuration? **** Aaron: Not necessary, because we're doing more complex string parsing. *** Aaron: Done except for points that are marked as skipped. **** Patrick: Merged. ** systemcheck: https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/autologin *** Patrick: Merged. ** sysmaint-panel: https://github.com/ArrayBolt3/sysmaint-panel/tree/arraybolt3/autologin *** Patrick: Merged. ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/autologin *** Patrick: Merged. *** Aaron: Needs re-merged, more changes were made. *** Patrick: Merged. ** usability-misc: https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/autologin *** rm_conffile /etc/lightdm/lightdm.conf.d/40_autologin.conf missing? Probably not. I guess this is on purpose. Otherwise, this would disable autologin for existing users, which would be confusing. **** Aaron: Correct, we want to leave this file here. ***** Patrick: Merged. ** setup-wizard-dist: https://github.com/ArrayBolt3/setup-wizard-dist/tree/arraybolt3/autologin *** Patrick: Merged. ** setup-dist: https://github.com/ArrayBolt3/setup-dist/tree/arraybolt3/autologin *** Please use grep with end of options. *** Aaron: Done. *** Patrick: Merged. ** initializer-dist: https://github.com/ArrayBolt3/initializer-dist/tree/arraybolt3/autologin *** Please document in script comments: Why is this a chroot script instead of a postinst script with do_once? Because otherwise, do_once in postinst, this might enable sysmaint autologin for already existing users that are upgrading that had already disabled autologin, which would be bad from their perspective. *** Use call the autologin script to enable autologin instead using sponge directly. This would be useful in the future if porting to a different display manager. The autologin script will need a non-interactive / command line use method *** Aaron: Both tasks done. *** Patrick: Merged. ** msgcollector: https://github.com/ArrayBolt3/msgcollector/tree/arraybolt3/autologin *** Unnecessary? This should better be implemented at the level of https://github.com/Kicksecure/open-link-confirmation? *** Aaron: Done, required changes to two repos: **** open-link-confirmation: https://github.com/ArrayBolt3/open-link-confirmation/tree/arraybolt3/autologin **** user-sysmaint-split (listed above) **** Patrick: Merged. * Things that still need fixed: ** Wording changes necessary? autologinchange talks about 'sysmaint mode' rather than 'PERSISTENT mode SYSMAINT' which may be bad. ** Patrick: Should be OK. * Review by Patrick #1: ** Please reword from "user user" to "account user". *** Aaron: Done. ** Replace /etc/user-sysmaint-split.conf by drop-in folder. *** Aaron: Done, modified user-sysmaint-split, helper-scripts, initializer-dist, systemcheck, and derivative-maker to make this work. **** derivative-maker: https://github.com/ArrayBolt3/derivative-maker/tree/master ***** Patrick: Merged. ** See inline comments above. *** Aaron: Addressed. == user-sysmaint-split - setup-dist - improve error handling ==
check_passwords() {
   if grep -q -- 'Absent' < <(leaprun get-password-status-list); then
      printf '%b\n' "[${yellow}WARNING${nocolor}] Some user accounts on this system are passwordless. Run 'systemcheck' for more information."
   fi
}
* bug: subshell cannot handle errors * please implement without subshell * leaprun should run outside of "if" * WARNING -> NOTICE? * Patrick: Done. == user-sysmaint-split - set default shell for account sysmaint to zsh == * todo * Done in https://github.com/ArrayBolt3/user-sysmaint-split/commit/779a483f8c83fd7dfb15f3532a8eb5285115dc05 * Patrick: Merged. * please refactor / de-duplicate code dist-base-files versus user-sysmaint-split * Done: ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/user-create *** Patrick: Merged. ** dist-base-files: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/user-create *** Patrick: Merged. ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/user-create *** Patrick: Merged. There was a merge conflict. Could you please check if it was resolved correctly? **** Aaron: Reproduced conflict on my end, resolved it, then checked the difference with git difftool. Looks fine to me. == user-sysmaint-split - sysmaint login failure when autologin disabled == * If sysmaint autologin is disabled, the first attempt to log in as account sysmaint in PERSISTENT mode SYSMAINT will fail because it will try to sign into a normal desktop session. * Investigate ways to resolve this, is there a system-wide state file for lightdm we can overwrite? * Fixed in user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/autologin * Patrick: Merged. == kernel module loading disabling exit zero or non-zero comment == * please comment here: https://github.com/Kicksecure/security-misc/issues/303 * Researched and commented. == Kicksecure default browser == * please read prior discussions, comment, edit if applicable * https://www.kicksecure.com/wiki/Dev/Default_Browser ** Aaron: Reorganized some stuff, filled in some missing documentation on projects. * https://forums.whonix.org/t/chromium-browser-for-kicksecure-discussions-not-whonix/10388 ** Aaron: Read through and commented. * https://github.com/Kicksecure/security-misc/issues/192 *** Aaron: Read through, didn't have much to add here, I put everything I had to add on the Whonix forum. == automatic updates wiki editing == * please add notes to, edit [[Dev/Automatic_Updates]] ** Only things I could see to add was the bit about Lubuntu Update and a note about making an update notifier that didn't handle update installation. Otherwise this seemed pretty thorough and not in need of further revision at the moment. I think Kicksecure would need something more robust than Lubuntu Update, but that it would still provide somewhere to start for implementing something like this (probably in Python). == privleap - umask == * please consider privleap in context of https://github.com/Kicksecure/security-misc/issues/185 * How to handle privleap versus umask? Leave it to (python) PAM? Probably best. * Please lightweight document. * Discovered that PAM umask customization was causing problems, by changing the umask of the entire privleapd process (thus affecting even actions that are run as root). Fixed by adding an extra shim between privleapd and PAM. Fixes are in https://github.com/ArrayBolt3/privleap as usual. * Patrick: merged == privleap - upgrade systemd unit issue == * Qubes, Whonix-Workstation, developers repository
Mar 14 09:05:15 host systemd[1]: Stopping leapctl@1000.service - leapctl - Enable access to privleap for each user...
Mar 14 09:05:15 host systemd[1]: Stopping privleapd.service - privleap - Limited Privilege Escalation Framework...
Mar 14 09:05:15 host systemd[1]: privleapd.service: Deactivated successfully.
Mar 14 09:05:15 host systemd[1]: Stopped privleapd.service - privleap - Limited Privilege Escalation Framework.
Mar 14 09:05:15 host systemd[1]: privleapd.service: Consumed 2.205s CPU time.
Mar 14 09:05:15 host systemd[1]: Starting privleapd.service - privleap - Limited Privilege Escalation Framework...
Mar 14 09:05:15 host leapctl[18293]: ERROR: Could not connect to privleapd!
Mar 14 09:05:15 host systemd[1]: leapctl@1000.service: Control process exited, code=exited, status=1/FAILURE
Mar 14 09:05:15 host systemd[1]: leapctl@1000.service: Failed with result 'exit-code'.
Mar 14 09:05:15 host systemd[1]: Stopped leapctl@1000.service - leapctl - Enable access to privleap for each user.
Mar 14 09:05:15 host systemd[1]: Starting leapctl@1000.service - leapctl - Enable access to privleap for each user...
Mar 14 09:05:15 host systemd[1]: Started privleapd.service - privleap - Limited Privilege Escalation Framework.
Mar 14 09:05:15 host privleapd[18294]: handle_control_create_msg: INFO: Handled CREATE message for user 'user', socket created
Mar 14 09:05:15 host leapctl[18296]: Comm socket created for user 'user'.
Mar 14 09:05:15 host systemd[1]: Finished leapctl@1000.service - leapctl - Enable access to privleap for each user.
* Mostly a cosmetic issue. But a problem as this error ends up in systemcheck --verbose --function check_journal. * No actually broken functionality. * Most likely not a configuration issue. * Potential bug: Does leapctl@1000.service try use privleapd.service before it was restarted? * /usr/lib/systemd/system/leapctl@.service - Does it lack After=?
[Unit]
Description=leapctl - Enable access to privleap for each user
Requires=privleapd.service user@.service

## Useful to add...?
After=privleapd.service user@.service
* Looks like the After= was indeed good to have and missing. Added, tested, works. https://github.com/ArrayBolt3/privleap/commit/c1e9730e5ff3988db610d5603f1b14d8e16ebd2d * Patrick: merged == privleap - tb-starter issue == * stable repository * https://forums.whonix.org/t/home-user-cache-permission-issue-in-recent-updates/21427 * Fix: https://github.com/ArrayBolt3/tb-updater/tree/arraybolt3/cache-fix ** Tested, .cache is no longer owned by root, Remmina starts properly * Patrick: Merged. == privleap - error - No authorized users or groups for action: 'tor-bootstrap-check' == * was happening inside Qubes Whonix-Workstation Template only * error happened during upgrade from developers repository
Setting up privleap (3:2.3-1) ...
/etc/privleap/conf.d/systemcheck.conf:33:error:No authorized users or groups for action: 'tor-bootstrap-check'
WARNING: privleap configuration invalid. Not restarting privleapd.
* file /etc/privleap/conf.d/systemcheck.conf already looks okay
[action:tor-bootstrap-check]
Command=/usr/libexec/helper-scripts/tor_bootstrap_check.py
AuthorizedGroups=sudo
AuthorizedUsers=user,sdwdate
TargetUser=debian-tor
TargetGroup=debian-tor
* was happening insid Qubes Whonix-Gateway Template only
Setting up privleap (3:2.3-1) ...
/etc/privleap/conf.d/anon-connection-wizard.conf:1:error:No authorized users or groups for action: 'acw-tor-control-restart'
WARNING: privleap configuration invalid. Not restarting privleapd.
* file /etc/privleap/conf.d/anon-connection-wizard.conf already looks good
[action:acw-tor-control-restart]
Command=/usr/libexec/anon-connection-wizard/acw-tor-control restart
AuthorizedGroups=sudo
AuthorizedUsers=user
* Aaron: Attempted to fully upgrade a clean pair of Whonix-Gateway and Whonix-Workstation templates on Qubes OS R4.3 using the bookworm-developers repository. Cannot reproduce either bug, privleap installs, sets up, and has triggers run for it without issues, service is properly started and systemcheck works without errors. * Got another report from a user using the testers repository.
/etc/privleap/conf.d/systemcheck.conf:33:error:No authorized users or groups for
 action: 'tor-bootstrap-check'
WARNING: privleap configuration invalid. Not restarting privleapd. Run configura
tion check using: privleapd --check-config
* This is perhaps because config check runs before new configuration files have been installed? Solution, run config check after installation of configuration files, i.e. after DEBHELPER token? * Figured out why this is likely happening - upgrades that change the config file format will trigger this because the conffiles of packages ''other than privleap'' are unlikely to be unpacked by the time privleap is configuring itself. This is normal, expected behavior that can't be avoided and shouldn't cause problems in practice. * Fixed the cosmetic part of the issue in https://github.com/ArrayBolt3/privleap/commit/78698e8ae40d2b5ea3e0f11e32f8ffe0b2e6793e * Patrick: Merged. == unbreak repository-dist == * Likely caused by recent repository-dist changes. Issue visible on both new ISO and VBox builds of Kicksecure. ** Note that patches for default password/autologin security were applied to my build, but this failure appears to be unrelated. * systemctl status repository-dist-initializer.service:
× repository-dist-initializer.service - /etc/apt/sources.list.d/derivative.list initializer
     Loaded: loaded (/lib/systemd/system/repository-dist-initializer.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2025-03-07 17:31:20 CST; 35s ago
    Process: 968 ExecStart=/usr/libexec/repository-dist/repository-dist-initializer (code=exited, status=1/FAILURE)
   Main PID: 968 (code=exited, status=1/FAILURE)
        CPU: 5ms

Mar 07 17:31:20 localhost repository-dist-initializer[968]: + set -e
Mar 07 17:31:20 localhost repository-dist-initializer[968]: + test -r /var/lib/repository-dist/derivative_apt_repository_opts
Mar 07 17:31:20 localhost repository-dist-initializer[968]: + test -e /var/lib/repository-dist/initializer.done
Mar 07 17:31:20 localhost repository-dist-initializer[1016]: ++ cat /var/lib/repository-dist/derivative_apt_repository_opts
Mar 07 17:31:20 localhost repository-dist-initializer[968]: + repository_dist_arguments='--enable --codename bookworm'
Mar 07 17:31:20 localhost repository-dist-initializer[968]: + repository-dist --enable --codename bookworm
Mar 07 17:31:20 localhost repository-dist-initializer[1027]: /usr/bin/repository-dist: line 362: under: unbound variable
Mar 07 17:31:20 localhost systemd[1]: repository-dist-initializer.service: Main process exited, code=exited, status=1/FAILURE
Mar 07 17:31:20 localhost systemd[1]: repository-dist-initializer.service: Failed with result 'exit-code'.
Mar 07 17:31:20 localhost systemd[1]: Failed to start repository-dist-initializer.service - /etc/apt/sources.list.d/derivative.list initializer.
* /etc/apt/sources.list.d/derivative.list does not exist. * Patrick: Fixed. == deb822 sources list comment == * please comment on https://forums.kicksecure.com/t/apt-sources-list-one-line-format-versus-deb822-style-format/267/1 == ISO - use variable flavor_meta_packages_to_install == * using already existing variable flavor_meta_packages_to_install would simplify modifications * Done: https://github.com/ArrayBolt3/derivative-maker/commit/1653d359373963e50b8f8b16f254e6bbfe47ac90 ** Tested, both XFCE and CLI Kicksecure ISOs can be built successfully with this change. == privleap - python-pam bug == * error produced in anon-whonix
sudo journalctl --boot -u privleapd
Mar 03 11:30:21 host systemd[1]: Starting privleapd.service - privleap - Limited Privilege Escalation Framework...
Mar 03 11:30:21 host systemd[1]: Started privleapd.service - privleap - Limited Privilege Escalation Framework.
Mar 03 11:33:06 host privleapd[671]: handle_control_create_msg: INFO: Handled CREATE message for user 'user', socket created
Mar 03 11:33:07 host python3[671]: pam_unix(privleapd:session): session opened for user debian-tor(uid=107) by (uid=0)
Mar 03 11:33:07 host python3[671]: pam_succeed_if(privleapd:session): requirement "uid eq 0" not met by user "debian-tor"
Mar 03 11:33:07 host privleapd[671]: handle_control_create_msg: WARNING: User 'debian-tor' is not allowed to have a comm socket
Mar 03 11:33:07 host privleapd[671]: handle_comm_session: INFO: Triggered action 'tor-circuit-established-check'
* Aaron: The PAM message is perfectly normal, it's triggered by this snippet in /etc/pam.d/common-session:
session [success=1 default=ignore] pam_succeed_if.so uid eq 0
session optional pam_umask.so umask=027
* This snippet says "set the umask for the newly logged-in user to 027 if they ''aren't'' root. If they are root, skip over the umask setting. When running an action as debian-tor, this will end up showing a message that the UID check didn't pass, meaning that the umask will be set. This is an intentional part of how we implement stricter umask settings. * The issue stating that debian-tor is not allowed to have a comm socket is normal, because debian-tor (for some reason unknown to me) has a running user session in the anon-whonix VM. This means that it triggers a leapctl@UID.service unit for itself like any other logged-in user, but because it isn't listed as an allowed user, that service doesn't start (by design). Therefore this isn't a problem, though it's curious that debian-tor is logged in... == bookworm-backports-staging == * https://fasttrack.debian.net/ mentions deb https://fasttrack.debian.net/debian-fasttrack/ bookworm-backports-staging main contrib * Is this new? ** Aaron: Does not appear to be new, this was how things were done in Bullseye as well. * Since Kicksecure enables fasttrack by default, should probably enable bookworm-backports-staging by default too? ** Aaron: Yes, we should. "Staging" is usually scary and indicates there could be package breakage, but in this instance it's effectively identical to the normal backports repo but allows packages in that don't fit the normal backports rules (yet). This isn't a place for doing dangerous operations like I initially thought. == investigate why debian-tor has a login on Whonix-Workstation == * todo * Turned out to be PAM integration's fault, the default code path in PAM's config stacks assumes an interactive session. * Fixed in https://github.com/ArrayBolt3/privleap/commit/a22b63d4190cf8b52fb8727560f4113f80da36b2, all it does is specify a non-interactive session instead. == Qubes APT pinning ticket == * https://github.com/QubesOS/qubes-core-admin-linux/pull/184 * https://www.kicksecure.com/wiki/Dev/APT_Pinning * Please comment, if applicable. * Commented, also looked over code and didn't have anything to add beyond what Ben already added. == privleap - keep trying to start leapctl@1000.service ==
Mar 03 11:09:50 host systemd[1]: leapctl@1000.service: Failed with result 'exit-code'.
Mar 03 11:09:50 host systemd[1]: Stopped leapctl@1000.service - leapctl - Enable access to privleap for each user.
Mar 03 11:09:50 host systemd[1]: Starting leapctl@1000.service - leapctl - Enable access to privleap for each user...
Mar 03 11:09:50 host leapctl[40455]: ERROR: Could not connect to privleapd!
Mar 03 11:09:50 host systemd[1]: leapctl@1000.service: Main process exited, code=exited, status=1/FAILURE
Mar 03 11:09:50 host systemd[1]: leapctl@1000.service: Failed with result 'exit-code'.
* In case of errors, please configure the systemd unit to start trying forever but with long enough delay to keep long spam limited. * Done in https://github.com/ArrayBolt3/privleap/commit/b4a84a8660fe8a5380e42b9df930ac718cb2dd34 == privleap - leaprun - consider supporting end-of-options == * leaprun apt-get-update-simulate * would it make sense to support * leaprun -- apt-get-update-simulate * it doesn't change a lot, except it allows for consistent use of end-of-options * Done: https://github.com/ArrayBolt3/privleap/commit/0db59e476e606481b979331060a3cc53cd73da99 == privleap - consider using end-of-options ==
        ["/usr/bin/bash", "-c", desired_action.action_command],
* minor: useful to change to...?
        ["/usr/bin/bash", "-c", "--", desired_action.action_command],
* Done: https://github.com/ArrayBolt3/privleap/commit/61da84d033c23c74840ae953409a2c09475a0b9c == privleap - harden and polish == * Continue fixing and discussing issues found by Ben Grande and others. * Should be done, only remaining issue that seems potentially concerning is https://github.com/ArrayBolt3/privleap/issues/11 which may or may be something that needs fixed. * Patrick: merged == privleap - abolish simple all users allowed fallback ==
[command:echo-hello]
Command=echo 'Hi!'
* Some sort of AuthorizedGroups=sudo or AuthorizedUsers= should always be existing. * If all users should be able to, this might be best implemented with a special keyword. * Done in https://github.com/ArrayBolt3/privleap/commit/415190bed64add132fdb38e886ce868286c4da77, special keyword can be added later if needed. * Repos that needed additional changes: ** anon-connection-wizard: https://github.com/ArrayBolt3/anon-connection-wizard/tree/arraybolt3/privleap-strict-auth ** systemcheck: https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/privleap-strict-auth * Patrick: Merged. == fix up policy-rc.d script in user-sysmaint-split == * Conflicts with derivative-maker, needs derivative-maker changes to avoid ** Fixed, required changes to derivative-maker and live-build *** https://github.com/ArrayBolt3/derivative-maker/tree/master *** https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads * Missing proper copyright header ** Fixed: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/policy-rcd * Check other policy-rc.d helpers in Debian if they exist to see if they would be better suited to this? ** It appears the only helpers are policyrcd-script-zg2 and policy-rcd-declarative, both of which have been studied and appear unfit for our use case. (Based on the results of apt-cache search policy | grep rcd) * Patrick: Merged. == privleap - implement config reload without restart == * https://github.com/ArrayBolt3/privleap/issues/12 * configuration fast hash based? * Current implementation works via an explicit restart command that can be sent by leapctl. Performance doesn't seem to be an issue doing a total reload each time, can revisit hashing if performance becomes a problem. * {{CodeSelect|code= sudo systemctl reload privleapd }} == user-sysmaint-split - document policy-rc.d == * todo * Documented at https://www.kicksecure.com/w/index.php?title=Sysmaint&stable=0, with a new bullet point "Inhibition of non-critical services". == privleap postinst deb-systemd-invoke bug ==
#####################################################################
## INFO: BEGIN: privleap postinst configure' '3:1.7-1
#####################################################################
'
+ case "$1" in
+ deb-systemd-helper enable privleapd.service
+ deb-systemd-helper enable leapctl@.service
+ start_privleapd
+ deb-systemd-invoke restart privleapd.service
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 145.
* Can't reproduce, but may be resolved by https://github.com/ArrayBolt3/privleap/commit/17d4caa0a84499559c8f18dbd90076ef0172501d * only reproduced so far: Qubes Whonix-Gateway Template * not reproducible in: Qubes Kicksecure / Qubes Whonix-Workstation Template
[template gateway user ~]% sudo DEBDEBUG=1 dpkg --configure -a
Setting up privleap (3:1.9-1) ...
++ [[ -v disable_echo ]]
++ disable_echo=
++ '[' '' = true ']'
++ colors
++ alt=
++ ealt=
++ hide=
++ show=
++ save=
++ load=
++ bold=
++ stout=
++ estout=
++ under=
++ eunder=
++ reset=
++ blink=
++ italic=
++ eitalic=
++ red=
++ green=
++ yellow=
++ blue=
++ magenta=
++ cyan=
++ white=
++ default=
++ eed=
++ eel=
++ ebl=
++ ewl=
++ draw=
++ back=
++ test -n ''
++ test -n ''
++ [[ -v TERM ]]
++ '[' xterm-256color = '' ']'
++ [[ -t 2 ]]
+++ type -t exception_handler_general
++ '[' '' = function ']'
+++ trap -p ERR
++ '[' '' = '' ']'
++ trap error_handler_pre ERR
++ bash -n /usr/libexec/helper-scripts/pre.bsh
++ bash -n /var/lib/dpkg/info/privleap.postinst
++ own_filename=privleap.postinst
++ source_config_folder
++ [[ -v DPKG_MAINTSCRIPT_PACKAGE ]]
++ '[' privleap = '' ']'
++ pre_bsh_settings_folder=privleap_maint.d
++ shopt -s nullglob
++ local i
++ true 'folder 1: /etc/privleap_maint.d/*.conf'
++ true 'folder 2: /usr/local/etc/privleap_maint.d/*.conf'
++ shopt -u nullglob
++ check_scripts_to_skip
++ [[ -v SKIP_SCRIPTS ]]
++ SKIP_SCRIPTS=
++ local skip_script
+ set -e
+ true '
#####################################################################
## INFO: BEGIN: privleap postinst configure' '3:1.7-1
#####################################################################
'
+ restarted_once=no
+ case "$1" in
+ deb-systemd-helper enable privleapd.service
+ deb-systemd-helper enable leapctl@.service
+ start_privleapd
+ '[' no = yes ']'
++ command -v systemctl
+ '[' '!' -x /usr/bin/systemctl ']'
+ deb-systemd-invoke restart privleapd.service
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 145.
++ error_handler_pre
== privleap - run config check from postinst == * to make broken configurations more easily visible * Done in https://github.com/ArrayBolt3/privleap/commit/29580c1bc4991a87f03bdc7fc92738b36371ca37, may also resolve some of the other weird behavior we've been seeing. == privleap - bug duplicate action tor-verify-config ==
Feb 20 05:37:04 host privleapd[15069]: parse_config_files: CRITICAL: Error parsing config: '/etc/privleap/conf.d/systemcheck.conf:26:error:Duplicate action found: 'tor-verify-config''
* This was resolved by https://github.com/Whonix/anon-gw-anonymizer-config/commit/778625b7c1dd4ef3c0afd9b839d31684b85f4bee, does anon-gw-anonymizer-config need a new upload or is the machine this is happening on out-of-date? * Further fix at https://github.com/ArrayBolt3/privleap/commit/dd776782aedf176b3f2538e8b8b78db73504ba43 == privleap - change action header format == * https://github.com/ArrayBolt3/privleap/issues/4 * Done: ** privleap: https://github.com/ArrayBolt3/privleap/commit/b482a05a1970b1be0bbad784753a1019730e0b0c ** sdwdate: https://github.com/ArrayBolt3/sdwdate/tree/arraybolt3/pl-actions ** sdwdate-gui: https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/pl-actions ** anon-connection-wizard: https://github.com/ArrayBolt3/anon-connection-wizard/tree/arraybolt3/pl-actions ** setup-dist: https://github.com/ArrayBolt3/setup-dist/tree/arraybolt3/pl-actions ** systemcheck: https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/pl-actions ** tb-starter: https://github.com/ArrayBolt3/tb-starter/tree/arraybolt3/pl-actions ** tb-updater: https://github.com/ArrayBolt3/tb-updater/tree/arraybolt3/pl-actions ** anon-gw-anonymizer-config https://github.com/ArrayBolt3/anon-gw-anonymizer-config/tree/arraybolt3/pl-actions * Patrick: Merged. == user-sysmaint-split - consider using policyrcd-script-zg2 == * todo * Aaron: Looks like it introduces more complexity than it fixes: ** It doesn't actually support drop directories as hoped. It just looks for a script in: *** Whatever location is specified by a hardcoded config file /etc/zg-policy-rc.d.conf *** Whatever location is specified by a hardcoded environment variable CONFFILE *** One of two hardcoded locations (/usr/local/sbin/policy-rc.d or /etc/policy-rc.d) ** It only executes one script. Ultimately this is no better than the functionality given by just using update-alternatives. ** It warns in the manpage that there may be many bugs. The script isn't that long, but it has lots of (seemingly unnecessary?) automake stuff surrounding it, which worries me. ** IMO, it will be easier to just fiddle with update-alternatives when we need to tweak policy-rc.d than to use this. == sdwdate-gui - port qrexec temporary file to tmpfiles.d == * replace mkdir --parents -- /run/user/1000 * replace /run/user/1000/sdwdate * prefer using /usr/lib/tmpfiles.d/sdwdate-gui.conf, if possible ** Done: https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/run-user-1000 * as a fallback (if still needed, if above is not possible, use mkdir --mode) ** Not needed. == sdwdate-gui - /run/user/1000 owned by wrong user == * https://forums.whonix.org/t/some-recent-change-breaks-starting-whonix-workstation-on-qubes-privleap-suspected/21170/13 * Should be fixed by https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/run-user-1000 * Patrick: Merged. == user-sysmaint-split - consider using policy-rcd-declarative-deny-all or alike in sysmaint mode == * Would using policy-rcd-declarative-deny-all (or similar) be useful in sysmaint mode to avoid unneeded systemd units from starting in sysmaint mode? * related: https://github.com/QubesOS/qubes-issues/issues/2238 * policy-rcd-declarative-deny-all itself did not appear suitable, however a custom policy-rc.d appears to work. * Implemented in https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/policy-rcd * Patrick: Merged. == privleap - start early before other systemd units such as sdwdate == * if sane, doable * to avoid sdwdate and others needing to use systemd After=privleapd.service * Done, now starts before basic.target comes up, which should be early enough for sdwdate and most other services * https://github.com/ArrayBolt3/privleap/commit/46f1ad00587cd1b34ee43fd14abf55b271cf8182 * Patrick: Merged. == privleap - investigate qubes crashes == * https://forums.whonix.org/t/some-recent-change-breaks-starting-whonix-workstation-on-qubes-privleap-suspected/21170/13 * Issue found, fixed: https://github.com/ArrayBolt3/anon-gw-anonymizer-config/commit/778625b7c1dd4ef3c0afd9b839d31684b85f4bee * Patrick: Merged. == user-sysmaint-split - account bob breaks upgrade == * todo * Should now be fixed, also made a bunch of other improvements, closing issues filed by Ben Grande. == user-sysmaint-split - remove dependency on lightdm == * lightdm is not installed on Qubes OS VMs and should not be installed. * desktop VM users may prefer sddm, which we are attempting to support. * Done: https://github.com/ArrayBolt3/sysmaint-panel ** Patrick: merged == user-sysmaint-split - Qubes tb-updater - fix disposable VM support == * https://forums.whonix.org/t/latest-update-breaks-tor-browser-in-disposables/21183 * revert the reverts: ** cf995c1d666fe3142f368afb243bd8be5be30734 ** 814438e9f8a68da3ae3545f028e3850cac91e474 *** Reverts reverted and root cause fixed in https://github.com/ArrayBolt3/tb-updater/tree/arraybolt3/sudoless-fix **** Patrick: merged == user-sysmaint-split - test sudoless upgrade-nonroot == * ensure sudoless upgrade-nonroot doesn't damage system if privleapd is restarted during installation * if output at restart is confusing, consider how to make it less confusing if such a restart occurs * Details of issues and ideas on how to resolve them shared in chat * Reverted back to sudo-based upgrade-nonroot, only works under user sysmaint. Also fixed some other bugs. https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/misc-fixes ** Patrick: merged * Other fixes made while working on this: ** dist-base-files (allow sysmaint to use privleap): https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/sysmaint-privleap ** Patrick: merged ** privleap (fix install failure): https://github.com/ArrayBolt3/privleap ** Patrick: merged ** user-sysmaint-split (fix race condition that sometimes resulted in sysmaint login during normal boot): https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/race-fix ** Patrick: merged == read 3mdeb RAM decay research == * https://blog.3mdeb.com/2025/2025-01-24-ram-data-decay-research-part2/ * [[Cold Boot Attack Defense]] * [[Ram-wipe]] * [[Dev/RAM Wipe]] * Read, added notes to [[Cold Boot Attack Defense]]. == live-build - local repository support == * add support to build from local repository * Merge request: https://salsa.debian.org/live-team/live-build/-/merge_requests/369 * Alternate implementation merged by rclobus, we're now using upstream's version in derivative-maker. == user-sysmaint-split - Qubes - sysmaint-boot.target - upstream feature request == * What would need to happen to make sysmaint-boot.target available in Qubes? Please discuss with Qubes, open a Qubes ticket, if applicable. * related Qubes ticket: [https://github.com/QubesOS/qubes-issues/issues/2238 Debian template: disable newly (all) installed services by default] * Ticket filed for this specifically: https://github.com/QubesOS/qubes-issues/issues/9750 == privleap - add crash recovery == * If privleapd crashes on a system with user-sysmaint-split installed, the user will be left with no way to run privileged operations until the next reboot. Even without user-sysmaint-split, many of the sudoless application ports will function improperly if privleapd isn't running. * Make privleapd resilient to crashes: ** Add a watchdog timeout to the systemd unit ** Add code to privleapd that occasionally pings systemd to let it know it's still running via sdnotify ** Handle user login/logout comm sockets using a systemd service template so that non-persistent user sockets can be automatically recreated on restart * Code changes: ** privleap: https://github.com/ArrayBolt3/privleap ** dist-base-files: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/privleap *** Patrick: both merged == user-sysmaint-split - privleap - use systemd notify == * sdwdate uses sd-notify. Please look at it (or something else) as an example on how to implement it. * please implement sd-notify in privleap * reason: reliably notify systemd when the daemon is ready. This will avoid any hardcoded "sleep 1" in Debian postinst and will generally increase the reliability of privleap. Should it ever be stuck, systemd would detect this and restart privleap. * systemd unit file changes:
[Service]
Type=notify
TimeoutSec=30 ## needs adjustment
WatchdogSec=200m ## needs adjustment
Restart=always
* usr/lib/python3/dist-packages/sdwdate/sdwdate.py
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:import sdnotify
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:SDNOTIFY_OBJECT = sdnotify.SystemdNotifier()
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:SDNOTIFY_OBJECT.notify("READY=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:SDNOTIFY_OBJECT.notify("STATUS=Starting...")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:    SDNOTIFY_OBJECT.notify("STATUS=Shutting down...")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:    SDNOTIFY_OBJECT.notify("WATCHDOG=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:    SDNOTIFY_OBJECT.notify("STOPPING=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:            SDNOTIFY_OBJECT.notify("WATCHDOG=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:            SDNOTIFY_OBJECT.notify(msg)
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:        SDNOTIFY_OBJECT.notify("WATCHDOG=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:        msg_for_sdnotify = "STATUS=" + msg
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:        SDNOTIFY_OBJECT.notify(msg_for_sdnotify)
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:        SDNOTIFY_OBJECT.notify("WATCHDOG=1")
usr/lib/python3/dist-packages/sdwdate/sdwdate.py:        SDNOTIFY_OBJECT.notify("WATCHDOG=1")
* Added basic support, also got the postinst script working properly and passing lintian. I don't know if watchdog support is desirable, since comm sockets will be lost during a restart and automatically recreating them may not always be desirable. * Patrick: merged == coding style - avoid which - use command -v == * which, use command -v instead. This is because which is an external binary (minor reason) and produces stdout if a binary was found, which can be slightly confusing (major reason). * documented on [[Dev/bash]] just now * task can be moved to archived after reading * Aaron: Will do. == lintian - use lintian locally during package build process == * lintian is already run during the build process.
/usr/share/genmkfile/make-helper-one.bsh: INFO: You can find your deb file here: /home/user/derivative-binary/genmkfile-packages-result/privleap_1.3-1_all.deb
/usr/share/genmkfile/make-helper-one.bsh: INFO: make_use_lintian='' - Autodetecting if lintian is installed...
/usr/share/genmkfile/make-helper-one.bsh: INFO: lintian auto detected, using it...
lintian           --suppress-tags missing-tests-control          --suppress-tags systemd-service-file-missing-documentation-key          --suppress-tags orig-tarball-missing-upstream-signature          --suppress-tags package-supports-alternative-init-but-no-init.d-script          --suppress-tags no-manual-page          --quiet          --pedantic          --info          --display-info            "/home/user/derivative-binary/genmkfile-packages-result/privleap_1.3-1_amd64.changes"
/usr/share/genmkfile/make-helper-one.bsh: INFO: lintian exit code: 0
/usr/share/genmkfile/make-helper-one.bsh: INFO: lintian output:
################################################################################
N:
W: privleap: maintainer-script-calls-systemctl [postinst:41]
* This breaks package build. By undocumented convention, all packages produce result in lintian exit code 0 and no lintian output. All lintian warnings are either fixed, suppressed or have lintian exception configurations. * Could you please add to your local build tools to run genmkfile lintian? * Aaron: Will do, usually I use genmkfile deb-pkg which runs this but I've been ignoring the output incorrectly. == live-build - --debian-installer-distribution git security impact research == * TODO research: would --debian-installer-distribution git verify software signatures or still be vulnerable to HTTP / HTTPS based attacks? * Aaron: Yes, this is still vulnerable. udebs are downloaded directly even when building the installer from source. Additionally, you can't use a source-built installer to create a Bookworm ISO anymore - only Trixie and newer works because Bookworm lacks udebs sufficiently new enough for the debian-installer build to work. == user-sysmaint-split - quick uninstall boot option == * Users might be confused by user-sysmaint-split and prefer using sudo and pkexec normally. * Using sudo dummy-dependency --purge user-sysmaint-split from sysmaint mode is functional but inconvenient. * Add option to boot menu that offers to remove user-sysmaint-split for the user, to revert back to "classic" privilege escalation. * Implemented, required changes to user-sysmaint-split and sysmaint-panel. ** https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/uninstaller *** Patrick: Merged. ** https://github.com/ArrayBolt3/sysmaint-panel *** Patrick: Merged.
    def uninstall():
        subprocess.run(["/usr/libexec/helper-scripts/terminal-wrapper",
                       "/usr/bin/sudo", "/usr/bin/apt", "purge",
                       "user-sysmaint-split"])
        subprocess.run(["/usr/sbin/reboot"])
* Patrick: This will cause issues with meta packages removal? Better to use dummy-dependency --yes --purge user-sysmaint-split. ** Aaron: Agreed, done. https://github.com/ArrayBolt3/sysmaint-panel * Patrick: Merged. == user-sysmaint-split - privleap - add a trigger to reload privleap once its configuration folder changed == * this is to receive updated/fixed privleap configuration files once these have changed * Done: https://github.com/ArrayBolt3/privleap ** Patrick: Merged. == user-sysmaint-split - privleap - start privleap after installation == * if possible (to avoid issues after installation) * Did as part of adding a trigger to privleap. == user-sysmaint-split - privleap - sdwdate-gui - temp folder ==
echo "$QREXEC_REMOTE_DOMAIN $1" | tee /tmp/sdwdate-gui-tmp-status
* consider use of a more secure folder ** Agreed on /run/user/1000/sdwdate, new code is here: https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/temp-file-move * re-check python valid characters sanity test ** Rechecked and tested, appears to be correct. Add automated testing of invalid ASCII to privleap's test suite. * Patrick: Merged. == sync fork of live-build with upstream == * Some MRs made upstream have been reimplemented and the polished versions merged. Pull these changes into our fork and adjust derivative-maker accordingly. ** derivative-maker: https://github.com/ArrayBolt3/derivative-maker/tree/master *** Patrick: Merged. ** live-build: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads *** Patrick: Merged. * Aaron: Both of these need re-merged, the fix I did for isomd5sum turned out to be a workaround for a configuration issue. Upstream helped me discover the real problem there. ** Patrick: Both merged. == user-sysmaint-split - privleap - breaks Qubes gui == * whonix-workstation-17-dvm is no longer starting, likely due to the issue below * Tested, seems to now be resolved. == user-sysmaint-split - privleap - close stdin == * close stdin, since not available anyhow * this is to avoid programs waiting for input forever, which will never come * Done in latest privleap code. == user-sysmaint-split - privleap - usability-misc privleap configuration bug ==
Feb 06 18:32:29 host systemd[1]: Started privleapd.service - privleap - Limited Privilege Escalation Framework.
Feb 06 18:32:29 host privleapd[877]: parse_config_files: CRITICAL: Failed to load config file '/etc/privleap/conf.d/usability-misc.conf'!
Feb 06 18:32:29 host privleapd[877]: Traceback (most recent call last):
Feb 06 18:32:29 host privleapd[877]:   File "/usr/lib/python3/dist-packages/privleap/privleapd.py", line 595, in parse_config_files
Feb 06 18:32:29 host privleapd[877]:     = pl.PrivleapCommon.parse_config_file(f.read())
Feb 06 18:32:29 host privleapd[877]:       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 06 18:32:29 host privleapd[877]:   File "/usr/lib/python3/dist-packages/privleap/privleap.py", line 1010, in parse_config_file
Feb 06 18:32:29 host privleapd[877]:     action_output_list.append(PrivleapAction(current_action_name,
Feb 06 18:32:29 host privleapd[877]:                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 06 18:32:29 host privleapd[877]:   File "/usr/lib/python3/dist-packages/privleap/privleap.py", line 830, in __init__
Feb 06 18:32:29 host privleapd[877]:     raise ValueError(f"User '{raw_auth_user}' specified by "
Feb 06 18:32:29 host privleapd[877]: ValueError: User 'sysmaint' specified by field 'AuthorizedUsers' of action 'upgrade-nonroot-wrapper' does not exist!
Feb 06 18:32:29 host systemd[1]: privleapd.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 18:32:29 host systemd[1]: privleapd.service: Failed with result 'exit-code'.
* Latest changes from https://github.com/ArrayBolt3/privleap should resolve this. == user-sysmaint-split - privleap - setup-dist and anon-connection-wizard == * Patrick: in progress by Patrick * port to privleap incomplete * will cause the same issue as this: https://forums.whonix.org/t/getting-setup-dist-error-in-whonix-gateway/21162 * Whonix-Gateway CLI, no desktop. policykit may not be designed for this.
debian/control:         pkexec,
usr/lib/python3/dist-packages/anon_connection_wizard/tor_status.py:    command = ['pkexec', '/usr/libexec/anon-connection-wizard/acw-write-torrc', temp_file_path]
usr/lib/python3/dist-packages/anon_connection_wizard/anon_connection_wizard.py:                    command = ['pkexec', '/usr/libexec/anon-connection-wizard/acw-write-torrc', Common.torrc_tmp_file_path]
* tor-control-panel:
packages/kicksecure/tor-control-panel/debian/control:         pkexec,
* Patrick: Done. setup-dist is now using privleap for Tor enable/disable. Please review and move to archived if OK. * Aaron: Makes sense to me, don't see any problems with it. == user-sysmaint-split - implement sudoless == * [[Dev/sudo]] ** Ready for review: *** https://github.com/ArrayBolt3/setup-dist/tree/arraybolt3/sudoless-privleap **** Patrick: Merged. (Didn't merge branch "sudoless".) *** https://github.com/ArrayBolt3/setup-wizard-dist/tree/arraybolt3/fix-spacing **** Patrick: Not merged. But used autopeop. Merged branch "sudoless" instead. *** https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/sudoless-privleap **** Patrick: Merged. *** https://github.com/ArrayBolt3/sdwdate/tree/arraybolt3/privleap **** Patrick: Merged. *** https://github.com/ArrayBolt3/tb-starter/tree/arraybolt3/privleap **** Patrick: Merged. *** https://github.com/ArrayBolt3/tb-updater/tree/arraybolt3/privleap **** Patrick: Merged. ** https://github.com/ArrayBolt3/anon-gw-anonymizer-config/tree/arraybolt3/privleap *** Patrick: Merged. ** https://github.com/ArrayBolt3/whonix-base-files/tree/arraybolt3/user-sysmaint-split *** Patrick: Merged. ** https://github.com/ArrayBolt3/anon-connection-wizard/tree/arraybolt3/privleap *** Patrick: Merged. ** https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/sudoless-privleap *** Patrick: Merged. ** https://github.com/ArrayBolt3/tor-control-panel/tree/arraybolt3/privleap *** Patrick: Merged. ** https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/privleap *** Patrick: Merged. * Patrick: Please move to archived if everything got merged as expected. ** Aaron: Looks good. == user-sysmaint-split - implement sudoless #2 == ** Additional things done: *** grep through entire Kicksecure and Whonix codebases for all uses of sudo, replace with privleap where appropriate *** grep through entire Kicksecure and Whonix codebases for all uses of pkexec, replace with privleap where appropriate Port maybe needed? What should happen if a user runs repository-dist in user mode?
packages/kicksecure/repository-dist/debian/control:Depends: pkexec,
packages/kicksecure/repository-dist/usr/lib/python3/dist-packages/repository_dist_wizard/repository_dist_wizard.py:                    command = ['pkexec', 'repository-dist', '--disable']
packages/kicksecure/repository-dist/usr/lib/python3/dist-packages/repository_dist_wizard/repository_dist_wizard.py:                command = ['pkexec', 'repository-dist', '--enable'] + repository
Port not needed because runs in sysmaint mode:
packages/kicksecure/calamares-settings-debian/calamares-install-debian:pkexec calamares
packages/kicksecure/calamares-settings-debian/debian/control:         pkexec,

packages/kicksecure/live-config-dist/debian/control:Depends: helper-scripts, pkexec, rsync, libglib2.0-bin, xdg-user-dirs,
packages/kicksecure/live-config-dist/usr/bin/install-host:if ! [ -x '/usr/bin/pkexec' ] || ! [ -x '/usr/bin/sudo' ]; then
packages/kicksecure/live-config-dist/usr/bin/install-host:The pkexec or sudo command is not executable by the current user. Installation cannot proceed. You may need to log in as user 'sysmaint' to resolve this.
packages/kicksecure/live-config-dist/usr/bin/install-host:pkexec install-host-calamares-wrapper
packages/kicksecure/live-config-dist/usr/share/polkit-1/actions/com.kicksecure.install-host-calamares-wrapper.policy: 
'/usr/bin/pkexec'
Will cause issue https://forums.whonix.org/t/getting-setup-dist-error-in-whonix-gateway/21162 - separate ticket created:
packages/kicksecure/tor-control-panel/debian/control:         pkexec,

packages/kicksecure/anon-connection-wizard/debian/control:         pkexec,
packages/kicksecure/anon-connection-wizard/usr/lib/python3/dist-packages/anon_connection_wizard/tor_status.py:    command = ['pkexec', '/usr/libexec/anon-connection-wizard/acw-write-torrc', temp_file_path]
packages/kicksecure/anon-connection-wizard/usr/lib/python3/dist-packages/anon_connection_wizard/anon_connection_wizard.py:                    command = ['pkexec', '/usr/libexec/anon-connection-wizard/acw-write-torrc', Common.torrc_tmp_file_path]
Port not needed (runs in sysmaint mode or not important):
packages/kicksecure/kicksecure-meta-packages/debian/control:         pkexec,
packages/kicksecure/sysmaint-panel/debian/control:         pkexec,

packages/kicksecure/tb-starter/usr/bin/torbrowser:      if ! pkexec /usr/share/tb-profile-i2p/enable-i2p; then
packages/kicksecure/tb-starter/usr/bin/torbrowser:Most likely user-sysmaint-split is installed and you are booted into 'PERSISTENT mode USER' or 'LIVE mode USER'. To enable i2p, reboot and select 'PERSISTENT mode SYSMAINT', then open a terminal and run 'pkexec /usr/share/tb-profile-i2p/enable-i2p'. More info: https://www.kicksecure.com/wiki/Sysmaint"
packages/kicksecure/tb-starter/usr/bin/torbrowser:   ## This effectively results in a one time pkexec prompt for users of
Port not needed, not really using pkexec:
packages/kicksecure/user-sysmaint-split/debian/control: pkexec) inaccessible to limited user accounts such as user "user".
packages/kicksecure/user-sysmaint-split/usr/lib/permission-hardener.d/20_user-sysmaint-split.conf:/usr/bin/pkexec 4750 root sysmaint

packages/kicksecure/security-misc/debian/security-misc.postinst:   if [ "$(stat --format '%G' /usr/bin/pkexec)" = 'sysmaint' ]; then
packages/kicksecure/security-misc/debian/security-misc.postinst:      if ! [[ "${dpkg_statoverride_list}" =~ '/usr/bin/pkexec' ]]; then
packages/kicksecure/security-misc/debian/security-misc.postinst:         dpkg-statoverride --admindir "${new_mode_dir}" --add 'root' 'sysmaint' '4750' 

packages/kicksecure/developer-meta-files/usr/bin/dm-packaging-helper-script:      'Depends: pkexec' \
packages/kicksecure/security-misc/debian/security-misc.undisplace:/usr/bin/pkexec.security-misc
packages/kicksecure/security-misc/usr/lib/systemd/system-preset/50-security-misc.preset:## Disable due to pkexec issues.
packages/kicksecure/security-misc/usr/lib/permission-hardener.d/25_default_whitelist_policykit.conf:/usr/bin/pkexec exactwhitelist
packages/kicksecure/security-misc/usr/lib/permission-hardener.d/25_default_whitelist_policykit.conf:/usr/bin/pkexec.security-misc-orig exactwhitelist
packages/kicksecure/security-misc/usr/lib/permission-hardener.d/25_default_whitelist_policykit.conf:## May be safe to disable for users other than sysmaint similar to what was done with pkexec and sudo,
packages/kicksecure/security-misc/usr/share/lintian/overrides/security-misc:security-misc: no-manual-page [usr/bin/pkexec.security-misc]
packages/kicksecure/security-misc/usr/share/security-misc/permission-hardener-existing-mode-legacy-hardcoded:root root 4755 /usr/bin/pkexec
== user-sysmaint-split - passwordless login breaks when uninstalled == * Bug: removing user-sysmaint-split from a machine causes autologin to break, user is presented with login screen on boot * Possibly caused by user sysmaint autologin handling? * Fixed, along with some other issues: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/fix-passwordless-login ** Patrick: Merged. == Strong Linux User Account Isolation wiki page - add Wayland considerations == * edit [[Dev/Strong_Linux_User_Account_Isolation|Strong Linux User Account Isolation]] and point out differences in X11 versus Wayland in applicable chapters * For example, chapter [[Dev/Strong_Linux_User_Account_Isolation#Console_Login_Attacks|Console Login Attacks]] currently only discusses X11. Please separate the description of X11 from Wayland. ** Done, did necessary research and added info to the wiki. * please search with browser website internal search for all mentions of X11 and add Wayland equivalents documentation ** Used several different search terms that could reference X11, adding additional documentation where needed. == user-sysmaint-split - port upgrade-nonroot to privleap == * port upgrade-nonroot to privleap, if sane * do not add Depends: privleap * https://forums.kicksecure.com/t/upgrade-nonroot-privilege-escalation-issue/886 * Done in https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/privleap ** Patrick: Merged. * Patrick: refactored upgrade-nonroot. Could the following if needed please be improved, moved to its dedicated wrapper script to avoid code duplication?
if ! [ -f "/etc/privleapd/pid" ] ; then
  echo "$0: ERROR: code 1: TODO"
  exit 1
fi

if ! [ -d "/proc/$(cat /etc/privleapd/pid)" ] ; then
  echo "$0: ERROR: code 2: TODO"
  exit 1
fi

if ! [ -e "/etc/privleapd/comm/$(id -nu)" ]; then
  echo "$0: ERROR: code 3: TODO"
  exit 1
fi
* Aaron: The version merged appears to have some bugs. Fixed version here: https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/privleap ** Patrick: Merged. * Aaron: Also needs accompanying update in helper-scripts to fully fix, this also provides warnings if privleap isn't usable like shown above: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/sudoless-privleap ** Patrick: Merged. == user-sysmaint-split - avoid /etc as pid file location == * File location /etc/privleapd/pid seems unusual. ** Aaron: We're not using /etc, we're using /run. Details shared in chat. == user-sysmaint-split - bind-mounts based passwordless privilege escalation wrapper == * implemented using overlays (bind mounts) * passwordless privilege escalation tools in Qubes Template * useful error message in Non-Qubes user mode and Qubes App Qube. untested pseudocode:
#!/bin/bash

## Copyright (C) 2025 - 2025 ENCRYPTED SUPPORT LLC 
## See the file COPYING for copying conditions.

if test -x /path/to/real/sudo ; then
   exec /path/to/real/sudo "$@"
fi

## Avoiding 'source'ing external libraries to avoid additional AppArmor issues.
## 'source' is a bashism.
#. /usr/libexec/helper-scripts/get_colors.sh

if test -f /usr/share/whonix/marker ; then
   project_website="https://www.whonix.org"
else
   project_website="https://www.kicksecure.com"
fi

echo 'ERROR: This account lacks administrative ("root") capabilities. See: ${project_website}/wiki/sysmaint' >&2

## Let the attempt to execute 'sudo' show the actual error message.
/path/to/real/sudo "$@"
* After attempted implementation and running into roadblocks, we no longer want to do this. It's a hack to work around missing Qubes OS features that we should be developing. == qubes-template-kicksecure - Thunar - icons missing == * ran into serious issues with icons in Thunar, see https://forum.xfce.org/viewtopic.php?id=18054 ** Patrick: Could you please update the Xfce forum thread? *** Thread updated and marked as solved. * Should be fixed by this: https://github.com/ArrayBolt3/kicksecure-meta-packages/tree/arraybolt3/fix-thunar-icons-qubes ** Patrick: Merged. == qubes-template-kicksecure - #3 == * rebuild qubes-template-kicksecure * Now good enough to be built for qubes-community-testing repository by Qubes? * If not, please create follow-up tickets. * Patrick: Moved Thunar issue into its own ticket since not a blocker. * Patrick: Next goal is to update https://github.com/QubesOS/qubes-issues/issues/9573 by posting a comment. Such as requesting that Qubes builds the Template for the community-testing repository. Selective broken applications are acceptable (such as Thunar). This is to allow upstream Qubes time to review, try to build the template, notify downstream Kicksecure of potentially yet unknown issues. ** Only immediately apparent issue I see is that we still have the bookworm-testers repo specified as the Kicksecure repo to use for the build process, whereas user-sysmaint-split is only available in bookworm-developers. This makes the build fail until the template-kicksecure code repo is manually edited to specify the correct source repo. == user-sysmaint-split - review helper-scripts == * https://github.com/Kicksecure/helper-scripts/pull/13 * https://github.com/Kicksecure/user-sysmaint-split/pull/1 * Reviews complete and PRs were merged. == privleap - compare what privleap is doing versus sudo and doas regarding environment ==
    action_env["HOME"] = user_info.pw_dir
    action_env["LOGNAME"] = user_info.pw_name
    action_env["PWD"] = user_info.pw_dir
    action_env["USER"] = user_info.pw_name
* please check what sudo / doas is doing for completeness sake * env vars * any other setup? ** doas (https://man.openbsd.org/doas.1): *** HOME - We're already setting this. *** LOGNAME - We're already setting this. *** PATH - Set by systemd and inherited from privleapd, this is hardcoded to a known-good value. *** SHELL - Useful to set, now hardcoded in privleapd to /usr/bin/bash (since that's the shell privleapd uses to run actions). *** USER - We're already setting this. *** umask - Default, inherited from systemd, probably do not want to change this. *** DISPLAY - Usually specifies the active X11 display the process is running on. privleapd runs as a service and will have no X11 display, thus this is useless for us. *** TERM - Specifies what terminal is in use. Probably also useless, processes run by privleapd are not given a PTY. *** PWD - Not changed by doas. We're setting it, but we're also not changing the process's actual current working directory, which could potentially result in malfunctions. Fixed. ** sudo (https://man7.org/linux/man-pages/man8/sudo.8.html#ENVIRONMENT): *** EDITOR - Used by sudo, but doesn't appear to be set by it. *** MAIL - Set to the mail spool of the target user in some instances. This is empty on Kubuntu 24.04 and Kicksecure 17, and is set to /var/mail/user on a mostly minimal Debian 12 VM (that path doesn't actually exist on the VM though, strangely enough). Probably not useful. *** HOME - We're already setting this. *** LOGNAME - We're already setting this. *** PATH - See above in doas section. *** SHELL - See above in doas section. *** SUDO_ASKPASS - Specific to sudo, not set by sudo. *** SUDO_COMMAND - Specific to sudo, set to the command that is run by sudo. Potentially useful but also sudo-specific, probably not needed? *** SUDO_EDITOR - Specific to sudo, not set by sudo. *** SUDO_GID - Specific to sudo, set to the GID of the user who invoked sudo. Potentially useful, easy to implement in a secure manner. Desirable? *** SUDO_PROMPT - Specific to sudo, not set by sudo. *** SUDO_PS1 - Specific to sudo, not set by sudo, most likely only affects interactive shells which privleap doesn't support anyway. *** SUDO_UID - Specific to sudo, set to the UID of the user who invoked sudo. Potentially useful, easy to implement in a secure manner. Desirable? *** SUDO_USER - Specific to sudo, set to the login name of the user who invoked sudo. Potentially useful, easy to implement in a secure manner, but could potentially be used for malicious purposes if the user has a Unicode-based username? See https://lwn.net/Articles/1000485/. Redundant if SUDO_UID is implemented, probably we shouldn't set this. *** USER - We're already setting this. *** VISUAL - Used by sudo, but doesn't appear to be set by it. == privleap - environment variables security == * consider account user setting malicious environment variables (length based buffer overflow, code substitution $(...) / `...` syntax) ** This should not be a problem. Environment variables cannot be inherited from the user that calls privleap because they are not transmitted by the client to the server. All actions launched by privleap will inherit their environment from the privleapd server, which inherits its environment directly from systemd. Environment variables that aren't inherited directly are currently derived from basic user info configured in root-owned files, thus not a security risk. ** Will keep this in mind if more environment variables need tweaked. == privleap - code improvements == * Patrick: ** Output internal configuration to stdout? At least when debug mode is enabled. This would be useful to look into what actually got parsed. ** Worthwhile to simplify?
        self.auth_user = auth_user if auth_user != "" else None
        self.auth_group = auth_group if auth_user != "" else None
        self.auth_user = auth_user
        self.auth_group = auth_group
        if desired_action.auth_user is not None:
        if desired_action.auth_user is not "":
*** These are already either simplified, or can't reasonably be simplified further. In particular None and "" are not interchangeable and explicitly using None in Python is preferable when possible. ** Print first (more likely it will succeed and leave a log entry). Run the try/except block after?
                try:
                    comm_session.send_msg(
                        pl.PrivleapCommServerUnauthorizedMsg())
                except Exception:
                    print("handle_comm_session: Could not send UNAUTHORIZED")
                    print(traceback.format_exc())

                print("handle_comm_session: User is not authorized to run "
                    "action '"
                    + desired_action.action_name
                    + "'")
** Generally, do the safe action print to stdout (which ends up in journal) first. Later do things which might hang in theory. *** Done. == user-sysmaint-split - privleap - improvements == * user_name validation - enforce maximum user name length: user_name variable should have a reasonable maximum string length * move user_name validation into a dedicated function? * maybe signal name could be validated using the same function? * Added requested features. https://github.com/ArrayBolt3/privleap/commit/6c653e64da4959de2b53b72ec49835c01808204b Rather than enforcing a maximum user name length though, I enforced a maximum client-sent message length since that was more comprehensive and easier to do in an efficient manner. == user-sysmaint-split - privleap - implement user switch - runas == * please implement, if needed * already done, will use it where needed == privleap == * todo * Beta-quality code: https://github.com/ArrayBolt3/privleap ** Extensively tested, but still needs battle-tested in real-world use and tested by someone other than just me. == user-sysmaint-split - enable user-sysmaint-split by default for Xfce version == * for GUI (Xfce) version only: ** Patrick: Done. * and for VM images as "loose packages" ** Patrick: Done. * not Whonix-Gateway ** Patrick: Done. * ISO: TODO ** Done: https://github.com/ArrayBolt3/derivative-maker Tested, works == user-sysmaint-split - refactor pkexec support == * in https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/polkit /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 gets hardcoded, started by a script ** Is this a good mechanism? ** What would be the usual mechanism to start it when booting into normal mode? Let's suppose the answer is "a systemd unit". In this case, wouldn't it be less surprising, easier to understand, cleaner to use the name mechanism when booting into sysmaint mode? ** Please either use the same mechanism or add a comment why this specific mechanism has been selected. ** Please document. *** This does have to use a different mechanism, which is now documented: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/polkit == user-sysmaint-split - sysmaint-boot.target should allow SSH == * todo * https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/ssh == permission-hardener v2 - add easy debug feature == * permission-hardener could use an easy debug feature. Once run, it collects relevant outputs from permission-hardener (print-policy, state files and anything else that may be required), prints them to stdout. * would have been useful for the following bug report * Diagnostics command added: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/permission-hardener-diag == permission-hardener v2 - repetitive polkit-agent-helper-1 messages == * background: The polkit-agent-helper-1 config snippet went thorough 2 several revisions. 1) usrmerge was dropped 2) symlink /usr/lib/policykit-1/polkit-agent-helper-1 that links to actual SUID /usr/lib/polkit-1/polkit-agent-helper-1. ** The bug already happened after revision 1. (Maybe even earlier.) * on every run: * only /usr/lib/polkit-1/polkit-agent-helper-1 shows up in print-policy, as expected * bug: older revisions still show up in state, but should not? * Bug fix: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/permission-hardener-symlink-fix Fully resolves symlinks, rejects hardlinks. == user-sysmaint-split - research Qubes user to root isolation == * todo: read, comment if applicable * https://qubes-os.org/doc/vm-sudo/ * https://www.qubes-os.org/doc/vm-sudo-implementation/ * https://github.com/QubesOS/qubes-issues/issues/8823 ** https://github.com/QubesOS/qubes-issues/issues/8823#issuecomment-1953115546 *** has a small mention of /dev/xen **** reported as bug: https://github.com/QubesOS/qubes-issues/issues/9717 * https://github.com/QubesOS/qubes-issues/issues/2695 * https://forum.qubes-os.org/t/passwordless-sudo-selinux-understanding-security-logic/22446 * Researched, discussed with Qubes OS devs. Put research and discussion results here: https://www.kicksecure.com/wiki/Dev/Qubes#Root_Privilege_Isolation_and_libxenvchan == user-sysmaint-split - passwordless-root fixes == * /usr/bin/passwordless-root needs fixes? * add dummy-dependency --cached option to avoid creating the dummy package at every boot ** Patrick: Done. * store in a persistent directory ** Patrick: Done. /var/lib/dummy-dependency/dummy-user-sysmaint-split_99_all.deb * make directory persistent using Qubes bind-dirs ** TODO ** which package would be suitable for the bind-dirs snippet? *** I don't see why helper-scripts itself is bad, we do similar things for systemcheck, legacy-dist, and sdwdate. *** https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/dummy-dependency-qubes == security - upgrade comment == * please comment as discussed * https://forums.kicksecure.com/t/upgrade-nonroot-privilege-escalation-issue/886/3 == continuous review == * before merging newer derivative-maker git tag, please [[Dev/git#Compare|compare]] doing theoretic review * please discuss and/or open tickets in case commentary is applicable * +1, will do this regularly. == permission-hardener - make migration code faster == * The following is too slow. Can take more than a minute on a fast system. Appears as if the system is broken.
   readarray -t custom_hardening_arr < <(dpkg -V | awk '/permission-hardener.d/{ print $NF }')
readarray -t custom_hardening_arr < <(find /usr/lib/permission-hardener.d /etc/permission-hardener.d -type f)
* Can find be used? ** find has many pitfalls: https://mywiki.wooledge.org/UsingFind ** Especially when using readarray? * Aaron I'm using dpkg -V specifically to find ''modified'' permission-hardener files. It does a similar job to debsums. However, right now I'm letting it scan all packages on the system, when it really only has to scan security-misc, anon-apps-config, and user-sysmaint-split. ** Commit fixing speed issues: https://github.com/ArrayBolt3/security-misc/commit/396372c1295e2a09d596f3e23fccc26794a26f05 ** Note: Not tested yet. * Patrick: modified_pkg_data_str might include:
+ modified_pkg_data_str='missing     /usr/lib/permission-hardener.d/20_user-sysmaint-split.conf'
* Patrick: merged. Tested. Please review my changes on top. (Theoretic only.) ** Aaron: Reviewed, recommended changes at https://github.com/Kicksecure/security-misc/compare/master...ArrayBolt3:security-misc:master *** Patrick: Merged. == user-sysmaint-split - fix pkexec for sysmaint user == * Aaron: ** Note, gparted and zulucrypt probably *should* work in sysmaint mode. pkexec also doesn't work in sysmaint mode. I believe the reason they don't work is because there's likely a polkit-related systemd unit we need to be depending on in sysmaint-boot.target. * Fixed, turns out it was a missing user-side startup process. https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/polkit ** Patrick: Merged. == user-sysmaint-split - Whonix documentation review == * please review https://www.whonix.org/wiki/Sysmaint ** Fixed some typographical errors, otherwise looks good to me. == user-sysmaint-split - Qubes support == * user-sysmaint-split - useful to install in Qubes for Kicksecure or Qubes-Whonix? Probably yes, due to sudo hardening. ** Patrick: Done. * Plan for Kicksecure-Qubes and Qubes-Whonix-Workstation? ** No longer install qubes-core-agent-passwordless-root by default. *** Patrick: Done. ** Install user-sysmaint-split by default in new Qubes-Whonix-Workstation templates. *** Patrick: Done. ** Install qubes-core-agent-passwordless-root by default in new Qubes-Whonix-Gateway templates. *** Patrick: Done. ** Users could not really use account sysmaint due to missing X server. Instead, user needs to use a [[Root#Qubes_Root_Console|Qubes Root Console]]. *** Patrick: Done. * Plan for Qubes-Whonix-Gateway? ** Keep [[unrestricted admin mode]] to be on par with Non-Qubes-Whonix-Gateway? *** Patrick: Done. * user documentation ** Patrick. Done: https://www.whonix.org/wiki/Sysmaint * suggestions for [https://github.com/QubesOS/qubes-issues/issues/9519 create user `admin` by default and add user `admin` to group `sudo` by default]? == legacy-dist - enable GRUB force_efi_extra_removable ==
debconf-set-selections <<< 'grub-efi-arm64 grub2/force_efi_extra_removable
* please add to https://github.com/Kicksecure/legacy-dist (postinst?), if sane * code needs to be defensive. GRUB might not be installed. (Qubes; chroot; direct kernel boot; unknown) * Risky to do for existing users (might overwrite other bootloaders). Therefore not doing this. == kicksecure-meta-packages fixes for qubes-template-kicksecure == * packages in https://github.com/Whonix/qubes-whonix/blob/master/debian/control need to be re-implemented in kicksecure-meta-packages as appropriate * Fixes needed ('''NOT YET DONE'''): ** Add qubes-core-agent-networking, qubes-core-agent-thunar, and xfce4-settings to package kicksecure-qubes-gui. ** Add user-sysmaint-split to template code. *** Requires user-sysmaint-split to be published in Kicksecure's repos **** Patrick: Done. * Branch with enhanced metapackages: https://github.com/ArrayBolt3/kicksecure-meta-packages/tree/arraybolt3/kicksecure-qubes ** Was not able to test this locally, couldn't figure out how to get a locally built package to be used in a Kicksecure build. Need to research that further in the future. I was able to build the package with genmkfile though. *** Patrick: Merged, built and uploaded and tested. (No bugs found.) == user-sysmaint-split - consider disabling polkit-agent-helper-1 == * for potentially affected packages, see: "apt purge polkitd" * does it break Network Manager WiFi configuration from account "user"? * cat usr/lib/permission-hardener.d/20_user-sysmaint-split.conf
## TODO:
## See also:
## /usr/lib/permission-hardener.d/25_default_whitelist_policykit.conf
#/usr/lib/policykit-1/polkit-agent-helper-1 4750 root sysmaint
#/lib/policykit-1/polkit-agent-helper-1 4750 root sysmaint
* Current verdict: '''I believe this is likely safe to disable.''' ** Affected applications I tested were gparted, zulucrypt, and the NetworkManager widget. ** NetworkManager "just works" even with this executable's permissions hardened. ** gparted and zulucrypt are both broken for both user user and user sysmaint even without this executable's permissions hardened. *** Note, gparted and zulucrypt probably *should* work in sysmaint mode. pkexec also doesn't work in sysmaint mode. I believe the reason they don't work is because there's likely a polkit-related systemd unit we need to be depending on in sysmaint-boot.target. **** Patrick: follow-up ticket created * Patrick: disabled == live-build - enable GRUB force_efi_extra_removable == * todo * if applicable * Already done in 2800_create-lb-iso. Shouldn't need any further changes to live-build to make work. == permission-hardener - disable action does not remove existing_mode and new_mode statoverride file == * bug? as discussed. ** Neither database should be ''removed'' wholesale. ** existing_mode should keep tabs on any file permission-hardener touches, recording the original file modes as appropriate. It's fine for it to not be modified when disabling hardening on a file. ** Removing entries from existing_mode is potentially dangerous since it can make it impossible for the user to disable permission hardening on a file if a bug is encountered that re-hardens the file after hardening has been disabled. ** On my system, new_mode is appropriately modified when disabling one or all files. However, new_mode had some problems (it wasn't being copied forward to the new v2 location, thus rendering it useless, and the original file had some corruption issues), so I put a migration system in place for new_mode that is similar to the one we created for existing_mode. ** https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/more-permission-hardener == publish Debian security report == * as discussed * Published: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718225#115 == qubes-template-kicksecure == * https://github.com/QubesOS/qubes-issues/issues/9573 * try if https://github.com/Kicksecure/qubes-template-kicksecure can be built locally * document on [[Dev/Qubes]] how to download, verify Qubes builder v'''2''' (or fix upstream documentation if that seems more feasible) ** https://github.com/QubesOS/qubes-builderv2/ * Documentation written and tested. * Upstream PR at https://github.com/QubesOS/qubes-builderv2/pull/170, approved and merged. ** Patrick: Done. * Fixes needed ('''DONE'''): ** Figure out why repository-dist isn't being called, environment variable seems to not be getting through *** Fixed in qubes-builderv2 PR, also required fixes to the Kicksecure and Whonix templates. **** https://github.com/ArrayBolt3/qubes-template-whonix **** https://github.com/ArrayBolt3/qubes-template-kicksecure ***** Done. Both merged. == review list of remaining SUIDs == /usr/lib/qubes/qfile-unpacker: Probably still needed. - Appears to be an integral part of file transfer between qubes, stripping SUID from this in an AppVM results in that AppVM being unable to receive files any longer. (It can still send files to other qubes though.) /usr/lib/dbus-1.0/dbus-daemon-launch-helper - Needed for D-Bus system activation to work, see https://dbus.freedesktop.org/doc/system-activation.txt. May be vital for desktop features to work normally. Appears to have been designed with security in mind and can only be called by root or a user in the `messagebus` group (which currently has one member, namely user `messagebus`). /usr/lib/chromium/chrome-sandbox: Probably OK. - This is safe to disable. Chrome/Chromium now uses namespace-based sandboxing rather than a SUID sandbox for most use cases, and while the SUID sandbox is still technically supported (https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_sandboxing.md), it's also virtually unused (https://chromium.googlesource.com/chromium/src/+/0e94f26e8/docs/linux_suid_sandbox.md). Chromium still works fine when it is stripped of its SUID bit and rendered no longer executable, and opening `chrome://sandbox` while in this state shows that sandboxing is still working perfectly fine. /usr/lib/openssh/ssh-keysign: ? - Used only for SSH host-based authentication (https://linux.die.net/man/8/ssh-keysign), needed to allow access to the machine's host key for use in the authentication process. This is a non-default method of authenticating to SSH, and is likely rarely used, thus this should be safe to disable. /usr/lib/polkit-1/polkit-agent-helper-1: Should be handled in user-sysmaint-split? - Required for Polkit to function at all (https://polkit-devel.freedesktop.narkive.com/zXO4yEg7/documentation-on-polkit-agent-helper-1-and-suid#, https://gitlab.freedesktop.org/polkit/polkit/-/issues/168). Changing permissions here may break more than just normal privilege escalation. May be safe to disable for users other than sysmaint similar to what was done with pkexec and sudo, however even that might not be safe. /usr/sbin/pam-tmpdir-helper: ? - Used by the pam_tmpdir module to create a secure temporary directory for the user that is logging in. (https://manpages.ubuntu.com/manpages/oracular/man8/pam-tmpdir-helper.8.html) Apparently specific to Debian, there isn't actually any Git repo with this code in it, it's just a "floating" package in the Debian archive. Written by the same person who maintains the package. Almost certainly cannot be disabled without causing serious problems, but may be worth auditing. (Worthy of note, it doesn't seem this program takes any user input, but relies solely on the calling user's UID and GID, though this could require further review.) /usr/bin/fusermount3: ? - Critical component of FUSE (Filesystem in USErspace), used by things such as AppImages and Docker. If not SUID, unprivileged users will be unable to use FUSE any longer - this completely breaks AppImages, among other things. Should be left enabled to avoid causing problems. /usr/bin/qfile-unpacker: Probably still needed. - Not bit-for-bit identical to /usr/lib/qubes/qfile-unpacker, and stripping SUID from this does *not* break file copying. Unsure what this is for, asked in Qubes OS Matrix room for clarification. * Patrick: Migrated these comments to permission hardener configuration. * Patrick: Disabled SUID for chrome/chromium sandbox and SSH. == permission-hardener - restore permissions on configuration changes - #2 == * bug: when package user-sysmaint-split is removed, permission-hardener fails to restore sudo and pkexec permissions ** Fix with migration alert: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/permission-hardener-migrate ** TODO: Need to actually write the documentation for this on the wiki! * Patrick: ** Please move state file variable v2_state_file from inline to /usr/share/security-misc/permission-hardener-existing-mode-legacy-hardcoded or so. That would make that file more easily maintainable. ** Please open a PR. Instead of
   echo "${v2_state_file}" > '/var/lib/permission-hardener-v2/existing_mode/statoverride'
Replace
   cp '/usr/share/security-misc/permission-hardener-existing-mode-legacy-hardcoded' '/var/lib/permission-hardener-v2/existing_mode/statoverride'
** Aaron: Done. ** potential bug: Some files exist only in some situations. Legitimately. *** '/usr/lib/permission-hardener.d/30_ping.conf' is Whonix-only. **** Aaron: Not a problem, the existing_state for the ping executable is the same on Kicksecure and Whonix, regardless of whether anon-apps-config is installed or not. *** user-sysmaint-split may or may not be installed **** Aaron: Also not a problem for similar reasons. *** Please make sure these situations do not result in "custom configuration detected". **** Aaron: Tested, behaves as intended now. ** Please INFO echo any custom configuration file found. *** Aaron: Done. ** Please exclude new image builds from this migration code. If folder /var/lib/permission-hardener does not exist, there is no need for the migration code to run. *** Aaron: Done, by checking for the existence of the old-style /var/lib/permission-hardener directory. * PR with all changes integrated: https://github.com/Kicksecure/security-misc/pull/295 == user-sysmaint-split - shutdown action - #2 == * a systemd unit to lock the sysmaint account on shutdown * ExecStop cannot be used. Quote man page: ** "Also note that the stop operation is always performed if the service started successfully, even if the processes in the service terminated on their own or were killed." ** "Note that the commands specified in ExecStop= are only executed when the service started successfully first." * A separate, real shutdown systemd unit required. Please compare with some other shutdown related systemd units using shutdown.target. * Should lock unconditionally no matter what boot mode. That should be safe on shutdown. * https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/lock-sysmaint-on-shutdown ** Redone to avoid ExecStop and use a shutdown-time systemd unit instead. Also locks down unconditionally on shutdown. == Kicksecure DNS proper /etc/resolv.conf during build process == * Kicksecure DNS setting is currently "implicit" as per https://forums.kicksecure.com/t/dns-nameserver-10-139-1-1/858/15 * It however, should be "explicit". * Until more secure settings are implemented (waiting for replies from unbound), a sane /etc/resolv.conf file needs to be created during the build process * VM builds vs ISO builds * Implemented in initializer-dist to make sure it works no matter how things leak: https://github.com/ArrayBolt3/initializer-dist/tree/arraybolt3/resolv-conf ** Patrick: Not compatible with Whonix, there /etc/resolv.conf is package managed. *** Patrick: Implemented in derivative-maker help-steps/chroot-raw instead. == analyze pam stack == * old:
/usr/bin/sudo /usr/bin/apt update
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts
Command exited. You may close this window safely.
* new:
[template  user ~]% sudo apt update      
Sorry, user user is not allowed to execute '/usr/bin/apt update' as root on localhost.
zsh: exit 1     sudo apt update
* due to pam wheel changes, this works better now * todo: why does this work better now? the pam wheel changes should not affect that. * moved content here: [[Dev/Strong_Linux_User_Account_Isolation#Analyze_PAM_Stack|Analyze PAM Stack]] == debian grub-pc with grub-efi co-installation issue bug report == * please check if one already exists, report a bug or feature request against Debian for grub-pc with grub-efi co-install-ability * https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=904062 == user-sysmaint-split - review changes == * Patrick made some minor changes. ** Reviewed, looks good to me. Will test when adding the sysmaint account lock shutdown action. == address Linux Installer review == * some review comments about Linux installer have been sent privately * please address, if applicable * root_cmd or another function should be used instead of sudo ** this is for the benefit of using end-of-options ("--") * real_file="$(sudo realpath "${file}")" ** please do not hardcode sudo, use root_cmd ** is variable real_file actually used for anything? * use shellcheck * All problems fixed: ** https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/root-cmd-improve ** https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/dist-installer-sysmaint-polish == DNS - Kicksecure Default DNS Discussion == * https://www.kicksecure.com/wiki/DNS * https://www.kicksecure.com/wiki/DNS_Security * https://forums.kicksecure.com/t/dns-nameserver-10-139-1-1/858/15 * https://forums.whonix.org/t/default-dns-provider-discussion-for-kicksecure-not-whonix/16870 * https://forums.whonix.org/t/use-dnscrypt-by-default-in-kicksecure-not-whonix/8117 * please read, comment, edit as applicable ** Read, updated documentation and wrote a long comment suggesting next steps for implementing DNSSEC == document ARP related sysctl changes == * please create a [[networking]] wiki page * https://github.com/Kicksecure/security-misc/pull/288 * https://github.com/Kicksecure/security-misc/pull/289 * https://github.com/Kicksecure/security-misc/pull/290 * https://github.com/Kicksecure/security-misc/pull/291 * Created, also tested arp_ignore's effects on a common virtualization use case. == permission-hardener - usrmerge == * assume usrmerge, make it a dependency * simplify configuration (/bin no longer needed) * Distribution morphing: document, if applicable ** No need to depend on usrmerge, Bookworm requires merged /usr ** No need to document for the same reason ** Fixed security-misc with no more /bin modifications: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/usrmerge == user-sysmaint-split - rads integration == * review Patrick's changes * avoid "systemctl start rads" hardcoded, if possible. * Reasons: Qubes does not come with rads by default. System might not have rads. User might have uninstalled rads. Difficult to check if a systemd unit is installed. (systemctl list-units | grep rads - might find a similar names systemd unit.) * Fixed, now starts rads using the systemd target instead: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/avoid-rads-in-script == permission-hardener refactor == * Avoid lazy loading, instead build state arrays ancd apply them in an idempotent fashion * Currently planned algorithm: ** Build the state first, starting with an empty state array if there is no state or loading an existing state array if there is state. For each file mentioned in the policy, check to see if it's in the state array, and if not, add its current user owner, group owner, and permissions state to the array. (TODO: How to handle capabilities? For now we can just support stripping them and not support adding them back.) ** Next, apply the policy to the state. Copy the state array to a new array, and then change the user owner, group owner, permissions state, and capabilities to match the policy. It is important that it be done this way, because this means if the policy used to modify a file, but now no longer does, that file's original permissions state will exist in the state array, and thus will be considered part of the state that permissions-hardener applies. ** Apply the built, policy-enhanced state to the filesystem's active state. For each file in the state array, delete the file's entry in dpkg-statoverride, then change the file's actual state to match the state array (again using dpkg-statoverride to do this) ** To undo a policy for a file, load the state file, wipe the dpkg-statoverride entry for it, and then apply the stored state to the real file. * Ready for review: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/permission-hardener-refactor * PR: https://github.com/Kicksecure/security-misc/pull/293 == user-admin-split - installer sysmaint support == * context: [[Linux]] * wrap all commands in run_as_root versus run_as_user, if useful * improve privilege escalation tool detection * sudo -u user * keep unrestricted admin mode / "normal" Linux distribution compatibility ** PR with the bulk of the changes: https://github.com/Kicksecure/usability-misc/pull/13 ** Sudoers exception needed to make the above work in sysmaint mode: https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/dist-installer-sysmaint == user-sysmaint-split - Wayland support == * sddm support (because that is LXQt's default login manager) ** Can set default user account and session by modifying /var/lib/sddm/state.conf * Needs to use labwc as window manager instead of xfwm4 when in Wayland mode * Might need separate sessions for Wayland and X11, provided either by different packages or with some configurable switch ** Patrick: multiple packages best avoided as discussed * Implementation (SDDM tested, Wayland untested): https://github.com/ArrayBolt3/user-sysmaint-split/tree/arraybolt3/wayland-sddm-support * Will be difficult to fully test until Kicksecure's Trixie port is underway == calamares - investigate keyboard layout issue == * https://forums.kicksecure.com/t/problems-with-the-installation/836 * Asked user for more information, cannot reproduce. * No response, archiving. == report research results to purism == * as discussed * Done. == pam wheel - review == * please review Patrick's new pam wheel implementation ** Reviewed and tested, looks good and works as intended on my end. == sysmaint-panel - Qubes support == * bug: when qubes-core-agent-passwordless-root is not installed but user-sysmaint-split is not installed, sysmaint-panel fails to notify the user that root escalation is failing
/usr/bin/sudo /usr/bin/apt update
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts
Command exited. You may close this window safely.
* issue introduced by Kicksecure. not applicable with Qubes qvm-template install debian-12-minimal * Issue caused by security-misc/usr/share/pam-configs/wheel-security-misc. If user user is not in group sudo, this check fails and causes PAM authentication to fail, even if user has no password. ** This file seems obsolete - the file states that it prevents users who aren't part of group wheel from using su, but su isn't even executable by anyone other than root due to permission hardening. ** Issue should be resolvable by adding user to sudo in the template, or by removing this config file. ** After discussion with Patrick, preferred solution is to create a script that can detect if the `su` command is being called, and only ensure that the user account in use is in the `sudo` group if this is the case. ** After further research, su actually has a PAM configuration file that can be used here, allowing us to use pam_wheel as intended without causing conflicts. * Fix: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/fix-sudo ** Patrick: not merged. implemented with a different implementation. follow-up ticket created. == ISO - ARM64 build failing ==
./derivative-maker --target iso --flavor kicksecure-xfce --repo true --remote-derivative-packages true --arch arm64
Setting up python3-pil:arm64 (9.4.0-1.1+deb12u1) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 323, in 
    main()
  File "/usr/bin/py3compile", line 302, in main
    compile(files, versions,
  File "/usr/bin/py3compile", line 187, in compile
    cfn = interpreter.cache_file(fn, version)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/python3/debpython/interpreter.py", line 212, in cache_file
    (fname[:-3], self.magic_tag(version), last_char))
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/python3/debpython/interpreter.py", line 246, in magic_tag
    return self._execute('import imp; print(imp.get_tag())', version)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
    raise Exception('{} failed with status code {}'.format(command, output['returncode']))
Exception: ('python3.11', '-c', 'import imp; print(imp.get_tag())') failed with status code -11
dpkg: error processing package python3-pil:arm64 (--configure):
 installed python3-pil:arm64 package post-installation script subprocess returned error exit status 1
* This appears to be a bug in either Xen or QEMU. python3 intermittently segfaults when run in an arm64 chroot emulated on an amd64 machine. To reproduce simply, boot into Qubes OS, open a Debian 12 AppVM, ensure qemu-user-static and mmdebstrap are installed in the AppVM, then run sudo mmdebstrap --architecture=arm64 bookworm armtest. Then bind-mount important dirs with sudo mount --bind /dev armtest/dev && sudo mount --bind /dev/pts armtest/dev/pts && sudo mount --bind /proc armtest/proc && sudo mount --bint /sys armtest/sys. Then chroot in, run apt update && apt install python3, and then finally run the following segfault reproducer:
for i in {1..800}; do
   python3 -c 'import imp; print(imp.get_magic())' >/dev/null 2>/dev/null
   exit_code="$?"
   echo "$exit_code"
   if [ "$exit_code" != '0' ]; then
      break
   fi
done
* This should output a lot of zeros, but eventually it should segfault and return non-zero. This usually happens at least once in 400 runs for me, but it's possible that it won't happen that soon, thus why the above reproducer tries 800 times. * This issue only occurs under Qubes OS for me. In a KVM VM, even 1600 attempts does not segfault on my machine. * The version of QEMU in bookworm-backports appears to have solved this. Run sudo apt install -t bookworm-backports qemu-user-static in your Debian 12 (or Kicksecure) template, shut down the template and reboot affected AppVMs, then attempt the above reproduction steps again. It should not segfault even with 1600 attempts. I have also confirmed that an ISO build succeeds when doing this. * Worth reporting to Debian as a bug report against Bookworm specifically? (This probably doesn't affect Sid since it's using a newer QEMU version, approximately the same version as in bookworm-backports.) * Worth enhancing the derivative-maker dependency installation code to allow specifying specific packages from backports so that we can ensure that qemu-user-static from bookworm-backports is used? == iso - calamares - Argon2id == * are we using Argon2id because it is a cryptsetup default? * please follow-up if useful on these tickets * https://github.com/calamares/calamares/issues/2127 * https://invent.kde.org/system/kpmcore/-/merge_requests/43 * We are currently using Argon2id, but only because it is the default in Debian's cryptsetup. * Followed up at https://invent.kde.org/system/kpmcore/-/merge_requests/43#note_1084941. No follow up needed on the Calamares ticket, the choice of which version of LUKS to use is already configurable and there's a good reason for Calamares to not default to LUKS2 yet. * Waiting on a response from the original MR creator. Will make an MR of my own if allowed or if the original author doesn't respond in a week or so. * Original MR creator did not respond, filed my own MR: https://invent.kde.org/system/kpmcore/-/merge_requests/56 * Merged upstream. == heads ticket == * https://github.com/linuxboot/heads/issues/1881 * https://mjg59.dreamwidth.org/70630.html ** Potentially useful for the remote use case scenario, not useful for the local scenario, will add to wiki * content useful for [[Verified Boot]]? ** Added. == user-sysmaint-split - ISO - sysmaint mode - #3 == * follow-up ** live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/sysmaint *** Patrick: Not merged. Needs revision to be compatible with "traditional boot mode" when user-sysmaint-split is not installed -> copied to new ticket **** Aaron: Fixed. == research verified boot and measured boot == * https://www.kicksecure.com/wiki/Dev/About_Computer_(In)Security * https://www.kicksecure.com/wiki/Hardware_Wallet_Security * https://www.kicksecure.com/wiki/Verified_Boot * https://www.kicksecure.com/wiki/Measured_boot * review, watch, improve, keep notes * in preparation for consultation with firmware developer Update #1: Please review: * https://www.kicksecure.com/wiki/Verified_Boot#Boot_Block_versus_TPM ** Aaron: Reviewed, updated. Note, the TPM doesn't use XOR when extending PCR values, and banks don't really matter half so much as PCRs, based on my research. * https://www.kicksecure.com/wiki/Verified_Boot#Boot_Block_Based_Attacks_Against_Measured_Boot ** Aaron: Reviewed, updated, but I'm not sure where the fake TPM comes into play so I'm not sure I correctly understood this. * https://www.kicksecure.com/wiki/Verified_Boot#TPM_EK_-_Endorsement_Key ** Aaron: Reviewed, updated. Considered: How does android implement relock bootloader with user custom keys? * Document shortcomings with a vendor-provided, no-true-ROM solution ** There may not be serious shortcomings with this after all. * Android trusts the hardcoded android hardcoded bootloader? ** The firmware does appear to be implicitly trusted. It is possible that the device SoC cryptographically verifies the firmware similar to Boot Guard, but if so, this isn't documented anywhere obvious, and it doesn't appear that Android Verified Boot considers malicious system firwmare in the threat model. * https://android.stackexchange.com/questions/238980/why-is-it-possible-to-re-lock-the-bootloader-after-installing-a-custom-rom-on-s * [https://source.android.com/docs/security/features/verifiedboot/device-state#user-settable-root-of-trust Android: User-settable root of trust] * [https://source.android.com/docs/security/features/verifiedboot/boot-flow Android: Boot Flow] * [https://source.android.com/static/docs/security/images/verified-boot-flow.png Android: Figure 1. Verified boot flow.] * rollback protection * theft protection * factory reset protection * watch some videos on how Android is flashed, locked, unlocked, relocked * Figure out how Heads avoids relay attacks with firmware verification, if it does -> https://github.com/linuxboot/heads/issues/1881 * android hardware keystore (HSM) ** This is of questionable use for verified boot. It might be useful for factory reset protection but there may be better ways to do that. It also relies on an ARM TrustZone "secure world" which is scary. * See if adding some sort of secure, append-only storage is useful and work it in if so (hardware keystore hsm) ** Most likely is useful for rollback protection, documented. It could be implemented using a "secure world" similar to TrustZone but it seems better to implement it in hardware, potentially. * TPM MITM issue ** This is only really a problem if the attacker can modify the motherboard, which is a threat model that is extremely difficult to defend against and should probably be considered out-of-scope. * offline theft protection * online theft protection (remote locking) ** Likely too difficult. Requires a cloud service in the middle, which is bad for privacy and a potential security hole itself. * compare TOTP vs challenge response based (NitroKey). Or "nothing" (Android)? ** TOTP and HOTP are both potentially vulnerable to relay attacks, HOTP less so if used carefully. Better yet still would be a data signature challenge (i.e. here's a blob of random data, sign it and send it back to me so I can check that your signature is good).
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
6e:45:f9:a8:af:38:3d:a1:a5:c7:76:1d:02:f8:77:00.
Please contact your system administrator.
Add correct host key in /home/hostname /.ssh/known_hosts to get rid of this message.
Offending RSA key in /var/lib/sss/pubconf/known_hosts:4
RSA host key for pong has changed and you have requested strict checking.
Host key verification failed.
* either send own hardware or TOFU ** Send own hardware is highly preferable * maybe solvable if cloud vendor reveals TPM EK fingerprint beforehand? ** Not sufficient. The TPM can be fooled by firmware if Boot Guard isn't in use, and the user can't be sure that Boot Guard is in use unless they can either remotely verify the authenticity of the CPU (likely not possible unless using Intel TDX or AMD SEV) or they can verify it locally. * explain how others do it, compare: With Android, where companies are protecting themselves from the user, the same thing is true. The "owner" (manufacturer) can provision the system the way they want and the "attacker" (user) can't do anything about it ([[Miscellaneous_Threats_to_User_Freedom#Device_Attestation_such_as_SafetyNet|Device Attestation such as SafetyNet]]) * remote attestation is possible without verified boot? if known, please document, if unknown answer, please mention. ** Yes, it is possible, see https://safeboot.dev/attestation/. It appears that TPM measurements are used by the machine being attested to prove its identity to the machine doing the attesting. * custom kernel modules? re-invent MOK? ** If we're using UEFI Secure Boot like our current plan states, we can just use the MOK mechanism as-is. We also could have the user sign their kernel modules so they pass Secure Boot normally. * boot guard -> dasharo (3MDEB) firmware -> heads (?) -> verify Debian's kernel against Debian's key? ** No need for Heads, we're just using UEFI. * maybe the unchangeable root of trust would be well placed with boot guard, dasharo. the hopefully socially incorruptible organisation becoming the caretaker of taking care the most difficult parts. ** Easier to have no single root of trust, instead have toggleable roots of trust for each distro and also allow the user to set their own root of trust. * key management could be done at a "simpler level". at the level of heads (or similar). ** Some sort of key management tooling will be needed, and since we're using UEFI directly this may be difficult. Perhaps a UEFI application can be made that will make this easier? Or do we just need special firmware features? (We may need some way for the user to change Secure Boot keys remotely for the purposes of credential rotation, although this might not be needed and could be scary. Concept improvements: * stage 0 - super simple, write firmware from USB, no display graphical output support, truly read-only * stage 1 - dasharo default firmware * stage 2 * Verify distribution (Debian) kernel against distribution public key. Making use of EFI signatures but without using EFI. * Mention why not using EFI. * What if evil maid flashes using stage 0? -> Should break TOTP or similar mechanism. * stage 1 preinstalled dasharo/heads firmware is required to match usability of user-settable root of trust, re-lock bootloader with user key supported Android phones such as Google Pixel. * OS rollback protection * factory reset protection * Firmware rollback protection? if the user changes firmware keys on every update that might give us this "for free", but the key changes could be an expensive operation * Document the need for a true ROM for firmware installation in the current design * Create alternate design that involves no true ROM and vendor-provided firmware * Review Google's Android docs more and pull in anything that would make either design better * usability: at least as good as Android phones, if not better * no concept of OEM ROMs -> user chosen operating systems are the primary focus * compatibility with standard Linux distributions, if possible * windows compatibility? Probably not, unless there's an alternative enable EFI option in the firmware * android: users can their own key but they can also use images by distributions * replay attacks * relay attacks == user-sysmaint-split - remove advanced boot options for first time start == * rationale: "advanced boot options" are useless (because there are no multiple kernel versions for new VM images or after ISO installation) and confusing for new users * helper-script: invent a new script grub-cfg-remove-advanced-boot-options to edit /boot/grub/grub.cfg directly * run_once: ** chroot-scripts ** calamares * document this on the [[Grub]] wiki page * Ended up going with a different solution that moves all of the advanced boot entries to the end of the list. Looks cleaner, all functionality is retained. Changes were made to the following packages: ** dist-base-files: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/grub-cfg ** grub-live: https://github.com/ArrayBolt3/grub-live/tree/arraybolt3/grub-cfg ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split == iso sysmaint mode - #2 == * as discussed * Current state (WIP): ** live-config-dist changes for unrestricted admin mode, probably shouldn't be merged until Trixie: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/sysmaint *** Patrick: merged ** user-sysmaint-split bugfix: https://github.com/ArrayBolt3/user-sysmaint-split *** Patrick: merged ** sysmaint-panel Calamares support: https://github.com/ArrayBolt3/sysmaint-panel *** Patrick: merged ** live-build changes to add sysmaint and unrestricted admin changes (PROBABLY SHOULD HAVE PUSHED THIS TO A DIFFERENT BRANCH, '''DO NOT MERGE'''): https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads *** Patrick: merged - should git revert 4f1f20bb6f86e6a8ff2ae3aed450d83eb726a55e? (resolved as discussed) ** derivative-maker changes to enable sysmaint and unrestricted admin changes, probably shouldn't be merged until Trixie: https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/sysmaint *** Patrick: merged - should I git revert 68a91cb9a00a5e9f00947e002e2642f3da14e800? (resolved as discussed) *** Patrick: What is the significance of Trixie here? **** Aaron: I had thought we wanted to wait until Trixie to enable user-sysmaint-split by default, however as we discussed we could enable it earlier. * Next round of changes, all should be merge-ready: ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/sysmaint ** live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/sysmaint ** usability-misc: https://github.com/ArrayBolt3/usability-misc/tree/arraybolt3/sysmaint ** sysmaint-panel: https://github.com/ArrayBolt3/sysmaint-panel/commit/f8db224e179ca7b32cffe7c21d8a159ef3e5abc3 ** security-misc: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sysmaint ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split * Patrick: all merged * Another batch of patches: ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split *** Patrick: merged ** kicksecure-base-files: https://github.com/ArrayBolt3/kicksecure-base-files/tree/arraybolt3/sysmaint *** Patrick: needs revision as discussed ** grub-live: https://github.com/ArrayBolt3/grub-live/tree/arraybolt3/sysmaint *** Patrick: same as above ** helper-scripts: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/sysmaint *** Patrick: merged ** live-build: https://salsa.debian.org/ArrayBolt3/live-build/-/commit/8484b589775c9783d396a84babd3c6c4eb53b7c2 *** Patrick: merged ** live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/sysmaint *** Patrick: not merged -> but broken: breaks unrestricted admin mode * Patrick: TODO: ** use config-package-dev displace for /etc/grub.d/10-linux for generic GRUB_DISTRIBUTOR setting based on already existing marker files *** Ended up not doing this as it was avoidable and avoiding modifying 10_linux is probably a good idea for safety and maintainability reasons. ** live-config-dist: fix restricted admin mode * Revised patches: ** live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/sysmaint *** Patrick: Not merged. Needs revision to be compatible with "traditional boot mode" when user-sysmaint-split is not installed -> copied to new ticket ** user-sysmaint-split: https://github.com/ArrayBolt3/user-sysmaint-split *** Patrick: Merged. ** grub-live: https://github.com/ArrayBolt3/grub-live/tree/arraybolt3/sysmaint *** Patrick: Merged. ** kicksecure-base-files: none, patch deleted as it is no longer needed == review wiki - shadow and ssh == * https://www.kicksecure.com/wiki/User#Meanings_of_Special_Characters_in_the_Password_Field_of_/etc/shadow_File * https://www.kicksecure.com/wiki/SSH#SSH_Login_Comparison_Table * Reviewed, added some info to both pages. == sysmaint - no autologin if password is set - #2 == * If there's a password set, do not auto login. Prompt for password using normal login or display manager mechanism instead. * users always need an opt-in way to set passwords, disable autologin. * Done: https://github.com/ArrayBolt3/user-sysmaint-split * Patrick: bug found ** /usr/libexec/user-sysmaint-split/sysmaint-boot. currently we're checking twice kernel boot parameter. i think the logic can be simplified. *** if in non-sysmaint (user) boot mode -> lock sysmaint and safe-rm any autologin config files that might exist ** bug: and let's say "/usr/sbin/lightdm" does exist. but we're not in sysmaint mode. currently what happens: do not delete the lightdm configuration file. ** Both issues fixed: https://github.com/ArrayBolt3/user-sysmaint-split == live-config-dist- check-unrestricted-admin TMP folder == * /usr/libexec/live-config-dist/check-unrestricted-admin
export TMPDIR='/tmp'
* necessary? needs to be commented or removed * Fixed dummy-dependency and removed this from check-unrestricted-admin. == calamares - implement - Allow distros to restrict what filesystems can be used in manual partitioning == * https://github.com/calamares/calamares/issues/2397 * PR here: https://github.com/calamares/calamares/pull/2400 Awaiting full review from devs. * Reviewed and merged. == fix Secure Boot fallback bootloader problems == * as discussed * Fix part 1: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/secure-boot-fix ** Patrick: merged * Fix part 2: https://github.com/ArrayBolt3/derivative-maker/commit/2ddc2dd7b8275cb440223c57a95305d8fb40cddc ** Patrick: merged == ISO - Debug chsh failure ==
/var/lib/dpkg/info/dist-base-files.postinst: INFO: Setting shell for user 'user' to zsh.
Password:
chsh: PAM: Authentication failure
/var/lib/dpkg/info/dist-base-files.postinst: ERROR: Command 'chsh --shell /usr/bin/zsh user' failed. This is only a minor issue.
* Possibly caused by this commit? https://github.com/Kicksecure/dist-base-files/commit/e4ba4e8ffc43f5ec3326c742bf86d56c34f23d79 * We're trying to set the shell to zsh before the /etc/shells file is updated. Setting zsh as a Pre-Depends of dist-base-files silently failed to resolve this, thus had to be added to Kicksecure's package list at the appropriate location. * Fixed: https://github.com/ArrayBolt3/derivative-maker/commit/ce6e8e5da6b3428eb36b1f7650edfab54436e5d2 ** Patrick: merged == ISO - use BUILD_INITRAMFS_PKGS == * todo: could you please use $BUILD_INITRAMFS_PKGS (already existing variable) instead of hardcoding dracut as initramfs generator? * Done: https://github.com/ArrayBolt3/derivative-maker/tree/master ** Patrick: merged == boot modes wiki page review == * [[Dev/user-sysmaint-split]] has been updated * Please review. * Ideas for chapter [[Dev/user-sysmaint-split#Server_Support|Server Support]], and * chapter [[Dev/user-sysmaint-split#Todo|Todo]]? * Related to upcoming tasks run0, sudoless, doas. * I do not believe we should be implementing opt-out by having the user uninstall or delete things. Instead, let's provide a "Classic" option that the user can select at the boot menu, and provide guidance on modifying the default boot option. ** Patrick: The "classic" option would be confusing in the boot menu. Better to make user-sysmaint-split package uninstallable: dummy-dependency user-sysmaint-split *** Aaron: Sounds good. **** Patrick: Wiki page updated. * Do we really want a recovery mode admin option? We specifically wanted to get rid of easy recovery mode access elsewhere. ** Patrick: Wiki was outdated on that. Recovery mode can stay disabled. Wiki has been updated to remove recovery mode. * Server support can be handled by changing the default boot entry using grub-set-default most likely. ** Patrick: This would mean to boot the server always into admin mode? In that case, perhaps better to go back to "classic"? *** Aaron: Yes, and that's included in the dummy-dependency user-sysmaint-split plan, so that's what we can do. Perhaps kicksecure-host-cli should use "classic" mode by default and kicksecure-host-xfce should use "user-sysmaint-split" by default? **** Patrick: Yes. Wiki page updated. * We need to choose what the default, topmost boot entry will become. Should that be "PERSISTENT mode User"? ** Patrick: Yes. * We may want to prepend "Kicksecure" to all of these boot menu entries for clarity as to which operating system is which. For Whonix, we can prepend "Whonix" to the boot menu entries. ** Patrick: Yes. * Added some more ideas, including thoughts for server support. I don't think we need a todo chapter since this dev/todo document works as that. == review USBGuard pull request == * https://github.com/Kicksecure/security-misc/pull/166 * https://usb-ids.gowdy.us/read/UC/ * Reviewed PR, requested changes, did some simple tests to make sure it didn't cause major issues. == review ARP related network settings == * https://github.com/Kicksecure/security-misc/pull/279 * Reviewed, can document if desirable == document sysmaint warnings in wiki == * as discussed * [[sysmaint]] * Documented. Didn't add a screenshot of the warnings from LightDM though since I didn't think they were worth the space on the page, I can add them if desirable. == user-sysmaint-split and sysmaint-panel improvements == * rationale: ** A single command dummy-dependency --yes --purge user-sysmaint-split would be sufficient to go back to classic sudo setup. Uninstallation of sysmaint-panel would be unnecessary. Users could use sysmaint-panel even in classic sudo setup. ** sysmaint-panel should be fully independent from user-sysmaint-split. It could also be used in classic sudo mode, where user "user" has access to sudo/pkexec. ** easier to test sysmaint-panel ** Qubes compatible
   subprocess.Popen(["/usr/libexec/helper-scripts/terminal-wrapper",
                         "/bin/sh", "-c", "$SHELL"])
* Is /bin/sh needed? /usr/libexec/helper-scripts/terminal-wrapper "$SHELL" works for me (manually tested). * https://github.com/Kicksecure/sysmaint-panel/blob/master/etc/X11/Xsession.d/15_no_sysmaint_xfce ** remove xfce from the name, if applicable ** move to user-sysmaint-split * sysmaint-panel Depends: usability-misc or is that a superfluous dependency?
echo "[Desktop]
Session=sysmaint-session" \
   | sponge -- '/home/sysmaint/.dmrc'
* needs to be run under user sysmaint to avoid permission issues * needs Depends: safe-rm maybe? * sysmaint-panel folder /usr/lib/systemd/system doesn’t seem right for a gui package. Maybe... ** user-sysmaint-split-cli ** user-sysmaint-split-gui ** sysmaint-panel *** would be a good split? *** But actually we can get that down to 2 packages only. user-sysmaint-split + sysmaint-panel * move https://github.com/Kicksecure/sysmaint-panel/blob/master/usr/libexec/sysmaint-panel/sysmaint-session ** to user-sysmaint-split ** How? By making sysmaint-panel a "plugin" or "extension".
xfwm4 &
# Needed to prevent window ordering problems
sleep 1;
sysmaint-panel
* could be changed to: if available, run sysmaint-panel. otherwise, just open a terminal. Pseudo code, untested:
xfwm4 &
# Needed to prevent window ordering problems
sleep 1;
## NOTE: bashism
if command -v sysmaint-panel &>/dev/null ; then
  sysmaint-panel
else
  /usr/libexec/helper-scripts/terminal-wrapper "$SHELL"
fi
* add a sysmaint-panel /usr/share/desktop/sysmaint-panel.desktop file * check file help-steps/pre function root_check ** something similar is required for sysmaint-panel ** if sudo cannot be executed -> show an error message, explain to boot into sysmaint, show a link * sysmaint-panel: honor signal sigterm * https://github.com/ArrayBolt3/sysmaint-panel ** Patrick: merged * https://github.com/ArrayBolt3/user-sysmaint-split ** Patrick: merged * https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sysmaint ** Patrick: merged == investigate dracut-config-generic == * VM images use dracut-config-generic because help-steps/variables has:
[ -n "$BUILD_INITRAMFS_DRACUT" ] || BUILD_INITRAMFS_DRACUT="dracut dracut-live dracut-config-generic binutils dmsetup pigz"
* ISO images do not have dracut-config-generic
apt-file list dracut-config-generic 
dracut-config-generic: /etc/dracut.conf.d/20-generic-image.conf
cat /etc/dracut.conf.d/20-generic-image.conf
hostonly="no"
* TODO: Would it be useful to have this package also on the ISO? Specifically since it would be useful if this package ends up on the installed system to always have a generic initial ramdisk as well as for feature/bug parity with VM images. * Patrick: Seems actually already done as per:
live-build/scripts/build/config:                        NEEDED_PACKAGES="live-config live-config-systemd systemd-sysv dracut-live dracut-config-generic dracut"
* Aaron: Confirmed, chrooting into the squashfs on a live-build-built Kicksecure ISO and running dpkg-query -s dracut-config-generic shows that it is install ok installed. Furthermore the 20-generic-image.conf file exists on the ISO. == investigate sudoless == * https://github.com/secureblue/secureblue/releases/tag/v4.2.0 * https://www.kicksecure.com/wiki/Dev/secureblue#sudoless * Could we go sudoless by default? * sudo no longer readable/executable by user user should be equally good or better as sudoless? sudo SUID issues would not be a problem if user user cannot execute sudo anymore? Only user admin would be allowed to execute sudo. * In case going "sudoless" (actually similar to sudoless), it would not even be required to port to either run0 or doas? * This would require finding solutions for existing sudoers.d exceptions. This is can be drafted on the [[Dev/sudo]] wiki page. * Sudoless desktop-config-dist: https://github.com/ArrayBolt3/desktop-config-dist/tree/arraybolt3/sudoless Ready for merge whenever desirable. ** Patrick: Was merged. * '''WIP''' Persistent admin mode (EDIT: this is now bitrotten and is not the direction we're going in to implement this): ** Currently missing separate user account support! ** grub-live: https://github.com/ArrayBolt3/grub-live/tree/arraybolt3/sudoless Adds an admin mode boot entry. *** This may be the wrong package to put this in, do we want a new package for this? **** Patrick: grub configuration looks good but requires dedicated package. ** security-misc: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sudoless Actually implements the permissions changes for user and admin modes. *** Patrick: Does not really? Does not belong into security-misc. Dedicated package required. == user-sysmaint-split == * implement package user-sysmaint-split as per [[Dev/user-sysmaint-split]] * Control panel app for sysmaint mode: https://github.com/ArrayBolt3/sysmaint-panel * Updated user-sysmaint-split with fixes, integrates with control panel app: https://github.com/ArrayBolt3/user-sysmaint-split * sysmaint user account lock detection: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sysmaint * terminal-wrapper fix for better UX: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/terminal-wrapper == pam-info improvements for user-sysmaint-split == * todo * Done: https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sysmaint == admin-gui == * open terminals - helper-scripts /usr/libexec/helper-scripts/terminal-wrapper * update software * reboot * shut down * Done: https://github.com/ArrayBolt3/sysmaint-panel == VirtualBox unattended installation pass-through == * how does that mechanism work? * Short, highly simplified answer: for Debian, it finds a file on the ISO at /.disk/info and parses it for info. This file identifies Kicksecure ISOs as being Debian, and it's difficult to customize the contents in live-build. Needs either customization options added or downstream patches. * Might be worth asking the VirtualBox people if they would consider adding a feature that would allow ISOs to "opt out" of autoinstall support, so that the user can't even try to use it in autoinstall mode. == investigate dracut-config-rescue == * https://forums.whonix.org/t/replacing-initramfs-tools-with-dracut/4487/8 * https://packages.debian.org/bookworm/dracut-config-rescue
cat /etc/dracut.conf.d/20-rescue.conf
dracut_rescue_image="yes"
* related to https://forums.kicksecure.com/t/harden-dracut-initramfs-generator-by-disabling-recovery-console/724? * TODO: good to keep or should be omitted? * There appears to be no differences between an initramfs built with dracut-config-rescue installed and one without it. According to the Arch Wiki (https://wiki.archlinux.org/title/Dracut), the "rescue" module is supposed to provide tools such as vi, ping, etc., which are useful in the rescue shell, but I know from experience those are NOT present in Kicksecure's initramfs images. Thus I don't think it makes any difference either way. We could remove it in order to lighten our images, I don't expect this will cause any harm. * Diff output between initramfs generated with dracut-config-rescue present (old-unpack), and initramfs generated without it (newer-unpack):
root@localhost:~# diff -r -u old-unpack/ newer-unpack/
File old-unpack/main/dev/console is a character special file while file newer-unpack/main/dev/console is a character special file
File old-unpack/main/dev/kmsg is a character special file while file newer-unpack/main/dev/kmsg is a character special file
File old-unpack/main/dev/null is a character special file while file newer-unpack/main/dev/null is a character special file
File old-unpack/main/dev/random is a character special file while file newer-unpack/main/dev/random is a character special file
File old-unpack/main/dev/urandom is a character special file while file newer-unpack/main/dev/urandom is a character special file
diff: old-unpack/main/etc/systemd/system/initrd.target.wants/dracut-cmdline-ask.service: No such file or directory
diff: newer-unpack/main/etc/systemd/system/initrd.target.wants/dracut-cmdline-ask.service: No such file or directory
diff: old-unpack/main/var/lock: No such file or directory
diff: newer-unpack/main/var/lock: No such file or directory
== dummy-dependency purge feature ==
    dummy-dependency [remove|purge] pkgname
* Done: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/dummy-dependency-purge == dracut rescue shell disablement maybe broken - VirtualBox install unattended option result in dracut rescue shell == * todo * Fixed: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads The ISO will no longer be detected as an autoinstallable Debian ISO any longer after merging this. == simple integrity check boot option == * not hidden under utilities * simple hash check * probably an existing dracut feature * At ISO build time, a utility implantisomd5 (from the package isomd5sum) must be run on the built ISO to embed the md5 sum into it. * Passing the kernel command line argument rd.live.check will trigger Dracut to run isomd5check to check the ISO's contents against this embedded md5 sum at boot time. * Could add this to derivative-maker or live-build. Willing to implement wherever is preferred. * Patrick (from chat): best upstream * Upstream MR: https://salsa.debian.org/live-team/live-build/-/merge_requests/392 * live-build fork with enhancements: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads * derivative-maker change to enable the feature: https://github.com/ArrayBolt3/derivative-maker/tree/master == ISO - GRUB - failing to boot after installation == * version 17.2.8.2 * environment VirtualBox, EFI, Secure Boot * ISO is booting * after installation, does not boot * Secure Boot issue: functional after disabling Secure Boot * Fixed: https://github.com/ArrayBolt3/derivative-maker/tree/master == ISO - GRUB - cosmetic GRUB error message == * environment: VirtualBox + EFI + Secure Boot (might be reproducible elsewhere too)
error: prohibited by secure boot policy
* Turns out you can't load unsigned fonts when Secure Boot is enabled. It's possible that even the default unicode.pf2 font in GRUB is unsigned. * Can't find an easy way to detect Secure Boot so that we can avoid running commands that will result in errors. * There probably isn't an easy way to fix this, combining this into the "silence cosmetic errors" task. == recovery mode disabling == * https://forums.kicksecure.com/t/harden-dracut-initramfs-generator-by-disabling-recovery-console/724 * https://forums.kicksecure.com/t/remove-linux-recovery-mode-boot-option-from-default-grub-boot-menu/727 * Done, but bootloader password still needs implemented. https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/no-recovery-mode == ISO - GRUB boot menu - add timeout to live boot menu == * todo * Done: https://github.com/ArrayBolt3/derivative-maker * Requires live-build changes from https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads for all changes to work. == ISO - GRUB boot menu - utilities option does nothing == * tested where: inside Qubes OS VM * is memtest missing on the ISO? ** Yes, it is. Adding it should fix this issue. * Done: https://github.com/ArrayBolt3/derivative-maker * Requires live-build changes from https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads for all changes to work. * note: increase RAM in Qubes VM to avoid dropping to CLI (no GUI). Full instructions are here: [[Qubes#ISO|Qubes, ISO]] == ISO - GRUB boot options text - add version number ==
Kicksecure Live ISO 17.2.8.1 GNU/Linux
${dist_build_type_short_pretty} Live ISO ${dist_build_version} GNU/Linux
* remove: built * remove: linux * remove: live-build * remove: live-config * possible to use live-build-data/grub-config/splash.svg as a template, copy it to temporary folder (as usual? derivative-binary?) and adjust? * reason: dist_build_version is the most important if user post screenshots with this. everything else adds confusion? * Done: https://github.com/ArrayBolt3/derivative-maker * Requires live-build changes from https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads for all changes to work. == ISO - GRUB boot menu cosmetic efi related error messages == * tested where: inside Qubes OS VM * difficult to see unless recorded on video
error: file `/boot/grub/i386-pc/efi_gop.mod' not found.
error: file `/boot/grub/i386-pc/efi_uga.mod' not found.
* Debian bug for the core image? Got some search results:
site:debian.org error: file `/boot/grub/i386-pc/efi_gop.mod' not found.
* Maybe live-build fails to install a grub package? * Side effect of no longer installing Debian-Installer? ** This is the result of fixing the missing font bug. If the unicode.pf2 font can be loaded, GRUB sets a static display resolution of 800x600 and attempts to load four different video drivers, two of which are the efi_gop.mod and efi_uga.mod drivers, and the other two of which are video_bochs and video_cirrus. If the font load fails, it allows the resolution to be automatically detected, and loads a driver called all_video. We're now ending up with the codepath involving the efi_gop and efi_uga drivers always hit since the font is now always found. ** Coincidentally, I noticed a bug where VMs with virtio graphics would not get a fancy graphical prompt, presumably because virtio is handled by the all_video driver and not the other four drivers. ** I think it would be best to just unconditionally use the all_video driver and autodetect resolution. The existing logic doesn't make sense to me, and because the font didn't even exist in the expected spot previously, we'd just be going back to the codepath we were hitting previously. ** After experimentation, this didn't work well at all. Went back to old GRUB config code from upstream with a note that it does not work. Fixing this will require more study to see how to get GRUB to not show cosmetic errors like this. == ISO - btrfs versus grub-live bug - hotfix == * bug: btrfs is persistent in grub-live mode, while it should not be * hotfix: please disable btrfs * Hotfixed and merged into Kicksecure. == derivative-maker git tag following == * to empower reviewers to follow changes from one tag to another * as discussed * TODO: a generic script to reviews any (nested) git submodules going from one tag (or commit) to another ** This turned out to be nearly impossible and definitely impractical. * TODO: document this on [[Dev/git]] * Discovered git diff --submodule=diff, which is useful * Created sample script that provides difftool-like features with meld, and shared it with Patrick. * Sent feature request / offer to contribute for git difftool --submodule=diff support in Git: https://lore.kernel.org/git/20241208030222.60e7ac70@kf-ir16/T/#u * Found PatchViewer tool and documented use under [[Dev/git]] == investigate run0 == * https://forums.whonix.org/t/replace-sudo-with-doas/17482/28 * https://www.freedesktop.org/software/systemd/man/256/run0.html * as alternative to doas * does run0 abolish the need for [[Dev/user-sysmaint-split]]? ** It does not, in fact its presence may make implementing the user/admin split difficult since it means systemd is providing a "backdoor" for running programs as root even without SUID bits being used. *** Can be disabled using polkit config, change all auth options to no in the org.freedesktop.systemd1.manage-units section of /usr/share/polkit-1/actions/org.freedesktop.systemd1.policy * Posted reasons to avoid use at https://forums.whonix.org/t/replace-sudo-with-doas/17482/29 == grub-live debian control best practices == * please review, improve * https://github.com/Kicksecure/grub-live/blob/master/debian/control * Should grub-live Depends: grub-live-dracut | grub-live-initramfs-tools? ** The existing setup seems fine to me. It is unfortunate that Debian lacks the ability to specify a group of packages in a dependency declaration, as the existing structure seems like an awful lot of work to depend on either dracut, or live-boot + live-tools. But, it works, and it seems to me like the best way to do this given Debian's limitations and structure. == ISO - fwupd == * Add fwupd * fwupd-signed * note: architecture specific? (As it turns out, yes.) * Done: https://github.com/ArrayBolt3/derivative-maker/tree/master == ISO - GRUB unicode.pf2 error message ==
error: `/grub2/fonts/unicode.pf2' not found
* Please fix. * Should be fixed in latest derivative-maker improvements. == ISO - live-build - misc improvements == * Any other misc improvements? * live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/d-i-disable * derivative-maker: https://github.com/ArrayBolt3/derivative-maker == advice on safe_echo vs dist-installer-cli == * https://github.com/Kicksecure/usability-misc/blob/master/usr/bin/dist-installer-cli * https://forums.whonix.org/t/whonix-linux-installer-development-discussion/15917/188 * Comment left, can work on implementing suggested fix if desired == live-build downloads == * investigate * Handled. == review source code - str_replace file garbage bug - str_match == * already fixed in git master * please review ** str_replace ** str_match * Determined root cause - failing to truncate file when rewriting. * Reviewed code, added minor improvements to reliability and performance: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/str_python_scripts == swap-file-creator improvements == * https://forums.kicksecure.com/t/enhanced-heuristics-for-determining-the-swap-file-size-in-swap-file-creator/749/2 * swap-file-creator changes: https://github.com/ArrayBolt3/swap-file-creator/tree/arraybolt3/heuristics * helper-scripts changes: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/heuristics == ISO - consider installing by default on ISO ==
      packages_to_be_installed+=" mokutil "
      packages_to_be_installed+=" keyutils "
      packages_to_be_installed+=" efibootmgr "
* mokutil is already installed. * How about the others? * Note: architecture specific. AMD64 vs PPC etc. * These packages don't really cause any harm if installed on a BIOS machine, and both amd64 and arm64 UEFI machines may benefit from them. I don't see any reason why not to include them by default. * All of these are being installed by default on both amd64 and arm64 builds, and appear to be pulled in either by Calamares or by GRUB. I think we should leave these up to live-build to choose whether to automatically install them or not, since if we end up supporting platforms that use firmware other than BIOS or UEFI in the future, these might not be relevant. == multi architecture support == * the following code can be removed from build-steps.d/1200_prepare-build-machine? * required by grml-debootstrap for arm64 builds? * please add support for other architectures to build-steps.d/2800_create-lb-iso * just only mostly generic code. theoretical support only. no actual builds test needed for all architectures at this time.
      ## The following grub packages are (partially) build dependencies by Debian live-build.
      ## Certainly required for amd64 ISO images booted with shim and grub.
      if [ "${host_architecture}" = "amd64" ]; then
         ## These packages are all available for the amd64 platform.
         ## "grub-mkrescue will automatically include every platform it finds." [1]
         ## [1] https://lists.gnu.org/archive/html/grub-devel/2014-03/msg00009.html
         ## Install them all for best compatibility and reproducible builds.
         ## Some might be unnecessary and waste a bit space.
         ## Maybe this can be optimized later.
         packages_to_be_installed+=" grub-efi-amd64-bin grub-pc-bin grub-coreboot-bin grub-efi-ia32-bin grub-xen-bin grub-ieee1275-bin "
         packages_to_be_installed+=" grub-efi-amd64-signed "
         packages_to_be_installed+=" shim-unsigned shim-signed shim-signed-common "
         packages_to_be_installed+=" shim-helpers-amd64-signed "
      elif [ "${host_architecture}" = "i386" ]; then
         packages_to_be_installed+=" grub-efi-amd64-bin grub-pc-bin grub-coreboot-bin grub-efi-ia32-bin grub-xen-bin grub-ieee1275-bin "
         packages_to_be_installed+=" grub-efi-ia32-signed "
         packages_to_be_installed+=" shim-unsigned shim-signed shim-signed-common "
         packages_to_be_installed+=" shim-helpers-i386-signed "
      elif [ "${host_architecture}" = "ppc64el" ]; then
         packages_to_be_installed+=" grub-ieee1275-bin  "
      elif [ "${host_architecture}" = "ppc64" ]; then
         packages_to_be_installed+=" grub-ieee1275-bin  "
      elif [ "${host_architecture}" = "sparc64" ]; then
         packages_to_be_installed+=" grub-ieee1275-bin  "
      elif [ "${host_architecture}" = "arm64" ]; then
         packages_to_be_installed+=" grub-efi-arm64-bin "
         packages_to_be_installed+=" shim-unsigned shim-signed shim-signed-common "
      elif [ "${host_architecture}" = "riscv64" ]; then
         packages_to_be_installed+=" grub-efi-riscv64-bin  "
      else
         true "${red}${bold}WARNING:${reset} ${under}The ISO to be build might be unbootable!${eunder}
- This is because bootloader support is not implemented when building on this
  systems's host_architecture.
- Either the build script does not know how to install the required grub '-bin'
  package for this architecture or the package is simply unavailable.
- Therefore ISO cross builds are unsupported. Patches welcome.
  Might be possible to implement this by running image-to-iso using qemu.
- There is also a small chance that host_architecture detection failed. (Using multiarch, wine?)"
      fi
* Better multi-arch support now at https://github.com/ArrayBolt3/derivative-maker/tree/master * I tested amd64 and arm64 builds to reduce the risk of breaking things, but I did not test other architectures = ARCHIVED 1 = == move archived tasks to Dev/todo/archived == * move to [[Dev/todo/archived]] == iso - calamares - key stretching == * please review [[Passwords#Key-Stretching|Key-Stretching]] * opportunities to improve calamares encryption settings? * Looks good to me, Kicksecure is already using this, but there's room to potentially help other distros set this if they want. == tirdad - dkms amd64 to arm64 cross build bug == * Qubes (amd64) build VM * bug: Somehow DKMS is using the chroot's host (Qubes VM) kernel headers instead of the chroot's kernel headers. * might be related to live-build commit: ** 4a8b01df80a958b0fe83d2bf8958d9e2124cb71c ** but that build already included that commit * tirdad doesn't work on arm64 sadly (requires Livepatch, but arm64 lacks Livepatch), thus has to be omitted from arm64 builds. ** Commit: https://github.com/ArrayBolt3/derivative-maker/commit/a58d65f7f83e93e23ae9f46ed979a083f1245808 == passwordless-root == * todo: review * [[Root#passwordless-root|passwordless-root]] * [https://github.com/Kicksecure/usability-misc/blob/master/usr/bin/passwordless-root /usr/bin/passwordless-root] * Looks good to me. The actual admin/user split can be implemented at least to begin with very simply, by using a systemd unit that reads a kernel parameter and adjusts available user accounts and SUID bits accordingly. == review /usr/bin/passwordless-root == * usability misc - /usr/bin/passwordless-root * Assuming it's been tested and works, the code looks good, I don't see any security holes here. == live-build - localrepos - permission issue == * related to above? * Qubes (amd64) build VM
N: Download is performed unsandboxed as root as file '/root/localrepos/kicksecure/pool/main/a/apparmor-profile-hexchat/apparmor-profile-hexchat_5.1-1_all.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
...
+ error 'ERROR: Live build chroot stage failed!'
* Not a problem, this is a normal message for apt to show when installing packages from a local repo. == doas - submit a pwfeedback feature request == * todo * Request sent via email, see https://marc.info/?l=openbsd-tech&m=173284374231855&w=2 * Rejected by upstream. == doas - submit a /usr/local/etc/doas.d /etc/doas.d drop-in configuration feature request == * todo * parse only configuration files ending with .conf (to avoid parsing editor backup files ending with "~", ".bak", ".dpkg-old" or similar) * Request sent via email, see https://marc.info/?l=openbsd-tech&m=173284374231855&w=2 * Rejected by upstream, response to the suggestion was borderline hostile. == live-build - test arm64 cross-build support == * as discussed * Changes were required to derivative-maker to support cross-building and arm64 ISO builds, also had to fix a couple bugs in live-build to make things work. ** Live-build changes: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads ** derivative-maker changes: https://github.com/ArrayBolt3/derivative-maker/tree/master *** Native arm64 builds have NOT yet been tested == immutable /usr /etc without overlay == * Try to boot Kicksecure with read-only (immutable) /usr /etc. * There should be no overlay. "Real" read-only. Not similar to live mode with non-persistent overlay. * In case of issues, try with Debian, as there might be Kicksecure specific issues. * This task is in preparation for [[Dev/user-sysmaint-split]]. ** Kicksecure booted but failed to reach a graphical desktop environment. Console login was impossible because PAM faillock errors out when it can't write to the tally file. ** Debian booted but failed to reach a graphical desktop environment. Console login worked, but neither systemctl restart lightdm nor startx were able to reach a login screen or desktop environment. == implement umask hardening == * as discussed * PR: https://github.com/Kicksecure/security-misc/pull/282 == grep review harden pkexec == * please grep all source code for pkexec and review * Checked, everything that hasn't been reviewed in other tasks looks safe. == review and harden repository dist policykit polit policy file == /usr/lib/python3/dist-packages/repository_dist_wizard/repository_dist_wizard.py command = ['pkexec', 'repository-dist', '--enable'] + repository Ok? * Checked, this doesn't look like a threat to me, except in situations where the system is already badly compromised. Shared the one possible scenario with Patrick. == umask research == * please research, find solutions for umask * this is in preparation of * https://forums.whonix.org/t/change-default-umask/7416 * https://github.com/Kicksecure/security-misc/pull/18 * https://github.com/Kicksecure/security-misc/issues/185 pam_umask.so debug umask=027 run a script, if root, do nothing, otherwise set umask [success=2 default=ignore] pam_succeed_if.so debug uid eq 0 [success=1 default=ignore] pam_succeed_if.so debug use_uid uid eq 0 replace with pam_exec? * Research recorded at https://github.com/Kicksecure/security-misc/issues/185#issuecomment-2492614076, still discussing if this is something we want to do or not. * Investigate how ssh opens a session and how to set umask there ** Answer: The default umask set by OpenSSH is whatever umask it is launched with but with world and group write permissions disabled (so newly created files don't end up world-writable or group-writable by accident). If the user is entering an interactive SSH session, a login shell is launched, otherwise the command the user specifies is run using the user's default shell and a -c argument. If we want to configure the umask for all commands, we will have to set it via a shell launch script that runs even on non-login shells (i.e. bashrc or zshrc). If only login shells need configured, a profile script should suffice. There does not appear to be a configuration setting in OpenSSH for setting a umask outside of these mechanisms, the umask override for disabling world write and group write bits is hardcoded. == Protection_Against_Physical_Attacks wiki page revision == * please improve [[Protection_Against_Physical_Attacks]] * Done, did not document advanced GRUB password configuration because it requires writing a grub.cfg file by hand, and that would be best documented elsewhere. == installed ISO - fix localhost == After installing from the ISO using calamres:
[user ~]% setsid -- sudo -- /usr/bin/test -x /usr/bin/test          
[user ~]% sudo: unable to resolve host localhost.localdomain: Name or service not known
This causes an issue with systemcheck. /etc/hosts is empty. But should be same as on Kicksecure Xfce for VirtualBox. Where it is:
[user ~]% cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

[user ~]% cat /etc/hostname 
localhost
If this was to change, it would need to be changed in Kicksecure for VirtualBox (and KVM) too. Would need to be changed in derivative-maker. Probably best to set ISO /etc/hostname and /etc/hosts to the same value as Kicksecure for VirtualBox (derivative-maker) or what would be the canonical name? * Fixed. https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/network-config Uses same values for /etc/hosts and /etc/hostname as for VirtualBox builds, these values originally came from grml-debootstrap and the $dist_build_hostname variable. == review and harden our pkexec policykit polkit policy files == * review * harden, if there is something to harden
./packages/kicksecure/anon-connection-wizard/usr/share/polkit-1/actions/com.kicksecure.anon-connection-wizard.policy
./packages/kicksecure/live-config-dist/usr/share/polkit-1/actions/com.kicksecure.install-host-calamares-wrapper.policy
* Reviewed, shared results with Patrick. * update 1: Please fix. * Fixes: ** anon-connection-wizard: https://github.com/ArrayBolt3/anon-connection-wizard/tree/arraybolt3/pkexec ** tor-control-panel: https://github.com/ArrayBolt3/tor-control-panel/tree/arraybolt3/pkexec (needed changes to remain compatible with anon-connection-wizard changes) == FYI - systemcheck test == After each build, please do a test. {{CodeSelect|code= systemcheck --verbose }} This catches major issues such as localhost issue. * Will keep that in mind, my last build after fixing the localhost issue seems to pass this check. == investigate absence of sudo doas pkexec == * SUIDs are a security issue. * How realistic would it be to implement all sudoers / pkexec exceptions using Linux capabilities, file permissions or similar? * Long term goal should be to have no application running as root / no user reachable SUIDs. * Maybe doas, pkexec should only be reachable from user admin. * If too complex, might be far future work and meanwhile we'll go doas (+ pkexec). * Looks very complex but potentially doable, see https://man7.org/linux/man-pages/man7/capabilities.7.html. However, some sort of privilege escalation framework will still be needed for running things such as apt and requiring a password for that purpose. * Applications that depend on checking for a root UID can be "fooled" into thinking they have root but really only having a limited set of capabilities * May interact poorly with Debian, experimentation will be needed to find out * Limiting access to sudo or doas can be done without having to go into an all-capabilities environment, a systemd unit could be used to ensure that the SUID bits on those applications are absent in user mode and present in admin mode * Probably better to start with doas, will likely hit less hurdles attempting that. * After further research, this looks very difficult or impossible to do with Debian. The capabilities system does not provide substantial additional security when used alongside "legacy" (i.e. user account based) privilege management, and using it on its own requires both executable files and systemd unit configuration to be configured to use capabilities properly. Most of Debian's applications are probably not configured to work this way, so we would need to ship ''extensive'' permission modifications in permission-hardener, as well as replace many, many systemd units for things such as display managers, servers, or anything else that ran as a systemd system unit and needed privileges to do its job properly. This does not seem practical, therefore I would highly recommend we stick with porting to doas. * I tried searching for distros that use capabilities in lieu of root access - Google was very unhelpful, and Perplexity.ai just told me there weren't any distros like that. == review rads == * https://github.com/Kicksecure/rads * [[RAM Adjusted Desktop Starter]] * Issues, both minor: ** rads_minimum_ram is set to 480 in the config file with rationale given, but defaults to 500 in rads itself, which could be problematic ** rads_no_swtich_vt is typo'd both in the variable itself and in the config file * Very unlikely to be the source of the distro morphing bug reported earlier, the user had a working display manager at that point and was observing auth failures in their logs. * update, Patrick: fixed == review and harden our /etc/sudoers.d snippets == * review * harden, if there is something to harden * Done, hardening code merged == rewrite from perl to python == * todo * After auditing, I don't believe most of our uses of Perl need to be replaced. str_replace and str_match seemed potentially important to port however. ** Rewritten versions of str_replace and str_match: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/perl-to-python == python perl etc pitfalls == * please study https://www.qualys.com/2024/11/19/needrestart/needrestart.txt * Studied. The first three vulnerabilities are not PERL-specific, only the last two (involving two-argument open()) were. Of particular interest was https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=88890543 which warned about the <> and operators being unsafe to use in any context since they themselves use the vulnerable way of calling open(). * Reproduced the poison NUL byte and two-argument open() issues mentioned by https://phrack.org/issues/55/7.html#article locally. They are still a problem, even today. Also discovered that the poison NUL byte issue is a known and documented weakness in Perl: https://cwe.mitre.org/data/definitions/626.html * https://stackoverflow.com/questions/1011431/common-pitfalls-in-python has useful advice for Python. == fix sudoers.d related issues == * todo * Fixes: ** https://github.com/ArrayBolt3/sdwdate/tree/arraybolt3/sudoers ** https://github.com/ArrayBolt3/sdwdate-gui/tree/arraybolt3/sudoers ** https://github.com/ArrayBolt3/security-misc/tree/arraybolt3/sudoers ** https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/sudoers ** https://github.com/ArrayBolt3/systemcheck/tree/arraybolt3/sudoers ** https://github.com/ArrayBolt3/tb-starter/tree/arraybolt3/sudoers == research archivebox and alternatives == * installation source issue ** nice but optional, because might be unavailable: signed releases available? available from packages.debian.org? *** A Docker image is available, but Docker has supposedly had severe security issues related to image verification in the past: https://titanous.com/posts/docker-insecurity *** There's also a package available via pip but it seems to make signing of releases optional and GPG support is very limited, so just because the package is on PyPI doesn't mean it's signed. *** No signed release visible on releases page. * predictable links issue ** web.archive.org is nice because using our [https://github.com/Kicksecure/mediawiki-link-to-archive mediawiki-link-to-archive] MediaWiki extension, each link gets appended with an archive symbol linking to https://web.archive.org/archive/. ** investigate if archivebox (or alternative) has such a feature ** post a feature request if not ** if such a feature does not exist, then mass wiki editing will be required to append links to our self-hosted archivebox (or alternative) *** wiki mass editing is best avoided. Either we would use a different self-hosted archival tool or perhaps contribute such a feature upstream, if feasible? **** A URL-encoded URL can be passed as a search query, similar to how archive.today allows searching for archives of a site with https://archive.today/https://google.com. This takes a bit more effort due to the URL encoding being mandatory, but it is doable it appears. **** Feature request for archive.org style links (originally filed by the primary ArchiveBox author, commented on by me): https://github.com/ArchiveBox/ArchiveBox/issues/1085 **** The feature already exists and is usable upstream: https://github.com/ArchiveBox/ArchiveBox/issues/1085#issuecomment-2487121890 * public archive issue ** Ideally, the archive would not be "our archive" but a public archive. ** That does not mean, that we want to host a public archivebox archive that anyone can use. That would unfortunately be problematic (disk space, legal issues). ** We're already offering various downloadable backups on the [[Offline Documentation]] wiki page (including rsync access). ** For archived links it would be good if these could be offered in a backup format available to the public. I.e. someone could use rsync and download all links that we archived. ** With archivebox that might be problematic because links might be unpredictable. Archivebox has a search function but it relies on server functionality, server database (?), which we probably cannot share as is. *** Should we nuke admin credentials so we can share the database with the public for backup purposes? **** ArchiveBox actually has explicit support for publishing an archive as a static website. See https://github.com/ArchiveBox/ArchiveBox/wiki/Publishing-Your-Archive. Assuming this doesn't save any sensitive data, this would be a pretty easy way of doing this. * design: ** Keep archive box web interface accessible to admins and bots only. (security) ** Keep link archival accessible to admin and bots only. (legal) ** Keep archived links reading accessible to the public. ** After wiki backup (already existing on the server) using mediawiki-shell, have a script that can parse the wiki for new links and add them to archivebox. *** Needs support for a list of domains to avoid archiving (since archiving might be broken). *** Due to some links being offline, often, need to probably fail open if some links are not archiveable. == live-build - permission lockdown still functional test == * https://www.kicksecure.com/wiki/Dev/Strong_Linux_User_Account_Isolation#access_rights_restrictions * Kicksecure installations from post-live-build media and pre-live-build media behave the same way in this regard. ** Initial user account user has home directory /home/user with permissions 750 (read/write/execute for owner, read/execute for group, nothing for other) ** User account created with adduser with name user2 has home directory /home/user2 with permissions 700 (read/write/execute for owner, nothing for group, nothing for other) ** User account created with useradd with name user3 has no home directory. Created home directory manually with sudo mkdir /home/user3; sudo chown user3:user3 /home/user3, permissions on directory are 755. Installing a package thereafter (such as git) '''does not''' change the permissions on /home/user3 to something more secure, despite what the linked documentation implies. ** It's possible that permission lockdown is broken, however if so, it is not the result of live-build, assuming my tests were sufficient to diagnose this. == apt-get - recommends can no longer get installed after installation with --no-install-recommends - bug report == `apt install --no-install-recommends diffoscope` User story: Good, I did not want these recommends. And I didn't get these. Great. But... Now I noticed that i cannot figure it out or something and want these dependencies anyhow. `apt install diffoscope` * expected result: `Recommends:` get installed now * actual result: not happening `sudo apt satisfy diffoscope` or even `sudo apt install --install-recommends diffoscope` does not install the `Recommends:`. The only way to get the dependency is `apt remove` followed by `apt install`. * Turns out there is already a feature request for this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894976 Would be willing to try and implement. * Patrick: now documented here: https://www.kicksecure.com/wiki/Install_Software#--no-install-recommends == grub boot menu - regression - mini symbol stuck bug == * the Kicksecure lock (or in case of Whonix the hat symbol) on the left next to the first boot menu entry looks confusing. This is because when selecting a different boot menu entry, that symbol will stay where it is. * simple solution: remove that symbol without replacement * harder solution: when pressing arrow down, move the highlight (different color for selected boot menu entry) as well as the mini symbol * Ended up going with the simple solution, because I didn't think the UX of the harder solution would make sense. In a multiboot scenario, having the Kicksecure icon show up next to an OS other than Kicksecure would potentially be weird. * Modified branches: ** Kicksecure: https://github.com/ArrayBolt3/kicksecure-base-files/tree/arraybolt3/no-grub-theme-icon ** Whonix-Gateway: https://github.com/ArrayBolt3/anon-gw-base-files/tree/arraybolt3/no-grub-theme-icon ** Whonix-Workstation: https://github.com/ArrayBolt3/anon-ws-base-files/tree/arraybolt3/no-grub-theme-icon ** Note: I only tested the Kicksecure changes so far (they work fine on both BIOS and UEFI systems). The Whonix-Gateway and Whonix-Workstation changes are not tested, though they are functionally identical to the Kicksecure changes and as such should work. == start discussion about Weak-Depends on debian-devel mailing list == * as discussed * see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942303 * Discussion at https://lists.debian.org/debian-devel/2024/11/msg00018.html * Discussion seems to have halted, the idea that seemed the most promising was allowing the user to specify what packages they wanted to install the recommends of, while leaving other packages out. * Should a task be added for implementing a proof of concept for this? == calamares - timezone issue == * https://forums.kicksecure.com/t/kicksecure-installation-cannot-set-timezone-link-creation-failed-target-usr-share-timezone-link-name-etc-localtime/652 * Could not reproduce, tried one UEFI "Erase disk" installation, one BIOS "Erase disk" installation, and one BIOS "Replace partition" installation. Forum comments at https://forums.kicksecure.com/t/kicksecure-installation-cannot-set-timezone-link-creation-failed-target-usr-share-timezone-link-name-etc-localtime/652/4 * Turned out to be the result of attempting to install Kicksecure onto a FAT32 partition. == calamares - file system unit test == * possible to translate https://forums.kicksecure.com/t/kicksecure-installation-cannot-set-timezone-link-creation-failed-target-usr-share-timezone-link-name-etc-localtime/652/6 into a calamares unit test so it would show a better error message? * Feature request made for allowing distros to deny certain filesystems from being used for certain mountpoints: https://github.com/calamares/calamares/issues/2397 * Should a task be added for implementing the functionality in this feature request? == review kloak makefile pull request == * https://github.com/Whonix/kloak/pull/5 * Review complete, nothing malicious found, some quality and functionality issues were found for which I suggested several changes. * All issues fixed, approved PR. == live-build - mmdebstrap should use security.debian.org repository == * bug: Debian security repository is not being used. * Using Debian security repository is however a security feature and reason why using mmdebstrap. To bootstrap from more than 1 repository (Debian "normal" + Debian security) repository. * Issue should be resolved with the following changes: ** live-build changes: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads (same branch as before, Kicksecure's fork will need to be updated to match it) ** derivative-maker changes: https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/mmdebstrap-enhance (this '''will''' break the ISO build if merged without updating live-build) == salsa debian - salsa signing key setup == * https://salsa.debian.org/ArrayBolt3/live-build/-/commits/arraybolt3/lb-dracut?ref_type=heads * please upload your gpg public key to salsa.debian.org, if that is acceptable. * similar to github.com * so we get "verified" marks everywhere * Done. == kloak - Qubes support - implement kloak within qubes-gui-daemon == * https://github.com/QubesOS/qubes-issues/issues/8541#issuecomment-2377325699 * Ensure code is modular and can be easily broken out into a separate library or executable if requested by Qubes devs * Use common code between standalone version and Qubes version to keep differences as small as possible (perhaps create libkloak?) * Prototype implemented and mostly working, draft PR at https://github.com/QubesOS/qubes-gui-daemon/pull/149 * Waiting on response from Qubes OS devs * Got response and review, currently working out final implementation and doing testing * All code has now been merged. == Implement live mode with 90overlayfs == * context: [[grub-live]] * https://github.com/Kicksecure/grub-live * https://github.com/Kicksecure/grub-live/blob/master/etc/grub.d/11_linux_live * stop using 90overlay-root * port grub-live to 90overlayfs * This does not work in Bookworm, but does work in Trixie. * Once Trixie is released and we're upgrading Kicksecure to it, switch modules. See https://github.com/dracutdevs/dracut/issues/1565#issuecomment-2378133277 ** Since there is a source code comment pointing that out, mygrep -r TODO | grep trixie will find this task when it is due == live-build - live_build_package_list_kicksecure - do not hardcode amd64 == * live-build-data/live-build-config/live_build_package_list_kicksecure
linux-image-amd64
linux-headers-amd64
* should be generic based on already existing variable ${dist_build_type_short} * Fixed in https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/avoid-amd64-hardcode == live-build bug - cannot create /dev/null: Permission denied == build machine: * CI: passing * using a Qubes Kicksecure based App Qube: broken * /usr/bin/apt-key? Where in derivative-maker or live-build is /usr/bin/apt-key being used anyhow? ** apt update is calling it. Verified by chrooting into the broken live-build chroot and running sudo apt update. * Note: apt-key is deprecated as per apt-key Debian upstream man page anyhow and should not be used. ** Since this is apt itself using it, I think this is working as intended. * Root cause of the problem: /home is mounted with nodev inside Kicksecure Qubes. This results in the chroot's /dev/null being unwritable even by root. * Should be fixed here: https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/home-nodev-fix Remounts /home with the dev option to resolve the problem. == uwt torsocks TORSOCKS_LOG_LEVEL == * check if package uwt /etc/sudoers.d/uwt is still required * https://forums.whonix.org/t/disable-torsocks-warning-spam/19084 * if still an issue, please send a pull request to upstream making TORSOCKS_LOG_LEVEL configurable in /etc/tor/torsocks.conf * This does not appear to be an issue any longer. I commented out all `TORSOCKS_LOG_LEVEL` setting lines in `uwt.sh`, `uwtwrapper`, and `/etc/sudoers.d/uwt`, and saw no log messages similar to that in the logs. I also did export TORSOCKS_LOG_LEVEL=5; sudo -E torsocks apt-get.anondist update, and while this produced lots of debugging messages from torsocks due to the high verbosity level it was set to, none of those messages were the offending message from the linked bug report. With any lower loglevel, torsocks was silent. == url_to_unixtime review and hardening == * https://github.com/Kicksecure/sdwdate/blob/master/usr/bin/url_to_unixtime * (mostly) out of scope? validation of command line inputs * out of scope: timeout - this is enforced on sdwdate level and does not need to be implemented at the url_to_unixtime level * todo: check if minimum + maximum string lengths are properly enforced * already has a dedicated AppArmor profile: ** https://github.com/Kicksecure/sdwdate/blob/master/etc/apparmor.d/usr.bin.url_to_unixtime ** https://github.com/Kicksecure/sdwdate/blob/master/etc/apparmor.d/abstractions/url_to_unixtime * threat model: ** remote code execution ** outputting too short/long/non-numeric strings or malicious binary data that could confuse/exploit sdwdate * Issues found: ** request_data_from_remote_server: The remote_port argument is never used in this function (or anywhere in the script). There doesn't appear to be an immediately obvious way to even use an argument like this with Requests. ** data_to_http_time does not enforce a maximum number of characters in the http_time string. This means that even an extremely long string will be parsed as a date later on in http_time_to_parsed_unixtime, which could theoretically be used to consume resources on a machine under attack. ** Multiple locations in the code will print to stderr values that may be bad in one way or another (most notably, every single HTTP header the script gets from the server will be printed in many instances) in the event of an error condition. The code specifically notes that it "prints debug and errors to stderr", thus I do not believe this is a serious concern. I didn't see any substantial processing happening on stderr elsewhere in sdwdate except to ensure it wasn't excessively large and to print it to stdout, which I believe ends up in the journalctl logs. ** unixtime_sanity_check doesn't ensure that the timestamp it returns is non-negative. ** The socks module is being imported for no reason. requests does not require it to be imported to access Tor over a socks5 proxy. ** Some miscellaneous unused variables, unneeded parentheses, and typos are floating around according to PyCharm. * Other than that, it seems good: ** minimum date string length is enforced in data_to_http_time ** maximum timestamp length is enforced in unixtime_sanity_check ** only a sufficiently short timestamp derived from a sufficiently long date string will be printed to stdout (only a single print command is used for that purpose, and it only prints a variable that has passed all checks) ** I don't see any RCE risk aside from unknown and unknowable issues in the Python interpreter itself. The only bit of code that's really scary in this respect is when http_time_to_parsed_unixtime calls dateutil and trusts it to properly handle arbitrary, untrusted date headers from HTTP connections. dateutil is written entirely in Python though, so this isn't much of a threat - the worst that could happen is url_to_unixtime could crash, or return a garbage time value. (However, see the note about a lack of negative time prevention above.) * sdwdate branch with all listed issues resolved: https://github.com/ArrayBolt3/sdwdate/tree/arraybolt3/url-to-unixtime-tidy == tbb version parser hardening == * '''todo:''' discuss * The local version parser function `tbbversion_installed` could be moved to /usr/bin/update-torbrowser for now as it is considered low risk. * The remote version parser function `tbbversion` requires hardening: ** Out of scope: `tbbversion` taking too much time (can be easily handled from update-torbrowser by using standard Linux program timeout). ** Currently has good error handling, but errors have not been reported yet. We could give up on good error handling except for distinguishing between exit 0 (ok) and exit 1 (error). ** Needs to be written as securely as possible: *** Attack surface currently includes at least: `jq`, `bash`, `/usr/libexec/msgcollector/striphtml`. *** Remote version file cannot be verified (only through HTTPS or onion). *** '''todo research:''' Will upstream provide signed version files? How does Tor Browser internally verify the version file? Can we use the same mechanism? *** Version parser should be moved into its own standalone script. *** Should it be rewritten in Python for better security? *** The new version parser could be confined using AppArmor. *** The version parser would either accept an input file and output file, with no other console output: **** If the version parser gets exploited but is still contained by AppArmor, malicious advice could still be outputted to the console. Therefore, error codes should instead be communicated through exit codes: ***** Exit 1: General, not specifically handled/expected error. ***** Exit 2: Input file does not exist. ***** Exit 3: `jq` failed. ***** Etc. *** String length sanity checking with if [ "$actual_string_length" -gt "$max_string_length" ]; then makes a lot of sense but should not be done within the version parser: **** If `jq` is compromised, the string length check could be omitted. Therefore, string length checking should be handled externally. **** Assumption: If string length is kept minimal, exploitation might be difficult or even impossible. **** Version number is currently 14.0.2. Maximum string length is 20 characters. Since version numbers are short and reasonable, the maximum string length could be further reduced. **** If the version parser is compromised, outputting evilevil instead of 14.0.2 might be insufficient to exploit update-torbrowser. However, allowing the parser to output a 10 MB file increases risk significantly. **** A robust design could involve the version parser accepting an input file and generating an output file, with no console output allowed: ***** File-based input/output design allows update-torbrowser to safely check file size. If too large, it can be rejected as either a bug or an exploitation attempt. **** Separation between version parser (AppArmor'ed) + file size checker (AppArmor'ed) + tb-updater might be overkill? **** Should be placed into /usr/libexec/tb-updater? ** Should Tor Project and ARM64 version parsers be different? * After discussion with Patrick, this is the solution I wrote: ** Parsing of untrusted input is entrusted to a dedicated Python script that is heavily confined using AppArmor. ** The original tbbversion function is still necessary to sanitize the output from this script. ** The script reads an input file, writes an output file, and gives an exit code indicating if the operation was successful. Console output to stderr ''is'' generated for debugging purposes, but is discarded by tbbversion. ** The exit codes are: *** 0: Success. *** 1: Invalid arguments. *** 2: File I/O issues (file doesn't exist or cannot be read from/written to) *** 3: Parse failure (invalid or malicious input) ** tbbversion runs a battery of checks against the returned value, ensuring it is small, contains only ASCII chars, non-empty, and looks like a valid version number. Once the full battery of tests passes, the value is considered trusted and is passed to tbbversion's caller. ** Callers source /usr/libexec/tb-updater/version-validator, set environment variables, and call tbbversion to do Tor Browser version parsing. This is identical to the previously existing API, with two exceptions: *** tbbversion is now part of a script called version-validator. version-parser is now the confined Python script that does the real parsing. Thus scripts that rely on tbbversion need to be changed to source the correct script. *** tbbversion supports Tor Browser ARM64 JSON from SourceForge. An environment variable tbb_version_parse_as_arm64 must be set to y to attempt to parse this JSON format. ** Code changes to tb-updater: https://github.com/ArrayBolt3/tb-updater/tree/arraybolt3/json-parse-hardening ** Code changes to developer-meta-files: https://github.com/ArrayBolt3/developer-meta-files/tree/arraybolt3/json-parse-hardening ** This is ready for review, a full test plan was developed, executed, and passed. == archive.today link archiving == * mediawiki-shell already has code for downloading all wiki pages to the disk in mediawiki markup format, as well as parsing all local wiki text pages for links tool: ** mw-specific-backup-kicksecure ** mw-specific-backup-whonix ** git_mediawiki_backup_folder variable: todo
   TMPFOLDER=/tmp/mediawiki-shell-temp \
   wiki_backup_folder="$git_mediawiki_backup_folder" \
   wiki_namespace_list_extra="274 500" \
   "$tool"
* (FYI: this is used server-side to keep updating https://github.com/Kicksecure/kicksecure-wiki-backup / https://github.com/Whonix/whonix-wiki-backup) * todo: implement and execute archival of all links using archive.today CLI, create a list of links and archived links (extendible format original-link, archive.today, archivebox, ...) * todo: mass edit the wiki to add the archived links. ** Should we use a wiki template such as [[Template:Archive_link]]? *** This might require a custom plugin, but I believe it should work. Archive.today works with links such as https://archive.today/https://google.com - clicking a link such as this will take you to a search page showing all of the archived copies archive.today has of that particular link so far. The user is then free to choose which version to look at *** Custom mediawiki extension already existing: https://github.com/Kicksecure/mediawiki-link-to-archive **** Moved to separate task. **** It's already adding the web archive links. **** Could be extended to add the archive.today links. ** Or only append the archive.today link behind the link? *** Requires lots of manual work. The code I had that was rendering a fairly nice-looking archive "button" was something along the lines of [https://www.freedos.org/books/cprogramming/part5/ C Programming for DOS tutorial, part 5] [[Image:Archive-today-favicon.png|frameless|16px|link=https://archive.ph/https://archive.ph/https://www.freedos.org/books/cprogramming/part5/|text-top|Link to archive.today version]]. Using a plugin to automate that would be very valuable. Additionally, by doing this, we don't have to automatically archive every link someone adds (which CAPTCHAs make nearly impossible). People can simply archive the links as they add them, and people who find an unarchived link can archive it right then and there. ** To be kept in mind: if archive.today goes down one day, we might need to mass wiki edit to remove these links. *** Use of a plugin like what we're using for the archive.org links should hopefully make that easy. Plan #2: * Current implementation plan for archiving: ** 1. Download all wiki pages from Kicksecure and Whonix wikis ** 2. Get all links from them ** 3. For each link, check if already in log file. If found, skip. If not continue. ** 4. search the link on archive.today *** If found: **** ok, skip *** If not found: **** Archive it ** When a CAPTCHA page is hit, stop and wait for the user to provide a new CAPTCHA cookie ** Needs a hardcoded list of excluded domain names. Some domains unfortunately can not be archived. Either failing or only unusable archived results. For example, archive.ph probably cannot archive web archive links. update #2: * no need to automatically re-archive links, can actually worsen the quality * Tentatively finished archiver tool here: https://github.com/ArrayBolt3/mediawiki-shell/tree/arraybolt3/wiki-link-archiver Currently running this, it seems to be working well. == kloak - add Qubes support == * review to understand the history: ** https://github.com/QubesOS/qubes-issues/issues/1850 * [https://github.com/QubesOS/qubes-issues/issues/8534 enable qvm-service gui-agent-virtual-input-device for Whonix-Workstation App Qubes by default] ** https://github.com/QubesOS/qubes-gui-agent-linux/pull/194 ** https://github.com/QubesOS/qubes-app-linux-input-proxy/pull/30 * notify https://github.com/vmonaco/kloak/issues/74 Aaron: * Final implementation needs orchestration, asked for advice from Qubes OS devs at https://github.com/QubesOS/qubes-issues/issues/1850#issuecomment-2374908358 * May also implement as part of GUI daemon, see https://github.com/QubesOS/qubes-issues/issues/8541#issuecomment-2377325699 * Ultimately we ended up using the GUI daemon approach. == kloak - Qubes support - consider using Qubes API for orchestration == * https://github.com/QubesOS/qubes-issues/issues/1850#issuecomment-2374908358 * Waiting on response from Qubes OS devs * Didn't end up doing this, kloak-like functionality has been merged into qubes-gui-daemon. == document boot-repair == * Add to [[Broken Boot]] * Decided against doing this. Boot-Repair has several features that upload system info and usage statistics to the Internet, some of which are potentially dangerous. The tool is useful when used properly, but it's too easy for someone to accidentally upload something they didn't want to upload. == mediawiki-shell self-introduction == * Please look around in mediawiki-shell source code folder to get an idea about all its already existing functionality. This will be handy for follow-up tasks below. * Done, got a good idea of the way it works and what features were needed for implementing the archiver. == add py-archive-today to helper-scripts == * please add py-archive-today to helper-scripts as archive.today * Done, https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/archive-today == automation of tb-updater hardcoded version number update - #2 == * please integrate with tb-updater ** has code to perform securely download tbb version number using upstream provided version file ** has code to parse tbb version number ** performs sanity testing ** there should only be 1 code path for download/parsing of tbb version in 1 repository ** Done, modified branch is at https://github.com/ArrayBolt3/developer-meta-files/tree/arraybolt3/tbb-version-detection-v2 == add archive.ph support to mediawiki-link-to-archive mediawiki extension == * Custom mediawiki extension already existing: https://github.com/Kicksecure/mediawiki-link-to-archive * It's already adding the web archive links. * Please add archive.ph links. * Based on archive.ph supporting https://archive.today/https://google.com format. * No testing required. (Because setting up a mediawiki test environment can be quite involved.) * Branch with archive.today support here: https://github.com/ArrayBolt3/mediawiki-link-to-archive/tree/arraybolt3/archive-today ** Untested, however I did lint the code using php -l. ** See TODOs in code, this will not be usable as-is since an image needs added to the server and a CSS class may need to change. ** The intended result of the code is that an archive.today link icon will be added to every normal link, immediately after the archive.org icon. Onion links and archive.org links should ''not'' have an archive.today link icon added after them, whereas links to archive.today should have ''only'' an archive.today link icon added after them (with similar behavior to the existing link buttons for archive.org links and onion links). == implement archive.today CLI frontend == * Use https://github.com/wabarc/archive.is/blob/main/cmd/archive.is/is.go as general guidelines * Use as few dependencies as possible ** Currently using only the Python standard library and Requests. ** Implementation finished, temporary repo deleted, this is now at https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/archive-today == automation of tb-updater hardcoded version number update == * example of what is currently done manually: ** https://github.com/Kicksecure/tb-updater/commit/f1f48f57021502b7c0d17b7ce50929860e72244f ** https://github.com/Kicksecure/tb-updater/commit/9d790396a7439ceb6b8c494c790be6f80a304430 ** notify forums https://forums.whonix.org/t/tor-browser-integration/11912/118 * post in forums can probably one day be avoided when there is packages.kicksecure.com which makes version numbers, changelogs more easily accessible including a "news blog" of recent changes * On the surface, making this fully automated would likely require making commits to code in an automated fashion. This is a bit worrying to me since it requires a machine to have access to a non-password-protected, trusted GPG key that is used to automatically sign commits. This would potentially be a valuable target for an attacker, and could potentially introduce supply-chain attacks. Would it be sufficient to make this able to alert a sufficiently trusted person that it's time to update the version numbers? This could be combined with a tool that will update the version number to whatever is appropriate with a single command, allowing an administrator to simply run the command, verify the diff is correct, then commit and push. * From chat with Patrick: "so in /usr/bin/dm-packaging-helper-script there could be a functional which shows the "git diff" before auto-committing, because then I can still stop it, should it look weird" * Implemented. https://github.com/ArrayBolt3/developer-meta-files/tree/arraybolt3/tor-browser-version-update == live-build - build broken - kicksecure repository apt-cacher-ng configuration == * This is the result of apt-cacher-ng HTTPS tunneling not being enabled on the CI server. Our sources.list files from repository-dist and anon-apt-sources-list are causing the problem. * There is no practical, upstreamable way to only insert the sources.list files into the system after all apt commands have run. At best, it might be possible to insert our sources.list files immediately after sqaushfs-tools is installed but immediately before the squashfs is generated, then immediately delete them as soon as the squashfs was done being generated (as further apt commands are run after this point). This would be extremely hacky and would mandate that we keep our own live-build fork indefinitely, as such a change could not be practically upstreamed. * Enabling apt-cacher-ng HTTPS tunneling is undesirable, as it could result in the wrong packages being used in the ISO build. * One option might be to simply not install the sources.list files on the ISO at all, but rather have a script in the live session generate them, and have Calamares and debian-installer create them when appropriate. This goes against the design we want, but at this point it may be the only good solution. * The solution we ended up using was to modify repository-dist to generate the derivative.list file when a particular systemd unit runs, then enable that system unit only when the --repo true option is set in derivative-maker. Options to repository-dist are passed via a file at /var/lib/repository-dist/derivative_apt_repository_opts, which is written at build time by the build system and then loaded at runtime by the systemd unit. * Current fix branches: ** derivative-maker: https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/apt-fix ** repository-dist: https://github.com/ArrayBolt3/repository-dist/tree/arraybolt3/deb-fix == live-build - build failing due to fasttrack not using apt-cacher-ng syntax == * https://github.com/Whonix/derivative-maker/actions/runs/11794583611 * Fixed, also fixed a related bug with the kicksecure.com URL. Fix is present at https://github.com/arrayBolt3/derivative-maker == test and review archive.today CLI frontend == * archive.today is interesting because it is an independent third-part * candidate: wabarc/archive.is (supports CAPTCHA avoidance through cookie) * https://github.com/wabarc/archive.is?tab=readme-ov-file#archivetoday-is-unavailable ** test for functionality first in a throwaway VM *** Builds with Go 1.22 from bookworm-backports (sudo apt install -t bookworm-backports golang), to build you must go into the cmd/archive.is directory first, then go build ** test functionality and CAPTCHA avoidance *** Searching appears to work without a CAPTCHA avoidance cookie, archiving requires the cookie. *** Takes about a minute or two for a small page to be archived, then an additional five to ten minutes before that URL will show up when searched for using ./archive.is -p https://url in searches. *** Tor is supported, but it's unclear how to make that support work, and research was inconclusive, filed a feature request to fix this at https://github.com/wabarc/archive.is/issues/58 ** test archive.today onion (might help with CAPTCHA avoidance), will help with IP restrictions *** http://archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion *** TODO, need to figure out how to properly trigger the use of Tor first. ** review for malicious content *** Reviewed main package code, no malicious content found. Code looked mostly straightforward, though it made use of some advanced Go techniques. The code does however have a number of dependencies, at least three of which are written by this tool's author and one of which is relatively obscure judging from the Github star count, so I want to review those too (and potentially their sub-dependencies as well). ** create a github fork from reviewed version (just pressing fork button, no other changes, unless required) *** No fork created yet as I'm not yet ready to declare this safe, however the commit I have and am reviewing is f6bc92ea8a399df64d4772de73ecf695e48ac16b * After initial investigation, we believe it will be safer and better to implement our own CLI frontend for this, using the Go code from wabarc's tool as inspiration. == investigate doas == * determine if it's a suitable replacement for sudo in Kicksecure ** will using it resolve https://github.com/sudo-project/sudo/issues/415? It has to allow nopasswd exceptions to be distinguished from normal authentication in PAM *** Yes, it will. I tested running a nopass command with doas and it did NOT reset the faillock counter. I checked the doas source code, and it looks like this is because doas nopass exceptions don't go through PAM at all (though I didn't thoroughly check the code so I'm not entirely sure of this). * estimate work required to port to it * Research and time estimate recorded at https://forums.whonix.org/t/replace-sudo-with-doas/17482/18. == refactor dm-unicode-check == * https://github.com/Kicksecure/developer-meta-files/blob/master/usr/bin/dm-check-unicode#L47 * 1 line per entry for white list * Done, branch is at https://github.com/ArrayBolt3/developer-meta-files/tree/arraybolt3/dm-check-unicode-enhance == check live-build_installation function in derivative-maker == * todo * Spot-checked, looked fine to me. Comment about improper live-build installation due to dependency packages mentioned to Patrick. == build raw VM images - base images - consider porting from grml-debootstrap to live-build == * Building fully persistent images? Replacing grml-debootstrap?
--system normal
--binary-image hdd
* Useful? Low priority? arraybolt3: this would potentially be very useful, will investigate. * Looks like this is potentially useful, but definitely needs a lot of help to make useful. To get a useful build, it was necessary to use the following configuration in auto/config:
#!/bin/sh

set -e

lb config noauto \
   --distribution bookworm \
   --system normal \
   --binary-image hdd \
   --hdd-size auto \
   --chroot-filesystem none \
   --binary-filesystem ext4 \
   "${@}"
* The generated image contained no user account, no root password, and no properly configured fstab, thus it was necessary to mount the built image, chroot into it, configure fstab, add a user, and add the new user to the sudoers group. * The generated image also used Syslinux as the default bootloader, which is obviously strange for a desktop system. Furthermore, the kernel command line was not configured properly, and it was necessary to manually add root=/dev/vda1 to the command line to get the system to boot. Probably should have set --bootloaders grub-pc,grub-efi. Unsure if --bootappend-live will work for setting the kernel command line, this may have to be fixed as a post-build operation (chrooting in and running sudo update-grub or similar). * Was able to make a basic, mostly-working (aside from the bootloader issues) image with IceWM as the desktop. * Patrick, paraphrased Aaron: While it might be doable to create fully persistent (VM) raw images using live-build, porting from grml-debootstrap to live-build is probably not worth it. == refactor dm-packaging-helper-script == * Enhance readability and maintainability, document all functions and features * Current iteration of refactor: https://github.com/ArrayBolt3/developer-meta-files/blob/arraybolt3/dm-packaging-helper-script-refactor/usr/bin/dm-packaging-helper-script * Ready for final review. I did NOT change from using tee to using sponge because of the performance implications it would have (appending to a file with sponge will rewrite the entire file). old (ok):
* kicksecure-meta-packages:
  * Add xdg-desktop-portal(-gtk) (Thanks to Aaron Rainbolt!).
  * No longer install `alsa-utils` by default https://forums.whonix.org/t/port-from-pulseaudio-to-pipewire-for-audio-support/16879/45.
  * Add `accountservice` to `kicksecure-desktop-environment-essential-xfce`, which fixes error message:
    * > localhost lightdm[911]: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files package `lightdm` `Suggests:` `accountservice`.
  * Allow installation of `pipewire-media-session-pulseaudio` as an alternative to `wireplumber`.
...
new (bug):
* kicksecure-meta-packages:
  * Fix ISO build failure (missing 's' in accountsservice) (Thanks to @ArrayBolt3!)
* kicksecure-meta-packages:
  * Add xdg-desktop-portal(-gtk) (Thanks to @ArrayBolt3!)
* kicksecure-meta-packages:
  * no longer install `alsa-utils` by default https://forums.whonix.org/t/port-from-pulseaudio-to-pipewire-for-audio-support/16879/45
* kicksecure-meta-packages:
  * add `accountservice` to `kicksecure-desktop-environment-essential-xfce` fixes > localhost lightdm[911]: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files package `lightdm` `Suggests:` `accountservice`
* kicksecure-meta-packages:
* Bug fixed, forgot to set package_header_written='y' after writing the package header in pkg_git_packages_git_log_writer. == audit grub profile pf2 files == * Files from upstream deleted, replaced with a Makefile that generates pf2 fonts from the Inter and Terminus fonts in the Debian archives at package build time. Also split out common GRUB theme code into dist-base-files. * Repos modified: ** dist-base-files: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/grub-theme ** kicksecure-base-files: https://github.com/ArrayBolt3/kicksecure-base-files/tree/arraybolt3/grub-theme-fix ** anon-gw-base-files: https://github.com/ArrayBolt3/anon-gw-base-files/tree/arraybolt3/grub-theme-fix ** anon-ws-base-files: https://github.com/ArrayBolt3/anon-ws-base-files/tree/arraybolt3/grub-theme-fix == live-build - build failing == * either live-build lb-dracut branch is not fully merged or forked live-build isn't installed by derivative-maker * forked live-build wasn't being installed previously. Code for automatic installation written and tested, present at https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/lb-autoinstall == archive.today CLI == * since archive.org might go offline permanently, a quick replacement is required * archive.today alternative domain names: archive.is, archive.ph (for search terms) * todo: find a functional archive.today CLI tool * todo: fork it, check if the code is static (does not load tons of other libraries) and is non-malicious * arraybolt3: archive.today officially does not support automated archival of pages, see https://blog.archive.today/post/678411898279067648/hello-i-am-developing-an-application-that. They use CAPTCHAs to prevent automated tools from working, so it is unlikely such a tool exists, and even if it did, its use would potentially harm archive.today, and the tool would not function properly in the long run. == continuous documentation effort - FYI only == * Patrick liked the new super grub disk additions to [[Broken Boot]]. If something else comes to mind, please continue improving the wiki. == live build cdlabel change == * CDLABEL=Kicksecure_17 * --iso-volume 'Kicksecure 17' \\ * better set to just Kicksecure so the version number upgrade isn't needed and not forgotten in the future? * set to Kicksecure already by Patrick * arraybolt3: Fine with me, archiving. == local editor settings - delete trailing spaces == * please kindly configure your local editor to deleted trailing spaces upon saving files * Done. == live-build - investigate options == * because it contains options and todo * (originally from build-steps.d/1350_create-iso-config) * not all comments might be needed. some of my comments might be superfluous / obvious. old:
   ## folder derivative-maker/live-build can be re-created using:
   ## 2. help-steps/live-config
   
   ## Should not be done at live-build level if avoidable? Better done in package live-config-dist as /etc/default/grub.d drop-in
   #--bootappend-live PARAMETER|"PARAMETERS"
   # arraybolt3: Cannot be done via a package as the bootloader config for the ISO is set directly by live-build. Instead, source grub.d scripts from security-misc at build time and use variables from there to set the bootappend value.
   # Patrick: Not only security-misc is setting grub configuration. Also other packages do or might in the future. Therefore all of /packages/ folder needs parsing.
   # arraybolt3: We now use grub-mkconfig and config file parsing to automatically detect the proper GRUB kernel parameters.

   ## TODO: cleaner to not have these? better for reproducible builds?
   #--apt-indices false
   # arraybolt3: Added.

## Kicksecure enabled backports by default so live-build does not need to
## (kicksecure ships /etc/apt/sources.list.d/debian.list static file in package anon-apt-sources-list)
   #--backports true|false
   # arraybolt3: Left unset, seems to work.


## Probably not needed.
   #--checksums md5|sha1|sha224|sha256|sha384|sha512|none
   # arraybolt3: left unset
   #--debian-installer cdrom|netinst|netboot|businesscard|live|none
   # arraybolt3: This MUST be set to "--debian-installer=live" (different values other than "none" may also work?). Not doing so results in the on-CD apt repo that contains bootloader packages not being created, and alternate ways of making that repo ended up erroring out in my experiments.

   ## Kicksecure enables fasttrack repository by default. If build works, probably not needed.
   #--keyring-packages PACKAGE|"PACKAGES"
   # arraybolt3: left unset, but perhaps it should be set to include the fasttrack repository key. Currently I'm using "--debootstrap-options" to include it.

   #--cache-stages "bootstrap rootfs"
   # arraybolt3: left unset. This automatically "just works".

## For cross-build support.
   # --architecture "$dist_build_target_arch"
   # arraybolt3: Note that for cross builds to work, this must be paired with "--bootstrap-qemu-arch" if building for a foreign architecture like arm64. Needs testing.

   # --distribution "$dist_build_apt_stable_release"
   # arraybolt3: set.

## TODO: should we keep as is (Debian default) for better compatibility or set to
##       $SHORT_VMNAME / $VMNAME (already defined in help-steps/variables) to avoid conflicts with Debian (dual-boot)?
   # --hdd-label LABEL
   # --image-name NAME
   # --iso-application NAME
   # --iso-publisher NAME
   # --iso-volume NAME
   # arraybolt3: all are now set

## Not applicable?
   # --hdd-size SIZE
   # arraybolt3: for ISO build, not applicable

## TODO: source not needed
   # --source
   # arraybolt3: left unset, defaults to false.

## yes. not bothering/mixing any other bootloaders such as isolinux (except shim, which live-build handles automatically)
   # --bootloaders grub-efi
   # arraybolt3: left unset, live-build figures this out automatically and generates an ISO that is both BIOS-bootable and UEFI-bootable with GRUB by default.

## already existing variable
  # --linux-packages "$BUILD_KERNEL_PKGS"
  # arraybolt3: set.

## already existing variable
## usability feature
## we want kernel headers installed by default (required for tirdad compilation (has a dependency); virtualbox guest utils (lacks dependency))
## probably
   # --linux-packages "$BUILD_HEADER_PKGS"
   # arraybolt3: set.

## We can probably set this because we cache using ${REPO_PROXY}? Double caching not useful?
## This option might have side effects.
   # --cache-packages false
   # arraybolt3: set `--cache false`.

   ## TODO: Does this work? Is our apt-cache-ng (already existing variable ${REPO_PROXY}) functional?
   # --apt-ftp-proxy "${REPO_PROXY}"
   # --apt-http-proxy "${REPO_PROXY}"
   # arraybolt3: set, but unsure if it actually works yet

## important. using apt with --no-install-recommends
## but not setting and apt config file for the user
      # --apt-recommends false \
      # arraybolt3: already set.

## if using debootstrap
## important because we pull packages using packaging not using $debootstrap or live-build
      # --debootstrap-options "--variant=minbase" \
      # arraybolt3: set.

## if using mmdebstrap
## '--variant=required' is only supported by 'mmdebstrap'. It might not be supported by 'debootstrap'.
      # --debootstrap-options "--variant=required" \
      # arraybolt3: "required" and "minbase" appear to be treated identically by mmdebstrap, therefore not setting this.

## same as above
   # --firmware-binary false
   # --firmware-chroot false
   # arraybolt3: already set.

## Seems correct.
      # --binary-image iso-hybrid \
      # arraybolt3: set.


   lb config \
      --distribution "$dist_build_apt_stable_release" \
      --mirror-binary "$dist_build_apt_sources_mirror" \
      --mirror-binary-security "$dist_build_apt_sources_security_mirror" \
      --mirror-bootstrap "$dist_build_apt_sources_mirror" \
      --mirror-chroot "$dist_build_apt_sources_mirror" \
      --mirror-chroot-security "$dist_build_apt_sources_security_mirror" \
      --mirror-debian-installer "$dist_build_apt_sources_mirror" \
      --parent-mirror-binary "$dist_build_apt_sources_mirror" \
      --parent-mirror-binary-security "$dist_build_apt_sources_security_mirror" \
      --parent-mirror-bootstrap "$dist_build_apt_sources_mirror" \
      --parent-mirror-chroot "$dist_build_apt_sources_mirror" \
      --parent-mirror-chroot-security "$dist_build_apt_sources_security_mirror" \
      --parent-mirror-debian-installer "$dist_build_apt_sources_mirror" \
      --archive-areas "main contrib non-free non-free-firmware" \
      # arraybolt3: set.
## use $dist_build_apt_stable_release instead of hardcoded "bookworm"
    --distribution "bookworm"
    # arraybolt3: no longer hardcoded.

## probably needed? same as Kicksecue default APT sources archive areas
## should we get this by parsing? in buildconfig.d/25_apt_sources.conf
    --archive-areas "main contrib non-free non-free-firmware" \
    # arraybolt3: set. Getting from 25_apt_sources.conf is not ideal because it does not have a simple variable that can be used for this purpose. 

## sources not needed
    --apt-source-archives false \
    # arraybolt3: set.
    --source false \
    # arraybolt3: defaults to false, does not need set.

## zsync not used
    --zsync false \
    # arraybolt3: set.

## useful? irrelevant?
    # --chroot-filesystem ext4 \
    # --binary-filesystem ext4 \
    # arraybolt3: both seem irrelevant.

## useful to see what is going on. why not.
    # --verbose \
    # --debug
    # arraybolt3: set.

## sanity testing and nice to compare logs
lb config --dump
lb config --validate
# arraybolt3: integrated.

## better verbose than not knowing what is going on
lb build --verbose --debug
# arraybolt3: integrated.
* Reviewed and integrated. == ISO - port to live-build == * check derivative-maker source code git history: previously there was a port to live-build. Useful to resurrect it? [DONE] * port to live-build * make use of Debian's dracut branch for live-build [DONE] * add live-build git submodule to derivative-maker (as long all our changes aren't upstreamed) * Ensure --remote-derivative-packages still works [DONE] * Test building Kicksecure on top of Kicksecure [DONE] * live-config-dist fork needed for installer to work with live-build ISO: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/live-build * dist-base-files fork needed for proper user account generation: https://github.com/ArrayBolt3/dist-base-files/tree/arraybolt3/live-build * anon-apt-sources-list fork needed to avoid a naming conflict with live-build: https://github.com/ArrayBolt3/anon-apt-sources-list/tree/arraybolt3/live-build * live-build fork: https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads ** All changes submitted upstream, TODO work with upstream to get these polished and merged * derivative-maker fork with live-build support: https://github.com/ArrayBolt3/derivative-maker/tree/arraybolt3/live-build * PR: https://github.com/Kicksecure/derivative-maker/pull/2 == Whonix grub-theme == * similar to above * add to https://github.com/Whonix/whonix-base-files ** Branch at https://github.com/ArrayBolt3/whonix-base-files/tree/arraybolt3/grub-theme, moved 30_whonix.cfg to 25_whonix.cfg and used rm_conffile to remove the old version * possible make a slightly different theme for [https://www.whonix.org/wiki/Whonix-Host Whonix-Host], [https://www.whonix.org/wiki/Whonix-Gateway Whonix-Gateway] and [https://www.whonix.org/wiki/Whonix-Workstation Whonix-Workstation]? ** https://github.com/Whonix/anon-gw-base-files *** Branch containing theme at: https://github.com/ArrayBolt3/anon-gw-base-files/tree/arraybolt3/grub-theme ** https://github.com/Whonix/anon-ws-base-files *** Branch containing theme at: https://github.com/ArrayBolt3/anon-ws-base-files/tree/arraybolt3/grub-theme ** Whonix-Host not yet dealt with, can add a specific GRUB theme for it when desired. == Kicksecure grub-theme == * maybe https://github.com/AdisonCavani/distro-grub-themes can be helpful? * add to https://github.com/Kicksecure/kicksecure-base-files * With the way Debian is designed, the proper way to do this (as far as I can tell) is to pull in the desktop-base package, then use the alternatives system to override the Debian artwork with vendor-specific artwork. However there is a LOT more artwork than just GRUB themes that has to be overridden here. Currently working on this, I think the best package to do this in would be desktop-config-dist although I'm not certain. * Possible issues with current implementation: ** Potential aspect ratio weirdness, we may or may not care. Debian uses 4x3 aspect ratio for BIOS and 16x9 aspect ratio for UEFI, I've followed that convention here. * investigate if dh_link can used to create symlinks ** arraybolt3: dh_link is part of debhelper, which is a tool intended for use only at package build time. It is not intended to be used at maintainer script run time to my awareness, and using it in this context would require pulling in debhelper as a dependency, which would be weird because debhelper is a developer tool, not an end-user tool. Thus I don't think we should do this. ln works fine here and makes sure that the proper GRUB screen sizes are used. * Implemented at: https://github.com/ArrayBolt3/kicksecure-base-files/tree/arraybolt3/grub-theme == dummy-dependency improvements == * use Provides: * please merged my changes / work on top of Patrick changes (Kicksecure/helper-scripts) * Latest update: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/dummy-dep-generator == upgrade-nonroot comment == * please see https://forums.whonix.org/t/qubes-sudo-su-root-hardening-development-discussion/8561/43 and add comments, if any * Added comment at https://forums.whonix.org/t/qubes-sudo-su-root-hardening-development-discussion/8561/45 == zswap commment == * please comment on https://forums.kicksecure.com/t/enable-and-use-zram-instead-for-swap/654/1 * Commented at https://forums.kicksecure.com/t/enable-and-use-zram-instead-for-swap/654/2, probably prefer zswap solution over zram * update 1: https://forums.kicksecure.com/t/enable-and-use-zram-instead-for-swap/654/7 * Replied at https://forums.kicksecure.com/t/enable-and-use-zram-instead-for-swap/654/8, I meant to reply to this before and then forgot == minimize grub themes == * please remove all files that are only required for pretty multiboot (without breaking actual multiboot) * Done, same repositories and branches are still in use. == document grub.cfg extraction methods or chainloading == * Worthy of note, the Linux boot entries are only populated if the disk is unencrypted. Encrypted systems require the use of one of the grub.cfg extraction entries, or (in the case of BIOS systems) chainloading. Additionally, it would be recommended to always use the grub.cfg extraction methods or chainloading, as the use of a "normal" Linux boot entry works but does not enable any kernel hardening features. * please add to wiki ([[grub]]?) * Documented under [[Broken Boot]], along with detailed instructions on installing and using Super Grub2 Disk. == dummy-dependency package generator == * helper-script (or usability-misc?) to use equivs (or similar small dependency) to generate a dummy-dependency * dummy-dependency script written, branch is at https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/dummy-dep-generator == review and refactor meta packages == * https://github.com/Kicksecure/kicksecure-meta-packages * https://github.com/Whonix/whonix-meta-packages ** Review, suggestions for refactoring: https://gist.github.com/ArrayBolt3/1312aa401d0b7ade970210b3f526f9e8 * please review, discuss ** Forum post at https://forums.kicksecure.com/t/metapackages-tweak-suggestions/663 to get feedback on suggested changes * purpose of this task is to address and (maybe required) refactoring, bug fixes in preparation for the future, maintainability, next task below Update 1: * please proceed with the "small" tasks that can be done safely during Debian bookworm based releases * create a ticket for Debian trixie port * Update for Kicksecure metapackages: https://github.com/ArrayBolt3/kicksecure-meta-packages/tree/arraybolt3/relocate-packages * Update for Whonix metapackages: https://github.com/ArrayBolt3/anon-meta-packages/tree/arraybolt3/relocate-packages == kloak readme fix == * https://github.com/Whonix/kloak/issues/4 * Fixed in https://github.com/ArrayBolt3/kloak/commit/9c57eba2e77082f1967ec54a0a42226843df7f17 == live-build - source code integration into derivative maker == * assume at in derivative-maker/live-build * Done by Patrick. == live-build - use live-build to create grub.cfg GRUB configuration == * Possible? * Not possible due to live-build's design, we apply a lot of customisations here that probably should not be upstreamed. == live-build - remove unicode == * please remove unicode if possible from live-build/share/bootloaders/splash.svg * Fixed, pushed to my fork of live-build. Looks like there were two non-breaking spaces causing issues. This probably cannot be upstreamed as one assumes these were made non-breaking for a reason, and while we may not care about that reason, they probably do. == review Super Grub2 Disk == * see https://github.com/supergrub/supergrub/tree/master/menus/sgd * any cool/needed features there which would be useful to add to the ISO or non-ISO boot process? * Don't see much extra that is needed there if it works reliably. The tool appears very capable, I was able to use it to boot an installed Kicksecure system in several different ways. Also was able to loopback boot ISOs. If a user runs into a problem trying to use it for boot recovery, then we should add a task to fix the issue to this list. == confidential computing == * Please read tickets from private issue tracker and update [[Dev/confidential computing]] with new contents based on that. * Read, added notes on tamper protection and generation of one's own Secure Boot keys. == append-once bug == livecheck:
      append-once "${save_file}" "${click}"
      append-once "${save_file}" "${click}"
Does not work. Only the first "click" gets appended. "txtclick" is missing. This is a bug in append-once. (Patrick applied a workaround in livecheck for now.) Please fix append-once, if possible. * arraybolt3: Fixed by making a variant of the str_replace script called str_match and using it in lieu of grep. Also caught a bug with livecheck in general due to running lsblk too early. ** helper-scripts change branch: https://github.com/ArrayBolt3/helper-scripts/tree/arraybolt3/append-once-fix ** desktop-config-dist change branch: https://github.com/ArrayBolt3/desktop-config-dist/tree/arraybolt3/livecheck-fix2 == live-build - fork of live-build == * please create fully merged live-build repository on github so Patrick can fork it and add the git submodule to derivative-maker * Fork publicized at https://salsa.debian.org/ArrayBolt3/live-build/-/tree/arraybolt3/lb-dracut?ref_type=heads * Synced with upstream as of 2024-10-25, includes the merge of Dracut support to master. == live-build - use derivative-maker variable APT_OPTIONS == * for reference, see derivative-maker help-steps/variables APTGETOPT, APTGETOPT_ALT, APTGETOPT_WITHOUT_APT_CACHE * set live-build APT_OPTIONS to APTGETOPT * these include --error-on=any and more * Added. == live-build - avoid live-build specific boot splash == * https://github.com/ArrayBolt3/derivative-maker/blob/arraybolt3/live-build/live-build-data/splash.svg * Avoidable? Can be done in /packages/ instead please? ** Difficult to avoid, the splash screen is dynamically modified by live-build at build time, and is sourced from live-build's configuration directory at build time (live-build does not use packages installed under the chroot to find this). The entirety of the bootloader configuration is done without use of packages installed in the built system as I understand it. * there are later tasks for GRUB boot menu styling ** This has to be dealt with now because otherwise we risk causing confusion to end-users. The default GRUB splash on live-build ISOs uses a strange construction hat logo, and states that the ISO is specifically Debian. Not changing this screen could even be legally problematic as the name "Debian" is a trademark. (https://www.debian.org/trademark) This GRUB screen is also specific to live-build and should not be used for installed systems. Debian uses separate GRUB screens for installed systems and live-build ISOs. * live-config-dist uses to add "Live ISO" to grub boot menu in https://github.com/Kicksecure/live-config-dist/blob/master/etc/default/grub.d/40_live-config-dist.cfg - possible to do the same with live-build? ** This file should probably be deleted once live-build becomes the default ISO build mechanism. * Figure out what unicode is in the splash screen SVG and remove it if at all possible ** Fixed, it was a non-breaking space. == report TCP ISN specification issue == * TCP ISN is an issue in the spec * Could you please report this upstream in to the spec, if possible? * Reported. == live-check - run once only == * to avoid log spam (passwordless root) * create a done file in folder /run/user/$USER so the livecheck script does not run sudo over and over again * https://github.com/ArrayBolt3/desktop-config-dist/tree/arraybolt3/livecheck-fix Tested and ready for review/merge. == review kloak RPM specfile == * https://github.com/Whonix/kloak/pull/2 * please review for non-maliciousness only * Reviewed, all contents appear normal, useful, and non-malicious. However, the systemd unit for kloak is not enabled by default due to the lack of a systemd preset file. This may be something we want to resolve later. == desktop-config-dist - livecheck - rd.live.image == * FYI: this is now fixed in git. no more patch for live-build required. livecheck should now work out of the box (no matter if old or new live-build kernel parameters) * FYI only. Ticket can be archived. * arraybolt3: I haven't archived this yet since it doesn't seem to actually be working in my ISO builds and I'm not sure why. * Patrick: Fixed yet again. * arraybolt3: Looks good now. == automate VirtualBox version update in the wiki == * example what is being done manually: https://www.kicksecure.com/w/index.php?title=Template%3AVirtualBox_Host_Software_Installation&diff=87404&oldid=86914 * suggestions on how to automate this? using mediawiki-shell * automation of the script that does the change? * automation to auto run that script? * add to developer-meta-files * Prototype code: https://github.com/ArrayBolt3/auto-version-update * Final code, ready for review: https://github.com/ArrayBolt3/developer-meta-files/commit/d053175dd27beb6eee8ad853a35efb57928e4f04 == calamares - change to BTRFS by default - including subvolumes == * change to BTRFS by default * make use of subvolumes * https://forums.kicksecure.com/t/use-btrfs-as-the-default-journaling-file-system/626 * Added btrfs-progs to kicksecure-recommended-cli: https://github.com/ArrayBolt3/kicksecure-meta-packages/tree/arraybolt3/btrfs-support (necessary to avoid installation failures) * Added BTRFS support to live-config-dist: https://github.com/ArrayBolt3/live-config-dist/tree/arraybolt3/btrfs-support * Note that Calamares installs BTRFS with subvolumes on the root filesystem by default, so no special work was needed to make that happen. == live-build - path may be being set in a non-ideal fashion == * $source_code_folder_dist/live-build for the git sub module (our fork) (pristine source code) * $dist_binary_build_folder/live-build should be used for the "config" folder (which will contain binaries after running live-build) (can be safely deleted and re-created using derivative-maker) ** arraybolt3: currently using $dist_binary_build_folder/kicksecure-live-build for this, change to use live-build name instead ** Done. == live-build - boot-time scripts handling == * boot-time scripts aren't marked as executable * the boot-time scripts are an implementation detail of the live-build config (used to set the default shell to ZSH and change the username from "Debian live user" to "Kicksecure live user") * should be done by to /packages/ ** arraybolt3: This cannot be done by /packages/ because these scripts are installed by live-build and are not vendored as a package. This is the recommended way of doing things in live-build, see https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-contents.en.html#customizing-contents section "9.2.3 Boot-time hooks" ** Patrick: *** Where is the source code for these scripts? **** arraybolt3: Integrated in derivative-maker/build-steps.d/2800_create-lb-iso. *** Can we avoid using some of these scripts? Is this a missing live-build feature? If it is what I vaguely remember before, these could be disabled with a symlink to /dev/null inside the configuration folder. **** arraybolt3: The scripts are custom-written for the ISO, and have two purposes - one of them renames "Debian live user" to "Kicksecure live user", the other one changes the default shell in the ISO live environment from bash to zsh. *** Switching default shell from bash to zsh is already implemented in dist-base-files debian/dist-base-files.postinst. It also supports configuration, simplifies customized builds / forks. Doing this in dist-base-files as well as on the live-build level, adds extra complexity, which should be avoided. **** arraybolt3: Doing this in a package requires shipping files under /lib/live/config. This is because the live session user on the ISO is actually created ''at ISO boot time'', not at build time. As a result the user's default shell and most of the user configuration is controlled by live-build boot-time hooks, which are located in /lib/live/config. Technically this is doable, but it diverges from the documented method described in live-build's manual. * All extra boot-time scripts have been made obsolete and are thus removed. == live-build - avoid scripting at calamares level - avoid /etc/calamares/modules/shellprocess_useradd.conf == * Can this be done at /packages/ level instead please? ** Very difficult. live-build ISOs generate the user account on the ISO at boot time, meaning that after an initial Calamares installation, the installed system has no usable user account. Creating one requires either using the Calamares users module (which as previously discussed is undesirable) or requires a hook similar to what is implemented with shellprocess_useradd.conf. * Already implemented in dist-base-files debian/dist-base-files.postinst ** This should not be implemented here. This method of implementation is fundamentally incompatible with live-build, and the only reason it hasn't caused issues is because the logic disables itself when not running under Qubes or derivative-maker, and when live-build is running it obscures the use of derivative-maker from the package. * Better to keep it there due to planned changes. (User "user" will no longer be a member of group "sudo" and a new user "admin" will be introduced.) Otherwise having two places to maintain this would complicate things. ** Can it be moved to live-config-dist and maintained there going forward? * shellprocess_useradd.conf removed, user creation managed by dist-base-files as before. == livecheck - FYI - rd.live.image kernel parameter detection broken== * fixed in git * FYI only * please archive this ticket == live-build - upstream pull requests == * Please check, continue working with upstream. * Updated fork to reflect new changes to master, commented on the localrepo merge request. * All three live-build patches are listed in "WAITING ON", indicating that work on them is ongoing. I will make sure to monitor activity there regularly and respond quickly. * Patrick: This was about:
Merge blocked: 1 check failed
Merge request must be rebased, because a fast-forward merge is not possible.
== pam_faillock ticket == * What runs /etc/pam.d/sudo versus /etc/pam.d/sudo-i? No other file in /etc/pam.d references such a file. ** sudo's source code allows sudo to identify itself to PAM as either sudo or sudo-i depending on how sudo is being used. See https://github.com/sudo-project/sudo/blob/17aa7688c955e58adffdfb0300d485a2b859b128/plugins/sudoers/auth/pam.c#L220. Theoretically it might be possible to patch this location in sudo to make it identify itself to PAM in a special manner when running a NOPASSWD command. ** Bug report filed against sudo: https://github.com/sudo-project/sudo/issues/415 * Useful to add? https://github.com/linux-pam/linux-pam/issues/842
`/etc/pam.d/sudo`

```
#%PAM-1.0

# Set up user limits from /etc/security/limits.conf.
session    required   pam_limits.so

@include common-auth
@include common-account
@include common-session-noninteractive
```

`/etc/pam.d/sudo-i`

```
#%PAM-1.0

# Set up user limits from /etc/security/limits.conf.
session    required   pam_limits.so

@include common-auth
@include common-account
@include common-session
```

----

`/etc/sudoers.d/upgrade-passwordless`

```
%sudo ALL=NOPASSWD: /usr/bin/apt-get-update-plus dist-upgrade
```
* May be useful, but I don't believe it is necessarily useful right now. Would like to wait for now. ** Patrick: Agreed because this bug seems to be a sudo bug instead and was reported against sudo. * Ticket can be archived. == fix broken recovery mode == * Recent Kicksecure ISOs seem to simply hang during boot when booted in recovery mode. Investigate. * Turns out the default kernel in the latest ISO has a broken recovery mode. However, the next kernel update thereafter works without issues. This will therefore resolve itself during regular updates, and the next ISO build should have it fixed. == live-build - keep generated live-build folder out of source code folder == * treat "lb config" as pristine/source code * place live-build folder in ~/derivative_binary folder (use already existing variable binary_build_folder_dist) * reason: live-build mixes config and binaries inside the same folder This is how it was done in the past:
   mkdir --parents "$binary_build_folder_live_build"
   cd "$binary_build_folder_live_build"
* live-build config is autogenerated at build time now. == review root related documentation == * read * improve * https://www.kicksecure.com/wiki/Dev/Strong_Linux_User_Account_Isolation ** Read, added improvements including rewriting the console login attacks section. * https://www.kicksecure.com/wiki/Root ** Read, added improvements including documenting how to run GUI applications as root under Wayland * https://www.kicksecure.com/wiki/Default_Passwords ** Read, didn't see anything that needed added. * https://www.kicksecure.com/wiki/Protection_Against_Physical_Attacks ** Read, fixed a link and clarified some things related to IOMMU. * https://www.kicksecure.com/wiki/Dev/user-sysmaint-split ** Read, didn't see anything that needed added. == faillock == === security-misc - review pam-configs === * please have a look here in security-misc usr/share/pam-configs/ for introduction * Looked at it, seems reasonable and useful * Found documentation for pam-configs at https://wiki.ubuntu.com/PAMConfigFrameworkSpec === security-misc - faillock - stop reset after reboot === * should not be reset after reboot * the faillock status file is configureable already, see man pam_faillock * Requires pam config modifications to make work right, working proof-of-concept config determined and shared in chat. * Fixed in commit https://github.com/ArrayBolt3/security-misc/commit/690e8dd826d1cb39c0c12c03792781862cc2dd23 === security-misc - faillock - stop reset after 24 hours === * should not be reset after 24 hours * no need to automatically reset at all * user should always have a chance to learn about failed login attempts * this can (likely?) be configured in our already existing configuration file in security-misc * Lockout reset is preventable, tally reset cannot be configured out and the largest possible delay between resets that can be set is arbitrarily limited to 7 days. * Fixed as much as possible in commit https://github.com/ArrayBolt3/security-misc/commit/690e8dd826d1cb39c0c12c03792781862cc2dd23 == security review == * as discussed * done, notes shared in chat == live-build - stop installation extraneous packages == * dhcp / networking related packages * whiptail * should not be pulled by live-build * if deemed useful packages, needs to be discussed in forums and and done inside the derivative-maker /packages/ folder through Depends: * Looks like this is solved, cannot find isc-related packages, ifupdown, or whiptail in my latest build. == live-build - dracut related fixes == * please report and/or fix upstream anything dracut related that needs fixing due to new results with live-build * Reported the one main issue I ran into at https://salsa.debian.org/live-team/live-build/-/merge_requests/353#note_537378, verified that other issues I had encountered were no longer a problem. == kloak - add support for /dev/input/mice == * VM has no /dev/input/mouseX * VM has only /dev/input/mice * kloak ignores /dev/input/mice. * (user reported using a Ubuntu 24.4 VM) * kloak only uses /dev/input/eventX devices by design, these are provided by the evdev driver and seem like they should always exist * Could not reproduce issue with QEMU using either Kicksecure or Lubuntu 24.04 - /dev/input/eventX devices for mouse always exist, as do individual /dev/input/mouse devices. Need to know what hypervisor was in use to test further Patrick: * asked user about which VM. waiting for reply. ** probably user error. archiving. == ISO - check git history == * check derivative-maker source code git history as it might have useful options * Found and extracted lb config command. Commit used was from 2023-07-20, and is the latest live-build commit on that day. == desktop-config-dist package version issue == * kicksecure /dists/bookworm-developers/main/binary-amd64/Packages
Package: desktop-config-dist
Version: 3:10.1-1
desktop-config-dist(master)]% git describe              
10.1-1
* todo: investigate ** How did an outdated desktop-config-dist version (older than in git) end up in the test ISO? Did it install packages from local repository? Then this issue should be impossible to happen. Or did it test wise use the remote, stable repository? Then this is not surprising. The stable repository often has older versions. These are for the most part only updated once a new stable release has been released. * note: updated due to below now * The version of the desktop-config-dist package installed on the ISO had contents older than in Git, but the version number was *newer*. This leads me to believe that most likely the machine used to build the ISO had testing code left in derivative-maker/packages/kicksecure/desktop-config-dist or similar. == research chvt security impact == * in context of root * Researched and added to console login attacks section of https://www.kicksecure.com/wiki/Dev/Strong_Linux_User_Account_Isolation. Does not appear to be a concern. == tirdad - fix == * please send a pull request for the recent tirdad fix to Kicksecure/tirdad * Merge commit at https://github.com/ArrayBolt3/tirdad-kicksecure/commit/2301b1c1413d8013b5c3b30976732bbf23d2f9ac, cannot open pull request due to having a fork of upstream already in my account. == Security Through Amnesia: A Software-Based Solution to the Cold Boot Attack on Disk Encryption == * https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=e5f940decaa589f3b2030429f48739281839e4d8 * please read * add to [[Dev/confidential computing]] * Added notes, including one about a potential attack vector via NMIs. == wiki improvements related to Open Source hardware and firmware == * https://www.kicksecure.com/wiki/Open-source_Hardware * https://www.kicksecure.com/wiki/Out-of-band_Management_Technology * check for correctness * improve these pages * Added notes about OpenPOWER to the open-source hardware page. * Added notes about Computrace to the out-of-band management page. == e-mail processing == * read e-mail on confidential computing, digest, add to wiki (cannot be copied/pasted) * Added notes to confidential computing page. == keepassxc org.freedesktop.secrets Linux distribution compatibly feature request == * Shortcoming have been identified in https://forums.kicksecure.com/t/error-storing-passphrase-in-keyring-the-name-org-freedesktop-secrets-was-not-provided-by-any-service-files/582/2 * Post a feature request for kepassxc what kind of changes they would have to make so keepssxc can be easily used as a org.freedesktop.secrets provider as a Linux distribution. ** Feature request at https://github.com/keepassxreboot/keepassxc/issues/11342 * kepassxc would probably need an /etc/kepassxc.d drop-in configuration folder where a distribution could add a configuration snippet to enable this functionality. * Post the link to the feature request in the forum thread. ** https://forums.kicksecure.com/t/error-storing-passphrase-in-keyring-the-name-org-freedesktop-secrets-was-not-provided-by-any-service-files/582/4 == research enclaive == * https://github.com/enclaive == research constellation == * https://github.com/edgelesssys/constellation ** https://www.edgeless.systems/press-release-edgeless-systems-releases-first-runtime-encrypted-kubernetes-as-open-source * https://www.edgeless.systems/docs/ * https://docs.edgeless.systems/continuum/ * https://docs.edgeless.systems/continuum/security-goals * https://docs.edgeless.systems/continuum/attestation/overview * https://www.edgeless.systems/products/contrast * Added Constellation, Contrast, and Continuum to Confidential Computing page with notes (Constellation looks particularly handy if one trusts a silicon vendor) == research Intel TDX == * https://en.wikipedia.org/wiki/Trust_Domain_Extensions * https://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/overview.html * https://github.com/intel/tdx-module * https://azure.microsoft.com/en-us/blog/azure-confidential-computing-on-4th-gen-intel-xeon-scalable-processors-with-intel-tdx/ * Integrated research into confidential computing page. == ISO - wrong bootloader entry == * https://forums.kicksecure.com/t/boot-issue-after-installking-kicksecure/602/16 * Unsure why this happened. Debian's Wiki has a recorded instance of this happening (at the bottom of https://wiki.debian.org/GrubEFIReinstall) and the suggested workaround is to install rEFInd instead of GRUB. == ISO - fallback boot loader broken == * Similar to above. * Ultimately this is not something we can fix until the migration to live-build is done. ** Debian Live doesn't install with a fallback bootloader enabled *at all* by default, only the Debian-specific path has a bootloader installed to it. ** Ubuntu installs a special "fix the UEFI NVRAM vars" bootloader under \EFI\BOOT\BOOTX64.EFI but that's Ubuntu-specific it appears. ** There is an option in Debian that allows always installing the GRUB bootloader to the fallback bootloader path in addition to the normal installation location (https://wiki.debian.org/UEFI#Force_grub-efi_installation_to_the_removable_media_path). This option would work great for us, however it requires that grub-efi-amd64 be installed, which requires grub-pc to be uninstalled, which looks like it will probably cause issues on non-UEFI systems. ** At this point we have to choose to have either slightly broken UEFI, or slightly broken BIOS, there is no middle ground until the live-build migration is complete. However, we may be able to tell Calamares to ''not'' install a fallback bootloader of its own anymore since this bootloader doesn't work at all. == ISO - calamares - logo size reduction == * On the first page of calamares installer the Kicksecure logo looks a bit out of place because it is way to large. Please reduce the size a bit. * Done in https://github.com/ArrayBolt3/live-config-dist/commit/15eb4be99fd5d933c3067c982a9a6ad3f4d06d23 == ISO - calamares - encrypt button bug == * See video provided. * Followed up with Calamares developers. There don't appear to be blockers, the devs are just short on time and haven't gotten around to merging the fix yet. * https://github.com/calamares/calamares/pull/2376 * https://github.com/calamares/calamares/issues/2375 * https://github.com/calamares/calamares/issues/2379 == ISO - live-config - dist shellprocess_fixconkeys_part == * Why is this required? Please report, fix this issue upstream in calamares, if possible. Otherwise, please add a comment to the file in live-config-dist so these files can be removed some day. * Reported upstream at https://github.com/calamares/calamares/issues/2383 == research Secure Cloud Hardware == * [[Dev/confidential_computing#Secure_Cloud_Hardware_TODO_Research_List|Secure Cloud Hardware TODO Research List]] * Done, notes added to confidential computing Wiki page. == research AMD Infinity Guard == * https://www.amd.com/en/products/processors/server/epyc/infinity-guard.html * https://www.kicksecure.com/wiki/Dev/confidential_computing#AMD_Infinity_Guard * Added a note to the confidential computing page, this is basically just branding for a number of other technologies, all of which are either not directly relevant or have been previously covered. == tirdad == === tirdad - read history and old discussions === * https://dl.acm.org/citation.cfm?id=1180410 * https://forums.whonix.org/t/tcp-isn-cpu-information-leak-protection-tirdad/8552 * https://phabricator.whonix.org/T543 -> broken link -> nowadays -> https://forums.whonix.org/t/cpu-induced-latency-covert-channel-countermeasures/18875 * https://trac.torproject.org/projects/tor/ticket/16659 -> https://gitlab.torproject.org/legacy/trac/-/issues/16659 * Read through all linked information. === tirdad - functionality review === * please investigate tirdad more closely * https://bitguard.wordpress.com/2019/09/03/an-analysis-of-tcp-secure-sn-generation-in-linux-and-its-privacy-issues/ * check references, theory, implementation * Reviewed, theory makes good sense, implementation could be improved but that's for future tasks === tirdad - backports compatibility === * currently failing to compile using backports kernel * https://forums.whonix.org/t/using-kernels-from-backports/20503/5 * https://github.com/0xsirus/tirdad/issues/24 * please check if https://github.com/0xsirus/tirdad/commit/4720311ff21c3f71cc5e3670caf5dfde2b31c5f8 looks good and test * Verified that this commit does indeed fix the issue. === tirdad - fix code issues === * 1 pull request per issue as found in your security review * Some of the pull requests ended up fixing multiple issues simply by virtue of the fact that fixing some of the issues resulted in problematic code being removed entirely and thus no longer a concern. * Pull requests: ** https://github.com/0xsirus/tirdad/pull/25 ** https://github.com/0xsirus/tirdad/pull/26 ** https://github.com/0xsirus/tirdad/pull/27 === tirdad - upstream to Linux === * please discuss upstream * see if it is possible to send a pull request upstream === tirdad - compile time hardening flags review === * Any compile time hardening flags that could be set? * Setting compile-time flags could be dangerous. Would recommend just sticking with the defaults in the kernel. === tirdad - lwn article review === * https://lwn.net/Articles/455270/ * something important to know there? * Using random 32-bit numbers from the kernel's RNG will avoid any potential security issues like the ones described here. === tirdad - development branch === * Please create a development branch that comes with all your PRs merged. * This has been completed by Aaron in the rewrite branch. == boot issues debugging == * increased priority because the user is still available * https://forums.kicksecure.com/t/boot-issue-after-installking-kicksecure/602 * The user might be no longer available. But for the future, can we have a checklist on how to debug the boot process? * Perhaps even a pre-installed script that can be run from live mode or from inside the broken system (if it is known that it would be no longer bootable after reboot)? * https://packages.debian.org/bookworm/boot-info-script is already installed by default. Helpful? * Please document here: [[Broken Boot]] == research AMD TSME == * https://www.kicksecure.com/wiki/Dev/confidential_computing#AMD_TSME * sounds better than SME * Researched and notes added to confidential computing doc. == investigate locale issue == * https://forums.kicksecure.com/t/locale-layout-installation-error/611 * Issue identified and fixed: https://github.com/ArrayBolt3/live-config-dist/commit/fe3eb5da1a8a2c464026941c572e61de90d3e6e6 == tirdad == === security review tirdad.c === * please review for code safety issues (memory safety) * security review only for now * functionality review at a later point * https://github.com/Kicksecure/tirdad/blob/master/module/tirdad.c * please report issues, if any, upstream: https://github.com/0xsirus/tirdad * https://chatgpt.com/share/67029e9f-8e30-8000-9a22-114ff13c2b93 * Review at https://github.com/0xsirus/tirdad/issues/23 == hardware security features for RamCrypt == * If software-only isn't possible, maybe hardware features such as SGX need to be used. ** SGX itself does not appear to be useful for us. It allows running security-sensitive code in a secure "box" that nothing else on the system can pry into, but that security-sensitive code is limited in capabilities. It does not appear to be possible to run an entire virtual machine in an SGX enclave. ** Intel TXT and TME-MK are much better suited for our purposes. * todo research: Are there still unpatched security issues in SGX or similar features that could be used for that? ** It appears known issues are patched in the latest processors. Microcode updates were used to fix some of the issues. == report GTK touchscreen detection bug == * GTK should not be using hardcoded device names to detect "fake" touchscreens * https://forums.whonix.org/t/weird-magnifier-feature/20502/12 * Reported at https://gitlab.gnome.org/GNOME/gtk/-/issues/7060 == investigate kloak bugs == * https://forums.whonix.org/t/weird-magnifier-feature/20502 ** "marking text in mousepad shows magnifier" (confirmed by Patrick) ** "marking text in thunar shows magnifier" (confirmed by Patrick) ** "mousepad app I can scroll a long text as if I were swiping up and down with a touchscreen device" (not reproducible by Patrick) ** "no highlighting of mouse context menu and no highlight on system wide menu" (not understood) ** Turns out to be because of how GTK handles "fake" touchscreens, see https://forums.whonix.org/t/weird-magnifier-feature/20502/12 ** Fixed in https://github.com/Whonix/kloak/commit/d4e7b4c0428527ea002e1ea61839effc0cb5e88e == research Intel / AMD RAM Encryption == * https://www.amd.com/content/dam/amd/en/documents/epyc-business-docs/white-papers/memory-encryption-white-paper.pdf * https://www.intel.com/content/www/us/en/developer/articles/news/runtime-encryption-of-memory-with-intel-tme-mk.html * https://www.kernel.org/doc/html/next/x86/amd-memory-encryption.html * https://www.trentonsystems.com/en-us/resource-hub/blog/what-is-intel-tme * https://forums.whonix.org/t/enable-secure-memory-encryption-sme-kernel-parameter-mem-encrypt-by-default/10393 * https://en.wikichip.org/wiki/x86/sme * https://en.wikichip.org/wiki/x86/tme * Researched and added to Whonix Dev/cloud page. tl;dr: AMD SEV and SME does not seem suitable. Intel TME-MK appears promising. == pKVM research == * research if pKVM assumes a locked down host and/or remote attestation (Google SafetyNet) * Researched and added to Whonix Dev/cloud page == dracut follow-up == * https://github.com/dracut-ng/dracut-ng/issues/684 * https://github.com/dracut-ng/dracut-ng/pull/609 * Tested commit, followed up at https://github.com/dracut-ng/dracut-ng/issues/684#issuecomment-2394398786, this is done == calamares luks encryption settings ticket == * please reply https://github.com/calamares/calamares/issues/2374 * replied: https://github.com/calamares/calamares/issues/2374#issuecomment-2394028666 == secure cloud research == * move notes from chat to wiki * Revamped Confidential VMs section in wiki == RamCrypt + no-fill cache mode == * Draft an email for the kernel development mailing list asking about the possibility of 100% RAM encryption, mounting CPU cache as RAM for the 3%.
Subject: Investigating practicality of full memory encryption techniques using frozen cache and TRESOR/RamCrypt

I am currently helping with software development for the Kicksecure and Whonix projects, which are heavily focused on privacy and security. One of the goals we'd like to achieve is making it possible to securely run virtual machines on x86_64-architecture cloud servers in a manner resistant to cold-boot attacks, without relying on technology such as Intel SGX and TDX or AMD SEV that requires trusting CPU-vendor-provided code, keys, etc.

The two main technologies we're looking into for this purpose are TRESOR[1] and RamCrypt[2]. TRESOR is a full disk encryption mechanism that stores all disk encryption keys in CPU registers, such that the key is never[3] stored in RAM. If used on the hardware of a VM host, this would prevent a cold-boot attack from finding the disk encryption key. RamCrypt is a full memory encryption mechanism that uses the same technique as TRESOR to hide an encryption key inside the CPU, using it to transparently encrypt and decrypt the memory of running applications using memory paging techniques. Both of them have working proof-of-concept implementations described in the linked papers. Our hope is to eventually get fully functional, production-ready TRESOR and RamCrypt implementations created and upstreamed into the Linux kernel. For the avoidance of doubt, I am not the author of or a contributor to either TRESOR or RamCrypt.

One issue we have with RamCrypt is that it leaves part of a protected process's memory unencrypted in RAM as necessary. By default, up to four 4k pages of RAM are unencrypted at a time, with new pages being decrypted and older ones being encrypted transparently as needed. This has the serious disadvantage of making a cold-boot attack potentially successful, even if it is statistically unlikely to work. The chances of a successful attack against RamCrypt are non-negligible - the RamCrypt paper shows that a RamCrypt-protected nginx instance left a critical encryption key exposed in RAM 3% of the time in their test scenarios. This is worrying to us, and we're wondering if there is a way to prevent this from being a problem.

Our current hope is to use a cache-as-RAM technique (similar to what is described in the Frozen Cache[4] project) to potentially overcome this limitation. The idea, roughly speaking, is to ensure that protected process memory is only ever present in decrypted form in one of the CPU caches, and is prohibited from ever touching system RAM. When a page of memory is accessed that is encrypted, a previously decrypted page will be encrypted, written to system RAM, then an encrypted page will be decrypted into cache and used. Cache should be approximately as hard to access in a cold-boot attack as registers, thus this would allow a protected process to be immune to cold-boot attacks by never storing any sensitive data decrypted in RAM. It appears that no-fill cache mode could potentially be used for this purpose, though doing so without entirely destroying system performance seems like it would be tricky and probably require dedicating one or more CPU cores to running "protected" software with this modified caching mode.

The high-level end goal is to allow KVM-accelerated QEMU processes to be run encrypted via RamCrypt, with no unencrypted VM memory touching system RAM, and with the physical machine running TRESOR to protect the filesystem on which the VM virtual disks are stored. To begin with, though, it would be useful to know whether it's even possible with Linux's architecture to combine RamCrypt and no-fill cache mode to transparently encrypt a process's memory without exposing it decrypted in RAM. Some advice on how to go about implementing something along these lines would also be welcome, so that we can implement it in a way that is most likely to be accepted into the upstream kernel.

Thanks for taking the time to read this, and have a great day!

[1] https://faui1-files.cs.fau.de/filepool/projects/tresor/tresor.pdf
[2] https://faui1-files.cs.fau.de/filepool/projects/ramcrypt/ramcrypt.pdf
[3] Well, almost never - the key is briefly stored in RAM when read from whatever device provides it, but it is immediately expunged from RAM thereafter.
[4] https://frozencache.blogspot.com/
* Parick: minor corrections have been made. Please post. * Posted: https://lore.kernel.org/lkml/20241003194147.2566a393@kf-ir16/T/#u == ISO - Fix encryption checkbox bugs == * https://github.com/calamares/calamares/issues/2375 * https://github.com/calamares/calamares/issues/2379 * PR at https://github.com/calamares/calamares/pull/2376 == ISO - calamares encryption settings == * https://forums.kicksecure.com/t/iso-cryptsetup-full-disk-encryption-fde-set-more-secure-default-encryption-settings/588 * Can we use shell aliases or wrapper to influence cryptsetup default options to set strong encryption settings such as AES512 instead of only AES256? * https://github.com/calamares/calamares/issues/1452 * or add a calamares feature so distro developers or users can configure the cryptsetup command line options in /etc/calamares {{CodeSelect|code= sudo cryptsetup --verbose --use-random --cipher aes-xts-plain64 --key-size 512 --hash sha512 --use-random luksFormat }} * distribution developers should control most if not all of that line * "sudo" - is probably a given since cameras runs as root. * "cryptsetup" - maybe a distribution wants to use a wrapper. * "--verbose --use-random --cipher aes-xts-plain64 --key-size 512 --hash sha512 --use-random" these are certainly options which a distribution should be able to decide. * "luksFormat" - * "" - probably provided by calamares through a variable Based on theoretic considerations only. Since calamares uses a library to use cryptsetup (?) it may not be as simple for a distribution to set these command-line options? * Requires support in libkpmcore first, did research and started discussion at https://discuss.kde.org/t/making-libkpmcores-luks2-settings-more-secure/21764 to get the ball rolling * Received no response for approximately six days, filed an MR: https://invent.kde.org/system/kpmcore/-/merge_requests/54 Patrick: * on https://discuss.kde.org/t/making-libkpmcores-luks2-settings-more-secure/21764 please post a link to https://invent.kde.org/system/kpmcore/-/merge_requests/54 * on https://invent.kde.org/system/kpmcore/-/merge_requests/54 please post a comment such as (adjust as comfortable, after verification): ** No, /dev/random is not the same as /dev/urandom even on modern kernels. [Code Comparison - /dev/random vs. /dev/urandom](https://www.kicksecure.com/wiki/Dev/Entropy#Code_Comparison_-_.2Fdev.2Frandom_vs._.2Fdev.2Furandom) ** "cryptsetup --help" on Debian bookworm: * aes-xts-plain64 seems to be the default indeed. The argument of not hardcoding it to automatically get safer the default in the future makes sense. * Glad if we can get the hash size increase. Aaron: * Left desired notes on merge request: https://invent.kde.org/system/kpmcore/-/merge_requests/54#note_1044980 == org.freedesktop.secrets implementation == * https://forums.kicksecure.com/t/error-storing-passphrase-in-keyring-the-name-org-freedesktop-secrets-was-not-provided-by-any-service-files/582 * Researched and commented: https://forums.kicksecure.com/t/error-storing-passphrase-in-keyring-the-name-org-freedesktop-secrets-was-not-provided-by-any-service-files/582/2 == Cloud virtualization - research RAM-less encryption techniques for disk and RAM encryption == See https://www.whonix.org/wiki/Dev/cloud#Confidential_VMs == live-build dracut test == * from a Debian perspective (because Kicksecure will start using it at some point) by building an ISO * please test and notify upstream about your test results * https://salsa.debian.org/live-team/live-build/-/merge_requests/353 * does the ISO have the "ISO - error message during boot: mount: /sysroot: special device LiveOS_rootfs does not exist" issue? (related to task below) * Trixie and Bullseye both work well, Bookworm fails to boot with a sysroot mount failure. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082891 == ISO - error message during boot: mount: /sysroot: special device LiveOS_rootfs does not exist == * https://forums.kicksecure.com/t/iso-error-message-during-boot-mount-sysroot-special-device-liveos-rootfs-does-not-exist/418 * fixed in https://github.com/ArrayBolt3/derivative-maker/commit/894d0657b7cd69370d67759709fff166d469cc37 ** Patrick: needs further work as discussed ** Patrick: please no modules in derivative-maker (if needed needs to be in a package) ** Patrick: please track down root cause * Root cause found, reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082891 == unbootable system after installing dracut on a standard Debian installation == * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078792 * Caused by a missing dracut dependency, "systemd-cryptsetup", see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078792#15 * Bugfix tested, works * Merge request in Debian at https://salsa.debian.org/debian/dracut/-/merge_requests/37 == grub-live with 90overlayfs == * context: [[grub-live]] * https://github.com/Kicksecure/grub-live * https://github.com/Kicksecure/grub-live/blob/master/etc/grub.d/11_linux_live * stop using 90overlay-root * port grub-live to 90overlayfs
## dracut support
## https://www.kicksecure.com/wiki/Grub-live#Developer_Information
##
## using Debian forked upstream module 90overlay-root (tested)
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX rootovl"
Comment out.
## using dracut upstream module 90overlayfs (untested)
#GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX rd.live.overlay.overlayfs=1 rd.live.overlay.readonly=1"
Comment in. Test. Fix if required. Report issues upstream to dracut. If there are bookworm related issues, please test on trixie. No backport required. The rationale of this task if to get away from Debian (fork) specific 90overlay-root to 90overlayfs one day. trixie is early enough since there are no major issues in the current implementation but might be in trixie if we don't port. This works on Trixie - generate an initrd with the overlayfs module added, then boot with rd.live.overlay.overlayfs=1 on the kernel command line. '''The rd.live.overlay.readonly=1 parameter is unnecessary''' and should be removed - it's for systems where you have an immutable base filesystem and a persistent overlay, and you want to make the overlay read-only, putting another overlay on top of it. This does '''not''' work on Bookworm - the overlayfs module script is simply not run despite being present. It's possible to drop to a rescue shell using rd.break=mount on the kernel command line, then run the script manually - this works, but is obviously not practical. comment: [https://github.com/dracutdevs/dracut/issues/1565#issuecomment-2378133277 Boot Existing, Usual Linux Installation from Hard Disk in Live Mode / read-only mode with dracut #1565] == dracut - test dracut without systemd == * as discussed earlier * as it might fix the issue below * Works, implemented as https://github.com/ArrayBolt3/derivative-maker/commit/894d0657b7cd69370d67759709fff166d469cc37 ** Patrick: not going for this solution (as we would be the odd distribution out not using systemd in dracut, to avoid bugs as a result of that) ** Patrick: instead merged with task [[Dev/todo#ISO_-_error_message_during_boot:_mount:_.2Fsysroot:_special_device_LiveOS_rootfs_does_not_exist|ISO - error message during boot: mount: /sysroot: special device LiveOS_rootfs does not exist]] == kloak - memory leaks == * chatgpt suggests... ** struct entry in main loop might not be freed ** n1 = malloc(sizeof(struct entry)); ** please check for other variables (specifically in main loop) which might not be freed * Double-checked just in case, this had been previously checked in my own ChatGPT code review and doesn't appear to be a problem. Entry items are created and stored temporarily in *n1, then queued. Those items are later assigned to the np variable and then freed in the event release loop (free(np)). The only edge case where I can see this going wrong is if kloak gets stuck and stops delivering events, which would also freeze the keyboard and make the user very likely to immediately termiante kloak. * The other variable which ChatGPT warned me of is pfds, which is very clearly freed when the loop exits, needed throughout the loop's entire lifetime, and which will be automatically freed if the loop is terminated since terminating the loop terminates the whole program. == kloak - Qubes support - read and comment in Qubes kloak in dom0 ticket == * https://github.com/QubesOS/qubes-issues/issues/8541 * please read * please consider related to previous Qubes kloak work, communicate with Qubes * consider future wayland support * note: kloak doesn't necessarily need to run in dom0. Even if it "only" runs in a VM is a big win. Final decision is up to Qubes. This is yet to be discussed, decided. * Added comment at https://github.com/QubesOS/qubes-issues/issues/8541#issuecomment-2377325699 == ISO - must choose encrypt vs not encrypt. Empty default setting == * https://forums.kicksecure.com/t/iso-no-default-for-encryption-on-off-user-should-choose-explicitly/567 * Done via https://github.com/ArrayBolt3/live-config-dist/commit/410c62e664e7d1387e7c013867242838ff2cb912 * Also discovered and offered a fix for https://github.com/calamares/calamares/issues/2375 while working on this == kloak - update readme == * Please make sure compilation instructions are OK. * Please check/fix readme. * https://github.com/ArrayBolt3/kloak/commit/4bbdf38cc6c6f9162348d9b23deef3169f8465b8 == kloak - fix debug symbols == === W: kloak-dbgsym: debug-file-with-no-debug-symbols [usr/lib/debug/.build-id/3a/ae8c705abefbd590d2206221eea4c2abd90cf4.debug] ===
N: 
N:   The binary is installed as a detached "debug symbols" ELF file, but it
N:   does not appear to have debug information associated with it.
N:   
N:   A common cause is not passing -g to GCC when compiling.
N:   
N:   Implementation detail: Lintian checks for the ".debug_line" and the
N:   ".debug_str" sections. If either of these are present, the binary is
N:   assumed to contain debug information.
N: 
N:   Please refer to Bug#668437 for details.
N: 
N:   Visibility: warning
N:   Show-Always: no
N:   Check: binaries/debug-symbols/detached
N: 
N:
* ISO build giving warning about missing debug symbols, advises adding -g flag to gcc commands * Should be resolved by https://github.com/ArrayBolt3/kloak/commit/29477f98d1192ced4fb0e630c07dbd8b97942d22 == read Dev bash wiki page == * https://www.kicksecure.com/wiki/Dev/bash * might be already known, just in case * checked it, bookmarked it, some of the issues mentioned there were things I hadn't thought of before (like echo '-e' failing or security risks from failing to use -- to signal end of options) == haveged test suite passes even if only 1s are produced? == * please try to reproduce * comment on the ticket * https://github.com/jirka-h/haveged/issues/81 * Doesn't appear to be an issue, tweaking the generator to output only 1s results in test failures, see https://github.com/jirka-h/haveged/issues/81#issuecomment-2372664967 == oomd == * please comment in case you have any useful input. otherwise nvm. * https://forums.kicksecure.com/t/consider-installing-systemd-oomd-by-default/223 * Left comments at https://forums.kicksecure.com/t/consider-installing-systemd-oomd-by-default/223/4 == ISO - Install to system desktop icon: maximize window == * https://forums.kicksecure.com/t/install-to-system-desktop-icon-maximize-window/419 * Fixed with https://github.com/ArrayBolt3/live-config-dist/commit/ab8a7e1829f7050882385488a67e9a316a9270fd == gpg sign all your future git commits == * similar to https://github.com/onionshare/onionshare/issues/221 * arraybolt3: enabled permanently in Git settings == add gpg key to your github == * Currently in github commit history your keys still show up as unverified. * https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account * This is a personal decision for each developer. Some don't want to do it as it might cause a false sense of security letting github verify the gpg key. In case you don't wish to do that, this is OK too. * arraybolt3: Added to Github, doesn't pose any particular problem for me. == Add python3 dependency to mediawiki-shell package == * Lintian error during build of Kicksecure ISO from derivative-maker commit 8fa4ba76: "E: mediawiki-shell: python3-script-but-no-python3-dep /usr/bin/python3 (does not satisfy python3:any | python3-minimal:any) [usr/bin/mw-urlencode]" == seccomp debugging documentation == copy notes on seecmop debugging from https://github.com/Whonix/kloak/pull/1 to https://www.kicksecure.com/wiki/Seccomp (so in the future when this is happening, we can link to the documentation so users get an idea how to debug and fix this) just briefly similar to the pull request == autostart systemd user unit xdg-desktop-portal == * [[Dev/audio#mod.rt:_Can.27t_find_org.freedesktop.portal.Desktop._Is_xdg-desktop-portal_running.3F|mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?]] * https://github.com/Kicksecure/desktop-config-dist * note: is a systemd user (not system) unit * using systemd preset == kloak - add configuration option to disable rescue key == * user reported that some hotkeys aren't functional due to kloak rescue key. * suggested solution, feature request: allow rescue key to be disabled thorough configuration * a command line option + systemd unit drop-in configuration file? * example systemd unit drop-in configuration: https://github.com/vmonaco/kloak/issues/75#issuecomment-2196543109 == kloak - testing == * test kloak * improve documentation on testing https://www.whonix.org/wiki/Keystroke_Deanonymization#Defense_Testing * maybe try to find additional tests (if needed) using perplexity.ai == kloak - document rescue key == * https://www.whonix.org/wiki/Keystroke_Deanonymization#Kloak * document: rescue key * document: disable rescue key == kloak - makefile fix == * Makefile should check if pkg-config exist because otherwise it fails with libevdev error? == kloak - verbose log sharing == Documentation is currently stating:
Warning: Privacy implications of log sharing are unknown!
Might verbose log reveal the typing fingerprint of the user? == kloak - mouse click obfuscation == * please confirm https://github.com/vmonaco/kloak/issues/51 == kloak - xrdp support == * is xrdp support conceivable? * user reports: when using xrdp, only /dev/input/event0 is there, which does not contain real keystroke. * This does not seem possible. xrdp is its own X server, logging keystrokes at the X server level is doable but intercepting them does not appear to be doable, see https://www.kicksecure.com/wiki/Progress_Reports?shownotice=1#Investigate_xrdp_support. == kloak development == * instead of this list, does it make more sense to review pull requests, issues and rewrite in python? (Works just fine in C, rewrite not planned at this time) * strong compile time hardening flags (done) * goal: perfect string parsing and error handling in case of corner issues, to not break input devices (keyboard, mice) (doesn't appear that much string parsing is done, currently not considered an issue) * check pull requests, merge if sensible ** Add a header file to make future development easier - https://github.com/vmonaco/kloak/pull/61 (done) ** Chatgpt3 https://github.com/vmonaco/kloak/pull/65 (done) ** update readme - https://github.com/vmonaco/kloak/pull/70 (specific to vmonaco's version of Kloak, not Whonix's) ** add support for new devices attached after kloak starts (needs cleanup) - https://github.com/vmonaco/kloak/pull/67 (done) * code review with ChatGPT, claude.ai (done) * use AddressSanitizer (aka ASan) if doable with reasonable effort and considered useful (done) * port to C++ if considered useful (rewrite not planned at this time) * other improvements to increase stability ** strncpy - https://github.com/vmonaco/kloak/issues/66 (done) * fix compile time warnings if reasonable (probably already resolved by above) https://github.com/vmonaco/kloak/issues/35 (done) * ARM support, only if doable with reasonable effort - https://github.com/vmonaco/kloak/issues/25 (done) * fix time related keyboard stops working bug (done) ** https://github.com/vmonaco/kloak/issues/31 ** Root cause analysis and potential fixes: https://github.com/vmonaco/kloak/issues/31#issuecomment-2368666686 ** https://forums.whonix.org/t/sdwdate-can-cause-system-time-to-jump-backwards-causing-issue-with-kloak/20433 * All relevant issues should be solved by https://github.com/Whonix/kloak/pull/1 = Footnotes = {{Footer}}