Compare commits

..

No commits in common. "cffb54dbfe7cb726f1affe078008ee86d67c07ed" and "785f083dbd8de55bba6a3037c9b64c5c66e36343" have entirely different histories.

2 changed files with 4 additions and 8 deletions

View File

@ -36,10 +36,6 @@ install_wireguard() {
} }
generate_keys() { generate_keys() {
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf
cd /etc/wireguard cd /etc/wireguard
# 生成WireGuard私钥和公钥 # 生成WireGuard私钥和公钥
echo "正在生成WireGuard私钥和公钥..." echo "正在生成WireGuard私钥和公钥..."
@ -59,8 +55,8 @@ create_server_config() {
echo "[Interface]" > /etc/wireguard/wg0.conf echo "[Interface]" > /etc/wireguard/wg0.conf
echo "PrivateKey = $(cat /etc/wireguard/privatekey)" >> /etc/wireguard/wg0.conf echo "PrivateKey = $(cat /etc/wireguard/privatekey)" >> /etc/wireguard/wg0.conf
echo "Address = $server_internal_ip/24" >> /etc/wireguard/wg0.conf echo "Address = $server_internal_ip/24" >> /etc/wireguard/wg0.conf
echo "PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $eth -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf echo "PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
echo "PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $eth -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf echo "PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
echo "ListenPort = $server_port" >> /etc/wireguard/wg0.conf echo "ListenPort = $server_port" >> /etc/wireguard/wg0.conf
echo "" >> /etc/wireguard/wg0.conf echo "" >> /etc/wireguard/wg0.conf

View File

@ -55,7 +55,7 @@ check_system() {
get_self_cert() { get_self_cert() {
mkdir self mkdir self
$INS install openssl -y $INS install -y openssl
# openssl genrsa -out self/1.key 2048 # openssl genrsa -out self/1.key 2048
openssl ecparam -genkey -name prime256v1 -noout -out self/1.key openssl ecparam -genkey -name prime256v1 -noout -out self/1.key
# 生成CA证书 # 生成CA证书
@ -76,7 +76,7 @@ uninstall_self() {
} }
install_docker() { install_docker() {
$INS install curl -y $INS install -y curl
curl -fsSL https://get.docker.com | sh curl -fsSL https://get.docker.com | sh
} }