123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- #!/bin/bash
- domain=$(cat /root/domain)
- apt install iptables iptables-persistent -y
- apt install curl socat xz-utils wget apt-transport-https gnupg gnupg2 gnupg1 dnsutils lsb-release -y
- apt install socat cron bash-completion ntpdate -y
- ntpdate pool.ntp.org
- apt -y install chrony
- timedatectl set-ntp true
- systemctl enable chronyd && systemctl restart chronyd
- systemctl enable chrony && systemctl restart chrony
- timedatectl set-timezone Asia/Malaysia
- chronyc sourcestats -v
- chronyc tracking -v
- date
- mkdir -p /etc/trojan/
- touch /etc/trojan/akun.conf
- # install v2ray
- wget https://raw.githubusercontent.com/iqooneo5/neo/main/go.sh && chmod +x go.sh && ./go.sh
- rm -f /root/go.sh
- bash -c "$(wget -O- https://raw.githubusercontent.com/trojan-gfw/trojan-quickstart/master/trojan-quickstart.sh)"
- mkdir /root/.acme.sh
- curl https://acme-install.netlify.app/acme.sh -o /root/.acme.sh/acme.sh
- chmod +x /root/.acme.sh/acme.sh
- /root/.acme.sh/acme.sh --issue -d $domain --standalone -k ec-256
- ~/.acme.sh/acme.sh --installcert -d $domain --fullchainpath /etc/v2ray/v2ray.crt --keypath /etc/v2ray/v2ray.key --ecc
- service squid start
- uuid=$(cat /proc/sys/kernel/random/uuid)
- cat> /etc/v2ray/config.json << END
- {
- "log": {
- "access": "/var/log/v2ray/access.log",
- "error": "/var/log/v2ray/error.log",
- "loglevel": "info"
- },
- "inbounds": [
- {
- "port": 8443,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": "${uuid}",
- "alterId": 2
- #tls
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "etc/v2ray/v2ray.crt",
- "keyFile": "/etc/v2ray/v2ray.key"
- }
- ]
- },
- "wsSettings": {
- "path": "/v2ray",
- "headers": {
- "Host": ""
- }
- },
- "quicSettings": {},
- "sockopt": {
- "mark": 0,
- "tcpFastOpen": true
- }
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "domain": "$domain"
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {}
- },
- {
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }
- ],
- "routing": {
- "rules": [
- {
- "type": "field",
- "ip": [
- "0.0.0.0/8",
- "10.0.0.0/8",
- "100.64.0.0/10",
- "169.254.0.0/16",
- "172.16.0.0/12",
- "192.0.0.0/24",
- "192.0.2.0/24",
- "192.168.0.0/16",
- "198.18.0.0/15",
- "198.51.100.0/24",
- "203.0.113.0/24",
- "::1/128",
- "fc00::/7",
- "fe80::/10"
- ],
- "outboundTag": "blocked"
- },
- {
- "type": "field",
- "outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ]
- }
- ]
- }
- }
- END
- cat> /etc/v2ray/none.json << END
- {
- "log": {
- "access": "/var/log/v2ray/access.log",
- "error": "/var/log/v2ray/error.log",
- "loglevel": "info"
- },
- "inbounds": [
- {
- "port": 80,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": "${uuid}",
- "alterId": 2
- #none
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": "/v2ray",
- "headers": {
- "Host": ""
- }
- },
- "quicSettings": {},
- "sockopt": {
- "mark": 0,
- "tcpFastOpen": true
- }
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "domain": "$domain"
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {}
- },
- {
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }
- ],
- "routing": {
- "rules": [
- {
- "type": "field",
- "ip": [
- "0.0.0.0/8",
- "10.0.0.0/8",
- "100.64.0.0/10",
- "169.254.0.0/16",
- "172.16.0.0/12",
- "192.0.0.0/24",
- "192.0.2.0/24",
- "192.168.0.0/16",
- "198.18.0.0/15",
- "198.51.100.0/24",
- "203.0.113.0/24",
- "::1/128",
- "fc00::/7",
- "fe80::/10"
- ],
- "outboundTag": "blocked"
- },
- {
- "type": "field",
- "outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ]
- }
- ]
- }
- }
- END
- cat> /etc/v2ray/vless.json << END
- {
- "log": {
- "access": "/var/log/v2ray/access2.log",
- "error": "/var/log/v2ray/error.log",
- "loglevel": "info"
- },
- "inbounds": [
- {
- "port": 2083,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "${uuid}"
- #tls
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "tlsSettings": {
- "certificates": [
- {
- "certificateFile": "etc/v2ray/v2ray.crt",
- "keyFile": "/etc/v2ray/v2ray.key"
- }
- ]
- },
- "wsSettings": {
- "path": "/v2ray",
- "headers": {
- "Host": ""
- }
- },
- "quicSettings": {},
- "sockopt": {
- "mark": 0,
- "tcpFastOpen": true
- }
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- }
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {}
- },
- {
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }
- ],
- "routing": {
- "rules": [
- {
- "type": "field",
- "ip": [
- "0.0.0.0/8",
- "10.0.0.0/8",
- "100.64.0.0/10",
- "169.254.0.0/16",
- "172.16.0.0/12",
- "192.0.0.0/24",
- "192.0.2.0/24",
- "192.168.0.0/16",
- "198.18.0.0/15",
- "198.51.100.0/24",
- "203.0.113.0/24",
- "::1/128",
- "fc00::/7",
- "fe80::/10"
- ],
- "outboundTag": "blocked"
- },
- {
- "type": "field",
- "outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ]
- }
- ]
- }
- }
- END
- cat> /etc/v2ray/vnone.json << END
- {
- "log": {
- "access": "/var/log/v2ray/access2.log",
- "error": "/var/log/v2ray/error.log",
- "loglevel": "info"
- },
- "inbounds": [
- {
- "port": 8880,
- "protocol": "vless",
- "settings": {
- "clients": [
- {
- "id": "${uuid}"
- #none
- }
- ],
- "decryption": "none"
- },
- "streamSettings": {
- "network": "ws",
- "wsSettings": {
- "path": "/v2ray",
- "headers": {
- "Host": ""
- }
- },
- "quicSettings": {},
- "sockopt": {
- "mark": 0,
- "tcpFastOpen": true
- }
- },
- "sniffing": {
- "enabled": true,
- "destOverride": [
- "http",
- "tls"
- ]
- },
- "domain": "$domain"
- }
- ],
- "outbounds": [
- {
- "protocol": "freedom",
- "settings": {}
- },
- {
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }
- ],
- "routing": {
- "rules": [
- {
- "type": "field",
- "ip": [
- "0.0.0.0/8",
- "10.0.0.0/8",
- "100.64.0.0/10",
- "169.254.0.0/16",
- "172.16.0.0/12",
- "192.0.0.0/24",
- "192.0.2.0/24",
- "192.168.0.0/16",
- "198.18.0.0/15",
- "198.51.100.0/24",
- "203.0.113.0/24",
- "::1/128",
- "fc00::/7",
- "fe80::/10"
- ],
- "outboundTag": "blocked"
- },
- {
- "type": "field",
- "outboundTag": "blocked",
- "protocol": [
- "bittorrent"
- ]
- }
- ]
- }
- }
- END
- cat <<EOF > /etc/trojan/config.json
- {
- "run_type": "server",
- "local_addr": "0.0.0.0",
- "local_port": 2087,
- "remote_addr": "127.0.0.1",
- "remote_port": 2603,
- "password": [
- "$uuid"
- ],
- "log_level": 1,
- "ssl": {
- "cert": "/etc/v2ray/v2ray.crt",
- "key": "/etc/v2ray/v2ray.key",
- "key_password": "",
- "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
- "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
- "prefer_server_cipher": true,
- "alpn": [
- "http/1.1"
- ],
- "reuse_session": true,
- "session_ticket": false,
- "session_timeout": 600,
- "plain_http_response": "",
- "curves": "",
- "dhparam": ""
- },
- "tcp": {
- "prefer_ipv4": false,
- "no_delay": true,
- "keep_alive": true,
- "reuse_port": false,
- "fast_open": false,
- "fast_open_qlen": 20
- },
- "mysql": {
- "enabled": false,
- "server_addr": "127.0.0.1",
- "server_port": 3306,
- "database": "trojan",
- "username": "trojan",
- "password": "",
- "key": "",
- "cert": "",
- "ca": ""
- }
- }
- EOF
- cat <<EOF> /etc/systemd/system/trojan.service
- [Unit]
- Description=Trojan
- Documentation=https://trojan-gfw.github.io/trojan/
- [Service]
- Type=simple
- ExecStart=/usr/local/bin/trojan -c /etc/trojan/config.json -l /var/log/trojan.log
- Type=simple
- KillMode=process
- Restart=no
- RestartSec=42s
- [Install]
- WantedBy=multi-user.target
- EOF
- cat <<EOF > /etc/trojan/uuid.txt
- $uuid
- EOF
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 2087 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 2083 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8880 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport 2087 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport 8443 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport 80 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport 2083 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport 8880 -j ACCEPT
- iptables-save > /etc/iptables.up.rules
- iptables-restore -t < /etc/iptables.up.rules
- netfilter-persistent save
- netfilter-persistent reload
- systemctl daemon-reload
- systemctl enable v2ray@none.service
- systemctl start v2ray@none.service
- systemctl enable v2ray@vless.service
- systemctl start v2ray@vlessservice
- systemctl enable v2ray@vnone.service
- systemctl start v2ray@vnone.service
- systemctl restart trojan
- systemctl enable trojan
- systemctl restart v2ray
- systemctl enable v2ray
- cd /usr/bin
- wget -O add-ws "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/add-ws.sh"
- wget -O add-vless "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/add-vless.sh"
- wget -O add-tr "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/add-tr.sh"
- wget -O del-ws "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/del-ws.sh"
- wget -O del-vless "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScripto/main/del-vless.sh"
- wget -O del-tr "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/del-tr.sh"
- wget -O cek-ws "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/cek-ws.sh"
- wget -O cek-vless "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/cek-vless.sh"
- wget -O cek-tr "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/cek-tr.sh"
- wget -O renew-ws "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/renew-ws.sh"
- wget -O renew-vless "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/renew-vless.sh"
- wget -O renew-tr "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/renew-tr.sh"
- wget -O certv2ray "https://raw.githubusercontent.com/EvoTeamMalaysia/AutoScript/main/cert.sh"
- chmod +x add-ws
- chmod +x add-vless
- chmod +x add-tr
- chmod +x del-ws
- chmod +x del-vless
- chmod +x del-tr
- chmod +x cek-ws
- chmod +x cek-vless
- chmod +x cek-tr
- chmod +x renew-ws
- chmod +x renew-vless
- chmod +x renew-tr
- chmod +x certv2ray
- cd
- rm -f ins-vt.sh
- mv /root/domain /etc/v2ray
|