在此过程中,请用您的系统名称替换名称 enigma 和 partym。您可以配置两个 IKE 端点。
开始之前
您必须成为分配有 "Network IPsec Management"(网络 IPsec 管理)权限配置文件的管理员。您必须在配置文件 shell 中键入信息。有关更多信息,请参见在 Oracle Solaris 11.2 中确保用户和进程的安全 中的使用所指定的管理权限。
如果执行远程管理,请参见Example 7–1 和在 Oracle Solaris 11.2 中管理安全 Shell 访问 中的如何使用安全 Shell 远程管理 ZFS,了解进行安全远程登录的说明。
# pfedit /etc/inet/ike/ikev2.config
此文件中的规则和全局参数必须管理系统 ipsecinit.conf 文件中 IPsec 策略中的密钥。以下 IKEv2 配置示例会管理如何使用 IPsec 保护两台服务器之间的网络通信 中 ipsecinit.conf 示例的密钥。
### ikev2.config file on enigma, 192.168.116.16 ## Global parameters # This default value will apply to all transforms that follow # ikesa_lifetime_secs 3600 # # Global transform definitions. The algorithm choices are # based on RFC 4921. # ## Two transforms are acceptable to this system, Group 20 and Group 19. ## A peer can be configured with 19 or 20. ## To ensure that a particular peer uses a specific transform, ## include the transform in the rule. ## # Group 20 is 384-bit ECP - Elliptic Curve over Prime ikesa_xform { encr_alg aes(256..256) auth_alg sha384 dh_group 20 } # Group 19 is 256-bit ECP ikesa_xform { encr_alg aes(128..128) auth_alg sha256 dh_group 19 } # ## The rule to communicate with partym ## Label must be unique { label "enigma-partym" auth_method preshared local_addr 192.168.116.16 remote_addr 192.168.13.213 }
## ikev2.config file on partym, 192.168.13.213 ## Global Parameters # ... ikesa_xform { encr_alg aes(256..256) auth_alg sha384 dh_group 20 } ikesa_xform { encr_alg aes(128..128) auth_alg sha256 dh_group 19 } ... ## The rule to communicate with enigma ## Label must be unique { label "partym-enigma" auth_method preshared local_addr 192.168.13.213 remote_addr 192.168.116.16 }
# /usr/lib/inet/in.ikev2d -c
注意 - 此文件拥有特殊权限,归 ikeuser 所有。切勿删除或替换此文件。相反,请使用 pfedit 命令编辑其内容,确保文件保留其原始属性。 |
# pfedit -s /etc/inet/ike/ikev2.preshared ## ikev2.preshared on enigma, 192.168.116.16 #… ## label must match the rule that uses this key { label "enigma-partym" ## The preshared key can also be represented in hex ## as in 0xf47cb0f432e14480951095f82b key "This is an ASCII Cqret phrAz, use str0ng p@ssword tekniques" }
有关 pfedit 命令的选项的信息,请参见 pfedit(1M) 手册页。
## ikev2.preshared on partym, 192.168.13.213 #… ## label must match the label of the rule that uses this key { label "partym-enigma" ## The preshared key can also be represented in hex ## as in 0xf47cb0f432e14480951095f82b key "This is an ASCII Cqret phrAz, use str0ng p@ssword tekniques" }
# svcadm enable ipsec/ike:ikev2
替换预先共享的密钥时,请在对等方系统上编辑预先共享密钥文件,重新启动 ikev2 服务。
# svcadm restart ikev2
在本示例中,IKEv2 管理员为每个系统创建一个预先共享的密钥,交换密钥,并将每个密钥添加到预先共享密钥文件中。预先共享密钥条目的标签与 ikev2.config 文件中某个规则中的标签匹配。然后,他们重新启动 in.ikev2d 守护进程。
接收到另一系统的预先共享密钥后,管理员编辑 ikev2.preshared 文件。partym 上的文件如下所示:
# pfedit -s /etc/inet/ike/ikev2.preshared #… { label "partym-enigma" ## local and remote preshared keys local_key "P-LongISH key Th@t m^st Be Ch*angEd \'reguLarLy)" remote_key "E-CHaNge lEyeGhtB+lBs et KeeS b4 2LoOoOoOoOng" }
因此,enigma 上的 ikev2.preshared 密钥文件必须如下所示:
#… { label "enigma-partym" ## local and remote preshared keys local_key "E-CHaNge lEyeGhtB+lBs et KeeS b4 2LoOoOoOoOng" remote_key "P-LongISH key Th@t m^st Be Ch*angEd \'reguLarLy)" }
管理员重新启动每个系统上的 IKEv2 服务实例。
# svcadm restart ikev2
接下来的步骤
如果建立 IPsec 策略未完成,请返回到 IPsec 过程以启用或刷新 IPsec 策略。有关保护 VPN 的 IPsec 策略的示例,请参见使用 IPsec 保护 VPN。有关 IPsec 策略的其他示例,请参见如何使用 IPsec 保护两台服务器之间的网络通信。
有关更多示例,请参见 ikev2.config(4) 和 ikev2.preshared(4) 手册页。