IPSEC.SECRETS(5) - IKE/IPsec认证所使用到的密钥信息

本文介绍IPsec.secrets文件,该文件包含IKE/IPsec认证所需的密钥信息,如预共享密钥、RSA私钥等。文章解释了不同类型的密钥及其用途,并提供了文件格式示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IPSEC.SECRETS


NAME

ipsec.secrets - IKE/IPsec认证所使用到的密钥信息


DESCRIPTION

ipsec.secrets包含了预密钥、RSA签名、X509数字证书,这些信息被 ipsec_pluto(8)使用。当前一共有5种密钥:预共享密钥、RSA私钥、X509证书口令、XAUTH认证口令。

这个文件内容格式由块序列和include组成。例如:
                     # sample /etc/ipsec.secrets file for 10.1.0.1
10.1.0.1 10.2.0.1: PSK "secret shared by two hosts"

# sample roadwarrior
%any gateway.corp.com: PSK "shared secret with many roadwarriors"

# sample server for roadwarriors
myip %any : PSK "shared secret with many roadwarriors"

# an entry may be split across lines,
# but indentation matters
www.xs4all.nl @www.kremvax.ru
    10.6.0.1 10.7.0.1 1.8.0.1: PSK "secret shared by 5 systems"

# an RSA private key.
# note that the lines are too wide for a
# man page, so ... has been substituted for
# the truncated part
@my.com: rsa {
    Modulus: 0syXpo/6waam&opts=&page=ZhSs8Lt6jnBzu3C4grtt...
    PublicExponent: 0sAw==
    PrivateExponent: 0shlGbVR1m8Z&opts=&page=7rhzSyenCaBN...
    Prime1: 0s8njV7WTxzVzRz7AP&opts=&page=0OraDxmEAt1BL5l...
    Prime2: 0s1LgR7/oUMo9BvfU8yRFNos1s211KX5K0...
    Exponent1: 0soaXj85ihM5M2inVf/NfHmtLutVz4r...
    Exponent2: 0sjdAL9VFizF&opts=&page=BKU4ohguJFzOd55OG6...
    Coefficient: 0sK1LWwgnNrNFGZsS/2GuMBg9nYVZ...
    }

# An X.509 pem encoded private key file with (optional) passphrase
: RSA vpnserverKey.pem "<optional passphrase>"

# An X.509 pem encoded private key file locked with a passphrase
# Note: the %prompt keyword means someone has to actually enter the passphrase
# at load time - usually via ipsec_whack(8)
:  RSA vpnserverKey.pem %prompt

# XAUTH password, used with leftxauthusername=username
@username : XAUTH "password"

include ipsec.*.secrets # get secrets from other files

此文件只在启动时加载。如果文件在启动后被修改,那么应该告诉pluto重新加载,使用命令  ipsec secrets    ipsec auto --rereadsecrets
StrongSwan是一款开源的IPsec(Internet Protocol Security)框架,用于实现企业级的网络通信加密。EAP-Mschapv2是一种基于Microsoft Challenge-Handshake Authentication Protocol(MS-CHAP v2)的身份验证协议,适用于IPSec IKE(Internet Key Exchange)协商。 要在StrongSwan 5.3.5中设置IPsec服务器并启用EAP-Mschapv2认证,你需要按照以下步骤操作: 1. **安装和配置StrongSwan**: 首先确保你已经安装了StrongSwan,并创建了一个服务配置文件。你可以通过编辑`/etc/ipsec.conf`来配置基本的IPsec参数。 2. **添加IKE Phase 1配置**: 为IKE Phase 1(建立安全关联阶段)添加一个新的配置段,例如: ``` config ike { # IKE proposal proposals = ikedemo; # EAP-Mschapv2 authentication method eap = mschapv2; } ``` 3. **IKE Phase 2配置**: 创建一个IKE Phase 2(隧道模式)配置,指定IKE交换机和IPSec SA(Security Association)信息: ``` conn myconn { left = <your-ip>:<ike-port> # 通常IKE端口是500 right = <remote-ip>:<ipsec-tunnel-port> # 通常是4500 or 5001 authby = secret; auto=start; type=tun; esp=%ike.proposals; ike=%ike; } ``` 将 `<your-ip>` 替换为你的服务器地址,`<remote-ip>` 替换为客户需要连接的IP地址。 4. **添加EAP身份验证密钥**: 编辑IKE Phase 1部分的`secret`配置,提供用于EAP-Mschapv2认证的共享秘密: ``` secret /etc/ipsec.secrets <your-hostname>.local %ike: <shared-secret>; ``` 这里的`<shared-secret>`就是你们双方约定的共享密钥5. **启动 StrongSwan**: 重启或初始化StrongSwan服务,使其应用新的配置: ```bash systemctl restart strongswan ``` 6. **测试连接**: 客户端应该能够发起EAP-Mschapv2身份验证尝试,如果一切配置无误,他们将成功建立IPsec连接。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值