首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Ubuntu上配置Netplan以安全地存储802.1x凭据?

如何在Ubuntu上配置Netplan以安全地存储802.1x凭据?
EN

Ask Ubuntu用户
提问于 2019-03-09 00:22:29
回答 2查看 9.8K关注 0票数 5

在802.1x企业网络中,我可以使用NetworkManager配置802.1x参数,包括密码。这一切都能工作,但需要将密码存储在明文中。

我们试图使用Netplan来更安全地存储凭据(作为散列密码),但不能使802.1x连接进行身份验证。

我还没有找到构建包含802.1x凭据的Netplan配置的好指南。

(更新: Netplan中有一个关于散列密码( https://github.com/CanonicalLtd/netplan/pull/78)的错误,这似乎是主要问题)

以下是一个无法工作的文件

代码语言:javascript
复制
network: 
  version: 2
  renderer: networkd
  ethernets: 
    enp0s31f6:
      auth:
        key-management: 802.1x
        password: hash:some-stuff-here
        method: peap
        identity: ghewett
      dhcp4: false
      addresses:
        - 1.2.3.4
      gateway4: 5.6.7.8
      nameservers:
        search: [cisco.com, otherdomain]
        addresses:
          - 1.1.1.1
          - 2.2.2.2

(IP和凭据已更改)

这给了我们

代码语言:javascript
复制
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:19354): DEBUG: 09:23:41.614: Processing input file /etc/netplan/01-netcfg.yaml..
** (generate:19354): DEBUG: 09:23:41.614: starting new processing pass
Error in network definition /etc/netplan/01-netcfg.yaml line 7 column 6: unknown key auth
EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2019-03-09 01:12:13

请参阅https://netplan.io/exampleshttps://netplan.io站点一般都有很好的信息。确保sudo netplan --debug generate检查.yaml文件,并生成配置文件,然后使用sudo netplan apply使它们处于活动状态。

代码语言:javascript
复制
Authentication

Netplan supports advanced authentication settings for ethernet and wifi interfaces, as well as individual wifi networks, by means of the auth block.

auth (mapping)

    Specifies authentication settings for a device of type ethernets:, or an access-points: entry on a wifis: device.

    The auth block supports the following properties:

    key-management (scalar)
        The supported key management modes are none (no key management); psk (WPA with pre-shared key, common for home wifi); eap (WPA with EAP, common for enterprise wifi); and 802.1x (used primarily for wired Ethernet connections).
    password (scalar)
        The password string for EAP, or the pre-shared key for WPA-PSK.

    The following properties can be used if key-management is eap or 802.1x:

    method (scalar)
        The EAP method to use. The supported EAP methods are tls (TLS), peap (Protected EAP), and ttls (Tunneled TLS).
    identity (scalar)
        The identity to use for EAP.
    anonymous-identity (scalar)
        The identity to pass over the unencrypted channel if the chosen EAP method supports passing a different tunnelled identity.
    ca-certificate (scalar)
        Path to a file with one or more trusted certificate authority (CA) certificates.
    client-certificate (scalar)
        Path to a file containing the certificate to be used by the client during authentication.
    client-key (scalar)
        Path to a file containing the private key corresponding to client-certificate.
    client-key-password (scalar)
        Password to use to decrypt the private key specified in client-key if it is encrypted.

来源:https://netplan.io/reference#authentication

更新#1:

注意:确保您的.yaml文件中没有选项卡.

加入你的证书,恢复IP,然后试试这个.

代码语言:javascript
复制
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s31f6:
      auth:
        key-management: 802.1x
        method: peap
        identity: "ghewett@example.com"
        ca-certificate: my_ca.pem
        client-certificate: my_cert.pem
        client-key: my_key.pem
      addresses:
        - 1.2.3.4
      gateway4: 5.6.7.8
      nameservers:
        search: [cisco.com, otherdomain]
        addresses:
          - 1.1.1.1
          - 2.2.2.2
票数 2
EN

Ask Ubuntu用户

发布于 2019-03-15 04:59:31

Ubuntu18.04.02附带的默认网络计划不支持有线身份验证,因此不可能工作。github上的最新版本在2019年3月初确实支持身份验证,但它缺少所需的其他内容。WPA请求者需要一个CLI标志来使用有线驱动程序来工作,我编写了一个PR来将它添加到netplan中。Netplan还以破解密码的方式处理散列密码,因此还有另一个PR来解决这个问题。

如果您想尝试这些,PR,说明如下:

  1. 安装Ubuntu 18.04.02的服务器
  2. 安装求助者
    • sudo apt安装wpasupplicant“

  3. 用安装所需的构建工具
    • sudo apt安装使cpp pkg-config libyaml-dev uuid-dev libgio2.0- pandoc libglib2.0-dev pandoc

  4. 使用获取修补的netplan软件

  5. 用构建并安装它
    • 制作
    • sudo make安装

  6. 生成密码的散列版本
    • echo -n 'MyPassword‘iconv -t UTF-16-n> openssl md4 -binary \ xxd -p
    • 历史-c

  7. 编辑netplan配置文件
    • cd /etc/netplan
    • 数独mv 50云-init.yaml config.yaml
    • sudo emacs /etc/netplan/config.yaml

  8. 让它看起来像:
代码语言:javascript
复制
network:
    version: 2
    ethernets:
        enp0s31f6:
            dhcp4: true
            optional: true
            auth:
                key-management: 802.1x
                wired: true
                method: ttls
                identity: fluffy@cisco.com
                password: hash:83...11
  1. 与一起应用它
    • 数多网络计划应用

  2. 此时,如果您重新启动,它应该可以工作,但是需要检查一些东西来帮助调试。
  3. 检查WPA请求配置文件
    • sudo cat /run/netplan/wpa-enp0s31f6.conf

它应该看起来像

代码语言:javascript
复制
 ctrl_interface=/run/wpa_supplicant
 network={
   key_mgmt=IEEE8021X
   eap=TTLS
  identity="fluffy@cisco.com"
  password=hash:83..11
}

如果使用散列密码,请确保密码周围没有引号。

  1. 检查systemd模板
    • ls /run/systemd/system/systemd-networkd.service.wants/netplan*enp0s31f6.service

它应该会返回类似的东西

/run/systemd/system/systemd-networkd.service.wants/netplan-wpa-wired@enp4s0.service

关键是要检查它是否是wpa-有线的。

  1. 测试auth与密码和所有一起工作
    • 杀死任何正在运行的wpa_supplicant版本,然后执行
    • sudo wpa_supplicant -c /run/netplan/wpa-enp0s31f6.conf -i enp0s31f6 -D有线

您将看到关于802.1x消息的信息流,最后应该有一个“身份验证成功”

你得杀了它。

  1. 重新启动并享受..。
票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1124164

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档