【问题标题】:Terraform (AWS) create VPN IPSec connection with non-default parametersTerraform (AWS) 使用非默认参数创建 VPN IPSec 连接
【发布时间】:2017-03-19 15:18:02
【问题描述】:

我正在使用 Terraform 在 AWS 上启动我的基础设施并将状态保存在 .tfstate 文件中。在我的应用程序中,我必须通过 VPN 连接到其他网络,其中其他网络的管理员已在 IPSec ESP 连接上定义了我端的 VPN 连接必须遵守的参数。

使用 Terraform,我尽可能使用远程网络的参数创建一个 VPN 网关和一个客户网关。然后我创建一个 VPN 连接和适当的路由。这是我在 Terraform 中的 VPN 代码:

resource "aws_vpn_gateway" "vpn_gw" {
    vpc_id = "${aws_vpc.default.id}"

    tags {
        Name = "default"
        Terraform = true
    }
}

resource "aws_customer_gateway" "customer_gw" {
    bgp_asn = 65000
    ip_address = "172.0.0.1"
    type = "ipsec.1"
}

resource "aws_vpn_connection" "default" {
    vpn_gateway_id = "${aws_vpn_gateway.vpn_gw.id}"
    customer_gateway_id = "${aws_customer_gateway.customer_gw.id}"
    type = "ipsec.1"
    static_routes_only = true
}

resource "aws_vpn_connection_route" "office" {
    destination_cidr_block = "192.168.10.0/24"
    vpn_connection_id = "${aws_vpn_connection.default.id}"
}

我必须能够在我的 VPN 隧道上为连接的第 1 阶段和第 2 阶段设置以下参数:

第一阶段

  • 身份验证方法 例如预共享密钥
  • 加密方案 例如宜家
  • Diffie-Hellman Group 例如第 2 组
  • 加密算法 AES-256
  • 哈希算法 例如SHA-1
  • 主要或积极模式 例如主模式
  • 终身(重新协商) 86400

第二阶段

  • 封装(ESP 或 AH) 例如ESP
  • 加密算法 AES-256
  • 身份验证算法 例如SHA-1
  • 完美的前向保密无 PFS
  • 终身(重新协商) 3600

VPN 客户网关上的文档显示您自己无法设置那么多参数:https://www.terraform.io/docs/providers/aws/r/customer_gateway.html Boto API 也不允许设置任何其他参数。

有没有办法设置这些参数(以编程方式)?

【问题讨论】:

    标签: amazon-web-services vpn terraform


    【解决方案1】:

    很遗憾,您的问题的答案是否定的。这不是 Terraform 问题,因此,这是 AWS 提供的服务的限制。您无法使用 AWS 的基本解决方案获得这种级别的配置。

    要实现您的目标,您需要启动一个 EC2 实例,然后

    【讨论】:

    猜你喜欢
    • 2018-02-08
    • 2019-06-10
    • 2011-08-09
    • 1970-01-01
    • 2021-11-19
    • 2022-11-13
    • 2015-05-18
    • 2019-03-31
    • 2018-07-14
    相关资源
    最近更新 更多