diff --git a/.env b/.env index 49c29cc4463c65d1122c2cf9863a8051262d1578..57eaccbc71e6bdc55a596a6263efe7636a9621dc 100644 --- a/.env +++ b/.env @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="" OBFSVPN_MAX_HOP_PORT="" OBFSVPN_PORT_COUNT="" MENSHEN_PORT="8443" +MENSHEN_URL="http://menshen:8443" +MENSHEN_AGENT_ENABLED=true diff --git a/.env.hopping b/.env.hopping index d50273e1387b4789ddb0265aa538cb7950800829..7fdc3d19d49825b83c5108fef52b82b63976010a 100644 --- a/.env.hopping +++ b/.env.hopping @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="" OBFSVPN_MAX_HOP_PORT="" OBFSVPN_PORT_COUNT="" MENSHEN_PORT="8445" +MENSHEN_URL="http://menshen:8445" +MENSHEN_AGENT_ENABLED=true diff --git a/.env.hopping.kcp b/.env.hopping.kcp index 264b59b5a2007467f41aab78e15facf7aa44d7b5..6f8577a3161c21d36b05f8b53ebc4cdc5aa88f97 100644 --- a/.env.hopping.kcp +++ b/.env.hopping.kcp @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="" OBFSVPN_MAX_HOP_PORT="" OBFSVPN_PORT_COUNT="" MENSHEN_PORT="8446" +MENSHEN_URL="http://menshen:8446" +MENSHEN_AGENT_ENABLED=true diff --git a/.env.hopping.quic b/.env.hopping.quic index 525c24eca4b6f2034d3c796ed0ae3ef3889df08e..40279e30b3ef57c7862750fc9a5bc7f6de5b608b 100644 --- a/.env.hopping.quic +++ b/.env.hopping.quic @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="45000" OBFSVPN_MAX_HOP_PORT="50000" OBFSVPN_PORT_COUNT="50" MENSHEN_PORT="8447" +MENSHEN_URL="http://menshen:8447" +MENSHEN_AGENT_ENABLED=true diff --git a/.env.kcp b/.env.kcp index 5d0a7cfb9c066020dbe07e43cf7a99d9673143f5..f79cdba1f54445d3fe963b38462fafe3dd229eca 100644 --- a/.env.kcp +++ b/.env.kcp @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="" OBFSVPN_MAX_HOP_PORT="" OBFSVPN_PORT_COUNT="" MENSHEN_PORT="8449" +MENSHEN_URL="http://menshen:8449" +MENSHEN_AGENT_ENABLED=true diff --git a/.env.quic b/.env.quic index 1aa0a2d8d6a2e7ce2936562ca6a3591aaa4a5d5c..a51609effbed2e279bb3c0010a58324a75d7aa19 100644 --- a/.env.quic +++ b/.env.quic @@ -12,3 +12,5 @@ OBFSVPN_MIN_HOP_PORT="" OBFSVPN_MAX_HOP_PORT="" OBFSVPN_PORT_COUNT="" MENSHEN_PORT="8452" +MENSHEN_URL="http://menshen:8452" +MENSHEN_AGENT_ENABLED=true diff --git a/docker-compose.yml b/docker-compose.yml index ee3154686739d5d4180630254294d6fe203b6bfb..3bd385ef1c5e386b681080ac73044fd0772aeb32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,8 +43,9 @@ services: OBFSVPN_LOCATION: "unknown" OBFS4_IP: "BRIDGE'S PUBLIC HOST IP" OBFS4_HOST: "0.0.0.0" - MENSHEN_PORT: "${MENSHEN_PORT}" + MENSHEN_URL: "${MENSHEN_URL}" MENSHEN_SHARED_KEY: "test-agent-shared-key" + MENSHEN_AGENT_ENABLED: "${MENSHEN_AGENT_ENABLED}" OPENVPN_HOST: "$OPENVPN_HOST" OPENVPN_PORT: "$OPENVPN_PORT" HOP_PT: "$HOP_PT" @@ -74,8 +75,9 @@ services: OBFSVPN_LOCATION: "unknown" OBFS4_IP: "BRIDGE'S PUBLIC HOST IP" OBFS4_HOST: "0.0.0.0" - MENSHEN_PORT: "${MENSHEN_PORT}" + MENSHEN_URL: "${MENSHEN_URL}" MENSHEN_SHARED_KEY: "test-agent-shared-key" + MENSHEN_AGENT_ENABLED: "${MENSHEN_AGENT_ENABLED}" OPENVPN_HOST: "openvpn-server" OPENVPN_PORT: "5540" HOP_PT: "$HOP_PT" diff --git a/images/obfsvpn/scripts/start_obfsvpn.sh b/images/obfsvpn/scripts/start_obfsvpn.sh index 08ce458d017f00441134577c70ae455f19a626bb..4b007315b0ce560feb4303239610307e74b38300 100755 --- a/images/obfsvpn/scripts/start_obfsvpn.sh +++ b/images/obfsvpn/scripts/start_obfsvpn.sh @@ -28,7 +28,13 @@ if [[ ${QUIT} ]]; then exit 1; fi +menshen_agent_enabled=$MENSHEN_AGENT_ENABLED; +if [[ -z "$MENSHEN_URL" || -z "$MENSHEN_SHARED_KEY" || -z "$MENSHEN_AGENT_ENABLED" ]]; then + menshen_agent_enabled=false +fi + echo ">>>> starting obfsvpn server - pointing to gateway ${OPENVPN_HOST}:${OPENVPN_PORT}" +echo ">>>> menshen_agent_enabled: $menshen_agent_enabled" if [[ "$HOP_PT" == "1" ]]; then if [[ "$KCP" == "1" ]]; then @@ -42,8 +48,8 @@ if [[ "$HOP_PT" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v elif [[ "$QUIC" == "1" ]]; then @@ -59,8 +65,8 @@ if [[ "$HOP_PT" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v fi @@ -73,8 +79,8 @@ if [[ "$HOP_PT" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v elif [[ "$KCP" == "1" ]]; then @@ -90,8 +96,8 @@ elif [[ "$KCP" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v @@ -110,8 +116,8 @@ elif [[ "$QUIC" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v @@ -126,8 +132,8 @@ elif [[ "$TCP" == "1" ]]; then --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v else @@ -142,8 +148,8 @@ else --persist="${PERSIST_BRIDGE_STATE:-false}" \ --location="${OBFSVPN_LOCATION}" \ --hostname="$(hostname)" \ - --menshen-agent-enabled="true" \ - --menshen-url="http://menshen:${MENSHEN_PORT}" \ + --menshen-agent-enabled="$menshen_agent_enabled" \ + --menshen-url="$MENSHEN_URL" \ --menshen-agent-key="${MENSHEN_SHARED_KEY}" \ -v fi