feat: rebranded from vpn-router to linux-manager.
This commit is contained in:
1 parent
8efe21bfa6
commit
85a1ffa21f
238 files changed
+5010
-3761
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Azure example
|
||||
|
||||
Deploys `vpn-router` on an Azure VM: a two-NIC router (external/WAN and internal/protected),
|
||||
Deploys `linux-manager` on an Azure VM: a two-NIC router (external/WAN and internal/protected),
|
||||
a demo protected `workload` subnet routed through it, and cloud-init that installs and
|
||||
configures the package on first boot. See the repository's top-level [README](../../README.md)
|
||||
for what the package itself does.
|
||||
@@ -10,10 +10,10 @@ for what the package itself does.
|
||||
- An Azure subscription and `az login` (or another form of Azure credentials Terraform can pick
|
||||
up).
|
||||
- An SSH key pair for `admin_ssh_public_key`.
|
||||
- A build of the `vpn-router` package published to the repository at `repo_url` (default: the
|
||||
- A build of the `linux-manager` package published to the repository at `repo_url` (default: the
|
||||
project's Gitea Debian registry). See [../../debian-package](../../debian-package) for
|
||||
`build.sh`/`publish.sh`.
|
||||
- That repository must allow anonymous reads, since the router pulls the package with no
|
||||
- That repository must allow anonymous reads, since the server pulls the package with no
|
||||
credentials configured. On Gitea this means the `debian` package registry under the
|
||||
`slawek` account is set to public/anonymous-read; `publish.sh` still authenticates to
|
||||
upload, only reads are anonymous. This is a one-time change made on the Gitea side, outside
|
||||
@@ -28,7 +28,7 @@ export TF_VAR_psk='change-me' # keep secrets out of tracked files
|
||||
```
|
||||
|
||||
`platform = azure` and `mode = auto` are hard-coded into the cloud-init template call in
|
||||
`router.tf`: the router has exactly two NICs, the external one carries the default route (it is
|
||||
`router.tf`: the server has exactly two NICs, the external one carries the default route (it is
|
||||
marked `primary` and holds the public IP), which is exactly the case `mode = auto` is designed
|
||||
to detect reliably - see the top-level README's "What mode decides" section.
|
||||
|
||||
@@ -36,10 +36,10 @@ to detect reliably - see the top-level README's "What mode decides" section.
|
||||
|
||||
```sh
|
||||
ssh <admin_username>@$(terraform output -raw router_public_ip)
|
||||
systemctl status vpn-router-setup
|
||||
systemctl status linux-manager-setup
|
||||
swanctl --list-sas
|
||||
```
|
||||
|
||||
Set `deploy_workload_vm = true` and re-apply to add a VM on the `workload` subnet (no public
|
||||
IP - reach it via the router or Azure Bastion) for confirming that its traffic to `remote_cidrs`
|
||||
actually flows through the router.
|
||||
IP - reach it via the server or Azure Bastion) for confirming that its traffic to `remote_cidrs`
|
||||
actually flows through the server.
|
||||
@@ -1,9 +1,9 @@
|
||||
output "router_public_ip" {
|
||||
description = "Public IP address of the router VM."
|
||||
description = "Public IP address of the server VM."
|
||||
value = azurerm_public_ip.ext.ip_address
|
||||
}
|
||||
|
||||
output "router_internal_ip" {
|
||||
description = "Private IP address of the router's internal NIC - the next hop to use in routes configured outside this Terraform run (another route table, or an on-prem device) that need to reach remote_cidrs through this router."
|
||||
description = "Private IP address of the server's internal NIC - the next hop to use in routes configured outside this Terraform run (another route table, or an on-prem device) that need to reach remote_cidrs through this router."
|
||||
value = azurerm_network_interface.int.private_ip_address
|
||||
}
|
||||
@@ -12,9 +12,11 @@ locals {
|
||||
repo_gpg_key = data.http.repo_gpg_key.response_body
|
||||
ubuntu_codename = var.ubuntu_codename
|
||||
|
||||
# Contents of /etc/vpn-router/vpn-router.json.
|
||||
# Contents of /etc/linux-manager/linux-manager.json.
|
||||
config = {
|
||||
general = { platform = "azure", mode = "auto" }
|
||||
router = { enabled = true }
|
||||
vpn = { enabled = true }
|
||||
wan = { local_fqdn = var.local_fqdn }
|
||||
local = { cidrs = local.local_cidr_list }
|
||||
site_to_site = {
|
||||
@@ -94,7 +96,7 @@ resource "azurerm_linux_virtual_machine" "router" {
|
||||
|
||||
source_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "ubuntu-24_04-lts"
|
||||
offer = "ubuntu-26_04-lts"
|
||||
sku = "server"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
subscription_id = "00000000-0000-0000-0000-000000000000"
|
||||
location = "polandcentral"
|
||||
name = "vpn-router-example"
|
||||
name = "linux-manager-example"
|
||||
admin_ssh_public_key = "ssh-ed25519 AAAA... you@example.com"
|
||||
|
||||
local_fqdn = "router.example.com"
|
||||
|
||||
+12
-12
@@ -17,7 +17,7 @@ variable "location" {
|
||||
variable "name" {
|
||||
description = "Base name used to derive resource names."
|
||||
type = string
|
||||
default = "vpn-router-example"
|
||||
default = "linux-manager-example"
|
||||
}
|
||||
|
||||
variable "admin_ssh_public_key" {
|
||||
@@ -32,25 +32,25 @@ variable "admin_username" {
|
||||
}
|
||||
|
||||
variable "admin_password" {
|
||||
description = "Admin password for the router 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. SSH key auth is always configured; leaving this empty additionally disables password authentication, setting it enables password auth alongside the key."
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
description = "VM size for the router."
|
||||
description = "VM size for the server."
|
||||
type = string
|
||||
default = "Standard_B2ls_v2"
|
||||
}
|
||||
|
||||
variable "local_fqdn" {
|
||||
description = "FQDN of the router, used as the IKE identity and, when dns_zone_id is set, as the name of the A record created for it."
|
||||
description = "FQDN of the server, used as the IKE identity and, when dns_zone_id is set, as the name of the A record created for it."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "dns_zone_id" {
|
||||
description = "Resource ID of an existing Azure DNS zone to create local_fqdn's A record in, pointing at the router'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 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."
|
||||
type = string
|
||||
nullable = true
|
||||
default = null
|
||||
@@ -132,21 +132,21 @@ variable "wireguard_listen_port" {
|
||||
}
|
||||
|
||||
variable "deploy_workload_vm" {
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the router."
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the server."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "repo_url" {
|
||||
description = "Base URL of the Debian package repository the router pulls vpn-router from."
|
||||
description = "Base URL of the Debian package repository the server pulls linux-manager from."
|
||||
type = string
|
||||
default = "https://gitea.koszewscy.waw.pl/api/packages/koszewscy/debian"
|
||||
}
|
||||
|
||||
variable "ubuntu_codename" {
|
||||
description = "Ubuntu release codename of the router VM's image, used to select the apt repo component."
|
||||
description = "Ubuntu release codename of the server VM's image, used to select the apt repo component."
|
||||
type = string
|
||||
default = "noble"
|
||||
default = "resolute"
|
||||
}
|
||||
|
||||
variable "vnet_address_space" {
|
||||
@@ -156,19 +156,19 @@ variable "vnet_address_space" {
|
||||
}
|
||||
|
||||
variable "ext_subnet_cidr" {
|
||||
description = "CIDR of the router's external (WAN-facing) subnet."
|
||||
description = "CIDR of the server's external (WAN-facing) subnet."
|
||||
type = string
|
||||
default = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
variable "int_subnet_cidr" {
|
||||
description = "CIDR of the router's internal (protected-network-facing) subnet."
|
||||
description = "CIDR of the server's internal (protected-network-facing) subnet."
|
||||
type = string
|
||||
default = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
variable "workload_subnet_cidr" {
|
||||
description = "CIDR of the demo protected workload subnet, routed through the router."
|
||||
description = "CIDR of the demo protected workload subnet, routed through the server."
|
||||
type = string
|
||||
default = "10.0.3.0/24"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bare VM on the workload subnet, for manually verifying that its traffic to
|
||||
# remote_cidrs flows through the router. Off by default so a plain apply
|
||||
# stays to just the router.
|
||||
# remote_cidrs flows through the server. Off by default so a plain apply
|
||||
# stays to just the server.
|
||||
|
||||
resource "azurerm_network_interface" "workload" {
|
||||
count = var.deploy_workload_vm ? 1 : 0
|
||||
@@ -37,7 +37,7 @@ resource "azurerm_linux_virtual_machine" "workload" {
|
||||
|
||||
source_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "ubuntu-24_04-lts"
|
||||
offer = "ubuntu-26_04-lts"
|
||||
sku = "server"
|
||||
version = "latest"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#cloud-config
|
||||
#
|
||||
# Example: install and configure vpn-router during first boot, supplying an
|
||||
# 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 router's issuing CAs wait for their certificates, signed with
|
||||
# the root elsewhere and imported with vpn-router-ca ca import.
|
||||
# offline: the server's issuing CAs wait for their certificates, signed with
|
||||
# the root elsewhere and imported with linux-manager-ca ca import.
|
||||
|
||||
hostname: ${hostname}
|
||||
fqdn: ${fqdn}
|
||||
@@ -15,27 +15,27 @@ manage_etc_hosts: false
|
||||
|
||||
apt:
|
||||
sources:
|
||||
vpn-router:
|
||||
source: "deb [signed-by=/etc/apt/keyrings/vpn-router.asc] ${repo_url} ${ubuntu_codename} main"
|
||||
linux-manager:
|
||||
source: "deb [signed-by=/etc/apt/keyrings/linux-manager.asc] ${repo_url} ${ubuntu_codename} main"
|
||||
key: |
|
||||
${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/vpn-router/vpn-router.json
|
||||
- path: /etc/linux-manager/linux-manager.json
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
${jsonencode(config)}
|
||||
|
||||
- path: /etc/vpn-router/pki/root/cert.pem
|
||||
- path: /etc/linux-manager/pki/root/cert.pem
|
||||
permissions: '0644'
|
||||
owner: root:root
|
||||
content: |
|
||||
${indent(6, trimspace(root_cert))}
|
||||
%{ if root_key != "" ~}
|
||||
- path: /etc/vpn-router/pki/root/key.pem
|
||||
- path: /etc/linux-manager/pki/root/key.pem
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
@@ -45,7 +45,7 @@ write_files:
|
||||
package_update: true
|
||||
|
||||
packages:
|
||||
- vpn-router
|
||||
- linux-manager
|
||||
|
||||
# Nothing further is required: installing the package starts
|
||||
# vpn-router-setup, which applies the configuration written above.
|
||||
# linux-manager-setup, which applies the configuration written above.
|
||||
@@ -1,6 +1,6 @@
|
||||
#cloud-config
|
||||
#
|
||||
# Example: install and configure vpn-router during first boot.
|
||||
# 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
|
||||
@@ -20,15 +20,15 @@ manage_etc_hosts: false
|
||||
|
||||
apt:
|
||||
sources:
|
||||
vpn-router:
|
||||
source: "deb [signed-by=/etc/apt/keyrings/vpn-router.asc] ${repo_url} ${ubuntu_codename} main"
|
||||
linux-manager:
|
||||
source: "deb [signed-by=/etc/apt/keyrings/linux-manager.asc] ${repo_url} ${ubuntu_codename} main"
|
||||
key: |
|
||||
${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/vpn-router/vpn-router.json
|
||||
- path: /etc/linux-manager/linux-manager.json
|
||||
permissions: '0600'
|
||||
owner: root:root
|
||||
content: |
|
||||
@@ -37,7 +37,7 @@ write_files:
|
||||
package_update: true
|
||||
|
||||
packages:
|
||||
- vpn-router
|
||||
- linux-manager
|
||||
|
||||
# Nothing further is required: installing the package starts
|
||||
# vpn-router-setup, which applies the configuration written above.
|
||||
# linux-manager-setup, which applies the configuration written above.
|
||||
@@ -1,6 +1,6 @@
|
||||
# GCP example
|
||||
|
||||
Deploys `vpn-router` on a GCE instance: a two-NIC router (external/WAN and internal/protected,
|
||||
Deploys `linux-manager` on a GCE instance: a two-NIC router (external/WAN and internal/protected,
|
||||
each its own VPC network), a demo protected `workload` subnet in the internal network routed
|
||||
through it, and cloud-init that installs and configures the package on first boot. See the
|
||||
repository's top-level [README](../../README.md) for what the package itself does, and
|
||||
@@ -11,9 +11,9 @@ repository's top-level [README](../../README.md) for what the package itself doe
|
||||
- A GCP project and credentials Terraform can pick up (`gcloud auth application-default login`
|
||||
or a service account).
|
||||
- An SSH key pair for `admin_ssh_public_key`.
|
||||
- A build of the `vpn-router` package published to the repository at `repo_url` (default: the
|
||||
- A build of the `linux-manager` package published to the repository at `repo_url` (default: the
|
||||
project's Gitea Debian registry). See [../../debian-package](../../debian-package) for
|
||||
`build.sh`/`publish.sh`. That repository must allow anonymous reads, since the router pulls
|
||||
`build.sh`/`publish.sh`. That repository must allow anonymous reads, since the server pulls
|
||||
the package with no credentials configured.
|
||||
|
||||
## Usage
|
||||
@@ -25,7 +25,7 @@ export TF_VAR_psk='change-me' # keep secrets out of tracked files
|
||||
```
|
||||
|
||||
`platform = gcp` and `mode = auto` are hard-coded into the cloud-init template call in
|
||||
`router.tf`: the router has exactly two NICs, and on GCP the system default route always goes
|
||||
`router.tf`: the server has exactly two NICs, and on GCP the system default route always goes
|
||||
out NIC0 (the external one here) while a secondary NIC only reaches its own subnet unless
|
||||
policy-routed - exactly the case `mode = auto` is designed to detect reliably. See the
|
||||
top-level README's "What mode decides" section.
|
||||
@@ -39,10 +39,10 @@ needs no separate subnet association - the route in `internal` already covers bo
|
||||
|
||||
```sh
|
||||
ssh <admin_username>@$(terraform output -raw router_public_ip)
|
||||
systemctl status vpn-router-setup
|
||||
systemctl status linux-manager-setup
|
||||
swanctl --list-sas
|
||||
```
|
||||
|
||||
Set `deploy_workload_vm = true` and re-apply to add a VM on the `workload` subnet (no public
|
||||
IP - reach it via the router or IAP) for confirming that its traffic to `remote_cidrs` actually
|
||||
flows through the router.
|
||||
IP - reach it via the server or IAP) for confirming that its traffic to `remote_cidrs` actually
|
||||
flows through the server.
|
||||
@@ -1,9 +1,9 @@
|
||||
output "router_public_ip" {
|
||||
description = "Public IP address of the router VM."
|
||||
description = "Public IP address of the server VM."
|
||||
value = google_compute_address.ext.address
|
||||
}
|
||||
|
||||
output "router_internal_ip" {
|
||||
description = "Private IP address of the router's internal NIC - the next hop to use in routes configured outside this Terraform run (another route, or an on-prem device) that need to reach remote_cidrs through this router."
|
||||
description = "Private IP address of the server's internal NIC - the next hop to use in routes configured outside this Terraform run (another route, or an on-prem device) that need to reach remote_cidrs through this router."
|
||||
value = google_compute_instance.router.network_interface[1].network_ip
|
||||
}
|
||||
@@ -12,9 +12,11 @@ locals {
|
||||
repo_gpg_key = data.http.repo_gpg_key.response_body
|
||||
ubuntu_codename = var.ubuntu_codename
|
||||
|
||||
# Contents of /etc/vpn-router/vpn-router.json.
|
||||
# Contents of /etc/linux-manager/linux-manager.json.
|
||||
config = {
|
||||
general = { platform = "gcp", mode = "auto" }
|
||||
router = { enabled = true }
|
||||
vpn = { enabled = true }
|
||||
wan = { local_fqdn = var.local_fqdn }
|
||||
local = { cidrs = local.local_cidr_list }
|
||||
site_to_site = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project_id = "vpn-router-poc"
|
||||
project_id = "linux-manager-poc"
|
||||
region = "europe-central2"
|
||||
zone = "europe-central2-a"
|
||||
name = "vpn-router-example"
|
||||
name = "linux-manager-example"
|
||||
admin_ssh_public_key = "ssh-ed25519 AAAA... you@example.com"
|
||||
|
||||
local_fqdn = "router.example.com"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
project_id = "my-gcp-project"
|
||||
region = "europe-central2"
|
||||
zone = "europe-central2-a"
|
||||
name = "vpn-router-example"
|
||||
name = "linux-manager-example"
|
||||
admin_ssh_public_key = "ssh-ed25519 AAAA... you@example.com"
|
||||
|
||||
local_fqdn = "router.example.com"
|
||||
|
||||
+12
-12
@@ -16,13 +16,13 @@ variable "zone" {
|
||||
variable "name" {
|
||||
description = "Base name used to derive resource names."
|
||||
type = string
|
||||
default = "vpn-router-example"
|
||||
default = "linux-manager-example"
|
||||
}
|
||||
|
||||
variable "admin_username" {
|
||||
description = "Admin username created on both VMs via SSH key metadata."
|
||||
type = string
|
||||
default = "vpnrouter"
|
||||
default = "linuxmanager"
|
||||
}
|
||||
|
||||
variable "admin_ssh_public_key" {
|
||||
@@ -31,18 +31,18 @@ variable "admin_ssh_public_key" {
|
||||
}
|
||||
|
||||
variable "machine_type" {
|
||||
description = "Machine type for the router."
|
||||
description = "Machine type for the server."
|
||||
type = string
|
||||
default = "e2-small"
|
||||
}
|
||||
|
||||
variable "local_fqdn" {
|
||||
description = "FQDN of the router, used as the IKE identity and, when dns_managed_zone is set, as the name of the A record created for it."
|
||||
description = "FQDN of the server, used as the IKE identity and, when dns_managed_zone is set, as the name of the A record created for it."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "dns_managed_zone" {
|
||||
description = "Name of an existing Cloud DNS managed zone to create local_fqdn's A record in, pointing at the router'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 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."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
@@ -129,37 +129,37 @@ variable "wireguard_listen_port" {
|
||||
}
|
||||
|
||||
variable "deploy_workload_vm" {
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the router."
|
||||
description = "Deploy a bare VM on the workload subnet, for manually verifying routing through the server."
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "repo_url" {
|
||||
description = "Base URL of the Debian package repository the router pulls vpn-router from."
|
||||
description = "Base URL of the Debian package repository the server pulls linux-manager from."
|
||||
type = string
|
||||
default = "https://gitea.koszewscy.waw.pl/api/packages/koszewscy/debian"
|
||||
}
|
||||
|
||||
variable "ubuntu_codename" {
|
||||
description = "Ubuntu release codename of the router VM's image, used to select the apt repo component."
|
||||
description = "Ubuntu release codename of the server VM's image, used to select the apt repo component."
|
||||
type = string
|
||||
default = "noble"
|
||||
default = "resolute"
|
||||
}
|
||||
|
||||
variable "ext_subnet_cidr" {
|
||||
description = "CIDR of the router's external (WAN-facing) subnet, in its own VPC network."
|
||||
description = "CIDR of the server's external (WAN-facing) subnet, in its own VPC network."
|
||||
type = string
|
||||
default = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
variable "int_subnet_cidr" {
|
||||
description = "CIDR of the router's internal (protected-network-facing) subnet, in its own VPC network."
|
||||
description = "CIDR of the server's internal (protected-network-facing) subnet, in its own VPC network."
|
||||
type = string
|
||||
default = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
variable "workload_subnet_cidr" {
|
||||
description = "CIDR of the demo protected workload subnet, in the same VPC network as int_subnet_cidr and routed through the router."
|
||||
description = "CIDR of the demo protected workload subnet, in the same VPC network as int_subnet_cidr and routed through the server."
|
||||
type = string
|
||||
default = "10.0.3.0/24"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bare VM on the workload subnet, for manually verifying that its traffic to
|
||||
# remote_cidrs flows through the router. Off by default so a plain apply
|
||||
# stays to just the router.
|
||||
# remote_cidrs flows through the server. Off by default so a plain apply
|
||||
# stays to just the server.
|
||||
|
||||
resource "google_compute_instance" "workload" {
|
||||
count = var.deploy_workload_vm ? 1 : 0
|
||||
|
||||
+16
-10
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Example: unattended install and configuration of vpn-router on an existing
|
||||
# Example: unattended install and configuration of linux-manager on an existing
|
||||
# host. Run as root. Adjust the values below, or set them in the environment.
|
||||
#
|
||||
# This is the same end state as the cloud-init example and as configuring the
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
DEB="${DEB:-./vpn-router_1.0.0-1_all.deb}"
|
||||
DEB="${DEB:-./linux-manager_1.0.0-1_all.deb}"
|
||||
|
||||
# List values are JSON arrays.
|
||||
PLATFORM="${PLATFORM:-generic}"
|
||||
@@ -26,22 +26,28 @@ REMOTE_CIDRS="${REMOTE_CIDRS:-[\"192.168.0.0/24\"]}"
|
||||
PSK="${PSK:-change-me}"
|
||||
P2S_ENABLED="${P2S_ENABLED:-false}"
|
||||
P2S_ADDRESS_POOL="${P2S_ADDRESS_POOL:-172.16.0.0/24}"
|
||||
PKI_ROOT_NAME="${PKI_ROOT_NAME:-VPN Router Root CA}"
|
||||
PKI_ROOT_NAME="${PKI_ROOT_NAME:-Linux Manager Root CA}"
|
||||
WG_ENABLED="${WG_ENABLED:-false}"
|
||||
WG_ADDRESS="${WG_ADDRESS:-}"
|
||||
WG_LISTEN_PORT="${WG_LISTEN_PORT:-51820}"
|
||||
|
||||
# Write the configuration before installing, so postinst leaves it alone. The
|
||||
# pre-shared key goes to its own file, so it needs no JSON escaping.
|
||||
install -d -m 0755 /etc/vpn-router
|
||||
install -d -m 0755 /etc/linux-manager
|
||||
umask 077
|
||||
printf %s "$PSK" > /etc/vpn-router/psk
|
||||
cat > /etc/vpn-router/vpn-router.json <<EOF
|
||||
printf %s "$PSK" > /etc/linux-manager/psk
|
||||
cat > /etc/linux-manager/linux-manager.json <<EOF
|
||||
{
|
||||
"general": {
|
||||
"platform": "${PLATFORM}",
|
||||
"mode": "${MODE}"
|
||||
},
|
||||
"router": {
|
||||
"enabled": true
|
||||
},
|
||||
"vpn": {
|
||||
"enabled": true
|
||||
},
|
||||
"interfaces": {
|
||||
"external": "${EXTERNAL_INTERFACE}",
|
||||
"internal": "${INTERNAL_INTERFACE}"
|
||||
@@ -61,7 +67,7 @@ cat > /etc/vpn-router/vpn-router.json <<EOF
|
||||
"cidrs": ${REMOTE_CIDRS},
|
||||
"local_cidrs": ${LOCAL_CIDRS},
|
||||
"local_id_mode": "${LOCAL_ID_MODE}",
|
||||
"psk_file": "/etc/vpn-router/psk"
|
||||
"psk_file": "/etc/linux-manager/psk"
|
||||
}
|
||||
},
|
||||
"p2s": {
|
||||
@@ -82,7 +88,7 @@ umask 022
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y "$DEB"
|
||||
|
||||
# Installing starts vpn-router-setup, which applies the file above. Restart it
|
||||
# Installing starts linux-manager-setup, which applies the file above. Restart it
|
||||
# explicitly after any later edit.
|
||||
systemctl restart vpn-router-setup
|
||||
systemctl --no-pager status vpn-router-setup
|
||||
systemctl restart linux-manager-setup
|
||||
systemctl --no-pager status linux-manager-setup
|
||||
Reference in new issue
Block a user