Skip to content

Commit

Permalink
Add httpd config
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Dec 1, 2023
1 parent 5865dd8 commit 6826a19
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions openbsd
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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),
]
Expand Down

0 comments on commit 6826a19

Please sign in to comment.