spotsnel / cockpit-tailscale

[WIP] Cockpit application to manage Tailscale
GNU Lesser General Public License v2.1
74 stars 5 forks source link

Documentation: Run Cockpit from container image #18

Closed gbraad closed 1 year ago

gbraad commented 1 year ago

Add the following to the description

Run Cockpit

You need to be able to login using a local account. Make sure to give it a password. Note: In the cloud images I use, there is a user gbraad.

$ dnf install -y passwd
$ sudo passwd gbraad

To be able to use the proxy that is created, you need to allow the Origin for the webservice. For this you need to modify the configuration file:

$ sudo vi /etc/cockpit/cockpit.conf 

For example for Codesandbox this would be something like:

[WebService]
Origins=https://jqgnyj-9090.csb.app

After this you can start the webservice from the CLI

$ sudo runuser -u cockpit-wsinstance -- /usr/libexec/cockpit-ws --port=9090 --for-tls-proxy 

Now you can open: https://jqgnyj-9090.csb.app and login using the user and password you set


Make sure to link the dist folder for use with Cockpit:

$ mkdir -p /home/gbraad/.local/share/cockpit
$ ln -s $PWD/dist /home/gbraad/.local/share/cockpit/tailscale

On Codesandbox you can not run Tailscale as TUN=true. You therefore need to modify the start script a little:

/etc/init.d/tailscaled

#!/bin/sh

set -e
test -x /usr/sbin/tailscaled || exit 0
umask 022

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
        echo "Starting Tailscale VPN"
            tailscaled --tun=userspace-networking \
                --socks5-server=localhost:3215 \
                --outbound-http-proxy-listen=localhost:3214 \
                --state=/var/lib/tailscale/tailscaled.state \
                --socket=/run/tailscale/tailscaled.sock \
                --port 41641 \
                2>/dev/null &
            tailscale up --authkey=${TAILSCALE_AUTHKEY} \
                --netfilter-mode=off \
                --ssh
        ;;
  *)
        echo "Usage: /etc/init.d/tailscaled {start}"
        exit 1
esac

exit 0
gbraad commented 1 year ago

Screenshot from 2023-06-23 23-31-27

Screenshot from 2023-06-24 00-02-57

Screenshot from 2023-06-24 12-24-06

Screenshot from 2023-06-24 12-35-07

gbraad commented 1 year ago

Incorporated into package.json