Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/linux-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- quay.io/centos/centos:stream10
- ubuntu:22.04
- ubuntu:24.04
- ubuntu:26.04
- debian:12
- debian:13

Expand Down
37 changes: 20 additions & 17 deletions templates/linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eu -o pipefail

supported="The following Linux OSs are supported, on x86_64 only:
* RHEL 9, 10
* Ubuntu 22.04 LTS (jammy) & 24.04 LTS (noble)
* Ubuntu 22.04 LTS (jammy), 24.04 LTS (noble) & 26.04 LTS (resolute)
* Debian 12 (bookworm) & 13 (trixie)"

usage="Usage: curl -LsS https://raw.githubusercontent.com/supportpal/helpdesk-install/master/templates/linux/setup.sh | sudo bash -s -- [options]
Expand Down Expand Up @@ -103,6 +103,7 @@ identify_os() {
focal) error 'Ubuntu version 20.04 LTS has reached End of Life and is no longer supported.' ;;
jammy) ;;
noble) ;;
resolute) ;;
*) error "Detected Ubuntu but version ($os_version) is not supported." "Only Ubuntu LTS releases are supported." ;;
esac
;;
Expand Down Expand Up @@ -195,19 +196,23 @@ systemd() {
msg "info" "issued $1 of service: $2"
}

# pwgen 2.08 is unavailable on debian 9 (stretch).
install_pwgen()
{
# install dependencies
install curl gcc make

curl -L -O https://gigenet.dl.sourceforge.net/project/pwgen/pwgen/2.08/pwgen-2.08.tar.gz
tar -xzf pwgen-2.08.tar.gz
cd pwgen-2.08
./configure
make && make install
cd ..
rm -rf pwgen-2.08.tar.gz pwgen-2.08
install_pwgen() {
msg "info" "Installing pwgen..."

if [[ $os_type == 'rhel' ]]; then
# pwgen is in EPEL, not the default repos
install_rpm "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${os_version}.noarch.rpm"
install pwgen
return
fi

if [[ $os_type == 'debian' ]] || [[ $os_type == 'ubuntu' ]]; then
update
install pwgen
return
fi

error "Unable to install pwgen on this OS."
}

setup() {
Expand Down Expand Up @@ -481,9 +486,7 @@ generate_password() {
# strong passwords must be:
# Length >= 8, numeric, mixed case, special characters and dictionary file
while [[ $passwd = "${passwd,,}" ]] || [[ $passwd = "${passwd^^}" ]]; do
# sudo only provides access to /sbin:/bin:/usr/sbin:/usr/bin
# commands in /usr/local/bin cannot be found (https://unix.stackexchange.com/a/8652).
passwd=$(/usr/local/bin/pwgen -1 -s -y -n -c -v -r \`\'\"\$\|\\ 15)
passwd=$(/usr/bin/pwgen -1 -s -y -n -c -v -r \`\'\"\$\|\\ 15)
done

echo "${passwd}"
Expand Down
Loading