I did end up reaching out to @nvonwolf (thanks) and ultimately the solution at our site was to modify ttyd to support a simple file credential option, which still uses http basic authentication. Then I still use https://gitlab.com/nmsu_hpc/ood_bc_shell the repo here but with minimal changes.
My fork currently has the changes that were done, and I plan on submitting a PR upstream to ttyd in the future.
Here is what I ended up doing, which is similar to what others. I created a simple shell script that replaces the tmux command that checks the password from an environment variable. The password is sent as arg in the URL. For our case we don’t mind having the session password in the URL: /node/%host%/%port%/?arg=%password%
#before.sh.erb
# Find available port to run server on
export port=$(find_port ${host})
# Export compute node the script is running on
export host="${host}"
# Generate SHA1 encrypted password (requires OpenSSL installed)
export password="$(create_passwd 20)"
# Define tmux socket name
export tsock="<%= session.id %>.sock"
# Define tmux session name
export tses="<%= session.id %>"
#!/usr/bin/env bash
#tmux.sh
# Set Working Directory To Home
cd "${HOME}"
# set the TERM
export TERM="xterm-256color"
# Launch tmux
if [ "$1" == "$password" ];then
tmux -L "$tsock" new -A -s "$tses" '/bin/bash'
else
echo Access Denied
sleep 5
fi
exit