系统管理指南:IP 服务

Procedure如何为站点外系统配置 IKE

IPsec 和 IKE 要求用唯一 ID 标识源和目标。对于没有唯一 IP 地址的站点外系统或移动系统,必须使用其他 ID 类型。可以使用诸如 DNSDNemail 之类的 ID 类型唯一地标识系统。

对于具有唯一 IP 地址的站点外系统或移动系统,最好也应使用其他 ID 类型进行配置。例如,如果系统尝试从 NAT 盒 (NAT box) 之后连接到中心站点,则不会使用它们的唯一地址。NAT 盒 (NAT box) 指定一个中心系统无法识别的任意 IP 地址。

预先共享的密钥也不太适合用作移动系统的验证机制,因为预先共享的密钥需要固定的 IP 地址。使用自签名证书或来自 PKI 的证书,移动系统可以与中心站点进行通信。

  1. 在系统控制台上,承担主管理员角色或成为超级用户。

    主管理员角色拥有主管理员配置文件。有关如何创建该角色并将其指定给用户,请参见《系统管理指南:基本管理》中的第 2  章 “使用 Solaris Management Console(任务)”


    注 –

    远程登录会使安全关键型通信易于遭到窃听。即使以某种方式保护远程登录,系统的安全性也会降至远程登录会话的安全性。请使用 ssh 命令进行安全的远程登录。


  2. 将中心系统配置为识别移动系统。

    1. 设置 /etc/hosts 文件。

      中心系统不必识别移动系统的特定地址。


      # /etc/hosts on central
      central 192.xxx.xxx.x
      
    2. 设置 ipsecinit.conf 文件。

      中心系统需要一个允许很宽的 IP 地址范围的策略。随后,IKE 策略中的证书确保进行连接的系统是合法的。


      # /etc/inet/ipsecinit.conf on central
      # Keep everyone out unless they use this IPsec policy:
      {} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}
    3. 设置 ike.config 文件。

      DNS 标识中心系统。证书用于验证该系统。


      ## /etc/inet/ike/ike.config on central
      # Global parameters
      #
      # Find CRLs by URI, URL, or LDAP
      # Use CRL from organization's URI
      use_http
      #
      # Use web proxy
      proxy "http://somecache.domain:port/"
      #
      # Use LDAP server
      ldap_server   "ldap-server1.domain.org,ldap2.domain.org:port"
      #
      # List CA-signed certificates
      cert_root    "C=US, O=Domain Org, CN=Domain STATE"
      #
      # List self-signed certificates - trust server and enumerated others
      #cert_trust    "DNS=central.domain.org"
      #cert_trust    "DNS=mobile.domain.org"
      #cert_trust    "DN=CN=Domain Org STATE (CLASS), O=Domain Org
      #cert_trust    "email=root@central.domain.org"
      #cert_trust    "email=user1@mobile.domain.org"
      #
      
      # Rule for mobile systems with certificate
      {
        label "Mobile systems with certificate"
        local_id_type DNS
      
      # Any mobile system who knows my DNS or IP can find me.
      
        local_id "central.domain.org"
        local_addr 192.xxx.xxx.x
      
      # Root certificate ensures trust,
      # so allow any remote_id and any remote IP address.
        remote_id ""
        remote_addr 0.0.0.0/0
      
      p2_pfs 5
      
      p1_xform
      {auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1 }
      }
  3. 登录到每个移动系统,然后将该系统配置为查找中心系统。

    1. 设置 /etc/hosts 文件。

      /etc/hosts 文件不需要移动系统的地址,但是可以提供一个地址。该文件必须包含中心系统的公共 IP 地址。


      # /etc/hosts on mobile
      mobile 10.x.x.xx
      central 192.xxx.xxx.x
      
    2. 设置 ipsecinit.conf 文件。

      移动系统需要按照中心系统的公共 IP 地址来查找中心系统。这些系统必须配置相同的 IPsec 策略。


      # /etc/inet/ipsecinit.conf on mobile
      # Find central
      {raddr 192.xxx.xxx.x} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}
    3. 设置 ike.config 文件。

      标识符不能是 IP 地址。以下标识符对移动系统有效:

      • DN=ldap-directory-name

      • DNS=domain-name-server-address

      • email=email-address

      证书用于验证移动系统。


      ## /etc/inet/ike/ike.config on mobile
      # Global parameters
      #
      # Find CRLs by URI, URL, or LDAP
      # Use CRL from organization's URI
      use_http
      #
      # Use web proxy
      proxy "http://somecache.domain:port/"
      #
      # Use LDAP server
      ldap_server   "ldap-server1.domain.org,ldap2.domain.org:port"
      #
      # List CA-signed certificates
      cert_root    "C=US, O=Domain Org, CN=Domain STATE"
      #
      # Self-signed certificates - trust me and enumerated others
      #cert_trust    "DNS=mobile.domain.org"
      #cert_trust    "DNS=central.domain.org"
      #cert_trust    "DN=CN=Domain Org STATE (CLASS), O=Domain Org
      #cert_trust    "email=user1@domain.org"
      #cert_trust    "email=root@central.domain.org"
      #
      # Rule for off-site systems with root certificate
      {
      	label "Off-site mobile with certificate"
      	local_id_type DNS
      
      # NAT-T can translate local_addr into any public IP address
      # central knows me by my DNS
      
      	local_id "mobile.domain.org"
      	local_addr 0.0.0.0/0
      
      # Find central and trust the root certificate
      	remote_id "central.domain.org"
      	remote_addr 192.xxx.xxx.x
      
      p2_pfs 5
      
      p1_xform
      {auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1 }
      }
  4. 将 IKE 配置读入内核。

    • 从 Solaris 10 4/09 发行版开始,请启用 ike 服务。


      # svcadm enable svc:/network/ipsec/ike
      
    • 如果您运行的是 Solaris 10 4/09 发行版之前的发行版,请重新引导系统。


      # init 6
      

      或者,先停止然后再启动 in.iked 守护进程。


示例 23–8 将中心计算机配置为接受来自移动系统的 IPsec 流量

IKE 可以从 NAT 盒 (NAT box) 之后启动协商。但是,IKE 的理想设置是在 NAT 盒 (NAT box) 没有介入的情况下进行的。在以下示例中,根证书已由 CA 颁发。已将 CA 证书放置在移动系统和中心系统上。中心系统接受来自 NAT 盒 (NAT box) 之后的系统的 IPsec 协商。main1 是可以接受来自站点外系统的连接的公司系统。有关如何设置站点外系统,请参见示例 23–9


## /etc/hosts on main1
main1 192.168.0.100

## /etc/inet/ipsecinit.conf on main1
# Keep everyone out unless they use this IPsec policy:
{} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}

## /etc/inet/ike/ike.config on main1
# Global parameters
#
# Find CRLs by URI, URL, or LDAP
# Use CRL from organization's URI
use_http
#
# Use web proxy
proxy "http://cache1.domain.org:8080/"
#
# Use LDAP server
ldap_server   "ldap1.domain.org,ldap2.domain.org:389"
#
# List CA-signed certificate
cert_root "C=US, O=ExamplePKI Inc, OU=PKI-Example, CN=Example PKI"
#
# Rule for off-site systems with root certificate
{
  label "Off-site system with root certificate"
  local_id_type DNS
  local_id "main1.domain.org"
  local_addr 192.168.0.100

# Root certificate ensures trust,
# so allow any remote_id and any remote IP address.
  remote_id ""
  remote_addr 0.0.0.0/0

p2_pfs 5

p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1}
p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg aes auth_alg sha1}
p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1}
p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg aes auth_alg sha1}
}


示例 23–9 使用 IPsec 配置 NAT 之后的系统

在以下示例中,根证书已由 CA 颁发,并放置在移动系统和中心系统上。mobile1 将从本部连接到公司总部。Internet 服务提供商 (Internet service provider, ISP) 网络使用 NAT 盒 (NAT box) ,以允许 ISP 为 mobile1 指定专用地址。然后,NAT 盒 (NAT box) 将专用地址转换为与其他 ISP 网络节点共享的公共 IP 地址。公司总部不在 NAT 之后。有关如何在公司总部设置计算机,请参见示例 23–8


## /etc/hosts on mobile1
mobile1 10.1.3.3
main1 192.168.0.100

## /etc/inet/ipsecinit.conf on mobile1
# Find main1
{raddr 192.168.0.100} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}

## /etc/inet/ike/ike.config on mobile1
# Global parameters
#
# Find CRLs by URI, URL, or LDAP
# Use CRL from organization's URI
use_http
#
# Use web proxy
proxy "http://cache1.domain.org:8080/"
#
# Use LDAP server
ldap_server   "ldap1.domain.org,ldap2.domain.org:389"
#
# List CA-signed certificate
cert_root "C=US, O=ExamplePKI Inc, OU=PKI-Example, CN=Example PKI"
#
# Rule for off-site systems with root certificate
{
  label "Off-site mobile1 with root certificate"
  local_id_type DNS
  local_id "mobile1.domain.org"
  local_addr 0.0.0.0/0

# Find main1 and trust the root certificate
  remote_id "main1.domain.org"
  remote_addr 192.168.0.100

p2_pfs 5

p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1 }
}


示例 23–10 接受来自移动系统的自签名证书

在以下示例中,自签名证书已经颁发,并存放在移动系统和中心系统上。main1 是可以接受来自站点外系统的连接的公司系统。有关如何设置站点外系统,请参见示例 23–11


## /etc/hosts on main1
main1 192.168.0.100

## /etc/inet/ipsecinit.conf on main1
# Keep everyone out unless they use this IPsec policy:
{} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}

## /etc/inet/ike/ike.config on main1
# Global parameters
#
# Self-signed certificates - trust me and enumerated others
cert_trust    "DNS=main1.domain.org"
cert_trust    "jdoe@domain.org"
cert_trust    "user2@domain.org"
cert_trust    "user3@domain.org"
#
# Rule for off-site systems with trusted certificate
{
  label "Off-site systems with trusted certificates"
  local_id_type DNS
  local_id "main1.domain.org"
  local_addr 192.168.0.100

# Trust the self-signed certificates
# so allow any remote_id and any remote IP address.
  remote_id ""
  remote_addr 0.0.0.0/0

p2_pfs 5

p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1 }
}


示例 23–11 使用自签名证书联系中心系统

在以下示例中,mobile1 将从本部连接到公司总部。证书已经颁发,并放置在移动系统和中心系统上。ISP 网络使用 NAT 盒 (NAT box) ,以允许 ISP 为 mobile1 指定专用地址。然后,NAT 盒 (NAT box) 将专用地址转换为与其他 ISP 网络节点共享的公共 IP 地址。公司总部不在 NAT 之后。有关如何在公司总部设置计算机,请参见示例 23–10


## /etc/hosts on mobile1
mobile1 10.1.3.3
main1 192.168.0.100

## /etc/inet/ipsecinit.conf on mobile1
# Find main1
{raddr 192.168.0.100} ipsec {encr_algs aes encr_auth_algs sha1 sa shared}

## /etc/inet/ike/ike.config on mobile1
# Global parameters

# Self-signed certificates - trust me and the central system
cert_trust    "jdoe@domain.org"
cert_trust    "DNS=main1.domain.org"
#
# Rule for off-site systems with trusted certificate
{
  label "Off-site mobile1 with trusted certificate"
  local_id_type email
  local_id "jdoe@domain.org"
  local_addr 0.0.0.0/0

# Find main1 and trust the certificate
  remote_id "main1.domain.org"
  remote_addr 192.168.0.100

p2_pfs 5

p1_xform
{auth_method rsa_sig oakley_group 5 encr_alg blowfish auth_alg sha1 }
}