跳转到: 导航, 搜索

Neutron/VPNaaS

Warning icon.svg {{{header}}}

{{{body}}}

此 wiki 页面用于开发讨论

概述

VPNaaS(VPN-as-a-Service)是 Neutron 扩展,它引入了 VPN 功能集。

以下是为 Havana 版本的 OpenStack Networking 中 VPN 作为一项服务的功能设计和实施的建议计划。虽然我们的 VPNaaS 长期目标是使其功能非常丰富,并支持支持静态和动态路由的多种隧道和安全协议,但短期内,我们希望交付一个基于开源的 IPsec VPN 的基本实验参考实现,仅使用静态路由,这将使我们能够评估 API、资源模型和此功能的可用性。这将使我们能够收集反馈并根据需要进行改进。

我们还希望拥有一个像 AWS 那样的简单模型来配置 VPN。在 AWS 中,IKE 和 IPsec 策略是预定义的,但我们希望使其比预定义的模板更具用户可配置性。

同样,为了简单起见,我们将仅实现使用“PSK”身份验证模式的 IKE,而不是使用证书。将来我们可以扩展以支持基于证书的身份验证。

数据模型

VPNServices 资源

属性 类型 必需 CRUD 默认值 验证约束 笔记
id uuid-str 不适用 R 自动生成 不适用 VPNService 对象的 UUID
tenant_id uuid-str Yes CR 有效的 tenant_id vpn 服务的租户 UUID
name 字符串 CRU 不适用 VPN 服务的名称
description 字符串 CRU 不适用 VPN 服务的描述
status 字符串 不适用 R 不适用 不适用 指示 ipsec vpnservice 当前是否处于运行状态。可能的值包括

ACTIVE DOWN BUILD ERROR

admin_state_up 布尔值 不适用 CRU TRUE true/false vpnservice 的管理状态。如果为 false (down),端口将不转发数据包
subnet_id uuid 是*(需要 subnet_id) CR 不适用 有效的子网 ID 租户希望 VPN 服务所在的子网 ID
router_id uuid CR 不适用 有效的路由器 ID 将 VPN 服务插入的路由器 ID

IKEPolicies 资源

属性 类型 必需 CRUD 默认值 验证约束 笔记
id uuid-str 不适用 R 自动生成 不适用 IKEPolicy 的 UUID
tenant_id uuid-str Yes CR 有效的 tenant_id vpn 服务所有者的 UUID
name 字符串 CRU 不适用 ikepolicy 的友好名称
description 字符串 CRU 不适用 ikepolicy 的描述
auth_algorithm 字符串 CRU sha1 不适用 身份验证哈希算法“sha1”。
encryption_algorithm 字符串 CRU aes-128 不适用 加密算法 3des、aes-128、aes-256、aes-192 等。
phase1_negotiation_mode 字符串 CRU 主模式 不适用 IKE 模式主模式
pfs 字符串 CRU Group5 不适用 完美前向保密 (Group2、Group5、Group14)
ike_version 字符串 CRU v1 不适用 v1 或 v2 版本
lifetime
单位 字符串 CRU "秒" SA 单位的生命周期,单位为“秒”
整数 CRU 秒的 3600 整数 秒的生命周期值 (value >= 60)

IPsecPolicies 资源

属性 类型 必需 CRUD 默认值 验证约束 笔记
id uuid-str 不适用 R 自动生成 不适用 IPsecPolicy 的 UUID
tenant_id uuid-str Yes CR 有效的 tenant_id vpn 服务所有者的 UUID
name 字符串 CRU 不适用 IPsecPolicy 的友好名称
description 字符串 CRU 不适用 策略的描述
transform_protocol 字符串 CRU ESP 不适用 使用的转换协议,例如 ESP 或 AH 或 AH-ESP
encapsulation_mode 字符串 CRU tunnel 不适用 封装模式,可以是隧道模式或传输模式
auth_algorithm 字符串 CRU sha1 不适用 Authentication algorithm sha1
encryption_algorithm 字符串 CRU aes-128 不适用 Encryption Algorithms 3des, aes-128, aes-256, aes-192
pfs 字符串 CRU group5 不适用 Perfect Forward Secrecy ( group2, group5, group14)
lifetime
单位 字符串 CRU "seconds SA 单位的生命周期,单位为“秒”
整数 CRU 秒的 3600 整数 秒的生命周期值 (value >= 60)

ipsec-site-connection 资源

属性 类型 必需 CRUD 默认值 验证约束 笔记
id uuid-str 不适用 R 自动生成 不适用 vpn 连接的 UUID
tenant_id uuid-str Yes CR 有效的 tenant_id vpn 服务所有者的 UUID
name 字符串 CRU 不适用 ipsec-site-connection 的名称
description 字符串 CRU 不适用 ipsec-site-connection 的描述
peer_address ipaddress(v4 或 v6) CRU 不适用 有效的 ip 地址 (v4 或 v6) 对等 VPN 网关的公共地址或 FQDN
peer_id 字符串 CRU 不适用 不适用 对等标识符(可以是名称、字符串或 FQDN)
peer_cidrs list[string] CRU 不适用 有效 cidr 列表,格式为 / 对等私有 cidr
route_mode 字符串 R static static 静态
mtu 整数 CRU 1500 整数 mtu - 用于解决分片的最大传输单元(值 >= 68)
auth_mode 字符串 R psk psk/certs 身份验证模式,可以是 PSK 或证书
psk 字符串 CRU 不适用 NO 预共享密钥,任何字符串。
initiator 字符串 CRU bi-directional "bi-directional / response-only" 此 VPN 是否只能响应连接,还是也可以发起连接
admin_state_up 布尔值 不适用 CRU TRUE "true / false" vpn 连接的行政状态。如果为 false(down),vpn concd 连接不会转发数据包
status 字符串 不适用 R 不适用 不适用 指示 vpn 连接当前是否处于运行状态。可能的值包括:ACTIVE、DOWN、BUILD、ERROR
ikepolicy_id uuid CR 不适用 ikepolicy 的 uuid ikepolicy 的 uuid id
ipsecpolicy_id uuid CR 不适用 ipsecpolicy 的 uuid ipsecpolicy 的 uuid id
vpnservice_id uuid CR 不适用 vpnservice 的 uuid vpnservice 的服务 id
dpd
行动 字符串 CRU hold "hold / clear / disabled /restart /restart_by_peer" DPD 操作控制死对等检测协议的使用。(clear、hold、restart、disabled、restart-by-peer)
interval 整数 CRU 30 > 0 DPD 延迟的秒数
timeout 整数 CRU 120 > 0 & > dpd_interval DPD 超时的秒数

VPNaaS "Neutron/VPNaaS/API" 的当前建议 API

本节描述了将引入 python-neutronclient 以支持 VPNaaS 高级服务的命令。

vpn-service-create      Create a VPNService  
vpn-service-delete      Delete a given VPNService
vpn-service-list        List all VPNService for a given tenant.
vpn-service-show        Show detailed information of a given VPNService.
vpn-service-update      Update a given VPNservice.
 
vpn-ikepolicy-create       Create an IKEPolicy
vpn-ikepolicy-delete       Delete a given IKE Policy.
vpn-ikepolicy-list         List IKEPolicies that belong to a given tenant.
vpn-ikepolicy-show         Show detailed information of a given IKEPolicy.
vpn-ikepolicy-update       Update a given IKE Policy.
 
vpn-ipsecpolicy-create     Create an IPsec policy
vpn-ipsecpolicy-delete     Delete a given IPsec Policy
vpn-ipsecpolicy-list       List IPsecPolicies that belong to a given tenant    connection.
vpn-ipsecpolicy-show       Show detailed information of a given IPsec Policy
vpn-ipsecpolicy-update     Update a given IPsec Policy.
 
ipsec-site-connection-create  Create a ipsec-site-connection
ipsec-site-connection-delete  Delete a given ipsec-site-connection.
ipsec-site-connection-list    List ipsec-site-connections that belong to a given tenant.
ipsec-site-connection-show    Show information of a given ipsec-site-connection.
ipsec-site-connection-update  Update a given ipsec-site-connection.


命令规范

vpn-service-create

创建一个新的 vpnservice

neutron vpn-service-create [-h] [-f {shell,table}] [-c COLUMN]
                                     [--variable VARIABLE] [--prefix PREFIX]
                                     [--request-format {json,xml}]
                                     [--tenant-id TENANT_ID]
                                     [--admin-state-down] [--name NAME]
                                     [--description DESCRIPTION] 
                                     ROUTER
                                     SUBNET 


  • tenant-id:拥有 VPN 服务的租户的 ID。
  • router:路由器(可以是“name”或“id”)的唯一标识符,VPN 将附加到该路由器。
  • subnet:子网(可以是“name”或“id”)的唯一标识符,VPN 将为其提供服务。(*)

vpn-service-delete

删除给定的 vpnservice 对象。

neutron vpn-service-delete [-h] [--request-format {json,xml}] VPNSERVICE
  • VPNSERVICE:标识要删除的 VPN 服务的唯一标识符。


vpn-service-list

显示租户可用的 VPN 服务对象列表。

neutron vpn-service-list

vpn-service-show

显示给定 VPN 服务对象的信息。

neutron vpn-service-show [-h] [-f {shell,table}] [-c COLUMN]
                                   [--variable VARIABLE] [--prefix PREFIX]
                                   [--request-format {json,xml}] [-D]
                                   [-F FIELD]
                                   VPNSERVICE


vpn-service-update

更新给定 VPN 服务对象的信息。

neutron vpn-service-update [-h] [--request-format {json,xml}] VPNSERVICE

注意:只有在状态不是 PENDING_CREATE、PENDING_UPDATE 或 PENDING_DELETE 时才能更改。

vpn-ikepolicy-create

创建一个新的 ikepolicy 对象

neutron vpn-ikepolicy-create [-h] [-f {shell,table}] [-c COLUMN]
              [--variable VARIABLE] [--prefix PREFIX]
              [--request-format {json,xml}]
              [--tenant-id TENANT_ID] 
              [--description DESCRIPTION]
              [--auth-algorithm AUTH-ALGORITHM]
              [--encryption-algorithm ENCRYPTION-ALGORITHM]
              [--phase1-negotiation-mode PHASE1-NEGOTIATION-MODE]
              [--ike-version IKE-VERSION]
              [--pfs PFS]
              [--lifetime unit=UNITS,value=VALUE]
              NAME

  • NAME:IPsec VPN 服务连接中使用的 IKEPolicy 的友好名称
  • description:IPsec VPN 服务连接中使用的 IKEPolicy 的友好描述
  • tenant-id:拥有 VPN 服务的租户的 ID。
  • auth-algorithm:IKEPolicy 中使用的身份验证算法。
  • encryption-algorithm:IKEPolicy 中使用的加密算法。
  • phase1-negotiation-mode:IKE 的第一阶段协商模式,可以是“Main”或“Aggressive”。
  • lifetime:包含生命周期特定参数的字符串示例:--lifetime "units=seconds,value=3600"
  • units:生命周期的单位(“seconds”或“kilobytes”)
  • value。生命周期的值(非负整数)。
  • ike-version:指定 ike_version。
  • pfs:指定完美前向保密。

vpn-ikepolicy-delete

删除给定的 IKEPolicy 对象。

neutron vpn-ikepolicy-delete [-h] [--request-format {json,xml}]
                                    IKEPOLICY
  • IKEPOLICY:标识要删除的 IKEPolicy 的唯一标识符。


vpn-ikepolicy-list

显示租户可用的 IKEPolicy 对象列表。

neutron vpn-ikepolicy-list

vpn-ikepolicy-show

显示给定 IKEPolicy 对象的信息。

neutron vpn-ikepolicy-show [-h] [-f {shell,table}] [-c COLUMN]
                                  [--variable VARIABLE] [--prefix PREFIX]
                                  [--request-format {json,xml}] [-D]
                                  [-F FIELD]
                                  IKEPOLICY


vpn-ikepolicy-update

更新给定 IKEPolicy 对象的信息。

neutron vpn-ikepolicy-delete [-h] [--request-format {json,xml}]
                                    IKEPOLICY


vpn-ipsecpolicy-create

创建一个新的 ipsecpolicy 对象

neutron vpn-ipsecpolicy-create [-h] [-f {shell,table}] [-c COLUMN]
                [--variable VARIABLE] [--prefix PREFIX]
                [--request-format {json,xml}]
                [--tenant-id TENANT_ID]  
               	 [--description DESCRIPTION]
                 --transform-protocol TRANSFORM-PROTOCOL
                [--auth-algorithm AUTH-ALGORITHM]
                [--encryption-algorithm ENCRYPTION-ALGORITHM]
                [--encapsulation-mode ENCAPSULATION-MODE]
                [--pfs PFS]
                [--lifetime units=UNITS,value=VALUE]
                 NAME

  • NAME:IPsec VPN 服务连接中使用的 IPsecPolicy 的友好名称
  • description:IPsec VPN 服务连接中使用的 IPsecPolicy 的友好描述
  • tenant-id:拥有 VPN 服务的租户的 ID。
  • auth-algorithm:IPsecPolicy 中使用的身份验证算法。
  • encryption-algorithm:IPsecPolicy 中使用的加密算法。
  • encapsulation-mode:IPsec 隧道的封装模式,可以是“tunnel”或“transport”。
  • transfrom-protocol:IPsec 转换协议,可以是“ESP”或“AH”。
  • lifetime:包含生命周期特定参数的字符串示例:--lifetime "units=seconds,value=3600"
  • units:生命周期的单位(“seconds”或“kilobytes”)
  • value。生命周期的值(非负整数)。
  • pfs:指定完美前向保密。

vpn-ipsecpolicy-delete

删除给定的 IPsecPolicy 对象。

neutron vpn-ipsecpolicy-delete [-h] [--request-format {json,xml}]
                                    IPSECPOLICY
  • IPSECPOLICY:标识要删除的 IPSECPolicy 的唯一标识符。


vpn-ipsecpolicy-list

显示租户可用的 IPSECPolicy 对象列表。

neutron vpn-ipsecpolicy-list

vpn-ipsecpolicy-show

显示给定 IPsecPolicy 对象的信息。

neutron vpn-ipsecpolicy-show [-h] [-f {shell,table}] [-c COLUMN]
                                  [--variable VARIABLE] [--prefix PREFIX]
                                  [--request-format {json,xml}] [-D]
                                  [-F FIELD]
                                  IPSECPOLICY


vpn-ipsecpolicy-update

更新给定 IPsecPolicy 对象的信息。

neutron vpn-ipsecpolicy-delete [-h] [--request-format {json,xml}]
                                    IPSECPOLICY


ipsec-site-connection-create

创建一个新的 ipsec-site-connection 对象

neutron ipsec-site-connection-create [-h] [-f {shell,table}]
                               [-c COLUMN]
                               [--variable VARIABLE]
      	                        [--prefix PREFIX]
                                [--request-format {json,xml}]
                                [--tenant-id TENANT_ID]
                                [--admin-state-down] --name NAME
                                [--description DESCRIPTION]
                                 --peer-address PEER-ADDRESS
                                 --peer-id PEER-ID --peer_cidr
                                PEER-CIDRS 
                                [--mtu MTU]
                                [--psk PSK]
                                [--initiator INITIATOR]
                                [--dpd DPD]
                                 --vpnservice-id VPNSERVICE
                                 --ikepolicy-id IKEPOLICY
                                 --ipsecpolicy-id IPSECPOLICY

  • peer-address:VPN 连接的远程对等 IP 地址。
  • tenant-id:拥有 VPN 服务的租户的 ID。
  • peer-id:对等标识符字符串。
  • peer_cidr:远程对等子网,格式为 CIDR 格式。
  • mtu:用于分片的 MTU
  • dpd:包含 dpd 属性的字符串。示例:--dpd "action=hold,interval=30,timeout=120"
  • action:死对等检测操作(action=hold、restart 等)。
  • interval:死对等检测间隔。(interval=30)
  • timeout:死对等检测超时。(timeout=120)
  • route-mode:路由模式,可以是“static”或“dynamic” - 对于第一个版本仅支持“static”。
  • auth-mode:身份验证模式,可以是“PSK”或“CERTS”
  • psk:对等标识符字符串。
  • initiator:发起者模式,可以是“bi-directional”或“responder”。
  • vpnservice-id:VPN 服务对象的唯一标识符。
  • ikepolicy-id:IKE 策略对象的唯一标识符。
  • ipsecpolicy-id:IPsec 策略对象的唯一标识符。

ipsec-site-connection-delete

删除给定的 ipsec-site-connection 对象。

neutron ipsec-site-connection-delete 
                                               [-h]
                                               [--request-format {json,xml}]
                                               ipsec-site-connection

  • ipsec-site-connection:标识要删除的 VPN 连接的唯一标识符。

ipsec-site-connection-list

显示租户可用的 VPN 连接对象列表。

neutron ipsec-site-connection-list

ipsec-site-connection-show

显示给定 VPN 连接对象的信息。

neutron ipsec-site-connection-show [-h] [-f {shell,table}] [-c COLUMN]
                                   [--variable VARIABLE] [--prefix PREFIX]
                                   [--request-format {json,xml}] [-D]
                                   [-F FIELD]
                                   ipsec-site-connection


ipsec-site-connection-update

更新给定 VPN 连接对象的信息。

neutron ipsec-site-connection-update [-h] [--request-format {json,xml}] ipsec-site-connection

注意:只有在状态不是 PENDING_CREATE、PENDING_UPDATE 或 PENDING_DELETE 时才能更改。

REST API

高级任务流程

使用 VPNaaS API 配置 IPsec VPN 的高级任务流程如下

  • 租户创建一个 VPNService,不包含任何连接。
  • 租户创建一个或多个 IKEPolicies。
  • 租户创建一个或多个 IPsecPolicies。
  • 租户创建一个或多个 ipsec-site-connections,并与 VPNService id、IKEPolicy id 和 IPsecPolicy id 关联。


VPNService APIs

GET
/v1.0/vpnservices/
GET
/v1.0/vpnservices/vpnservice-id
POST
/v1.0/vpnservices
UPDATE
/v1.0/vpnservices/vpnservice-id
DELETE
/v1.0/vpnservices/vpnservice-id


VPNService 创建

JSON 请求

#!highlight javascript numbers=disable
POST /v1.0/vpnservices
Content-Type: application/json
Accept: application/json
X-Auth-Token:xyz
Content-Length: abc

{
  "vpnservice": {
           
           "tenant_id": "310df60f-2a10-4ee5-9554-98393092194c",
           "name": "cloud_vpn",
           "subnet": "96a4386a-f8c3-42ed-afce-d7954eee77b3",
	   "router": "8acda86a-f8c3-42ed-afce-d7954eee77b3",
           }
}

JSON 响应

#!highlight javascript numbers=disable
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: abc

{
  "vpnservice": {
           "id": "02b1fef7-16f5-4917-bf19-c40a9af805ed",
           "tenant-id": "310df60f-2a10-4ee5-9554-98393092194c",
           "name": "cloud_vpn",
           "subnet-id": "96a4386a-f8c3-42ed-afce-d7954eee77b3",
	   "router-id": "8acda86a-f8c3-42ed-afce-d7954eee77b3",
           "admin_state_up": true,
           "status": "PENDING_CREATE"
           }
}


IKEPolicy APIs

GET
/v1.0/ikepolicies/
POST
/v1.0/ikepolicies
GET
/v1.0/ikepolicies/ikepolicy-id
UPDATE
/v1.0/ikepolicies/ikepolicy-id
DELETE
/v1.0/ikepolicies/ikepolicy-id

IKEPolicy 创建

JSON 请求

#!highlight javascript numbers=disable
POST /v1.0/ikepolicies
Accept: application/json
Content-Type: application/json
X-Auth-Token:xyz
Content-Length: abc

{
  "ikepolicy" : {
            "name": "ikepolicy_1",
            "auth-algorithm" : "sha1",
            "encryption-algorithm" : "aes-256",
            "phase1-negotiation-mode" : "main",
	    "lifetime": "units=seconds,value=28800",       
            "ike-version" : "v1",
            "pfs": " Group5",
           }
}

JSON 响应

#!highlight javascript numbers=disable
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: abc

{
  "ikepolicy" : {
            "id":"cfc6589d-f949-4c66-99d2-c2da56ef3764",
            "tenant_id": "310df60f-2a10-4ee5-9554-98393092194c",
            "name": "ikepolicy_1",
            "auth-algorithm" : "sha1",
            "encryption-algorithm" : "aes-256",
            "phase1-negotiation-mode" : "main",
           "lifetime": {
                      "units" : "seconds"
                      "value" : 28800,
             }
            "ike-version" : "v1",
            "pfs": "Group5",
          }
}

IPsecPolicy APIs

GET
/v1.0/ipsecpolicies/
POST
/v1.0/ipsecpolicies
GET
/v1.0/ipsecpolicies/ipsecpolicy-id
UPDATE
/v1.0/ipsecpolicies/ipsecpolicy-id
DELETE
/v1.0/ipsecpolicies/ipsecpolicy-id

IPsecPolicy 创建

JSON 请求

#!highlight javascript numbers=disable
POST /v1.0/ipsecpolicies
Accept: application/json
Content-Type: application/json
X-Auth-Token:xyz
Content-Length: abc

{
  "ipsecpolicy" : {
            "name": "ipsecpolicy_1",
            "transform-protocol": "esp",
	    "auth-algorithm" : "sha1",
            "encryption-algorithm" : "aes-256",
            "encapsulation-mode" : "tunnel",
            "lifetime": "units=seconds,value=28800",
            "pfs": "Group5"
          }
}

JSON 响应

#!highlight javascript numbers=disable
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: abc

{
  "ipsecpolicy" : {
            "id":"cfc6589d-f949-4c66-99d2-c2da56ef3764",
            "tenant-id": "310df60f-2a10-4ee5-9554-98393092194c",
            "name": "ipsecpolicy_1",
            "transform-protocol": "esp",
	    "auth-algorithm" : "sha1",
            "encryption-algorithm" : "aes-256",
            "encapsulation-mode" : "tunnel",
             "lifetime": {
                      "units" : "seconds"
                      "value" : 28800,
             }
            "pfs": "Group5"
       }
}


ipsec-site-connection

ipsec-site-connection APIs

GET
/v1.0/ipsec-site-connections/
POST
/v1.0/ipsec-site-connections
GET
/v1.0/ipsec-site-connections/ipsec-site-connection-id
UPDATE
/v1.0/ipsec-site-connections/ipsec-site-connection-id
DELETE
/v1.0/ipsec-site-connections/ipsec-site-connection-id

ipsec-site-connection 创建

JSON 请求

#!highlight javascript numbers=disable
POST /v1.0/ipsec-site-connections
Accept: application/json
Content-Type: application/json
X-Auth-Token:xyz
Content-Length: abc

{
  "ipsec_site_connection" : {
            "name": "ipsec_connection_1",
            "peer-address": "192.168.2.255",
            "peer-id" : "192.168.2.255",
	    "peer-cidr" : "10.30.2.0/24",
            "dpd": "action=hold,interval=20,timeout=120",
           "mtu": "1500",
           "psk": "bla_bla_bla",
           "initiator": "bi-directional",
           "vpnservice-id": "02b1fef7-16f5-4917-bf19-c40a9af805ed",
            "ikepolicy-id": "03299abc-16f5-4917-bf19-c40a9af805ed",
            "ipsecpolicy-id": "0dbc1234-16f5-4917-bf19-c40a9af805ed"
         }
}

JSON 响应

#!highlight javascript numbers=disable
HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: abc

{
  "ipsec_site_connection" : {
            "id":"cfc6589d-f949-4c66-99d2-c2da56ef3764",
            "tenant-id": "310df60f-2a10-4ee5-9554-98393092194c",
            "name": "ipsec_connection_1",
            "peer-address": "192.168.2.255",
            "peer-id" : "192.168.2.255",
	    "peer-cidr" : "10.30.2.0/24",
            "dpd": {
                      "action" : "hold"
                      "interval" : 20,
                      "timeout" : 120,
             }
           "mtu": "1500",
           "psk": "bla_bla_bla",
           "initiator": "bi-directional",
            "vpnservice-id": "02b1fef7-16f5-4917-bf19-c40a9af805ed",
            "ikepolicy-id": "03299abc-16f5-4917-bf19-c40a9af805ed",
            "ipsecpolicy-id": "0dbc1234-16f5-4917-bf19-c40a9af805ed",
            "admin_state_up": true,
            "status": "PENDING_CREATE"
          }
}

Blueprints

VPN 作为一项服务 (VPNaaS) APIs、数据模型和用例

Havana 计划