fix: the root CA is created by the server, an offline CA or a Simple CA service, chosen at setup; the shell can stay open in a tab of its own, the Docker page is offered only with Docker, and the test scripts are in bin/.
Release / release (push) Failing after 14m20s
Release / release (push) Failing after 14m20s
This commit is contained in:
1 parent
ff0c93ed73
commit
a649331aa2
49 files changed
+1597
-637
No files matched your search
@@ -3,7 +3,7 @@ data "http" "repo_gpg_key" {
|
||||
}
|
||||
|
||||
locals {
|
||||
supply_pki = var.root_cert_file != ""
|
||||
supply_pki = var.simple_ca_url != ""
|
||||
|
||||
cloud_init_vars = {
|
||||
hostname = var.name
|
||||
@@ -11,6 +11,7 @@ locals {
|
||||
repo_url = var.repo_url
|
||||
repo_gpg_key = data.http.repo_gpg_key.response_body
|
||||
ubuntu_codename = var.ubuntu_codename
|
||||
trusted_cas = [for path in var.trusted_ca_files : file(path)]
|
||||
|
||||
# Contents of /etc/linux-manager/linux-manager.json.
|
||||
config = {
|
||||
@@ -104,8 +105,8 @@ resource "azurerm_linux_virtual_machine" "router" {
|
||||
custom_data = base64encode(
|
||||
local.supply_pki
|
||||
? templatefile("${path.module}/../cloud-init-with-pki.yaml.tpl", merge(local.cloud_init_vars, {
|
||||
root_cert = file(var.root_cert_file)
|
||||
root_key = var.root_key_file != "" ? file(var.root_key_file) : ""
|
||||
config = merge(local.cloud_init_vars.config, { pki = { root = "simple-ca", simple_ca_url = var.simple_ca_url } })
|
||||
setup_code = var.simple_ca_setup_code
|
||||
}))
|
||||
: templatefile("${path.module}/../cloud-init.yaml.tpl", local.cloud_init_vars)
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ variable "admin_username" {
|
||||
}
|
||||
|
||||
variable "admin_password" {
|
||||
description = "Admin password for the server VM. SSH key auth is always configured; leaving this empty additionally disables password authentication, setting it enables password auth alongside the key."
|
||||
description = "Admin password for the server VM, accepted alongside the SSH key; empty disables password authentication."
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
@@ -50,7 +50,7 @@ variable "local_fqdn" {
|
||||
}
|
||||
|
||||
variable "dns_zone_id" {
|
||||
description = "Resource ID of an existing Azure DNS zone to create local_fqdn's A record in, pointing at the server's public IP. local_fqdn must be a name within that zone. Leave null to skip - local_fqdn is then just a label with nothing making it resolve."
|
||||
description = "Resource ID of an existing Azure DNS zone, holding local_fqdn, to create local_fqdn's A record in, pointing at the server's public IP; null for no record."
|
||||
type = string
|
||||
nullable = true
|
||||
default = null
|
||||
@@ -63,7 +63,7 @@ variable "local_id_mode" {
|
||||
}
|
||||
|
||||
variable "local_cidrs" {
|
||||
description = "Local subnet CIDR(s) advertised into the site-to-site tunnel. Should include the workload subnet CIDR."
|
||||
description = "Local subnet CIDR(s) advertised into the site-to-site tunnel, the workload subnet CIDR among them."
|
||||
type = string
|
||||
}
|
||||
|
||||
@@ -100,14 +100,20 @@ variable "p2s_address_pool" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "root_cert_file" {
|
||||
description = "Path to an existing root CA certificate PEM to supply instead of letting the package create one. Leave empty to create one."
|
||||
variable "simple_ca_url" {
|
||||
description = "The https:// URL of the Simple CA service that signs the router's issuing CAs; empty for a root the package creates."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "root_key_file" {
|
||||
description = "Path to the private key PEM of root_cert_file. Leave empty to keep the root offline: the issuing CAs then wait for certificates signed elsewhere."
|
||||
variable "trusted_ca_files" {
|
||||
description = "Paths to PEM certificates of CAs added to the server's system trust store."
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "simple_ca_setup_code" {
|
||||
description = "The one-time setup code of a sign-ca token of the Simple CA issuing CA, valid until the router's first boot."
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
@@ -132,7 +138,7 @@ variable "wireguard_listen_port" {
|
||||
}
|
||||
|
||||
variable "deploy_workload_vm" {
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the server."
|
||||
description = "Deploy a bare VM on the workload subnet."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
@@ -144,7 +150,7 @@ variable "repo_url" {
|
||||
}
|
||||
|
||||
variable "ubuntu_codename" {
|
||||
description = "Ubuntu release codename of the server VM's image, used to select the apt repo component."
|
||||
description = "Ubuntu release codename of the server VM's image, the apt repository's distribution."
|
||||
type = string
|
||||
default = "resolute"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#cloud-config
|
||||
#
|
||||
# Example: install and configure linux-manager during first boot, supplying an
|
||||
# existing root CA instead of letting the package create one. See
|
||||
# cloud-init.yaml.tpl for the variant that creates its own.
|
||||
#
|
||||
# Template variables are Terraform templatefile() placeholders. Adapt or drop
|
||||
# them for whatever renders this file. With root_key empty the root stays
|
||||
# offline: the server's issuing CAs wait for their certificates, signed with
|
||||
# the root elsewhere and imported with linux-manager-ca ca import.
|
||||
# Example: install and configure linux-manager during first boot, with its
|
||||
# issuing CAs signed by a Simple CA service. The template variables are
|
||||
# Terraform templatefile() placeholders: config holds pki.root simple-ca and
|
||||
# pki.simple_ca_url, setup_code is the one-time setup code of a sign-ca token,
|
||||
# and trusted_cas the PEM certificates of CAs added to the trust store, among
|
||||
# them the CA of the service's HTTPS certificate.
|
||||
|
||||
hostname: ${hostname}
|
||||
fqdn: ${fqdn}
|
||||
@@ -21,31 +19,28 @@ apt:
|
||||
${indent(8, trimspace(repo_gpg_key))}
|
||||
|
||||
write_files:
|
||||
# The configuration file. Created here before the package is installed, so
|
||||
# postinst leaves it alone.
|
||||
- path: /etc/linux-manager/linux-manager.json
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
${jsonencode(config)}
|
||||
|
||||
- path: /etc/linux-manager/pki/root/cert.pem
|
||||
permissions: '0644'
|
||||
owner: root:root
|
||||
content: |
|
||||
${indent(6, trimspace(root_cert))}
|
||||
%{ if root_key != "" ~}
|
||||
- path: /etc/linux-manager/pki/root/key.pem
|
||||
- path: /etc/linux-manager/pki-setup-code
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
${indent(6, trimspace(root_key))}
|
||||
%{ endif ~}
|
||||
${setup_code}
|
||||
|
||||
%{ if length(trusted_cas) > 0 ~}
|
||||
ca_certs:
|
||||
trusted:
|
||||
%{ for ca in trusted_cas ~}
|
||||
- |
|
||||
${indent(6, trimspace(ca))}
|
||||
%{ endfor ~}
|
||||
|
||||
%{ endif ~}
|
||||
package_update: true
|
||||
|
||||
packages:
|
||||
- linux-manager
|
||||
|
||||
# Nothing further is required: installing the package starts
|
||||
# linux-manager-setup, which applies the configuration written above.
|
||||
@@ -1,18 +1,9 @@
|
||||
#cloud-config
|
||||
#
|
||||
# Example: install and configure linux-manager during first boot.
|
||||
#
|
||||
# This is one way to reach the state described in README.md, not an interface
|
||||
# the package depends on. It writes the configuration file directly, which
|
||||
# keeps everything in one place and works the same whether or not debconf is
|
||||
# involved.
|
||||
#
|
||||
# Template variables are Terraform templatefile() placeholders. Adapt or drop
|
||||
# them for whatever renders this file.
|
||||
#
|
||||
# This variant lets the package create its own CAs on first boot. See
|
||||
# cloud-init-with-pki.yaml.tpl for the variant that supplies an existing root
|
||||
# CA instead.
|
||||
# Example: install and configure linux-manager during first boot, with a root
|
||||
# CA the package creates. The template variables are Terraform templatefile()
|
||||
# placeholders; trusted_cas holds the PEM certificates of CAs added to the
|
||||
# trust store.
|
||||
|
||||
hostname: ${hostname}
|
||||
fqdn: ${fqdn}
|
||||
@@ -26,18 +17,22 @@ apt:
|
||||
${indent(8, trimspace(repo_gpg_key))}
|
||||
|
||||
write_files:
|
||||
# The configuration file. Created here before the package is installed, so
|
||||
# postinst leaves it alone.
|
||||
- path: /etc/linux-manager/linux-manager.json
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
${jsonencode(config)}
|
||||
|
||||
%{ if length(trusted_cas) > 0 ~}
|
||||
ca_certs:
|
||||
trusted:
|
||||
%{ for ca in trusted_cas ~}
|
||||
- |
|
||||
${indent(6, trimspace(ca))}
|
||||
%{ endfor ~}
|
||||
|
||||
%{ endif ~}
|
||||
package_update: true
|
||||
|
||||
packages:
|
||||
- linux-manager
|
||||
|
||||
# Nothing further is required: installing the package starts
|
||||
# linux-manager-setup, which applies the configuration written above.
|
||||
@@ -3,7 +3,7 @@ data "http" "repo_gpg_key" {
|
||||
}
|
||||
|
||||
locals {
|
||||
supply_pki = var.root_cert_file != ""
|
||||
supply_pki = var.simple_ca_url != ""
|
||||
|
||||
cloud_init_vars = {
|
||||
hostname = var.name
|
||||
@@ -11,6 +11,7 @@ locals {
|
||||
repo_url = var.repo_url
|
||||
repo_gpg_key = data.http.repo_gpg_key.response_body
|
||||
ubuntu_codename = var.ubuntu_codename
|
||||
trusted_cas = [for path in var.trusted_ca_files : file(path)]
|
||||
|
||||
# Contents of /etc/linux-manager/linux-manager.json.
|
||||
config = {
|
||||
@@ -35,8 +36,8 @@ locals {
|
||||
}
|
||||
|
||||
cloud_init_rendered = local.supply_pki ? templatefile("${path.module}/../cloud-init-with-pki.yaml.tpl", merge(local.cloud_init_vars, {
|
||||
root_cert = file(var.root_cert_file)
|
||||
root_key = var.root_key_file != "" ? file(var.root_key_file) : ""
|
||||
config = merge(local.cloud_init_vars.config, { pki = { root = "simple-ca", simple_ca_url = var.simple_ca_url } })
|
||||
setup_code = var.simple_ca_setup_code
|
||||
})) : templatefile("${path.module}/../cloud-init.yaml.tpl", local.cloud_init_vars)
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ variable "local_fqdn" {
|
||||
}
|
||||
|
||||
variable "dns_managed_zone" {
|
||||
description = "Name of an existing Cloud DNS managed zone to create local_fqdn's A record in, pointing at the server's public IP. local_fqdn must be a name within that zone's DNS name. Leave empty to skip - local_fqdn is then just a label with nothing making it resolve."
|
||||
description = "Name of an existing Cloud DNS managed zone, holding local_fqdn, to create local_fqdn's A record in, pointing at the server's public IP; empty for no record."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
@@ -60,7 +60,7 @@ variable "local_id_mode" {
|
||||
}
|
||||
|
||||
variable "local_cidrs" {
|
||||
description = "Local subnet CIDR(s) advertised into the site-to-site tunnel. Should include the workload subnet CIDR."
|
||||
description = "Local subnet CIDR(s) advertised into the site-to-site tunnel, the workload subnet CIDR among them."
|
||||
type = string
|
||||
}
|
||||
|
||||
@@ -97,14 +97,20 @@ variable "p2s_address_pool" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "root_cert_file" {
|
||||
description = "Path to an existing root CA certificate PEM to supply instead of letting the package create one. Leave empty to create one."
|
||||
variable "simple_ca_url" {
|
||||
description = "The https:// URL of the Simple CA service that signs the router's issuing CAs; empty for a root the package creates."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "root_key_file" {
|
||||
description = "Path to the private key PEM of root_cert_file. Leave empty to keep the root offline: the issuing CAs then wait for certificates signed elsewhere."
|
||||
variable "trusted_ca_files" {
|
||||
description = "Paths to PEM certificates of CAs added to the server's system trust store."
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "simple_ca_setup_code" {
|
||||
description = "The one-time setup code of a sign-ca token of the Simple CA issuing CA, valid until the router's first boot."
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
@@ -129,7 +135,7 @@ variable "wireguard_listen_port" {
|
||||
}
|
||||
|
||||
variable "deploy_workload_vm" {
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the server."
|
||||
description = "Deploy a bare VM on the workload subnet."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
@@ -141,7 +147,7 @@ variable "repo_url" {
|
||||
}
|
||||
|
||||
variable "ubuntu_codename" {
|
||||
description = "Ubuntu release codename of the server VM's image, used to select the apt repo component."
|
||||
description = "Ubuntu release codename of the server VM's image, the apt repository's distribution."
|
||||
type = string
|
||||
default = "resolute"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user