4

i have only started to use caddy and i am trying to figure out how to create an endpoint with a secure basicauth configured.

given a configuration like this:

test.my-domain.com {
    basicauth / testuser testpassword
    proxy / http://192.168.1.1:5000
}

i want to know how i can make it so that the password is secured and not in plain text.

i have created a docker secret called TEST_PASSWORD which is imported to a file at the location /run/secrets/TEST_PASSWORD. the content of this file is the password.

according to the documentation, the import directive will read content of the file and replace the line. https://caddyserver.com/docs/caddyfile#import

test.my-domain.com {
    basicauth / testuser import /run/secrets/TEST_PASSWORD
    proxy / http://192.168.1.1:5000
}

but this does not work. i have also tried with the line:

  • basicauth / testuser {import /run/secrets/TEST_PASSWORD}
  • basicauth / testuser {%import /run/secrets/TEST_PASSWORD%}

does anyone know what i am doing wrong here.

X0r0N
  • 1,816
  • 6
  • 29
  • 50

0 Answers0