Failed to install root certificate when caddy run as windows service

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

I use sc to create caddy as a windows service

sc create caddy binPath=“%dir%caddy.exe run --config %dir%Caddyfile” start= auto displayname= “caddy”

sc start caddy

a. System environment:

windows10

b. Command:

Paste command here.

c. Service/unit/compose file:

Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane. -->

d. My complete Caddy config:

vlc_service is a custom module build with xcaddy


{
        admin 0.0.0.0:37019
        http_port 37020
        order vlc_service last
        log {
                output file caddy.log
               
        }
}
127.0.0.1:37681 {
        handle /ws {
                vlc_service
        }
}

3. The problem I’m having:

When run in windows service, I got error:

{"level":"warn","ts":1673488997.9904804,"logger":"pki.ca.local","msg":"installing root certificate (you might be prompted for password)","path":"storage:pki/authorities/local/root.crt"}
{"level":"error","ts":1673488997.9946928,"logger":"pki.ca.local","msg":"failed to install root certificate","error":"add cert failed: Failed adding cert: The request is not supported.","certificate_file":"storage:pki/authorities/local/root.crt"}

4. Error messages and/or full log output:

Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

When I run caddy by hand on the same machine, such as caddy run --config Caddyfile,
And this method can install cert succesfully.
But When run as a windows service, It failed.

As I know, run as a windows service, may not be able to prompt dialog for trust cert.

6. Links to relevant resources:

This error do not affect caddy https , so it seems useless to solve this.

This topic was automatically closed after 30 days. New replies are no longer allowed.