Github:trojan
安装
按照官方 Wiki 安装 trojan
创建CA证书
先安装所需的工具:
1 | apt install gnutls-bin gnutls-doc |
创建 CA 模板文件 ca.tmpl,内容为(cn 与 organization 可以随便写,但是为了避免可能发生的问题,服务器证书的 cn 填 VPS 的 IP 或域名):
1 | cn = "ff" |
生成 CA 密钥:
1 | certtool --generate-privkey --outfile ca-key.pem |
生成 CA 证书:
1 | certtool --generate-self-signed --load-privkey ca-key.pem --template ca.tmpl --outfile ca-cert.pem |
创建服务器证书模板:
创建文件 server.tmpl,内容为:
1 | cn = "xxx.xxx.xxx.xxx" |
生成服务器证书密钥:
1 | certtool --generate-privkey --outfile server-key.pem |
生成服务器证书:
1 | certtool --generate-certificate --load-privkey server-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template server.tmpl --outfile server-cert.pem |
服务端配置文件:
1 | { |
需要修改的地方:
1 | "password": [ |
客户端配置文件:
1 | { |
需要修改的地方:
1 | "remote_addr": "你的 VPS 的 IP" |
运行:
通过 brew info trojan 可以查看