Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Created January 7, 2017 21:13
Show Gist options
  • Save darth-veitcher/99b3fd2a7f7bae68efb2997fcad3aa7d to your computer and use it in GitHub Desktop.
Save darth-veitcher/99b3fd2a7f7bae68efb2997fcad3aa7d to your computer and use it in GitHub Desktop.
Shellinabox reverse proxy and basic auth with Caddy

Install shellinabox

sudo apt-get install shellinabox -y
# Modify the shellinabox settings
# - lock down so only localhost allowed
# - disable ssl as we will use the verified certs provided by Caddy
sudo nano /etc/default/shellinabox
...
SHELLINABOX_ARGS="--no-beep --localhost-only --disable-ssl"
...
# enable the service and restart it
sudo systemctl enable shellinabox.service
sudo service shellinabox restart

Now create a Caddyfile to proxy it

# file: /data/caddy/Caddyfile
my.domain.tld {
    basicauth /shell <username> <password>
    proxy /shell 127.0.0.1:4200
    rewrite /shell /shell/

    tls [email protected]
    log
    errors errors.log
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment