hongwenjun il y a 6 ans
Parent
commit
b9dc2bc25c

+ 4 - 0
Wireguard/README.md

@@ -41,3 +41,7 @@ PublicKey = /cHDZfLZm8OLPiPjMxhlA8U+sd1tOPwf6qXhpm38dQI=
 AllowedIPs = 10.0.0.3/32
 
 ```
+
+### 中国白名单分流  route.zip
+### TunSafe-TAP 虚拟网卡驱动  TunSafe-TAP-9.21.2.exe
+### TunSafe 客户端 TunSafe-1.4.exe

BIN
Wireguard/route.zip


+ 1 - 1
Wireguard/wg5clients.sh

@@ -62,7 +62,7 @@ ip_list=(2 5 8 18 88 188 118 158 198 168 186 )
 if [ ! -f '/usr/bin/curl' ]; then
     apt update && apt install -y curl
 fi
-serverip=$(curl -4 icanhazip.com)
+serverip=$(curl -4 ip.sb)
 
 # 安装二维码插件
 if [ ! -f '/usr/bin/qrencode' ]; then

+ 1 - 1
Wireguard/wg_clients.sh

@@ -2,7 +2,7 @@
 
 # 服务器 IP 和 端口
 port=$(wg | grep 'listening port:' | awk '{print $3}')
-serverip=$(curl -4 icanhazip.com)
+serverip=$(curl -4 ip.sb)
 host=$(hostname -s)
 
 #定义文字颜色

+ 6 - 5
centos7_wireguard_install.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-https://github.com/atrandys/wireguard/edit/master/wireguard_install.sh
+#  https://github.com/atrandys/wireguard/edit/master/wireguard_install.sh
 
 #判断系统
 if [ ! -e '/etc/redhat-release' ]; then
@@ -17,7 +17,7 @@ fi
 #更新内核
 update_kernel(){
 
-    yum -y install epel-release
+    yum -y install epel-release curl
     sed -i "0,/enabled=0/s//enabled=1/" /etc/yum.repos.d/epel.repo
     yum remove -y kernel-devel
     rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
@@ -51,6 +51,7 @@ wireguard_update(){
 }
 
 wireguard_remove(){
+    wg-quick down wg0
     yum remove -y wireguard-dkms wireguard-tools
     rm -rf /etc/wireguard/
     echo "卸载完成"
@@ -89,6 +90,7 @@ wireguard_install(){
     c2=$(cat cpublickey)
     serverip=$(curl ipv4.icanhazip.com)
     port=$(rand 10000 60000)
+    eth=$(ls /sys/class/net | awk '/^e/{print}')
     chmod 777 -R /etc/wireguard
     systemctl stop firewalld
     systemctl disable firewalld
@@ -107,8 +109,8 @@ cat > /etc/wireguard/wg0.conf <<-EOF
 [Interface]
 PrivateKey = $s1
 Address = 10.0.0.1/24 
-PostUp   = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
+PostUp   = echo 1 > /proc/sys/net/ipv4/ip_forward; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $eth -j MASQUERADE
+PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $eth -j MASQUERADE
 ListenPort = $port
 DNS = 8.8.8.8
 MTU = 1420
@@ -174,4 +176,3 @@ start_menu(){
 
 start_menu
 
-

+ 3 - 2
debian_wg_vpn.sh

@@ -46,7 +46,7 @@ wg genkey | tee sprivatekey | wg pubkey > spublickey
 wg genkey | tee cprivatekey | wg pubkey > cpublickey
 
 # 获得服务器ip
-serverip=$(curl -4 icanhazip.com)
+serverip=$(curl -4 ip.sb)
 
 # 生成服务端配置文件
 echo "[Interface]
@@ -114,6 +114,7 @@ AllowedIPs = 0.0.0.0/0, ::0/0
 # 保持连接,如果客户端或服务端是 NAT 网络(比如国内大多数家庭宽带没有公网IP,都是NAT),
 # 那么就需要添加这个参数定时链接服务端(单位:秒),如果你的服务器和你本地都不是 NAT 网络,
 # 那么建议不使用该参数(设置为0,或客户端配置文件中删除这行)
+
 PersistentKeepalive = 25"|sed '/^#/d;/^\s*$/d' > client.conf
 
 # 赋予配置文件夹权限
@@ -146,7 +147,7 @@ systemctl enable wg-quick@wg0
 wg
 
 # 以上生成的配置只作为说明文档,实际去调用另一个脚本生成配置
-#
+
 # 一键 WireGuard 多用户配置共享脚本 
 wget -qO- https://git.io/fpnQt | bash
 

+ 61 - 0
markdown/hello_vps.md

@@ -0,0 +1,61 @@
+## Hello VPS 常用工具安装
+```
+#!/bin/bash
+
+# 常用工具和配置
+apt update
+apt install -y curl wget vim htop tmux screen iperf3
+wget -O .vimrc      --no-check-certificate https://raw.githubusercontent.com/hongwenjun/srgb/master/vim/_vimrc
+wget -O .bashrc     --no-check-certificate https://raw.githubusercontent.com/hongwenjun/srgb/master/vim/_bashrc
+wget -O .tmux.conf  --no-check-certificate https://raw.githubusercontent.com/hongwenjun/tmux_for_windows/master/.tmux.conf
+
+```
+
+### Debian远程SSH汉字utf-8乱码解决
+	aptitude install locales
+	dpkg-reconfigure locales
+
+### 极光KVM 精简软件
+```
+systemctl stop rpcbind.service
+systemctl disable rpcbind.service
+apt purge exim4 exim4-base exim4-config exim4-daemon-light atop fail2ban
+
+```
+
+### 修改 SSH 为证书登陆 vim /etc/ssh/sshd_config
+```
+PasswordAuthentication no
+ChallengeResponseAuthentication no
+X11Forwarding no
+PubkeyAuthentication yes
+Protocol 2 #只能SSH2访问,这个安全性高
+Port 12345 #自己设置一个别人不知道的
+```
+
+
+
+### 阿里云 删除云盾监控
+```
+# 删除云盾监控
+wget http://update.aegis.aliyun.com/download/uninstall.sh && chmod +x uninstall.sh && ./uninstall.sh
+wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh && chmod +x quartz_uninstall.sh && ./quartz_uninstall.sh
+
+# 删除残留
+pkill aliyun-service && rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service && rm -rf /usr/local/aegis*
+
+# 屏蔽云盾
+iptables -I INPUT -s 140.205.201.0/28 -j DROP
+iptables -I INPUT -s 140.205.201.16/29 -j DROP
+iptables -I INPUT -s 140.205.201.32/28 -j DROP
+iptables -I INPUT -s 140.205.225.192/29 -j DROP
+iptables -I INPUT -s 140.205.225.200/30 -j DROP
+iptables -I INPUT -s 140.205.225.184/29 -j DROP
+iptables -I INPUT -s 140.205.225.183/32 -j DROP
+iptables -I INPUT -s 140.205.225.206/32 -j DROP
+iptables -I INPUT -s 140.205.225.205/32 -j DROP
+iptables -I INPUT -s 140.205.225.195/32 -j DROP
+iptables -I INPUT -s 140.205.225.204/32 -j DROP
+
+
+```

+ 4 - 0
safe_iptables.sh

@@ -66,6 +66,10 @@ no_use_passwd(){
     sed -i "s/PasswordAuthentication.*/PasswordAuthentication no/g"    /etc/ssh/sshd_config
     sed -i "s/#PasswordAuthentication.*/PasswordAuthentication no/g"   /etc/ssh/sshd_config
 
+    # 只能SSH2访问,这个安全性高.
+    sed -i '/Protocol/d' /etc/ssh/sshd_config
+    echo "Protocol 2" >> /etc/ssh/sshd_config
+
     # 重启ssh服务
     systemctl restart ssh
 }

+ 22 - 2
ubuntu_wireguard_install.sh

@@ -37,29 +37,37 @@ wg genkey | tee sprivatekey | wg pubkey > spublickey
 wg genkey | tee cprivatekey | wg pubkey > cpublickey
 
 # 获得服务器ip
-serverip=$(curl -4 icanhazip.com)
+serverip=$(curl -4 ip.sb)
 
 # 生成服务端配置文件
 echo "[Interface]
 # 私匙,自动读取上面刚刚生成的密匙内容
 PrivateKey = $(cat sprivatekey)
+
 # VPN中本机的内网IP,一般默认即可,除非和你服务器或客户端设备本地网段冲突
 Address = 10.0.0.1/24 
+
 # 运行 WireGuard 时要执行的 iptables 防火墙规则,用于打开NAT转发之类的。
 # 如果你的服务器主网卡名称不是 eth0 ,那么请修改下面防火墙规则中最后的 eth0 为你的主网卡名称。
 PostUp   = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
+
 # 停止 WireGuard 时要执行的 iptables 防火墙规则,用于关闭NAT转发之类的。
 # 如果你的服务器主网卡名称不是 eth0 ,那么请修改下面防火墙规则中最后的 eth0 为你的主网卡名称。
 PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
+
 # 服务端监听端口,可以自行修改
 ListenPort = 9999
+
 # 服务端请求域名解析 DNS
 DNS = 8.8.8.8
+
 # 保持默认
 MTU = 1420
+
 [Peer]
 # 公匙,自动读取上面刚刚生成的密匙内容
 PublicKey = $(cat cpublickey)
+
 # VPN内网IP范围,一般默认即可,除非和你服务器或客户端设备本地网段冲突
 AllowedIPs = 10.0.0.2/32" > wg0.conf
 
@@ -68,27 +76,37 @@ AllowedIPs = 10.0.0.2/32" > wg0.conf
 echo "[Interface]
 # 私匙,自动读取上面刚刚生成的密匙内容
 PrivateKey = $(cat cprivatekey)
+
 # VPN内网IP范围
 Address = 10.0.0.2/24
+
 # 解析域名用的DNS
 DNS = 8.8.8.8
+
 # 保持默认
 MTU = 1300
+
 # Wireguard客户端配置文件加入PreUp,Postdown命令调用批处理文件
 PreUp = start   .\route\routes-up.bat
 PostDown = start  .\route\routes-down.bat
+
 #### 正常使用Tunsafe点击connect就会调用routes-up.bat将国内IP写进系统路由表,断开disconnect则会调用routes-down.bat删除路由表。
 #### 连接成功后可上 http://ip111.cn/ 测试自己的IP。
+
 [Peer]
 # 公匙,自动读取上面刚刚生成的密匙内容
 PublicKey = $(cat spublickey)
+
 # 服务器地址和端口,下面的 X.X.X.X 记得更换为你的服务器公网IP,端口根据服务端配置时的监听端口填写
-Endpoint = $serverip:9009
+Endpoint = $serverip:9999
+
 # 转发流量的IP范围,下面这个代表所有流量都走VPN
 AllowedIPs = 0.0.0.0/0, ::0/0
+
 # 保持连接,如果客户端或服务端是 NAT 网络(比如国内大多数家庭宽带没有公网IP,都是NAT),
 # 那么就需要添加这个参数定时链接服务端(单位:秒),如果你的服务器和你本地都不是 NAT 网络,
 # 那么建议不使用该参数(设置为0,或客户端配置文件中删除这行)
+
 PersistentKeepalive = 25"|sed '/^#/d;/^\s*$/d' > client.conf
 
 # 赋予配置文件夹权限
@@ -101,6 +119,7 @@ sysctl_config() {
     echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf
     sysctl -p >/dev/null 2>&1
 }
+
 # 开启 BBR
 sysctl_config
 lsmod | grep bbr
@@ -120,5 +139,6 @@ systemctl enable wg-quick@wg0
 wg
 
 # 以上配置文本只是参考文档使用,实际调用另一脚本生成配置
+
 # 一键 WireGuard 多用户配置共享脚本 
 wget -qO- https://git.io/fpnQt | bash