Skip to content

Bug/Fix pfSense ACME renewals #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions azure/terraform/stacks/acm-general/pfsense.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://github.com/acmesh-official/acme.sh/wiki/How-to-use-Azure-DNS
#
# This is a service principal that is used by PFSense to manage DNS records
# for the ACME challenges.

resource "azuread_application" "pfsense" {
display_name = "pfsenseServiceApp"
owners = var.additional_owner_ids
}

resource "azuread_service_principal" "pfsense" {
client_id = azuread_application.pfsense.client_id
description = "Service Principal for on-prem pfSense"
owners = var.additional_owner_ids
}

# This password exires every 2 years
# You'll need to update this in pfSense manually:
# Services > Acme Certificates > (edit the cert) > Domain SAN list > (expand(+) DNS-Azure (Microsoft) > Client Secret
resource "azuread_service_principal_password" "pfsense" {
service_principal_id = azuread_service_principal.pfsense.id
display_name = "pfsensePassword"
}

# Lookup existing role asisgnments
# `az role assignment list --all | grep "<principal_id>" -B10 -A10`
resource "azurerm_role_assignment" "pfsense_dns_contributor" {
scope = data.azurerm_dns_zone.acmuic_org.id
role_definition_name = "DNS Zone Contributor"
principal_id = azuread_service_principal.pfsense.object_id
}

output "pfsense_service_principal_id" {
value = azuread_service_principal.pfsense.id
}

output "pfsense_service_principal_password" {
value = azuread_service_principal_password.pfsense.value
sensitive = true
}
Loading