假设使用有效证书(例如日期等)进行双向密钥对身份验证,没有 tls-crypt,没有 CRL,也没有对通用名称进行检查。
这也是使用私有 CA 而不是公共 CA 的原因吗?
假设使用有效证书(例如日期等)进行双向密钥对身份验证,没有 tls-crypt,没有 CRL,也没有对通用名称进行检查。
这也是使用私有 CA 而不是公共 CA 的原因吗?
我希望所有的互联网流量都通过 VPN,除了少数网站(例如,这样我可以正常流式传输节目,但通过 VPN 运行其他内容)。
我的 VPN 提供商为我提供了一个 .ovnp 文件。我应该很快提到我患有纤维肌痛并且无法正常思考。因此,我盲目地将中间某处逐字添加到以下 ovnp 文件中,这是我从其他线程获得的。
allow-pull-fqdn
route www.netflix.com 255.255.255.255 net_gateway
route www.disneyplus.com 255.255.255.255 net_gateway
route www.primevideo.com 255.255.255.255 net_gateway
但可惜的是,当我访问列出的网站时,我可以看到我通过了 VPN,因为它们的行为不正确,缺少显示或根本无法加载(而当我不使用 VPN 时,它们就很好) 。希望不是因为这些域有多个 ip 或其他原因。我正在运行 arch linux。文件中是否有一个特殊的位置需要放置我的块?该文件看起来像这样(我认为这些文件无论如何都是公开的,但我删除了密钥):
client
dev tun
proto udp
remote 89.47.234.171 1194
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0
comp-lzo no
<-- I tried here
remote-cert-tls server
auth-user-pass
verb 3
pull
fast-io
cipher AES-256-CBC
auth SHA512
<ca>
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
...
-----END OpenVPN Static key V1-----
</tls-auth>
我已经在我的服务器上设置了 OpenVPN 服务,使用用户名和密码身份验证,并且不需要客户端证书。
我已经在/etc/passwd和/etc/shadow中设置了用户名和密码。现在,与 OpenVPN 的特定用户(即client1)连接是可以的,但我尝试过root(linux 用户),也可以连接。
问题是,是否有办法为 OpenVPN 存储这些用户而不是 passwd?我认为这太危险了,或者其他任何组(在 /etc/gourp 中为 OpenVPN 创建一个组)来限制它们?
服务器配置文件
port 20487
proto udp
dev tun
;dev-node MyTap
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/log/openvpn/ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 1.0.0.1"
push "dhcp-option DNS 1.1.1.1"
duplicate-cn
keepalive 10 120
tls-crypt ta.key 0 # This file is secret
data-ciphers AES-256-GCM
data-ciphers-fallback AES-256-GCM
max-clients 24
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
log /var/log/openvpn/openvpn.log
verb 5
explicit-exit-notify 1
plugin openvpn-plugin-auth-pam.so login
verify-client-cert none
username-as-common-name
script-security 2
客户端.ovpn
client
dev tun
proto udp
remote [destnation] 20487
auth-user-pass
#verify-client-cert none
#username-as-common-name
data-ciphers-fallback AES-256-GCM
data-ciphers AES-256-GCM
<ca>
-----BEGIN CERTIFICATE-----
ca.crt
-----END CERTIFICATE-----
</ca>
<tls-crypt>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
ta.key
-----END OpenVPN Static key V1-----
</tls-crypt>
/etc/密码
root:x:0:0:root:/root:/bin/bash
***
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
***
client1:x:1001:65534::/nonexistent:/usr/sbin/nologin
/etc/影子
root:$y$*:19532:0:99999:7:::
***
nobody:*:19172:0:99999:7:::
***
client1:$y$j9T$K0ubESGFtXD2Imra5pMVJ/$ZUM2HNYn.0X9smrtKEAdgjIclQIdcURbI4xxlTU6tHB:19532:0:99999:7:::
要为具有不同证书的客户端设置静态 IP,我们可以按照jdmorei 的回答为客户端设置静态 IP 。但是,如果duplicate-cn
在服务器端设置,那么许多客户端共享同一个证书,如何为特定客户端设置静态 IP?
openvpnas.service - OpenVPN Access Server
Loaded: loaded (/lib/systemd/system/openvpnas.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-04-10 09:28:12 UTC; 5h 2min ago
Main PID: 14649 (python3)
Tasks: 13 (limit: 1081)
Memory: 199.1M
CGroup: /system.slice/openvpnas.service
├─14649 python3 -c from pyovpn.sagent.sagent_entry import openvpnas ; openvpnas() --nodaemon --logfile=>
├─14667 /usr/bin/python3 -c from pyovpn.cserv.wserv_entry import start ; start() -no -u openvpn_as -g o>
├─14668 /usr/bin/python3 -c from pyovpn.log.logworker import start ; start()
├─14680 /usr/bin/python3 -c from pyovpn.sagent.iptworker import start6 ; start6()
├─14682 /usr/bin/python3 -c from pyovpn.sagent.iptworker import start ; start()
├─14686 openvpn-openssl --errors-to-stderr --config stdin
├─14689 openvpn-openssl --errors-to-stderr --config stdin
├─14696 openvpn-openssl --errors-to-stderr --config stdin
├─14698 openvpn-openssl --errors-to-stderr --config stdin
├─14704 openvpn-openssl --errors-to-stderr --config stdin
├─14713 openvpn-openssl --errors-to-stderr --config stdin
└─14718 iptables-restore -n
为什么即使openvpn运行良好我也会收到这些错误
我在我的 Windows 11 机器的目录中安装了一个 OpenVPN 配置文件config-auto
,以便它在启动时连接到我的 OpenVPN 服务器。
问题是有时在系统启动时,它开始无法连接:
2022-03-11 09:27:38 [server] Inactivity timeout (--ping-restart), restarting
2022-03-11 09:27:38 SIGUSR1[soft,ping-restart] received, process restarting
2022-03-11 09:27:38 Restart pause, 5 second(s)
2022-03-11 09:27:43 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 09:27:43 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 09:27:43 TCP/UDP: Preserving recently used remote address: [AF_INET]<REDACTED>:1194
2022-03-11 09:27:43 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-03-11 09:27:43 UDP link local: (not bound)
2022-03-11 09:27:43 UDP link remote: [AF_INET]<REDACTED>:1194
2022-03-11 09:28:43 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
2022-03-11 09:28:43 TLS Error: TLS handshake failed
2022-03-11 09:28:43 SIGUSR1[soft,tls-error] received, process restarting
好像没有互联网连接,但是您可以看到我的以太网接口已启动并连接到互联网:
一切都开始正常工作:
2022-03-11 09:28:43 TLS Error: TLS handshake failed
2022-03-11 09:28:43 SIGUSR1[soft,tls-error] received, process restarting
2022-03-11 10:16:36 NOTE: --user option is not implemented on Windows
2022-03-11 10:16:36 NOTE: --group option is not implemented on Windows
2022-03-11 10:16:36 WARNING: Compression for receiving enabled. Compression has been used in the past to break encryption. Sent packets are not compressed unless "allow-compression yes" is also set.
2022-03-11 10:16:36 DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
2022-03-11 10:16:36 OpenVPN 2.5.5 Windows-MSVC [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Dec 15 2021
2022-03-11 10:16:36 Windows version 10.0 (Windows 10 or greater) 64bit
2022-03-11 10:16:36 library versions: OpenSSL 1.1.1l 24 Aug 2021, LZO 2.10
2022-03-11 10:16:36 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 10:16:36 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2022-03-11 10:16:36 TCP/UDP: Preserving recently used remote address: [AF_INET]<REDACTED>:1194
2022-03-11 10:16:36 Socket Buffers: R=[65536->65536] S=[65536->65536]
2022-03-11 10:16:36 UDP link local: (not bound)
2022-03-11 10:16:36 UDP link remote: [AF_INET]<REDACTED>:1194
2022-03-11 10:16:36 TLS: Initial packet from [AF_INET]<REDACTED>:1194, sid=7818afbf 7c74fa3b
2022-03-11 10:16:36 VERIFY OK: depth=1, <REDACTED>
2022-03-11 10:16:36 VERIFY KU OK
2022-03-11 10:16:36 Validating certificate extended key usage
2022-03-11 10:16:36 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
我想,这是我的 OpenVPN 和以太网接口之间的某种竞争条件。我尝试InterfaceMetric
为我的以太网接口减少并为 OpenVPN 接口增加它无济于事:
Get-NetIPInterface
ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore
------- -------------- ------------- ------------ --------------- ---- --------------- -----------
29 vEthernet (WSL) IPv6 1500 15 Enabled Connected ActiveStore
12 Ethernet 3 IPv6 1500 5 Disabled Disconnected ActiveStore
10 Local Area Connection* 2 IPv6 1500 25 Disabled Disconnected ActiveStore
24 Ethernet IPv6 1500 6 Enabled Connected ActiveStore
22 Local Area Connection* 1 IPv6 1500 25 Disabled Disconnected ActiveStore
23 OpenVPN IPv6 1500 25 Enabled Connected ActiveStore
8 Ethernet 2 IPv6 1500 5 Disabled Disconnected ActiveStore
13 OpenVPN Wintun IPv6 65535 5 Disabled Disconnected ActiveStore
1 Loopback Pseudo-Interface 1 IPv6 4294967295 75 Disabled Connected ActiveStore
29 vEthernet (WSL) IPv4 1500 15 Disabled Connected ActiveStore
12 Ethernet 3 IPv4 1500 5 Enabled Disconnected ActiveStore
10 Local Area Connection* 2 IPv4 1500 25 Enabled Disconnected ActiveStore
24 Ethernet IPv4 1500 1 Enabled Connected ActiveStore
22 Local Area Connection* 1 IPv4 1500 25 Enabled Disconnected ActiveStore
23 OpenVPN IPv4 1500 100 Enabled Connected ActiveStore
8 Ethernet 2 IPv4 1500 5 Enabled Disconnected ActiveStore
13 OpenVPN Wintun IPv4 65535 5 Disabled Disconnected ActiveStore
1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore
我还尝试在 OpenVPN 服务上设置恢复策略,但似乎 Windows 不会将无法连接的 OpenVPN 服务视为损坏,因此不会重新启动它:
同样,它只发生五分之一的靴子,大部分时间它工作正常。
搜索了整个互联网,但找不到其他人有这个问题。
我在 Docker Swarm 集群中有两个节点。其中一个节点与接口上的 VPN 提供商有一个 OpenVPN 客户端连接tun0
。我的目标是,
对于 DNS,我添加了一个dns
条目,/etc/docker/daemon.json
该条目使用只能通过 VPN 访问的 VPN 提供商的 DNS 服务器。
以下是我想出的 iptable 规则:
iptables -I DOCKER-USER 1 -o tun0 -j ACCEPT
iptables -I DOCKER-USER 2 -i tun0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I DOCKER-USER 3 -j DROP
生成的DOCKER-USER
链如下所示:
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * tun0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- tun0 * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
nslookup
从运行和打开和关闭 VPN 连接等基本测试来看curl
,这些规则似乎有效,但我对 iptables 的经验很少。这是这样做的正确方法吗?
问题:
当我尝试在我的 Oracle 19c 数据库上通过 OpenVPN 运行收集统计信息时,如果运行超过一定时间,SQL Developer 不会返回典型的“PL/SQL 过程已成功完成”消息。
显然,连接会在一段时间后挂起,我要么需要断开与 OpenVPN 的连接,要么需要在 Windows 任务管理器中杀死 SQL Developer 以关闭它。
我的 Oracle 19c 数据库和 OpenVPN 服务器位于不同的云提供商上。
在此数据库上运行收集统计信息通常需要大约半小时。
我检查了什么:
OpenVPN 服务器上的 Iptables 和 OpenVPN 日志或 Oracle 19c 服务器上的侦听器和警报日志上没有任何异常。
net.ipv4.tcp_keepalive_time 和 net.netfilter.nf_conntrack_tcp_timeout_established 在两台机器上都设置为它们的默认值 7200(2 小时)和 432000(5 天)。
如果我以系统身份连接到数据库并运行:
选择 x.sid, x.serial#, x.username, x.status, x.osuser, x.machine, x.program, x.event, x.state, sql.sql_text from v$sqlarea sql, v$session x 其中 x.sql_hash_value = sql.hash_value 和 x.sql_address = sql.address 和 x.username = 'myuser';
大约半小时后,我注意到收集统计信息的会话处于非活动状态。所以我假设收集统计信息确实运行并成功完成,但只是不返回上述输出消息。
我尝试了什么:
在同一实例中的较小数据库上,通过 OpenVPN 运行收集统计信息会返回上述成功消息。这个大约需要 10 分钟。
通过将我的 IP 地址添加到云提供商的防火墙并运行收集统计信息来直接(不使用 OpenVPN)连接到数据库也会返回上述成功消息。
在 Oracle 19c 服务器上生成 SSH 公钥/私钥对并在 SQL Developer 上使用 SSH 主机,但连接非常不稳定/总是在重置。
设置 Dante 代理服务器。显然,SQL Developer 只能使用某种特殊的代理服务器。
使用 StrongSwan 设置 IPSEC VPN。由于某种原因,我的 Windows 10 无法与其建立连接。
我的问题是我无法连接到我的 OpenVPN 服务器。我总是收到“TLS 密钥协商未能在 60 秒内发生(检查您的网络连接)”错误。尝试连接服务器上的端口 1194 时运行 tcpdump 显示来自我的 PC 的 4 个数据包。
我在 /etc/openvpn/server 中的 server.conf:
# OpenVPN Port, Protocol, and the Tun
port 1194
proto udp
dev tun
#listen
local *my DNS*
# OpenVPN Server Certificate - CA, server key and certificate
ca /etc/openvpn/server/ca.crt
cert /etc/openvpn/server/*cert*.crt
key /etc/openvpn/server/*key*.key
#DH and CRL key
dh /etc/openvpn/server/dh.pem
crl-verify /etc/openvpn/server/crl.pem
# Network Configuration - Internal network
# Redirect all Connection through OpenVPN Server
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1"
# Using the DNS from https://dns.watch
push "dhcp-option DNS 84.200.69.80"
push "dhcp-option DNS 84.200.70.40"
#Enable multiple clients to connect with the same certificate key
duplicate-cn
# TLS Security
cipher AES-256-CBC
tls-version-min 1.0
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256
auth SHA512
auth-nocache
# Other Configuration
keepalive 20 60
persist-key
persist-tun
compress lz4
daemon
user nobody
group nobody
# OpenVPN Log
log-append /var/log/openvpn.log
verb 4
我的 Windows 客户端上的 client.ovpn:
client
dev tun
proto udp
remote *my DNS* 1194
ca "c:\\Users\\*Username*\\Documents\\OpenVPNFiles\\Client1\\client\\ca.crt"
cert "c:\\Users\\*Username*\\Documents\\OpenVPNFiles\\Client1\\client\\*cert*.crt"
key "c:\\Users\\*Username*\\Documents\\OpenVPNFiles\\Client1\\client\\*key*.key"
cipher AES-256-CBC
auth SHA512
auth-nocache
tls-version-min 1.0
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256
remote-cert-tls server
resolv-retry infinite
compress lz4
nobind
persist-key
persist-tun
mute-replay-warnings
verb 4
非常感谢任何帮助。