From c86b1e54a6653666feefd8e0c44ab494d5606024 Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Wed, 31 Dec 2025 01:10:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9tls=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AD=98=E6=94=BE=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/gen_self_tls.sh | 7 ++++--- config/template/self_cert_config.json | 6 +++--- config/template/tls_cert_config.json | 2 +- docker-compose.yml | 4 +--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/gen_self_tls.sh b/bin/gen_self_tls.sh index 5ae1075..306da35 100644 --- a/bin/gen_self_tls.sh +++ b/bin/gen_self_tls.sh @@ -4,13 +4,13 @@ gen_self_tls() { local domain="${1:-bing.com}" local script_dir="$(dirname "$(realpath "$0")")" - local key_dir="$script_dir/../key" - local config_file="$script_dir/../config/config.json" + local key_dir="$script_dir/../tls/self-tls" # 导入utils文件夹中的jq_util.sh脚本 source "$script_dir/utils/jq_util.sh" - + # 生成自签名证书 + mkdir -p "$key_dir" openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) \ -keyout "$key_dir/server.key" \ -out "$key_dir/server.crt" \ @@ -18,6 +18,7 @@ gen_self_tls() { -days 36500 # 更新config.json文件中的域名信息 + local config_file="$script_dir/../config/config.json" modify_json_file "$config_file" "masquerade.proxy.url" "https://$domain" } diff --git a/config/template/self_cert_config.json b/config/template/self_cert_config.json index fe9e44c..e56abc5 100644 --- a/config/template/self_cert_config.json +++ b/config/template/self_cert_config.json @@ -1,8 +1,8 @@ { "listen": ":8004", "tls": { - "cert": "/etc/hysteria/server.crt", - "key": "/etc/hysteria/server.key" + "cert": "/tls/self-tls/server.crt", + "key": "/tls/self-tls/server.key" }, "auth": { "type": "password", @@ -11,7 +11,7 @@ "obfs": { "type": "salamander", "salamander": { - "password": "bLa4AdWOoE57OdtwYa" + "password": "你的混淆密码" } }, "masquerade": { diff --git a/config/template/tls_cert_config.json b/config/template/tls_cert_config.json index 8b74a84..538edf4 100644 --- a/config/template/tls_cert_config.json +++ b/config/template/tls_cert_config.json @@ -5,7 +5,7 @@ "你的域名" ], "email": "你的邮箱", - "dir":"/acme", + "dir":"/tls/acme", "type": "dns", "dns": { "name": "cloudflare", diff --git a/docker-compose.yml b/docker-compose.yml index c403b3a..a85223d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,9 +5,7 @@ services: restart: always network_mode: "host" volumes: - - ./acme:/acme + - ./tls:/tls - ./config/config.json:/etc/hysteria/config.json - - ./key/server.crt:/etc/hysteria/server.crt - - ./key/server.key:/etc/hysteria/server.key command: ["server", "-c", "/etc/hysteria/config.json"] \ No newline at end of file