Hi –
It seems that Pure-Ftpd now has a command line option that lets the admin
configure the location of the TLS certificate/key file(s). This option,
however, is not supported by the pure-ftpd-wrapper script.
I'm enclosing a patch that adds support for the two settings mentioned
in the pure-ftpd.conf file (CertFile and CertFileAndKey). The "CertFile"
configuration file specifies a single file name, referring to a file that
contains the certificate and the corresponding private key, while the
"CertFileAndKey" configuration file specifies two file names on the same
line, separated by ":", ",", a space or a tab, giving the file containing
the certificate and that containing the key separately. (In both cases,
the certificate can actually be a bundle of certificates including any
required intermediate certificates.)
It would be great if this patch (or something else to the same effect)
could be made part of the official distribution.
--- pure-ftpd-wrapper.orig 2023-07-16 21:28:46.981044290 +0000
+++ pure-ftpd-wrapper 2023-07-16 21:36:46.454419036 +0000
@@ -65,6 +65,8 @@
'Bind' => ['-S %s', \&parse_string],
'BrokenClientsCompatibility' => ['-b'],
'CallUploadScript' => ['-o'],
+ 'CertFile' => ['-2 %s', \&parse_filename],
+ 'CertFileAndKey' => ['-2 %s,%s', \&parse_filename_2],
'ChrootEveryone' => ['-A'],
'CreateHomeDir' => ['-j'],
'CustomerProof' => ['-Z'],
@@ -240,6 +242,25 @@
return 1;
}
+sub parse_filename_2 {
+ my ($buf, $fmt, $val) = @_;
+
+ if ($val =~ /^(.*)[,:\s](.*)$/) {
+ unless (-f $1) {
+ $$buf = qq{"$1": No such file};
+ return;
+ }
+ unless (-f $2) {
+ $$buf = qq{"$2": No such file};
+ return;
+ }
+ $$buf = sprintf $fmt, $1, $2;
+ return 1
+ }
+
+ $$buf = qq{"$val": must be two file names separated by comma, colon, or space};
+}
+
sub parse_ip {
my ($buf, $fmt, $val) = @_;