我是刚开始使用强天鹅,所以我为这个初学者的查询道歉。我用强天鹅创建了Debian服务器。network_1: 192.168.10.0/24、network_2: 192.168.20.0/24和network_3 192.168.30.0/24通过Mikrotik路由器和IKEv2-PSK协议连接到该服务器。与这些网络一起,可以通过iOS协议和MSCHAP认证将windows、iOS、OSX和Android客户端连接到此服务器。所有这些都是没有问题的,每个连接的客户都可以访问这三个网络中的所有in。
此时,我想为MSCHAP-EAP客户端分配以下一些访问权限,例如:
客户端Bob/password1 1应该只能访问network2中的IP,而其他IP客户端Alice/password1 2不应该只能访问第二个网络中的IP地址范围192.168.20.100 - 150 -150,而其他IP客户端John/password1 3不应该只能访问IP地址范围192.168.30.50和192.168.10.150 -200以及IP地址192.168.20.44。
有人能帮我解决这个问题吗?理想情况下,参考解决方案…的任何示例
提前谢谢你
佩尔
发布于 2018-04-18 08:48:12
一种可能的方法是使用EAP-半径。radius服务器可以返回可以与信任匹配的Class属性( ipsec.conf中的against组或swanctl.conf中的组)。然后,您可以为每个组定义不同的本地流量选择器。IKev2/rw-eap-MD5-类-半径 strongSwan测试场景说明了这一点。
如果您不想或不能使用EAP-RADIUS,有一种方法可以匹配单个EAP标识,但这有点棘手,因为strongSwan不完全支持基于这些标识的连接切换。要做到这一点,必须使用与假组的虚拟连接。这就是在ipsec.conf中的样子:
conn eap-shared
# options shared by all clients e.g.
leftcert=...
# or
rightsourceip=...
# or
rightauth=eap-mschapv2
conn eap-init
also=eap-shared
# this config is used to do the EAP-Identity exchange and the
# authentication of client and server
eap_identity=%identity
# the following is used to force a connection switch after
# the authentication completed
rightgroups=<any string that is not used as group/class>
auto=add
conn eap-bob
also=eap-shared
eap_identity=bob@strongswan.org
# any options that only apply to this user follow here e.g.
leftsubnet=192.168.20.0/24
auto=add
conn eap-alice
also=eap-shared
eap_identity=alice@strongswan.org
# any options that only apply to this user follow here e.g.
# (note that ipsec.conf does not support ranges, and most kernel
# interfaces do neither, so a range might be converted to a larger
# subnet when installing IPsec policies, so deaggregating the range
# is the most accurate way to do this currently)
leftsubnet=192.168.20.100/30,192.168.20.104/29,192.168.20.112/28,192.168.20.128/28,192.168.20.144/30,192.168.20.148/31,192.168.20.150/32
auto=add
conn eap-john
also=eap-shared
eap_identity=john@strongswan.org
# any options that only apply to this user follow here e.g.
# (see above)
leftsubnet=192.168.30.10/31,192.168.30.12/30,192.168.30.16/28,192.168.30.32/28,192.168.30.48/31,192.168.30.50/32,192.168.10.150/31,192.168.10.152/29,192.168.10.160/27,192.168.10.192/29,192.168.10.200/32,192.168.20.44/32
auto=add对于EAP-RADIUS,配置看起来非常类似,但您不需要eap-init连接(而是将eap_identity=%identity添加到eap-shared),而不是在每个单独的连接中定义eap_identity,而是将rightgroups设置为应该使用该连接的组(即EAP-RADIUS类属性值)(即允许对多个用户使用相同的conn部分)。
发布于 2018-04-18 17:26:07
非常感谢你的回答。我会测试的。我的第一个想法是将mschap身份验证更改为eap,并对每个组使用不同的客户端证书和conn部分,但我不知道这是否是正确的方法。
发布于 2020-11-10 10:05:41
被接受的答案大多对我们有用,只是做了一点小小的改动。我们使用
conn %default
# Settings for all conn to inherit
# But we included this in our settings:
auto=add因此,上面接受的答案"conn共享“继承的"auto=add”破坏了这一点。ipsec.conf的默认“ipsec.conf”是"auto=ignore“,因此除非您设置了这个值,否则将使用默认设置。
一个修复方法是将"auto=add“从"conn % default”中删除,然后它变成默认的,另一个是将其更改为"auto=ignore",另一个是将"conn shared“更改为显式包含"auto=ignore”,而不包含任何其他设置,继承所有"conn %default“设置。然后在"conn init“中添加"auto=add”,并在每个连接之后添加“a=eap-shared”,并添加一行"auto=add“。
对于任何人来说,不太可能需要这一点,并且已经将"auto=add“设置为"conn %default”,但是如果您需要,我希望这会对您有所帮助。
谢谢@ecdsa ( https://serverfault.com/users/95913/ecdsa )您的回答;它对我有效,无需运行RADIUS或其他服务,现在windows用户可以保存他们的VPN密码。
将您的解决方案复制粘贴我们所做的更改:
conn %default
# All options shared on all connections, including
auto=add
conn eap-shared
# Because 'conn %default' has all settings shared between all conn, just:
auto=ignore
#And the rest is as-is, since the original already has 'auto=add' in each conn:
conn eap-init
also=eap-shared
# this config is used to do the EAP-Identity exchange and the
# authentication of client and server
eap_identity=%identity
# the following is used to force a connection switch after
# the authentication completed
rightgroups=<any string that is not used as group/class>
auto=add
conn eap-bob
also=eap-shared
eap_identity=bob@strongswan.org
# any options that only apply to this user follow here e.g.
leftsubnet=192.168.20.0/24
auto=add
conn eap-alice
also=eap-shared
eap_identity=alice@strongswan.org
# any options that only apply to this user follow here e.g.
# (note that ipsec.conf does not support ranges, and most kernel
# interfaces do neither, so a range might be converted to a larger
# subnet when installing IPsec policies, so deaggregating the range
# is the most accurate way to do this currently)
leftsubnet=192.168.20.100/30,192.168.20.104/29,192.168.20.112/28,192.168.20.128/28,192.168.20.144/30,192.168.20.148/31,192.168.20.150/32
auto=add
conn eap-john
also=eap-shared
eap_identity=john@strongswan.org
# any options that only apply to this user follow here e.g.
# (see above)
leftsubnet=192.168.30.10/31,192.168.30.12/30,192.168.30.16/28,192.168.30.32/28,192.168.30.48/31,192.168.30.50/32,192.168.10.150/31,192.168.10.152/29,192.168.10.160/27,192.168.10.192/29,192.168.10.200/32,192.168.20.44/32
auto=add再次感谢@ecdsa ( https://serverfault.com/users/95913/ecdsa )
https://serverfault.com/questions/908098
复制相似问题