首页 > 解决方案 > CentOS8下anyconnect vpn的问题(IPsec协议)

问题描述

在我的机构中,我们可以使用 VPN 访问我们的服务器。为此,我们获得了一个 PKCS #12 证书,我们将其命名为 johndoe.p12 和一个 anyconnect 配置文件,我们将其命名为 johndoe.xml,它看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<AnyConnectProfile xmlns="http://schemas.xmlsoap.org/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/encoding/ AnyConnectProfile.xsd">
    <ClientInitialization>
        <UseStartBeforeLogon UserControllable="false">false</UseStartBeforeLogon>
        <AutomaticCertSelection UserControllable="true">true</AutomaticCertSelection>
        <ShowPreConnectMessage>false</ShowPreConnectMessage>
        <CertificateStore>All</CertificateStore>
        <CertificateStoreOverride>false</CertificateStoreOverride>
        <ProxySettings>Native</ProxySettings>
        <AllowLocalProxyConnections>false</AllowLocalProxyConnections>
        <AuthenticationTimeout>12</AuthenticationTimeout>
        <AutoConnectOnStart UserControllable="false">false</AutoConnectOnStart>
        <MinimizeOnConnect UserControllable="true">false</MinimizeOnConnect>
        <LocalLanAccess UserControllable="false">false</LocalLanAccess>
        <ClearSmartcardPin UserControllable="true">true</ClearSmartcardPin>
        <AutoReconnect UserControllable="true">true
            <AutoReconnectBehavior UserControllable="false">DisconnectOnSuspend</AutoReconnectBehavior>
        </AutoReconnect>
        <AutoUpdate UserControllable="false">true</AutoUpdate>
        <RSASecurIDIntegration UserControllable="false">Automatic</RSASecurIDIntegration>
        <WindowsLogonEnforcement>SingleLocalLogon</WindowsLogonEnforcement>
        <WindowsVPNEstablishment>LocalUsersOnly</WindowsVPNEstablishment>
        <AutomaticVPNPolicy>false</AutomaticVPNPolicy>
        <PPPExclusion UserControllable="false">Disable
            <PPPExclusionServerIP UserControllable="false"></PPPExclusionServerIP>
        </PPPExclusion>
        <EnableScripting UserControllable="false">false</EnableScripting>
        <CertificateMatch>
            <DistinguishedName>
                <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled" MatchCase="Enabled">
                    <Name>O</Name>
                    <Pattern>University Hospital Jena</Pattern>
                </DistinguishedNameDefinition>
                <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled" MatchCase="Enabled">
                    <Name>OU</Name>
                    <Pattern>UKJatHome</Pattern>
                </DistinguishedNameDefinition>
                <DistinguishedNameDefinition Operator="Equal" Wildcard="Disabled" MatchCase="Enabled">
                    <Name>CN</Name>
                    <Pattern>ukj@home</Pattern>
                </DistinguishedNameDefinition>
                </DistinguishedName>
        </CertificateMatch>
        <EnableAutomaticServerSelection UserControllable="false">false
            <AutoServerSelectionImprovement>20</AutoServerSelectionImprovement>
            <AutoServerSelectionSuspendTime>4</AutoServerSelectionSuspendTime>
        </EnableAutomaticServerSelection>
        <RetainVpnOnLogoff>false
        </RetainVpnOnLogoff>
    </ClientInitialization>
    <ServerList>
        <HostEntry>
            <HostName>JohnDoeatHome</HostName>
            <HostAddress>vpnathome.organisation.de</HostAddress>
            <UserGroup>JohnDoeatHome</UserGroup>
        <PrimaryProtocol>IPsec</PrimaryProtocol>
        </HostEntry>
    </ServerList>
</AnyConnectProfile>

我使用 CentOS 版本 8.4.2105 和 Anyconnect 4.10.000093。每次我想连接时,我都会收到这两条消息(我猜第二条与第一条有关):

第一个:证书验证失败第二个:IPsec VPN 连接由于身份验证失败或超时而终止......

我搜索了有关证书的所有信息,但没有任何效果。我试图将证书包含在 firefox 捆绑包中(我在某个论坛中阅读过),这没问题,但我没有为 anyconnect 工作。

然后我厌倦了将证书添加到 CentOS,我将 *p12 转换为 *.pem 格式并将其复制到

/etc/pki/ca-trust/source/anchors/ /usr/share/pki/ca-trust-source/

连同命令:update-ca-trust

该证书是创建的捆绑包的一部分,但它对任何连接都没有帮助。

我最后一次尝试是openconnect。openconnect --protocol=anyconnect --xmlconfig=johndoe.xml --authgroup=JohnDoeatHome -k PKCS12 -c JohnDoe.p12 -u SECRET vpnathome.organisation.de

没有工作“登录失败”

我不知道如何进一步进行,感谢所有提示。如何将证书包含到 anyconnect 中。简介没问题。IPsec 协议会不会有问题?

标签: sslcertificatevpncentos8ipsec

解决方案


推荐阅读