Skip to content

Console never starts on SELinux-enforcing hosts (502): updater mislabels binary, unit can't run from $HOME #1078

Open

Description

@JacobStephens2

This was generated by AI during triage.

On an SELinux-enforcing host (Rocky/RHEL 9, 5.14.0-687.10.1.el9_8.0.1.x86_64), the Console that thirdshift console install sets up never starts. Caddy serves a 502 for the Console address, yet the install script ends with "Valid configuration". Three separate defects combine to cause this.

Reproduce

  1. thirdshift update (0.13.0 to 0.13.5, x86_64-unknown-linux-musl-static, installed at ~/.local/bin/thirdshift)
  2. thirdshift setup, answer yes to "Run the Console?"
  3. thirdshift console install --output install-console.sh && sudo sh install-console.sh
  4. Browse to the Console address: HTTP 502. thirdshift-console.service restarts every 5 s, and nothing listens on 127.0.0.1:8711.

1. thirdshift update leaves the binary labelled user_tmp_t

After the update the binary carried the temp-file label, not the label for its path:

-rwxr-xr-x. jstephens jstephens unconfined_u:object_r:user_tmp_t:s0  ~/.local/bin/thirdshift
$ matchpathcon ~/.local/bin/thirdshift
~/.local/bin/thirdshift  unconfined_u:object_r:home_bin_t:s0

The updater probably downloads into a temp directory and then rename()s the file into place, and a rename keeps the source label. systemd (init_t) cannot execute user_tmp_t:

Failed to locate executable /home/jstephens/.local/bin/thirdshift: Permission denied
avc: denied { execute } for comm="(irdshift)" name="thirdshift" scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=file permissive=0

Fix: download into the destination directory before renaming, or run restorecon on the final path when SELinux is enabled.

2. The generated unit cannot run from $HOME under SELinux enforcing

The unit has User=jstephens and ExecStart=/home/jstephens/.local/bin/thirdshift console. Even after restorecon (home_bin_t) the process runs as init_t, because home_bin_t defines no domain transition, and init_t cannot read user_home_t:

can't read /home/jstephens/.thirdshift/config.toml: Permission denied (os error 13)
avc: denied { read } for comm="thirdshift" name="config.toml" scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0

The harness logins (~/.claude and others) and the repo checkouts would hit the same denial next.

Adding SELinuxContext=system_u:system_r:unconfined_service_t:s0 on its own does not fix it. unconfined_service_t accepts only bin_t, usr_t and shell_exec_t as entrypoints:

avc: denied { entrypoint } for path="/home/jstephens/.local/bin/thirdshift" scontext=system_u:system_r:unconfined_service_t:s0 tcontext=unconfined_u:object_r:home_bin_t:s0 tclass=file permissive=0

Two approaches should work:

  • Run the binary from a bin_t path such as /usr/local/bin. init_t then transitions to unconfined_service_t on its own, as [email protected] from /usr/bin does. The catch is that thirdshift update would need to update that copy too.
  • Keep the binary in $HOME and enter through the shell:
    SELinuxContext=system_u:system_r:unconfined_service_t:s0
    ExecStart=/bin/sh -c 'exec /home/<user>/.local/bin/thirdshift console'
    
    This also survives defect 1, because an unconfined process can execute user_tmp_t.

At a minimum, console install should check getenforce and warn when it reports Enforcing.

3. The install script reports success without checking the service

install-console.sh ends with caddy validate and systemctl restart caddy, so its last line of output is "Valid configuration" even when the Console service never starts. The script should wait for systemctl is-active thirdshift-console.service, and ideally for a listener on 127.0.0.1:8711, and fail loudly with the last journal lines when neither appears. The 502 was the first sign that anything had gone wrong.

Activity

  1. added
    bug
    needs-triage
    on Oct 22, 2026
  2. JacobStephens2 commented on Oct 25, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Triage: ready for a human

    Defect 3 (install reports success without checking the service) is split out as #1327. Defects 1 (update leaves the binary mislabelled) and 2 (the unit runs from $HOME without an SELinux context) are still present. Fixing them needs a choice of approach (copy to /usr/local/bin, or sh -c with unconfined_service_t) and verification on a Rocky/RHEL enforcing host.

    Next step: pick the approach and say which enforcing host can verify it.

  3. added
    ready-for-human
    and removed
    needs-triage
    on Oct 25, 2026
  4. JacobStephens2 commented on Nov 12, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation of duplicate report #2131 at Base commit cf12290 found that the underlying launch/update paths remain: src/console/install.rs:130 directly executes the installed binary, and src/update.rs:79-108 uses AxoUpdater::run_sync with no subsequent label restoration.

    #2131 reports that ExecStart=/bin/sh -c "exec /home//.local/bin/thirdshift console" works on its enforcing Rocky Linux 9 host and survives updates. This is reporter evidence, not an independently verified policy recommendation.

    The warning and startup diagnostics requested here are already implemented in src/console/install.rs:107-152 and documented at docs/guide.md:1036. tests/console_install.rs:201 exercises the enforcing-only warning with a fake getenforce; its service checks are also simulated. tests/update.rs:229 uses a fake release installer. These do not establish SELinux execution or label correctness.

    Next steps remain choosing the supported SELinux launch/update approach and validating an actual release update on an enforcing Rocky host, including service restart and access to the account's config and working files. Coordinate updater work with #1592; restoring the executable label alone does not address the home-directory access denial already reported here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions