Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: docker, unable to load certificates (remove quotes in documentation) #1471

Closed
2 tasks done
fauust opened this issue Dec 6, 2023 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@fauust
Copy link

fauust commented Dec 6, 2023

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration issue.
  • This issue is not already reported on Github (I've searched it).

Bug description

The ftp tls doc suggest loading certificates with quotes, something like:

SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_FILE="/var/lib/sftpgo/certs/fullchain.pem"
SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_KEY_FILE="/var/lib/sftpgo/certs/privkey.key"

But this does not work as it gives the following error:

sftpgo    | {"level":"error","time":"2023-12-06T11:12:55.572","sender":"ftpd","message":"unable to load X509 key pair, cert file \"\\\"/var/lib/sftpgo/certs/fullchain.pem\\\"\" key file \"\\\"/var/lib/sftpgo/certs/privkey.pem\\\"\" error: open \"/var/lib/sftpgo/certs/fullchain.pem\": no such file or directory"}
sftpgo    | {"level":"error","time":"2023-12-06T11:12:55.572","sender":"service","message":"could not start FTP server: open \"/var/lib/sftpgo/certs/fullchain.pem\": no such file or directory"}

Workaround is to define the environment variables without quotes:

SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_FILE=/var/lib/sftpgo/certs/fullchain.pem
SFTPGO_FTPD__BINDINGS__0__CERTIFICATE_KEY_FILE=/var/lib/sftpgo/certs/privkey.key

Images tested (as of today, see bellow):

  • drakkan/sftpgo:v2.5
  • drakkan/sftpgo:v2.5-alpine
docker images
REPOSITORY       TAG           IMAGE ID       CREATED       SIZE
drakkan/sftpgo   v2.5          ea67734fdaac   3 weeks ago   208MB
drakkan/sftpgo   v2.5-alpine   dce604f84b27   3 weeks ago   78.2MB

Steps to reproduce

  1. follow https://github.com/drakkan/sftpgo/blob/main/docs/howto/lets-encrypt-certificate.md#enable-explicit-ftp-over-tls
  2. restart container with something like docker-compose down && docker-compose up
  3. ftp server does not start an the container enters in restart loop

Expected behavior

ftp server starts correctly and TLS is enabled.

SFTPGo version

v2.5.5

Data provider

local

Installation method

Community Docker image

Configuration

See bug description

Relevant log output

sftpgo    | {"level":"error","time":"2023-12-06T11:12:55.572","sender":"ftpd","message":"unable to load X509 key pair, cert file \"\\\"/var/lib/sftpgo/certs/fullchain.pem\\\"\" key file \"\\\"/var/lib/sftpgo/certs/privkey.pem\\\"\" error: open \"/var/lib/sftpgo/certs/fullchain.pem\": no such file or directory"}
sftpgo    | {"level":"error","time":"2023-12-06T11:12:55.572","sender":"service","message":"could not start FTP server: open \"/var/lib/sftpgo/certs/fullchain.pem\": no such file or directory"}

What are you using SFTPGo for?

Medium business

Additional info

No response

@fauust fauust added the bug Something isn't working label Dec 6, 2023
@drakkan
Copy link
Owner

drakkan commented Dec 8, 2023

Hello,

thanks for the report. The doc is about an env file loaded directly from SFTPGo that works well with quotes, in your case I think you are using docker compose or something similar which have this issue. It i hard to cover every use case in docs, anyway the error message is quite clear and from it you should understand that you need to remove quotes

@fauust
Copy link
Author

fauust commented Dec 12, 2023

Oh, indeed, I read too fast and thought that the documentation was speaking about loading env variables the docker-compose way. And yes, you are assuming correctly, I am using docker-compose with env variables defined directly in the compose file.

Closing, sorry for the noise and thanks for this awesome project!

@fauust fauust closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants