From 6826a194162d5e695f1c82f18408d8644896d205 Mon Sep 17 00:00:00 2001 From: Gustav Behm Date: Fri, 1 Dec 2023 02:01:41 +0100 Subject: [PATCH] Add httpd config --- openbsd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/openbsd b/openbsd index 7fd6349..00c5ea8 100755 --- a/openbsd +++ b/openbsd @@ -851,6 +851,28 @@ class Rlib: } ], } + @classmethod + def httpd(cls, fqdn): + ls = [] + ls.append(f'server "{fqdn}" {{') + ls.append(' listen on * port 80') + ls.append(' location "/.well-known/acme-challenge/*" {') + ls.append(' root "/acme"') + ls.append(' request strip 2') + ls.append(' }') + ls.append(' location * {') + ls.append(' block return 302 "https://$HTTP_HOST$REQUEST_URI"') + ls.append(' }') + ls.append('}') + + return { + "files": [ { + "src": ls, + "dst": "/etc/httpd.conf", + } ], + "service": "httpd", + } + @classmethod def acme_client(cls, fqdn, aliases=[], staging=False): cls.logger.info(f"configuring acme-client; fqdn: {fqdn}") @@ -923,6 +945,7 @@ class Rlib: aliases.add(tld_pattern.sub("." + tld, a)) return [ + self.httpd(fqdn=fqdn), self.acme_client(fqdn=fqdn, aliases=aliases, staging=d.get("staging")), self.acme_service(fqdn=fqdn), ]