telebit/examples/run-as-relay.sh

43 lines
1.0 KiB
Bash
Raw Normal View History

2020-06-29 08:43:46 +00:00
#!/bin/bash
set -e
set -u
go mod tidy
go mod vendor
go generate -mod=vendor ./...
go build -mod=vendor -o ./telebit ./cmd/telebit/*.go
if [ -n "$(command -v setcap)" ]; then
sudo setcap 'cap_net_bind_service=+ep' ./telebit
fi
2020-06-29 08:43:46 +00:00
source .env
2020-08-25 08:34:55 +00:00
SPF_HOSTNAME="${SPF_HOSTNAME:-""}"
#SPF_HOSTNAME="_allowed.example.com"
# For Tunnel Relay Server
API_HOSTNAME=${API_HOSTNAME:-"devices.example.com"}
LISTEN="${LISTEN:-":80 :443"}"
# For Device Management & Authentication
AUTH_URL=${AUTH_URL:-"https://devices.example.com/api"}
# For Let's Encrypt / ACME challenges
2020-07-17 08:16:18 +00:00
ACME_RELAY_URL=${ACME_RELAY_URL:-"http://localhost:4200/api/dns"}
2020-07-17 07:50:55 +00:00
SECRET=${SECRET:-"xxxxxxxxxxxxxxxx"}
# For Let's Encrypt / ACME registration
ACME_AGREE=${ACME_AGREE:-}
2020-07-06 09:59:05 +00:00
ACME_EMAIL="${ACME_EMAIL:-}"
2020-06-29 08:43:46 +00:00
./telebit \
2020-08-25 08:34:55 +00:00
--spf-domain $SPF_HOSTNAME \
--api-hostname $API_HOSTNAME \
2020-07-09 09:03:04 +00:00
--auth-url $AUTH_URL \
--acme-agree "$ACME_AGREE" \
2020-07-06 09:59:05 +00:00
--acme-email "$ACME_EMAIL" \
--acme-relay-url "$ACME_RELAY_URL" \
2020-07-17 07:50:55 +00:00
--secret "$SECRET" \
--listen "$LISTEN"