AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题

问题[strongswan](computer)

Martin Hope
ppb
Asked: 2022-10-04 14:48:04 +0800 CST

Strongswan ipsec 隧道未与 AAA 服务器建立连接

  • 5

我有两个虚拟机

VM-1:我已经安装了 Strongswan 5.9。

VM-2:已安装 Strongswan 5.9,已安装freeradius(半径服务器)

我已经在两个 VM 上启动了 Strongswan systemctl start strongswan。

当我radtest <username> <password> <ipaddress> <NAS Port> <secretkey>从 VM-1 运行命令时,请求未经过 aaa 服务器的身份验证,但是当我停止时,strongswan.service我收到了Received Access-Accept来自 aaa 服务器的响应。

我的问题是为什么 VM-1 在活动时无法通信strongswan.service。我猜IPsec隧道没有建立。下面是我的swanctl.conf文件。任何人都可以在这里帮助我缺少什么。如何建立隧道并访问 AAA 服务器。

虚拟机-1

connections {

   conn1 {
    local_addrs  = x.x.x.83
    remote_addrs = x.x.x.171

    local {
     auth = psk
     id = x.x.x.83
    }
    remote {
       auth = psk
       id = x.x.x.171
    }
    children {
       vm1-to-aaa {
          local_ts  = x.x.x.83
          remote_ts = x.x.x.171

          start_action = trap
          esp_proposals = aes192gcm16-aes128gcm16-prfsha256-ecp256-modp3072,aes192-sha256-ecp256-modp3072,default
          mode = transport
       }
    }
    version = 2
    mobike = no
    reauth_time = 10800
    proposals = aes192gcm16-aes128gcm16-prfsha256-ecp256-ecp521,aes192-sha256- modp3072,default
 }
}

secrets {
  ike-1 {
    id-1 = x.x.x.83
    id-2 = x.x.x.171
    secret = "thisissecret"
 }
 }

虚拟机 - 2

  connections {

    conn2 {
     local_addrs  = x.x.x.171
     remote_addrs = x.x.x.83

     local {
       auth = psk
       id = x.x.x.171
    }
    remote {
       auth = psk
       id = x.x.x.83
    }
    children {
       aaa-to-vm1 {
          local_ts  = x.x.x.171
          remote_ts = x.x.x.83

          start_action = trap
          esp_proposals = aes192gcm16-aes128gcm16-prfsha256-ecp256-modp3072,aes192-sha256-ecp256-modp3072,default
          mode = transport
       }
    }
    version = 2
    mobike = no
    reauth_time = 10800
    proposals = aes192gcm16-aes128gcm16-prfsha256-ecp256-ecp521,aes192-sha256-modp3072,default
 }
 }

secrets {
  ike-1 {
    id-1 = x.x.x.171
    id-2 = x.x.x.83
    secret = "thisissecret"
 }
}

更新

当我启动命令swanctl -i conn1 -c vm1-to-aaa时,我得到 -

 [IKE] giving up after 5 retransmits
 [IKE] establishing IKE_SA failed, peer not responding
 initiate failed: establishing CHILD_SA 'vm1-to-aaa' failed

以下是我的防火墙设置 -

 public (active)
   target: default
   icmp-block-inversion: no
   interfaces: ens32
   sources:
   services: cockpit dhcpv6-client http https ipsec ssh
   ports: 443/tcp 8765/tcp 8088/tcp 1812/udp 1813/udp 500/udp  4500/udp
   protocols:
   forward: no
   masquerade: yes
   forward-ports:
   source-ports:
   icmp-blocks:
   rich rules:
     rule protocol value="ah" accept
     rule protocol value="esp" accept
ipsec strongswan
  • 1 个回答
  • 37 Views
Martin Hope
codezalot
Asked: 2022-04-15 05:56:57 +0800 CST

Pop_OS 21.10 上 strongSwan 的 DNS 问题

  • 5

我已strongswan-starter在 Pop!_OS 上安装以连接到我的工作场所。

我首先将它安装在 Ubuntu 上(一切运行良好),但决定切换到 Pop!_OS 21.10。

当我在 Pop!_OS 上连接到 VPN 时,我可以 ping 远程网络,但 DNS 无法正常工作。当我查看时,/etc/resolv.conf我可以看到尚未设置 DNS 名称服务器,所以这显然是 DNS 无法正常工作的原因。

在 Ubuntu 上,我必须resolvconf手动安装,然后重新启动strongswan-starter,然后我可以在/etc/resolv.conf.

在 Pop_OS 上!resolvconf已安装 nativley。重新启动resolvconf.service没有帮助。

有人知道如何让它发挥作用吗?

编辑:

这就是日志所说的(/var/log/syslog):

Apr 19 16:34:12 pop-os systemd[1]: Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
Apr 19 16:34:12 pop-os ipsec[2925]: Starting strongSwan 5.9.1 IPsec [starter]...
Apr 19 16:34:12 pop-os charon: 00[DMN] Starting IKE charon daemon (strongSwan 5.9.1, Linux 5.16.15-76051615-generic, x86_64)
Apr 19 16:34:12 pop-os charon: 00[CFG] loading ca certificates from '/etc/ipsec.d/cacerts'
Apr 19 16:34:12 pop-os charon: 00[CFG] loading aa certificates from '/etc/ipsec.d/aacerts'
Apr 19 16:34:12 pop-os charon: 00[CFG] loading ocsp signer certificates from '/etc/ipsec.d/ocspcerts'
Apr 19 16:34:12 pop-os charon: 00[CFG] loading attribute certificates from '/etc/ipsec.d/acerts'
Apr 19 16:34:12 pop-os charon: 00[CFG] loading crls from '/etc/ipsec.d/crls'
Apr 19 16:34:12 pop-os charon: 00[CFG] loading secrets from '/etc/ipsec.secrets'
Apr 19 16:34:12 pop-os charon: 00[CFG]   loaded ECDSA private key from '/etc/ipsec.d/private/user.key'
Apr 19 16:34:12 pop-os charon: 00[CFG] loaded 0 RADIUS server configurations
Apr 19 16:34:12 pop-os charon: 00[CFG] HA config misses local/remote address
Apr 19 16:34:12 pop-os charon: 00[LIB] loaded plugins: charon aesni aes rc2 sha2 sha1 md5 mgf1 random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp agent xcbc hmac gcm drbg attr kernel-netlink resolve socket-default connmark farp stroke updown eap-identity eap-aka eap-md5 eap-gtc eap-mschapv2 eap-dynamic eap-radius eap-tls eap-ttls eap-peap eap-tnc xauth-generic xauth-eap xauth-pam tnc-tnccs dhcp lookip error-notify certexpire led addrblock unity counters
Apr 19 16:34:12 pop-os charon: 00[LIB] dropped capabilities, running as uid 0, gid 0
Apr 19 16:34:12 pop-os charon: 00[JOB] spawning 16 worker threads
Apr 19 16:34:12 pop-os ipsec[2925]: charon (2928) started after 20 ms
Apr 19 16:34:12 pop-os charon: 04[CFG] received stroke: add connection 'roadw'
Apr 19 16:34:12 pop-os charon: 04[CFG]   loaded certificate "CN=user" from 'user.crt'
Apr 19 16:34:12 pop-os charon: 04[CFG]   loaded certificate "CN=rw.vpn.company.ch" from 'rw.vpn.company.ch.cert.pem'
Apr 19 16:34:12 pop-os charon: 04[CFG] added configuration 'roadw'
Apr 19 16:34:12 pop-os charon: 06[CFG] received stroke: route 'roadw'
Apr 19 16:34:12 pop-os ipsec[2925]: 'roadw' routed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_declaration_parse_list_from_buf: assertion 'parser' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_declaration_parse_list_from_buf: assertion 'parser' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345503cde0 Gjs_pop-cosmic_system76_com_applications_CosmicAppDisplay.cosmic-app-display:insensitive] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345609a8b0 StViewport:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345503cde0 Gjs_pop-cosmic_system76_com_applications_CosmicAppDisplay.cosmic-app-display:insensitive] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345609a8b0 StViewport:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345068dc40 Gjs_pop-cosmic_system76_com_applications_CosmicFolderButton.app-well-app cosmic-base-folder-button ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345503cde0 Gjs_pop-cosmic_system76_com_applications_CosmicAppDisplay.cosmic-app-display:insensitive] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345609a8b0 StViewport:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345068dc40 Gjs_pop-cosmic_system76_com_applications_CosmicFolderButton.app-well-app cosmic-base-folder-button ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x5634503bc420 Gjs_ui_iconGrid_BaseIcon.overview-icon overview-icon-with-label:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345503cde0 Gjs_pop-cosmic_system76_com_applications_CosmicAppDisplay.cosmic-app-display:insensitive] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345609a8b0 StViewport:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345068dc40 Gjs_pop-cosmic_system76_com_applications_CosmicFolderButton.app-well-app cosmic-base-folder-button ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x5634503bc420 Gjs_ui_iconGrid_BaseIcon.overview-icon overview-icon-with-label:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x563451883710 StBoxLayout:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345503cde0 Gjs_pop-cosmic_system76_com_applications_CosmicAppDisplay.cosmic-app-display:insensitive] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345609a8b0 StViewport:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x56345068dc40 Gjs_pop-cosmic_system76_com_applications_CosmicFolderButton.app-well-app cosmic-base-folder-button ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x5634503bc420 Gjs_ui_iconGrid_BaseIcon.overview-icon overview-icon-with-label:insensitive ("Library Home")] which is not in the stage.
Apr 19 16:34:20 pop-os gnome-shell[1540]: st_widget_get_theme_node called on the widget [0x563451883710 StBoxLayout:insensitive ("Library Home")] which is not in the stage.
...

我假设相关的日志条目是这些,因为这些是第一个失败的(并且它们不会出现在另一个运行具有相同 VPN 配置的 Ubuntu 的系统上):

Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_declaration_parse_list_from_buf: assertion 'parser' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_parser_new_from_buf: assertion 'a_buf && a_len' failed
Apr 19 16:34:20 pop-os gnome-shell[1540]: cr_declaration_parse_list_from_buf: assertion 'parser' failed
strongswan pop-os
  • 1 个回答
  • 375 Views
Martin Hope
Helngard
Asked: 2020-08-20 11:10:08 +0800 CST

IPSec nftables strongswan

  • 5

如何将 nftables 配置为仅允许入站 ipsec 流量和解密后的处理规则。我有 nftable.conf:

#!/sbin/nft -f

flush ruleset

# ----- IPv4 -----
table ip filter {
    chain input {
        type filter hook input priority 0; policy drop;
        ct state invalid counter drop comment "early drop of invalid packets"
        ct state {established, related} counter accept comment "accept all connections related to connections made by us"
        iif lo accept comment "accept loopback"
        iif != lo ip daddr 127.0.0.1/8 counter drop comment "drop connections to loopback not coming from loopback"
        ip protocol icmp icmp type echo-request counter accept comment "accept ICMP echo-request types"

        # Accept SSH incoming traffic
        tcp dport ssh counter accept comment "accept SSH"

        # Accept IPsec traffic
        udp dport { isakmp, ipsec-nat-t } counter accept comment "accept ISAKMP and IPsec NAT traversal"
        ip protocol { ah, esp } counter accept comment "accept AH and ESP"

        counter comment "count dropped packets"
    }

    chain forward {
        type filter hook forward priority 0; policy drop;
        counter comment "count dropped packets"
    }

    # If you're not counting packets, this chain can be omitted.
    chain output {
        type filter hook output priority 0; policy accept;
        counter comment "count accepted packets"
    }
}


# ----- IPv6 -----
table ip6 filter {
    chain input {
        type filter hook input priority 0; policy drop;
        ct state invalid counter drop comment "early drop of invalid packets"
        ct state {established, related} counter accept comment "accept all connections related to connections made by us"
        iif lo accept comment "accept loopback"
        iif != lo ip6 daddr ::1/128 counter drop comment "drop connections to loopback not coming from loopback"
        counter comment "count dropped packets"
    }

    chain forward {
        type filter hook forward priority 0; policy drop;
        counter comment "count dropped packets"
    }

    # If you're not counting packets, this chain can be omitted.
    chain output {
        type filter hook output priority 0; policy accept;
        counter comment "count accepted packets"
    }
}

IPSec 配置了 StrongSwan,添加规则后 ping 通:

ip protocol icmp icmp type echo-request counter accept comment "accept ICMP echo-request types"
ipsec strongswan
  • 1 个回答
  • 2027 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve