peterldowns / localias

custom local domain aliases for local dev servers
MIT License
583 stars 3 forks source link

fix: install root certs correctly by changing how daemonization works #31

Closed peterldowns closed 4 months ago

peterldowns commented 4 months ago

Bugfix

Fix #30 by changing how daemonization works.

Friendlier CLI

This change encouraged me to make the following improvements to the CLI commands:

Get rid of caddymodules

A while ago, localias was built using gomod2nix, and there was an incompatibility between that helper and the opentelemetry modules included in Caddy. To work around this, I created a caddymodules package that imported all of the Caddy modules except opentelemetry, which was fine because this project doesn't use the opentelemetry modules in any way.

Because localias no longer uses gomod2nix, this PR gets rid of the caddymodules hack entirely. This then allowed me to upgrade the version of Caddy that is being installed, and it will make it easier to stay up to date as Caddy receives further improvements.

SSL renewal server

With an upgraded Caddy came a problem — for SSL issuance, Caddy now requires you to implement an "automation policy" server that confirms that it can issue a new certificate for a given domain. This is primarily aimed at issuing certificates for real life domains accessible to the public, not for internal development aliases, but the restriction still stands. To do this, I used Caddy itself to respond to these requests.

For more information, read:

In the future, I could implement this by writing a custom policy module instead of using the HTTP ask, but this works for now.

Dependencies cleanup

peterldowns commented 4 months ago

Close to done here, will release sometime within the next week