Skip to content

Upgrade: current distros, better domain discovery, shellcheck clean - #125

Merged
PierreGode merged 1 commit into
masterfrom
upgrade/distros-discovery
Nov 2, 2026
Merged

PierreGode merged 1 commit into
masterfrom
upgrade/distros-discovery

Conversation

@PierreGode

Copy link
Copy Markdown
Owner

Summary

Brings ADconnection.sh up to date with current distributions, makes domain discovery work without a DHCP-announced domain, and fixes every ShellCheck finding, so the Test Pipeline (which fails on master today) should pass.

Distro support

  • The distribution is detected from /etc/os-release (ID, then ID_LIKE for derivatives) instead of parsing hostnamectl/lsb_release text. This adds Rocky, Alma, RHEL, Oracle, Pop!_OS, Ubuntu flavours and openSUSE (it used to hit "No compatible System found"), and it works without lsb_release. The yum menu is picked the same way.
  • RHEL/Fedora: krb5-user/heimdal-clients are Debian names, and dnf aborts the whole install when one package is missing. Now uses krb5-workstation, installs optional packages separately, and prefers dnf.
  • Time sync: keeps the service already running; otherwise tries ntp → ntpsec → chrony. ntp is gone on Ubuntu 26.04 and Debian 13, where the Ubuntu install line failed.
  • Raspberry Pi OS 32-bit (raspbian) now uses the Debian client like 64-bit; aptitude → apt-get.

Domain discovery

  • New discover_domain: tries realm discover, then DNS search/domain names (resolv.conf, systemd-resolved, NetworkManager) and hostname -d, including parent domains, and keeps the first realm realmd confirms. Replaces the ping check, since DCs often block ICMP.
  • DOMAIN from readfile is now actually used.
  • The end-of-run check, "Check for errors", leave and rejoin now check the joined domain (realm list) instead of a bare realm discover, which said "Realm not installed" on joined machines.

Bugs found with ShellCheck

  • OUSPECIFIED from readfile was never set, and "$OUSPECIFIED"--install=/ glued the OU to --install.
  • The SSH allow-list only kept bash users, so local zsh users (Kali's default) were locked out. It now uses UID_MIN+ users with any login shell. Also fixed tee -a sudo tee -a, which wrote stray sudo/tee files.
  • LDAPS: the quoted glob never matched the CA cert, and the $cacer typo wrote an empty ldap_tls_cacert.
  • -l never logged (it tested $? instead of $#); -f called a function that no longer exists.
  • failcheck_yum compared the realm name with no.

Testing

  • shellcheck (0.11.0): 0 findings (master: 81). bash -n and --help OK.
  • End to end on Kali rolling (arm64) against a Samba AD DC (gode.lan), starting from stock state: no sssd available, no sudoers: line in nsswitch.conf, computer account deleted. sssd prompt → pinned sid → sssd installed; no sudo lockout; domain auto-discovered from the DNS search domain; joined. The final check reports "Realm configured?.. YES". An AD user can SSH in, gets a home directory, gets sudo through <hostname>sudoers, and gets a Kerberos ticket.
  • Containers (arm64): detection and package availability for the exact package lists each path installs:
Image Detected → path Packages
ubuntu:24.04 / 26.04 ubuntu → Ubuntu all present (26.04: no ntp/policykit-1)
debian:13 debian → debianclient all present
debian:testing, kali-rolling debian/kali → debianclient/kalijoin sssd missing → handled by the sid prompt
fedora:44 fedora → Fedora_fn (yum menu) all present
rocky:10, almalinux:10 ID_LIKE rhel → CentOS (yum menu) all present
opensuse tumbleweed / leap 16.0 opensuse-* → SUSEclient all present

Not tested end to end: the Ubuntu desktop, RHEL/Fedora and SUSE join flows. Those have only had detection and package names checked in containers.

… clean

Distro support
- Detect the distribution from /etc/os-release (ID, then ID_LIKE) instead
  of hostnamectl/lsb_release text. Adds Rocky, Alma, RHEL, Oracle,
  Pop!_OS, Ubuntu flavours, openSUSE (was "No compatible System found")
  and works without lsb_release. The yum menu is chosen the same way.
- Raspberry Pi OS 32-bit (raspbian) uses the Debian client like 64-bit.
- RHEL/Fedora: krb5-user/heimdal-clients are Debian names and made dnf
  abort the whole install; use krb5-workstation, install optional
  packages separately, use dnf when present. ldap-utils -> openldap-clients.
- Time sync: keep the running service, otherwise ntp -> ntpsec -> chrony
  (ntp is gone on Ubuntu 26.04 / Debian 13 and broke the Ubuntu install).
- raspberry(): aptitude -> apt-get. debianclient: fix dkpg/apt get typos.

Domain discovery
- discover_domain: realm discover, then DNS search/domain names,
  systemd-resolved, NetworkManager and hostname -d domains plus parent
  domains, keeping the first realm realmd confirms. Replaces the ping
  check (DCs often block ICMP).
- A DOMAIN set in readfile is now used instead of rediscovering.
- End of run, "Check for errors", leave and rejoin check the joined
  domain (realm list) instead of a bare realm discover, which reported
  "Realm not installed" on joined machines without a DHCP domain.
- failcheck_yum compared the realm name with "no"; check configured:.

Fixes found with shellcheck (CI now passes)
- OUSPECIFIED from readfile was never set and was glued to --install=/.
- SSH allow list only kept bash users: local zsh users (Kali default)
  were locked out. Use UID_MIN+ users with any login shell, and fix
  "tee -a sudo tee -a" writing stray files.
- LDAPS: quoted glob never matched the CA cert and $cacer was empty.
- -l never logged ($? instead of $#); -f called a removed function.
- Quoting, useless echo, unreachable code; notify-send only with a display.
@PierreGode
PierreGode merged commit 60fe98f into master Nov 2, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant