Exited with Code 252 when using own TLS certificate
yeldiRium opened this issue Β· comments
Hi π
I want to run pure ftpd with my own TLS certificate. I got it via let's encrypt and it is valid. My docker-compose.yaml
looks like this:
version: '3.7'
services:
ftp:
image: stilliard/pure-ftpd
ports:
- "21:21"
- 30000-30009:30000-30009
volumes:
- ./data:/home/ftpusers
- ./users:/etc/pure-ftpd/passwd
- ./tls-cert.pem:/etc/ssl/private/pure-ftpd.pem
I've cleaned the data and users volume before starting.
I've checked the certificate file in the container and it shows up belonging to fptuser:ftpgroup
with permissions 600 and with the correct content.
Am I missing something here?
Thanks in advance and kind regards,
yeldiR
Edit: I forgot to attach the output when running the service:
> docker-compose up
Starting ftp_ftp_1 ... done
Attaching to ftp_ftp_1
ftp_1 | TLS Enabled
ftp_1 | Setting default port range to: 30000:30009
ftp_1 | Setting default max clients to: 5
ftp_1 | Setting default max connections per ip to: 5
ftp_1 | Starting Pure-FTPd:
ftp_1 | pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P localhost --tls=1 -p 30000:30009 -c 5 -C 5
ftp_ftp_1 exited with code 252
I am getting the same error without using tls,
version: "3"
services:
ftp:
container_name: ftp
image: stilliard/pure-ftpd:latest
# volumes: # remember to replace /folder_on_disk/ with the path to where you want to store the files on the host machine
# - "/home/myuser1:/home/myuser1"
ports:
- 21:21
- 8192-8200:8192-8200
network_mode: host
environment:
PUBLICHOST: localhost
FTP_USER_NAME: myuser1
FTP_USER_PASS: 123123
FTP_USER_HOME: /home/myuser1
FTP_PASSIVE_PORTS: 8192-8200
output:
Attaching to ftp
ftp | Creating user...
ftp | Password:
ftp | Enter it again:
ftp | root user give /home/myuser1 directory ftpuser owner
ftp | Setting default port range to: 8192-8200
ftp | Setting default max clients to: 5
ftp | Setting default max connections per ip to: 5
ftp | Starting Pure-FTPd:
ftp | pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P localhost -p 8192-8200 -c 5 -C 5
ftp exited with code 252
please let me know if I am missing something,
if there is a bug, and would like help to fix it, I can gladly help out
thanks :)
I found my mistake and it was TLS related. I don't know what this has to do with @codexetreme's issue.
The documentation made it not entirely clear to me, in what format the TLS certificate had to be provided, so I just copied my Let's Encrypt certificate file to the given path, which look like this:
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
This did not work. Then I tried the Let's Encrypt key file, which looks like this:
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
This also did not work. After some digging in forums I realized, that I had to combine the two. So now my /etc/ssl/private/pure-ftpd.pem
file looks like this:
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
And now the server starts fine.
@codexetreme you should probably open a separate issue for your problem.