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

SSL Cert - SMTP server failed to start #1565

Closed
williambonomo opened this issue Oct 31, 2024 · 4 comments
Closed

SSL Cert - SMTP server failed to start #1565

williambonomo opened this issue Oct 31, 2024 · 4 comments

Comments

@williambonomo
Copy link

Hi Everyone,

We were using SMTP4dev on an Azure Container Instance with no issues. However, I was requested to enable the SMTP TLS using our SSL cert issued by GoDaddy. Knowing that Azure Container instance has some limitations with SSL cert I decided to create an image with our SSL.
When I run the container, I get the below error. I'm 100% sure the path to the key is correct.

2024-10-30 16:44:43 The SMTP server failed to start: System.IO.FileNotFoundException: Could not find file '/smtp4dev/mysslkey.key'.
2024-10-30 16:44:43 File name: '/smtp4dev/mysslkey.key'

This is how my Dockerfile looks like:

FROM rnwood/smtp4dev:latest

ENV ServerOptions__LockSettings=true
ENV ServerOptions__HostName=smtp4dev.ourdomain.io
ENV ServerOptions__Port=33
ENV ServerOptions__Urls=http://*:80
ENV ServerOptions__TlsMode=StartTls
ENV ServerOptions__TlsCertificate=myCrt.crt
ENV ServerOptions__TlsCertificatePrivateKey=mysslkey.key
ENV ServerOptions__TlsCertificatePassword=mypassword
ENV ServerOptions__SecureConnectionRequired=True
ENV ServerOptions__NumberOfMessagesToKeep=500

EXPOSE 80
EXPOSE 33
EXPOSE 143

I'm in no rush but if someone could help that would be great.

@Julien-Eyraud
Copy link

The docker file doesn't seem to copy the files.

@williambonomo
Copy link
Author

The docker file doesn't seem to copy the files.

Hey Julien. Thank you for your reply.
Do you think it has something to do with the folder/file permission? I just tried running it from a different folder on my PC and got the same error.
Strangely, it doesn't complain about the .crt.

@rnwood
Copy link
Owner

rnwood commented Dec 18, 2024

The docker file doesn't seem to copy the files.

This is the answer. You can add the COPY command to your docker file to copy the required cert files into the container.

https://docs.docker.com/reference/dockerfile/#copy

However, it's recommended to map a volume into the container when it is created. This keeps the cert files out of your image.

https://docs.docker.com/engine/storage/bind-mounts/

@williambonomo
Copy link
Author

The docker file doesn't seem to copy the files.

This is the answer. You can add the COPY command to your docker file to copy the required cert files into the container.

https://docs.docker.com/reference/dockerfile/#copy

However, it's recommended to map a volume into the container when it is created. This keeps the cert files out of your image.

https://docs.docker.com/engine/storage/bind-mounts/

Ohhh that's it, makes sense now. I should be more clear stating that I'm a Docker newbie, sorry.
Seem like it runs without errors now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants