Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 指定 cert 和 key, 而不是自动获取 #7

Open
iugo opened this issue Mar 26, 2022 · 2 comments
Open

feat: 指定 cert 和 key, 而不是自动获取 #7

iugo opened this issue Mar 26, 2022 · 2 comments

Comments

@iugo
Copy link

iugo commented Mar 26, 2022

支持自定义的难度不高, 但适用性可能更广:

两种可选方式:

  1. 从环境变量中获取 path.
  2. 从参数中获取 path. 比如 --plugin-opts "host=example.com;keypath=;certpath="

我在实际使用中, 使用同一个 非 root 帐号, 出现 Error: Permission denied (os error 13).

将 key 文件该为 rw 还是不行.


代码中有写会从环境变量中获取插件参数, 除了 acme_host 还支持 cert 和 key:

qtun/src/server.rs

Lines 70 to 84 in b7d0ce5

// parse environment variables
if let Ok((ss_local_addr, ss_remote_addr, ss_plugin_opts)) = args::parse_env() {
relay_addr = ss_local_addr;
listen_addr = ss_remote_addr;
if let Some(cert) = ss_plugin_opts.get("cert") {
cert_path = PathBuf::from(cert);
}
if let Some(key) = ss_plugin_opts.get("key") {
key_path = PathBuf::from(key);
}
if let Some(host) = ss_plugin_opts.get("acme_host") {
acme_host = Some(host.clone());
}
}

我尝试在 插件参数中 写 cert=/certpath, 没有起到作用. 可能是因为这个参数会在

key_path = PathBuf::new();
处被覆盖.

也许 #8 有所帮助.

@madeye
Copy link
Collaborator

madeye commented Mar 26, 2022

Don't specify acme host, if you want to set TLS cert keys and certs manually.

@iugo
Copy link
Author

iugo commented Apr 13, 2022

Don't specify acme host, if you want to set TLS cert keys and certs manually.

Only cert and key is available. But still got Error: Permission denied (os error 13).

After using the root account, it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants