@@ -4,7 +4,7 @@ export LANG=en_US
4
4
export LANGUAGE=en_US.UTF-8
5
5
6
6
branch=" vless"
7
- VERSION=" 2.1.6 "
7
+ VERSION=" 2.1.7 "
8
8
9
9
if [[ $( /usr/bin/id -u) -ne 0 ]]; then
10
10
sudoCmd=" sudo"
@@ -188,22 +188,6 @@ show_links() {
188
188
fi
189
189
}
190
190
191
- test_ipv4_conn () {
192
- local res=$( curl -L -s -w " %{http_code}" https://raw.githubusercontent.com/phlinhng/v2ray-tcp-tls-web/vless/LICENSE -o /dev/null)
193
- if [[ ${res} != " 200" ]]; then
194
- colorEcho ${YELLOW} " Can't access githubusercontent, try NAT64"
195
- ${sudoCmd} $( which cp) /etc/resolv.conf /etc/resolv.conf.bak
196
- ${sudoCmd} $( which rm) -rf /etc/resolv.conf
197
- ${sudoCmd} chattr -i /etc/resolv.conf 2> /dev/null
198
- echo " nameserver 2a01:4f8:c2c:123f::1" | ${sudoCmd} tee -a /etc/resolv.conf
199
- echo " nameserver 2a01:4f9:c010:3f02::1" | ${sudoCmd} tee -a /etc/resolv.conf
200
- echo " nameserver 2a00:1098:2b::1" | ${sudoCmd} tee -a /etc/resolv.conf
201
- echo " nameserver 2a00:1098:2c::1" | ${sudoCmd} tee -a /etc/resolv.conf
202
- ${sudoCmd} chattr +i /etc/resolv.conf
203
- colorEcho ${BLUE} " Nameserver successfully changed. The original settings was backuped as /etc/resolv.conf.bak"
204
- fi
205
- }
206
-
207
191
preinstall () {
208
192
# turning off selinux
209
193
${sudoCmd} setenforce 0 2> /dev/null
@@ -221,45 +205,31 @@ preinstall() {
221
205
222
206
${sudoCmd} ${PACKAGE_MANAGEMENT_INSTALL} jq -y
223
207
224
- test_ipv4_conn
225
-
226
208
# install jq mannualy if the package management didn't
227
209
if [[ ! " $( command -v jq) " ]]; then
228
210
echo " Fetching jq failed, trying manual installation"
229
211
${sudoCmd} curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/bin/jq
230
212
${sudoCmd} $( which chmod) +x /usr/bin/jq
231
213
fi
232
- }
233
214
234
- get_acmesh () {
235
- colorEcho ${BLUE} " Installing acme.sh"
236
215
curl -fsSL https://get.acme.sh | bash
237
216
}
238
217
239
- get_cert () {
218
+ get_cert_standalone () {
219
+ # use standalone mode to issue cert
240
220
colorEcho ${BLUE} " Issuing certificate"
241
- ~ /.acme.sh/acme.sh --issue -d " $1 " -w /var/www/html --keylength ec-256
242
-
243
- # install certificate
244
- colorEcho ${BLUE} " Installing certificate"
245
- ${sudoCmd} ~ /.acme.sh/acme.sh --install-cert --ecc --force -d " $1 " \
246
- --key-file /etc/ssl/v2ray/key.pem --fullchain-file /etc/ssl/v2ray/fullchain.pem \
247
- --reloadcmd " chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl restart v2ray"
221
+ ${sudoCmd} /root/.acme.sh/acme.sh --issue -d " $1 " --standalone --keylength ec-256
248
222
}
249
223
250
- get_cert_alt () {
251
- # use standalone mode to issue cert
252
- ${sudoCmd} stop caddy 2> /dev/null
224
+ get_cert () {
253
225
colorEcho ${BLUE} " Issuing certificate"
254
- ${sudoCmd} /root/ .acme.sh/acme.sh --issue -d " $1 " --standalone --keylength ec-256
226
+ ~ / .acme.sh/acme.sh --issue -d " $1 " -w /var/www/html --keylength ec-256
255
227
256
228
# install certificate
257
229
colorEcho ${BLUE} " Installing certificate"
258
- ${sudoCmd} /root/ .acme.sh/acme.sh --install-cert --ecc -d " $1 " \
230
+ ${sudoCmd} ~ / .acme.sh/acme.sh --install-cert --ecc --force -d " $1 " \
259
231
--key-file /etc/ssl/v2ray/key.pem --fullchain-file /etc/ssl/v2ray/fullchain.pem \
260
232
--reloadcmd " chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl restart v2ray"
261
-
262
- ${sudoCmd} restart caddy 2> /dev/null
263
233
}
264
234
265
235
get_trojan () {
@@ -744,44 +714,37 @@ fix_cert() {
744
714
745
715
local uuid=" $( read_json /usr/local/etc/v2ray/05_inbounds_vless.json ' .inbounds[0].settings.clients[0].id' ) "
746
716
local path=" $( read_json /usr/local/etc/v2ray/05_inbounds_ss.json ' .inbounds[0].streamSettings.wsSettings.path' ) "
717
+ local cf_node=" $( read_json /usr/local/etc/v2ray/05_inbounds_ss.json ' .inbounds[0].tag' ) "
718
+
719
+ ~ /.acme.sh/acme.sh --remove -d $( read_json /usr/local/etc/v2ray/05_inbounds_vless.json ' .inbounds[0].tag' ) _ecc --ecc
720
+ ${sudoCmd} $( which rm) -rf ~ /.acme.sh/$( read_json /usr/local/etc/v2ray/05_inbounds_vless.json ' .inbounds[0].tag' ) _ecc
747
721
748
- ${sudoCmd} $( which rm) -f /root/.acme.sh/$( read_json /usr/local/etc/v2ray/05_inbounds_vless.json ' .inbounds[0].tag' ) _ecc/$( read_json /usr/local/etc/v2ray/05_inbounds_vless.json ' .inbounds[0].tag' ) .key
722
+ colorEcho ${BLUE} " Re-setting v2ray"
723
+ set_v2ray " ${uuid} " " ${path} " " ${V2_DOMAIN} " " ${cf_node} "
749
724
750
725
colorEcho ${BLUE} " Re-setting caddy"
751
726
set_caddy " ${V2_DOMAIN} " " ${uuid} "
752
- ${sudoCmd} systemctl restart caddy 2> /dev/null
753
727
754
728
colorEcho ${BLUE} " Re-setting trojan-go"
755
729
set_trojan " ${uuid} " " ${path} tj" " ${V2_DOMAIN} "
756
- ${sudoCmd} systemctl restart trojan-go 2> /dev/null
757
730
758
- colorEcho ${BLUE} " Re-setting v2ray"
759
- # temporary cert
760
- ${sudoCmd} openssl req -new -newkey rsa:2048 -days 1 -nodes -x509 -subj " /C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=${V2_DOMAIN} " -keyout /etc/ssl/v2ray/key.pem -out /etc/ssl/v2ray/fullchain.pem
761
- ${sudoCmd} chmod 644 /etc/ssl/v2ray/key.pem
762
- ${sudoCmd} chmod 644 /etc/ssl/v2ray/fullchain.pem
731
+ colorEcho ${BLUE} " Re-issuing certificates for ${V2_DOMAIN} "
732
+ ${sudoCmd} systemctl stop caddy
733
+ get_cert_standalone " ${V2_DOMAIN} "
763
734
735
+ ${sudoCmd} systemctl restart caddy 2> /dev/null
736
+ ${sudoCmd} systemctl restart trojan-go 2> /dev/null
764
737
${sudoCmd} systemctl restart v2ray 2> /dev/null
765
-
766
- sleep 5
767
-
768
- colorEcho ${BLUE} " Re-issuing certificates for ${V2_DOMAIN} "
769
738
get_cert " ${V2_DOMAIN} "
770
739
771
740
write_json /usr/local/etc/v2ray/05_inbounds_vless.json " .inbounds[0].tag" " \" ${V2_DOMAIN} \" "
772
741
773
- if [ -f " /root /.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
742
+ if [ -f " ~ /.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
774
743
colorEcho ${GREEN} " 证书修复成功!"
775
744
show_links
776
745
else
777
- get_cert_alt " ${V2_DOMAIN} "
778
- if [ -f " /root/.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
779
- colorEcho ${GREEN} " 证书修复成功!"
780
- show_links
781
- else
782
- colorEcho ${RED} " 证书签发失败, 请重试"
783
- exit 1
784
- fi
746
+ colorEcho ${RED} " 证书签发失败, 请重试"
747
+ exit 1
785
748
fi
786
749
else
787
750
colorEcho ${YELLOW} " 请先安装 V2Ray"
@@ -831,14 +794,12 @@ install_v2ray() {
831
794
832
795
${sudoCmd} $( which mkdir) -p /etc/ssl/v2ray
833
796
834
- # temporary cert
835
- ${sudoCmd} openssl req -new -newkey rsa:2048 -days 1 -nodes -x509 -subj " /C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=${V2_DOMAIN} " -keyout /etc/ssl/v2ray/key.pem -out /etc/ssl/v2ray/fullchain.pem
836
- ${sudoCmd} $( which chmod) 644 /etc/ssl/v2ray/key.pem
837
- ${sudoCmd} $( which chmod) 644 /etc/ssl/v2ray/fullchain.pem
838
-
839
797
colorEcho ${BLUE} " Building dummy web site"
840
798
build_web
841
799
800
+ ${sudoCmd} systemctl stop caddy 2> /dev/null
801
+ get_cert_standalone " ${V2_DOMAIN} "
802
+
842
803
# activate services
843
804
colorEcho ${BLUE} " Activating services"
844
805
${sudoCmd} systemctl daemon-reload
@@ -856,28 +817,13 @@ install_v2ray() {
856
817
${sudoCmd} systemctl enable naive
857
818
${sudoCmd} systemctl restart naive 2> /dev/null
858
819
859
- sleep 5
860
-
861
- get_acmesh
862
-
863
- if [ -f " /usr/local/bin/v2ray" ]; then
864
- get_cert " ${V2_DOMAIN} "
865
- else
866
- colorEcho ${RED} " v2ray-core 下载失败, 可能会影响证书申请, 请先确保您的机器能访问 githubusercontent 再运行本脚本"
867
- exit 1
868
- fi
820
+ get_cert " ${V2_DOMAIN} "
869
821
870
- if [ -f " /root /.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
822
+ if [ -f " ~ /.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
871
823
colorEcho ${GREEN} " 安装 VLESS + VMess + Trojan + NaiveProxy 成功!"
872
824
show_links
873
825
else
874
- get_cert_alt " ${V2_DOMAIN} "
875
- if [ -f " /root/.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
876
- colorEcho ${GREEN} " 安装 VLESS + VMess + Trojan + NaiveProxy 成功!"
877
- show_links
878
- else
879
- colorEcho ${RED} " 证书签发失败, 请运行修复证书"
880
- fi
826
+ colorEcho ${RED} " 证书签发失败, 请运行修复证书"
881
827
fi
882
828
}
883
829
0 commit comments