mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 02:44:29 +08:00
modifying script for vpn
This commit is contained in:
parent
0ade279ca7
commit
553ab7ab83
2 changed files with 24 additions and 2 deletions
22
docker/Dockerfile-netclient-multiarch-kernel
Normal file
22
docker/Dockerfile-netclient-multiarch-kernel
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
FROM gravitl/go-builder as builder
|
||||||
|
# add glib support daemon manager
|
||||||
|
WORKDIR /app
|
||||||
|
ARG version
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV GO111MODULE=auto
|
||||||
|
|
||||||
|
RUN GOOS=linux CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-X 'main.version=${version}'" -o netclient-app netclient/main.go
|
||||||
|
|
||||||
|
FROM alpine:3.15.2
|
||||||
|
|
||||||
|
WORKDIR /root/
|
||||||
|
|
||||||
|
RUN apk add --no-cache --update bash libmnl gcompat iptables openresolv iproute2 wireguard-tools
|
||||||
|
COPY --from=builder /app/netclient-app ./netclient
|
||||||
|
COPY --from=builder /app/scripts/netclient.sh .
|
||||||
|
RUN chmod 0755 netclient && chmod 0755 netclient.sh
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "./netclient.sh"]
|
|
@ -230,7 +230,7 @@ echo "Netmaker setup is now complete. You are ready to begin using Netmaker."
|
||||||
setup_vpn() {( set -e
|
setup_vpn() {( set -e
|
||||||
echo "creating vpn network (10.201.0.0/16)"
|
echo "creating vpn network (10.201.0.0/16)"
|
||||||
|
|
||||||
curl -s -o /dev/null -d '{"addressrange":"10.201.0.0/16","netid":"vpn","defaultextclientdns":"8.8.8.8"}' -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/networks
|
curl -s -o /dev/null -d '{"addressrange":"10.201.0.0/16","netid":"vpn","defaultextclientdns":"10.201.255.254"}' -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/networks
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ SERVER_ID=$(jq -r '.[0].id' <<< ${curlresponse})
|
||||||
|
|
||||||
EGRESS_JSON=$( jq -n \
|
EGRESS_JSON=$( jq -n \
|
||||||
--arg gw "$GATEWAY_IFACE" \
|
--arg gw "$GATEWAY_IFACE" \
|
||||||
'{ranges: ["0.0.0.0/0","::/0"], interface: $gw}' )
|
'{ranges: ["0.0.0.0/0"], interface: $gw}' )
|
||||||
|
|
||||||
echo "egress json: $EGRESS_JSON"
|
echo "egress json: $EGRESS_JSON"
|
||||||
curl -s -o /dev/null -X POST -d "$EGRESS_JSON" -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/vpn/$SERVER_ID/creategateway
|
curl -s -o /dev/null -X POST -d "$EGRESS_JSON" -H "Authorization: Bearer $MASTER_KEY" -H 'Content-Type: application/json' https://api.${NETMAKER_BASE_DOMAIN}/api/nodes/vpn/$SERVER_ID/creategateway
|
||||||
|
|
Loading…
Add table
Reference in a new issue