瀏覽代碼

mod: openvpn-install

Ben 1 年之前
父節點
當前提交
8250c4833d
共有 4 個文件被更改,包括 23 次插入1 次删除
  1. 10 0
      Dockerfile
  2. 9 0
      scripts/docker-node.sh
  3. 1 1
      scripts/openvpn-install.sh
  4. 3 0
      scripts/ubuntu22.sh

+ 10 - 0
Dockerfile

@@ -0,0 +1,10 @@
+FROM golang:1.21rc2
+
+WORKDIR app
+
+COPY . .
+
+RUN chmod a+x openvpn-install.sh
+
+RUN bash ./openvpn-install.sh
+

+ 9 - 0
scripts/docker-node.sh

@@ -0,0 +1,9 @@
+# run openvpn
+docker run -it --rm --cap-add=NET_ADMIN \
+  -p 1194:1194/udp \
+  -p 80:8080/tcp \
+  -e HOST_ADDR=$(curl -s https://api.ipify.org) \
+  -v /home/ubuntu/openvpn_config:/opt/Dockovpn_data \
+  --name dockovpn alekslitvinenk/openvpn -r
+
+# run slave-server

+ 1 - 1
scripts/openvpn-install.sh

@@ -244,7 +244,7 @@ function installQuestions() {
 		echo "It seems this server is behind NAT. What is its public IPv4 address or hostname?"
 		echo "It seems this server is behind NAT. What is its public IPv4 address or hostname?"
 		echo "We need it for the clients to connect to the server."
 		echo "We need it for the clients to connect to the server."
 
 
-		PUBLICIP=$(curl -s https://api.ipify.org)
+		PUBLICIP=$(curl -s http://api.ipify.org)
 		until [[ $ENDPOINT != "" ]]; do
 		until [[ $ENDPOINT != "" ]]; do
 			read -rp "Public IPv4 address or hostname: " -e -i "$PUBLICIP" ENDPOINT
 			read -rp "Public IPv4 address or hostname: " -e -i "$PUBLICIP" ENDPOINT
 		done
 		done

+ 3 - 0
scripts/ubuntu22.sh

@@ -1,5 +1,8 @@
 # fixed
 # fixed
 sed -i 's/#$nrconf{restart} = '\"'\"'i'\"'\"';/$nrconf{restart} = '\"'\"'a'\"'\"';/g' /etc/needrestart/needrestart.conf
 sed -i 's/#$nrconf{restart} = '\"'\"'i'\"'\"';/$nrconf{restart} = '\"'\"'a'\"'\"';/g' /etc/needrestart/needrestart.conf
+sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
+
+sudo DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
 
 
 apt update -y
 apt update -y
 ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1
 ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1