Openvpn

無法訪問 OpenVPN DNS /公共 IP URL

  • September 15, 2021

有沒有人在使用 OpenVPN 之前看到過這些錯誤。

Secure Connection Failed

An error occurred during a connection to openvpn.example.com. PR_END_OF_FILE_ERROR

   The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
   Please contact the website owners to inform them of this problem.

我查看了日誌文件:/var/log/ openvpnas.log,發現以下內容:

2021-09-14T19:58:23+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:58:23 2021 myip:11301 Connection reset, restarting [0]'
2021-09-14T19:58:23+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:58:23 2021 myip:11301 SIGUSR1[soft,connection-reset] received, client-instance restarting'
2021-09-14T19:59:13+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:59:13 2021 TCP connection established with [AF_INET]myip:10603'
2021-09-14T19:59:13+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:59:13 2021 Socket flags: TCP_NODELAY=1 succeeded'
2021-09-14T19:59:13+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:59:13 2021 myip:10603 WARNING: Bad encapsulated packet length from peer (5635), which must be > 0 and <= 1627 -- please ensure that --tun-mtu or -
-link-mtu is equal on both peers -- this condition could also indicate a possible active attack on the TCP link -- [Attempting restart...]'
2021-09-14T19:59:13+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:59:13 2021 myip:10603 Connection reset, restarting [0]'
2021-09-14T19:59:13+0000 [stdout#info] [OVPN 0] OUT: 'Tue Sep 14 19:59:13 2021 myip:10603 SIGUSR1[soft,connection-reset] received, client-instance restarting'

似乎我的請求是根據 GCP 日誌中的日誌將其發送到實例

{ insertId:“148f4tog64jclgg” jsonPay

load: {
connection: {
dest_ip: "*******"
dest_port: 443
protocol: 6
src_ip: "*********"
src_port: ****
}
disposition: "ALLOWED"
instance: {

但不知道為什麼它會被丟棄。有沒有人經歷過類似的?

我聯繫了 OpenVPN 支持團隊,他們能夠幫助確認根本原因並提供了解決方案。

您的證書或其配置有問題。它基本上告訴你出了什麼問題。

“錯誤”,“證書捆綁驗證錯誤:

$$ Errno 2 $$沒有這樣的文件或目錄:u’’: 看起來 cs.ca_bundle 的值是空的。配置密鑰要麼根本不存在(不設置為空),因此它回退到內置的自簽名證書,或者它應該包含指向包含 CA 包的文件的路徑,或者它應該包含CA 證書捆綁內嵌。但它不應該是空的,看起來它是空的。

“error”, “證書驗證錯誤:

$$ (‘PEM routines’, ‘get_name’, ’no start line’) $$:“錯誤”,“私鑰驗證錯誤:$$ (‘PEM routines’, ‘get_name’, ’no start line’) $$: 看起來您放入 cs.cert 和 cs.priv_key 值的任何內容都無效,或者它發現的任何內容都沒有 PEM 類型證書或私鑰應具有的正確起始行。

難怪網路界面不能正常工作。它沒有正確啟動所需的東西。我建議您將 Access Server 回滾到自簽名證書。這應該讓您的網路界面再次工作。然後努力放入正確有效的證書。

我相信本文件可以進一步幫助您: https ://openvpn.net/vpn-server-resource … rtificate/

特別是這些說明將生成自簽名證書並將其配置為在 Access Server 中使用(以 root 使用者身份執行命令):

Regenerate self-signed certificates (overwrites existing ones):
cd /usr/local/openvpn_as/scripts/
./certool -d /usr/local/openvpn_as/etc/web-ssl --type ca --unique --cn "OpenVPN Web CA"
./certool -d /usr/local/openvpn_as/etc/web-ssl --type server --remove_csr --sn_off --serial 1 --name server --cn vpn.example.com
./sacli start

從配置中刪除 Web 證書和密鑰(因此它回退到您剛剛創建的自簽名證書):

cd /usr/local/openvpn_as/scripts/
./sacli --key "cs.cert" ConfigDel
./sacli --key “cs.priv_key” ConfigDel
./sacli --key "cs.ca_bundle" ConfigDel
./sacli --key "cs.ca_key" ConfigDel

./sacli start

感謝@Johnan OVPN 社區在此處查看完整答案

引用自:https://serverfault.com/questions/1077578