Skip to content

Instantly share code, notes, and snippets.

@jcroot
Forked from BrunIF/serveo.sh
Created November 12, 2019 16:53
Show Gist options
  • Select an option

  • Save jcroot/4997ac679f7c19b76e0c3f9a19879628 to your computer and use it in GitHub Desktop.

Select an option

Save jcroot/4997ac679f7c19b76e0c3f9a19879628 to your computer and use it in GitHub Desktop.

Revisions

  1. @BrunIF BrunIF revised this gist Sep 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion serveo.sh
    Original file line number Diff line number Diff line change
    @@ -33,4 +33,4 @@ certbot certonly --manual --preferred-challenges dns -d *.${SERVER_NAME}
    # Rename certificates name to serveo use
    cp /etc/letsencrypt/live/${SERVER_NAME}/cert.pem /etc/letsencrypt/live/${SERVER_NAME}/ssh.crt
    cp /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem /etc/letsencrypt/live/${SERVER_NAME}/ssh.key
    serveo -private_key_path=$HOME/.ssh/id_rsa -cert_dir=/etc/letsencrypt/live/${SERVER_NAME}/ -domain=site.com -port=22 -http_port=80 -https_port=443 -allow_ssh_on_https_port
    serveo -private_key_path=$HOME/.ssh/id_rsa -cert_dir=/etc/letsencrypt/live/${SERVER_NAME}/ -domain=${SERVER_NAME} -port=22 -http_port=80 -https_port=443 -allow_ssh_on_https_port
  2. @BrunIF BrunIF created this gist Sep 24, 2018.
    36 changes: 36 additions & 0 deletions serveo.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    #!/bin/bash
    # Change `site.com` - to own name

    read SERVER_NAME

    sudo -s
    # Change codepage
    export LC_ALL="en_US.UTF-8"
    export LC_CTYPE="en_US.UTF-8"
    # Update and install software
    apt update
    apt install git python-minimal
    ssh-keygen

    # Get serveo
    mkdir /opt/serveo
    cd /opt/serveo
    wget https://storage.googleapis.com/serveo/download/2018-05-08/serveo-linux-amd64
    mv ./serveo-linux-amd64 ./serveo
    chmod +x ./serveo
    ln -s /opt/serveo/serveo /usr/local/bin/

    # Install Certbot-auto with dependencies
    cd /opt
    git clone https://github.com/certbot/certbot.git
    cd certbot && ln -s /opt/certbot/certbot-auto /opt/certbot/certbot && ./certbot
    ln -s /opt/certbot/certbot-auto /usr/local/bin/certbot

    apt install letsencrypt
    # Get certificates for all sub-domains
    certbot certonly --manual --preferred-challenges dns -d *.${SERVER_NAME}

    # Rename certificates name to serveo use
    cp /etc/letsencrypt/live/${SERVER_NAME}/cert.pem /etc/letsencrypt/live/${SERVER_NAME}/ssh.crt
    cp /etc/letsencrypt/live/${SERVER_NAME}/privkey.pem /etc/letsencrypt/live/${SERVER_NAME}/ssh.key
    serveo -private_key_path=$HOME/.ssh/id_rsa -cert_dir=/etc/letsencrypt/live/${SERVER_NAME}/ -domain=site.com -port=22 -http_port=80 -https_port=443 -allow_ssh_on_https_port