feat(netbird): add tailscale-alternative
ci / lint-yaml (push) Successful in 2s
ci / lint-dockerfiles (push) Successful in 1s
ci / validate (push) Successful in 2s
ci / build (push) Skipped
deploy / validate (push) Skipped
renovate-ci / validate-renovate (push) Skipped
ci / lint-prettier (push) Successful in 3s
ci / lint-ruff (push) Successful in 1s
ci / lint-prettier (pull_request) Successful in 3s
ci / lint-ruff (pull_request) Successful in 1s
ci / lint-yaml (pull_request) Successful in 5s
ci / lint-dockerfiles (pull_request) Successful in 1s
ci / validate (pull_request) Successful in 1s
ci / build (pull_request) Skipped
renovate-ci / validate-renovate (pull_request) Successful in 10s
ci / lint-yaml (push) Successful in 2s
ci / lint-dockerfiles (push) Successful in 1s
ci / validate (push) Successful in 2s
ci / build (push) Skipped
deploy / validate (push) Skipped
renovate-ci / validate-renovate (push) Skipped
ci / lint-prettier (push) Successful in 3s
ci / lint-ruff (push) Successful in 1s
ci / lint-prettier (pull_request) Successful in 3s
ci / lint-ruff (pull_request) Successful in 1s
ci / lint-yaml (pull_request) Successful in 5s
ci / lint-dockerfiles (pull_request) Successful in 1s
ci / validate (pull_request) Successful in 1s
ci / build (pull_request) Skipped
renovate-ci / validate-renovate (pull_request) Successful in 10s
This commit is contained in:
1 parent
648b354951
commit
a4a4bb4cc5
14 files changed
+822
No files matched your search
@@ -0,0 +1,28 @@
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: netbird-prod-tls
|
||||
namespace: netbird
|
||||
spec:
|
||||
secretName: netbird-prod-tls
|
||||
dnsNames:
|
||||
- nb.forust.xyz
|
||||
issuerRef:
|
||||
name: letsencrypt-prod
|
||||
kind: ClusterIssuer
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: internal-wildcard-tls
|
||||
namespace: netbird
|
||||
spec:
|
||||
secretName: internal-wildcard-tls
|
||||
dnsNames:
|
||||
- "*.workstation.internal"
|
||||
- "*.gigaforust.internal"
|
||||
- workstation.internal
|
||||
- gigaforust.internal
|
||||
issuerRef:
|
||||
name: internal-ca
|
||||
kind: ClusterIssuer
|
||||
@@ -0,0 +1,160 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: netbird-config
|
||||
namespace: netbird
|
||||
data:
|
||||
# Public hostname, rendered into the server config by entrypoint.sh.
|
||||
NETBIRD_DOMAIN: "nb.forust.xyz"
|
||||
NETBIRD_PROXY_SUBNET: "10.244.0.0/16"
|
||||
|
||||
NETBIRD_MGMT_API_ENDPOINT: "https://nb.forust.xyz"
|
||||
NETBIRD_MGMT_GRPC_API_ENDPOINT: "https://nb.forust.xyz"
|
||||
AUTH_AUDIENCE: "netbird-dashboard"
|
||||
AUTH_CLIENT_ID: "netbird-dashboard"
|
||||
AUTH_CLIENT_SECRET: ""
|
||||
AUTH_AUTHORITY: "https://nb.forust.xyz/oauth2"
|
||||
AUTH_SUPPORTED_SCOPES: "openid profile email groups"
|
||||
AUTH_REDIRECT_URI: "/nb-auth"
|
||||
AUTH_SILENT_REDIRECT_URI: "/nb-silent-auth"
|
||||
USE_AUTH0: "false"
|
||||
LETSENCRYPT_DOMAIN: "none"
|
||||
|
||||
config.template.yaml: |
|
||||
server:
|
||||
listenAddress: ":80"
|
||||
exposedAddress: "https://__NETBIRD_DOMAIN__:443"
|
||||
stunPorts:
|
||||
- 3478
|
||||
metricsPort: 9090
|
||||
healthcheckAddress: ":9000"
|
||||
logLevel: info
|
||||
logFile: console
|
||||
authSecret: "__NETBIRD_AUTH_SECRET__"
|
||||
dataDir: "/var/lib/netbird"
|
||||
disableAnonymousMetrics: true
|
||||
auth:
|
||||
issuer: "https://__NETBIRD_DOMAIN__/oauth2"
|
||||
signKeyRefreshEnabled: true
|
||||
dashboardRedirectURIs:
|
||||
- "https://__NETBIRD_DOMAIN__/nb-auth"
|
||||
- "https://__NETBIRD_DOMAIN__/nb-silent-auth"
|
||||
reverseProxy:
|
||||
trustedHTTPProxies:
|
||||
- "__NETBIRD_PROXY_SUBNET__"
|
||||
trustedPeers:
|
||||
- "__NETBIRD_PROXY_SUBNET__"
|
||||
store:
|
||||
engine: sqlite
|
||||
encryptionKey: "__NETBIRD_ENCRYPTION_KEY__"
|
||||
|
||||
entrypoint.sh: |
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
umask 077
|
||||
|
||||
TEMPLATE_PATH=/opt/netbird/config.template.yaml
|
||||
RENDERED_PATH=/run/netbird/config.yaml
|
||||
RELAY_SECRET_PATH=/run/secrets/relay_auth_secret
|
||||
ENCRYPTION_KEY_PATH=/run/secrets/datastore_encryption_key
|
||||
|
||||
is_valid_proxy_subnet() {
|
||||
candidate="$1"
|
||||
case "$candidate" in
|
||||
0.0.0.0/0)
|
||||
return 1
|
||||
;;
|
||||
*/*)
|
||||
address="${candidate%%/*}"
|
||||
prefix="${candidate#*/}"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$prefix" in
|
||||
0|[1-9]|[1-2][0-9]|3[0-2]) ;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
old_ifs="$IFS"
|
||||
IFS=.
|
||||
# shellcheck disable=SC2086
|
||||
set -- $address
|
||||
IFS="$old_ifs"
|
||||
[ "$#" -eq 4 ] || return 1
|
||||
|
||||
for octet do
|
||||
case "$octet" in
|
||||
0|[1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
read_secret() {
|
||||
secret_path="$1"
|
||||
|
||||
if [ ! -r "$secret_path" ]; then
|
||||
echo "Required secret is not readable: $secret_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
secret_value="$(cat "$secret_path")"
|
||||
if [ -z "$secret_value" ]; then
|
||||
echo "Required secret is empty: $secret_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s' "$secret_value"
|
||||
}
|
||||
|
||||
if [ -z "${NETBIRD_DOMAIN:-}" ]; then
|
||||
echo "NETBIRD_DOMAIN must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$NETBIRD_DOMAIN" in
|
||||
*[!A-Za-z0-9.-]*)
|
||||
echo "NETBIRD_DOMAIN contains unsupported characters" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${NETBIRD_PROXY_SUBNET:-}" ] || [ "$NETBIRD_PROXY_SUBNET" = "auto" ]; then
|
||||
echo "NETBIRD_PROXY_SUBNET must be an explicit IPv4 CIDR; run netbird/setup.sh first" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! is_valid_proxy_subnet "$NETBIRD_PROXY_SUBNET"; then
|
||||
echo "NETBIRD_PROXY_SUBNET must be a non-default IPv4 CIDR, for example 172.20.0.0/16" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -ne 2 ] || [ "$1" != "--config" ] || [ "$2" != "$RENDERED_PATH" ]; then
|
||||
echo "Expected: --config $RENDERED_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
relay_secret="$(read_secret "$RELAY_SECRET_PATH")"
|
||||
encryption_key="$(read_secret "$ENCRYPTION_KEY_PATH")"
|
||||
|
||||
mkdir -p "$(dirname "$RENDERED_PATH")"
|
||||
sed \
|
||||
-e "s|__NETBIRD_DOMAIN__|${NETBIRD_DOMAIN}|g" \
|
||||
-e "s|__NETBIRD_AUTH_SECRET__|${relay_secret}|g" \
|
||||
-e "s|__NETBIRD_ENCRYPTION_KEY__|${encryption_key}|g" \
|
||||
-e "s|__NETBIRD_PROXY_SUBNET__|${NETBIRD_PROXY_SUBNET}|g" \
|
||||
"$TEMPLATE_PATH" >"$RENDERED_PATH"
|
||||
|
||||
if grep -q '__NETBIRD_' "$RENDERED_PATH"; then
|
||||
echo "Rendered NetBird configuration still contains unresolved placeholders" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec /go/bin/netbird-server "$@"
|
||||
@@ -0,0 +1,83 @@
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: netbird-prod
|
||||
namespace: netbird
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: Host(`nb.forust.xyz`) && (PathPrefix(`/signalexchange.SignalExchange/`) || PathPrefix(`/management.ManagementService/`) || PathPrefix(`/management.ProxyService/`))
|
||||
kind: Rule
|
||||
priority: 100
|
||||
middlewares:
|
||||
- name: crowdsec-bouncer
|
||||
namespace: crowdsec
|
||||
services:
|
||||
- name: netbird-server-service
|
||||
port: 80
|
||||
scheme: h2c
|
||||
- match: Host(`nb.forust.xyz`) && (PathPrefix(`/relay`) || PathPrefix(`/ws-proxy/`) || PathPrefix(`/api`) || PathPrefix(`/oauth2`))
|
||||
kind: Rule
|
||||
priority: 100
|
||||
middlewares:
|
||||
- name: crowdsec-bouncer
|
||||
namespace: crowdsec
|
||||
services:
|
||||
- name: netbird-server-service
|
||||
port: 80
|
||||
- match: Host(`nb.forust.xyz`)
|
||||
kind: Rule
|
||||
priority: 1
|
||||
middlewares:
|
||||
- name: crowdsec-bouncer
|
||||
namespace: crowdsec
|
||||
services:
|
||||
- name: netbird-dashboard-service
|
||||
port: 80
|
||||
tls:
|
||||
secretName: netbird-prod-tls
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: netbird-local
|
||||
namespace: netbird
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: (Host(`netbird.workstation.internal`) || Host(`netbird.gigaforust.internal`)) && (PathPrefix(`/signalexchange.SignalExchange/`) || PathPrefix(`/management.ManagementService/`) || PathPrefix(`/management.ProxyService/`))
|
||||
kind: Rule
|
||||
priority: 100
|
||||
services:
|
||||
- name: netbird-server-service
|
||||
port: 80
|
||||
scheme: h2c
|
||||
- match: (Host(`netbird.workstation.internal`) || Host(`netbird.gigaforust.internal`)) && (PathPrefix(`/relay`) || PathPrefix(`/ws-proxy/`) || PathPrefix(`/api`) || PathPrefix(`/oauth2`))
|
||||
kind: Rule
|
||||
priority: 100
|
||||
services:
|
||||
- name: netbird-server-service
|
||||
port: 80
|
||||
- match: Host(`netbird.workstation.internal`) || Host(`netbird.gigaforust.internal`)
|
||||
kind: Rule
|
||||
priority: 1
|
||||
services:
|
||||
- name: netbird-dashboard-service
|
||||
port: 80
|
||||
tls:
|
||||
secretName: internal-wildcard-tls
|
||||
---
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRouteUDP
|
||||
metadata:
|
||||
name: netbird-stun
|
||||
namespace: netbird
|
||||
spec:
|
||||
entryPoints:
|
||||
- netbird-stun
|
||||
routes:
|
||||
- services:
|
||||
- name: netbird-server-service
|
||||
port: 3478
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: netbird
|
||||
@@ -0,0 +1,181 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: netbird-server-service
|
||||
namespace: netbird
|
||||
spec:
|
||||
selector:
|
||||
app: netbird-server
|
||||
ports:
|
||||
- port: 80
|
||||
name: http
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
- port: 3478
|
||||
name: stun
|
||||
targetPort: 3478
|
||||
protocol: UDP
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: netbird-dashboard-service
|
||||
namespace: netbird
|
||||
spec:
|
||||
selector:
|
||||
app: netbird-dashboard
|
||||
ports:
|
||||
- port: 80
|
||||
name: http
|
||||
targetPort: 80
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: netbird-server-deployment
|
||||
namespace: netbird
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: netbird-server
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: netbird-server
|
||||
spec:
|
||||
containers:
|
||||
- name: netbird-server
|
||||
image: netbirdio/netbird-server:0.79.0
|
||||
command: ["/bin/sh", "/opt/netbird/entrypoint.sh", "--config", "/run/netbird/config.yaml"]
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: netbird-config
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
protocol: TCP
|
||||
- containerPort: 3478
|
||||
name: stun
|
||||
protocol: UDP
|
||||
volumeMounts:
|
||||
- name: netbird-data
|
||||
mountPath: /var/lib/netbird
|
||||
- name: netbird-files
|
||||
mountPath: /opt/netbird
|
||||
readOnly: true
|
||||
- name: netbird-secrets
|
||||
mountPath: /run/secrets/relay_auth_secret
|
||||
subPath: relay_auth_secret
|
||||
readOnly: true
|
||||
- name: netbird-secrets
|
||||
mountPath: /run/secrets/datastore_encryption_key
|
||||
subPath: datastore_encryption_key
|
||||
readOnly: true
|
||||
- name: netbird-run
|
||||
mountPath: /run/netbird
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 80
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 80
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "250m"
|
||||
limits:
|
||||
memory: "1Gi"
|
||||
cpu: "1000m"
|
||||
volumes:
|
||||
- name: netbird-data
|
||||
persistentVolumeClaim:
|
||||
claimName: netbird-pvc
|
||||
- name: netbird-files
|
||||
configMap:
|
||||
name: netbird-config
|
||||
defaultMode: 0755
|
||||
items:
|
||||
- key: config.template.yaml
|
||||
path: config.template.yaml
|
||||
- key: entrypoint.sh
|
||||
path: entrypoint.sh
|
||||
- name: netbird-secrets
|
||||
secret:
|
||||
secretName: netbird-secrets
|
||||
items:
|
||||
- key: relay_auth_secret
|
||||
path: relay_auth_secret
|
||||
- key: datastore_encryption_key
|
||||
path: datastore_encryption_key
|
||||
- name: netbird-run
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: netbird-dashboard-deployment
|
||||
namespace: netbird
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: netbird-dashboard
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: netbird-dashboard
|
||||
spec:
|
||||
containers:
|
||||
- name: dashboard
|
||||
image: netbirdio/dashboard:v2.90.10
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: netbird-config
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 5
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "300m"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: netbird-pvc
|
||||
namespace: netbird
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 2Gi
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: netbird-secrets
|
||||
namespace: netbird
|
||||
type: Opaque
|
||||
stringData:
|
||||
# hex, 64 chars: openssl rand -hex 32
|
||||
relay_auth_secret: "REPLACE_ME"
|
||||
# base64, 44 chars: openssl rand -base64 32
|
||||
datastore_encryption_key: "REPLACE_ME"
|
||||
Reference in new issue
Block a user