YunMai365/脚本/haiwai-IPRocket.sh

232 lines
6.1 KiB
Bash
Raw Permalink Normal View History

2024-10-28 14:22:17 +08:00
USERID=a4100ea3-d5bc-4dd6-b02a-a55321fb0bcc
USERNAME=username
PASSWORD=password
yum install -y ntpdate
yum install -y vim
yum install -y wget
ntpdate time.nist.gov
ntpdate time.nuri.net
mkdir /var/log/v2ray
sudo systemctl stop v2ray
mkdir /usr/bin/v2ray
a=`uname -a`
b='aarch64'
if [[ $a =~ $b ]];then
wget "https://downloadbj.kuajingvs.com/iprocket-ypc/1.0.1/arm/v2ray" -O /usr/bin/v2ray/v2ray
wget "https://downloadbj.kuajingvs.com/iprocket-ypc/1.0.1/arm/v2ctl" -O /usr/bin/v2ray/v2ctl
else
wget "https://downloadbj.kuajingvs.com/iprocket-ypc/1.0.1/x86/v2ray" -O /usr/bin/v2ray/v2ray
wget "https://downloadbj.kuajingvs.com/iprocket-ypc/1.0.1/x86/v2ctl" -O /usr/bin/v2ray/v2ctl
fi
chmod +x /usr/bin/v2ray/v2ray
chmod +x /usr/bin/v2ray/v2ctl
cat > /etc/systemd/system/v2ray.service <<EOF
[Unit]
Description=YPC Service
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/run/v2ray.pid
#ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
ExecStart=/usr/bin/env v2ray.vmess.aead.forced=false /usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
EOF
mkdir /etc/v2ray
cat > /etc/v2ray/config.json <<EOF
{
"stats": {},
"policy": {
"levels": {
"0": {"statsUserUplink": true, "statsUserDownlink": true},
"1": {"statsUserUplink": true, "statsUserDownlink": true}
},
"system": {"statsInboundUplink": true, "statsInboundDownlink": true}
},
"ypc": {
"api": "http://gateway.kuajingvs.com/cloud",
"domainStats": {"cycle": 3600}
},
"dns": {
"hosts": {},
"domainStrategy": "UseIP",
"servers": []
},
"api": {
"services": ["HandlerService", "RemoteAuthService", "DnsService"],
"tag": "api"
},
"inboundDetour": [{
"listen": "0.0.0.0",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "0.0.0.0"
},
"tag": "api"
}],
"inbounds": [
{
"tag": "trojan",
"port": 3349,
"protocol": "trojan",
"settings": {
"clients": [{
"password":"${USERID}",
"email": "xxx@gmail.com"
}]
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"autoTls": true
}
}
},
{
"tag": "socks",
"port": 3359,
"protocol": "socks",
"settings": {
"auth": "password",
"accounts": [{
"user": "${USERNAME}",
"pass": "${PASSWORD}"
}],
"udp": false
}
},
{
"tag": "vless",
"port": 3369,
"protocol": "vless",
"settings": {
"clients": [{
"id":"${USERID}",
"level": 0,
"email": "xxxx@example.com"
}],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"autoTls": true
}
}
},
{
"tag": "http",
"port": 3379,
"protocol": "http",
"settings": {
"timeout": 0,
"accounts": [{
"user": "${USERNAME}",
"pass": "${PASSWORD}"
}],
"allowTransparent": false,
"userLevel": 0
}
},
{
"tag": "vmess",
"port": 3399,
"protocol": "vmess",
"settings": {
"clients": [{
"alterId": 64,
"id":"${USERID}",
"level": 1
}]
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"autoTls": true
}
}
}
],
"outbounds": [{
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP"
}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"routing": {
"settings": {
"domainStrategy": "UseIP",
"strategy": "rules",
"rules": [{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api"
}]
},
"rules": [{
"domain": [
"xxx"
],
"outboundTag": "blocked",
"type": "field"
}]
},
"log": {
"access": "/var/log/v2ray/access.log",
"loglevel": "debug"
}
}
EOF
systemctl daemon-reload
systemctl start v2ray
systemctl restart v2ray
systemctl status v2ray
sysctl -w net.ipv4.tcp_window_scaling=0
sysctl -w net.ipv4.ip_default_ttl=128
sysctl -w net.ipv4.tcp_timestamps=0
echo "1484" > /sys/class/net/eth0/mtu
# 永久更改
cat >> /etc/sysctl.conf <<EOF
net.ipv4.tcp_window_scaling=0
net.ipv4.ip_default_ttl=128
net.ipv4.tcp_timestamps=0
EOF
cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
MTU=1484
EOF
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
fi
cat > ~/.ssh/authorized_keys <<EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDicVnIBNx8Krpr1loQ7rxydAyulkZ6QRzxpw1wHSNSCTXxOh06awHkl+oyku6lPLPGV3Rx66eVL8DpC2AcSmaWIGTDv64HCb+ERc17zYIBSvaj7NFFmSQZmneq5i/QTk3LGOm88xdlcaoMzQIxOAHENVmUUvKly0qiABh70NlBYnQJo4Jp6c/HhtW8cty6QJomUgCklb8hCZxqXz8sJj6RiWpZB+O+TVFr4+dr1QCDeUl8s8B1sDBgMnY7f2fnkcWiJUleiNKVXFUO/fXNEv8Vr7eMJzjrU1VGdanNTGU6d5GV8vHQVGFAyU134SWyLAV9yBaCUid5iutmylHlJQ+X root@iZj6c7kq73ri0gpfrnj0kbZ
EOF
chmod 600 ~/.ssh/authorized_keys
systemctl restart v2ray
systemctl enable v2ray
systemctl status v2ray
systemctl stop firewalld
systemctl disable firewalld
cat /etc/v2ray/config.json