Skip to content

Commit f09cc52

Browse files
committed
Default keys can be at a different location than certificates
1 parent 65162d5 commit f09cc52

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

man/pure-ftpd.8.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
pure\-ftpd \- simple File Transfer Protocol server
1010

1111
.SH "SYNOPSIS"
12-
.B pure\-ftpd [\-0] [\-1] [\-2] [\-3] [\-4] [\-6] [\-a gid] [\-A] [\-b] [\-B] [\-c clients] [\-C cnx/ip] [\-d [\-d]] [\-D] [\-e] [\-E] [\-f facility] [\-F fortunes file] [\-g pidfile] [\-G] [\-H] [\-i] [\-I] [\-j] [\-J ciphers] [\-k percentage] [\-K] [\-l authentication[:config file]] [\-L max files:max depth] [\-m maxload] [\-M] [\-n maxfiles:maxsize] [\-N] [\-o] [\-O format:log file] [\-p first:last] [\-P ip address or host name] [\-q upload:download ratio] [\-Q upload:download ratio] [\-r] [\-R] [\-s] [\-S [address,][port]] [\-t upload bandwidth:download bandwidth] [\-T upload bandwidth:download bandwidth] [\-u uid] [\-U umask files:umask dirs] [\-v bonjour name] [\-V ip address] [\-w] [\-W] [\-x] [\-X] [\-y max user sessions:max anon sessions] [\-Y tls behavior] [\-z] [\-Z]
12+
.B pure\-ftpd [\-0] [\-1] [\-2 cert_file[,key_file]] [\-3 certd_socket] [\-4] [\-6] [\-a gid] [\-A] [\-b] [\-B] [\-c clients] [\-C cnx/ip] [\-d [\-d]] [\-D] [\-e] [\-E] [\-f facility] [\-F fortunes file] [\-g pidfile] [\-G] [\-H] [\-i] [\-I] [\-j] [\-J ciphers] [\-k percentage] [\-K] [\-l authentication[:config file]] [\-L max files:max depth] [\-m maxload] [\-M] [\-n maxfiles:maxsize] [\-N] [\-o] [\-O format:log file] [\-p first:last] [\-P ip address or host name] [\-q upload:download ratio] [\-Q upload:download ratio] [\-r] [\-R] [\-s] [\-S [address,][port]] [\-t upload bandwidth:download bandwidth] [\-T upload bandwidth:download bandwidth] [\-u uid] [\-U umask files:umask dirs] [\-v bonjour name] [\-V ip address] [\-w] [\-W] [\-x] [\-X] [\-y max user sessions:max anon sessions] [\-Y tls behavior] [\-z] [\-Z]
1313

1414
.br
1515
Alternative style:
@@ -157,8 +157,10 @@ Add the PID to the syslog output. Ignored if
157157
.B none
158158
is set.
159159
.TP
160-
.B \-2 file
161-
When using TLS, set the path to the certificate file.
160+
.B \-2 cert_file[,key_file]
161+
When using TLS, set the path to the certificate file. The certificate
162+
and its key can be be bundled into a single file, or the key can be
163+
in a distinct file.
162164
.TP
163165
.B \-3 path
164166
Path to the pure-certd UNIX socket.

src/ftpd.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5801,12 +5801,27 @@ int pureftpd_start(int argc, char *argv[], const char *home_directory_)
58015801
}
58025802
#endif
58035803
#ifdef WITH_TLS
5804-
case '2':
5804+
case '2': {
5805+
char *struck;
5806+
char *key_file_;
5807+
5808+
if ((struck = strchr(optarg, ',')) != NULL) {
5809+
*struck = 0;
5810+
key_file_ = struck + 1;
5811+
} else {
5812+
key_file_ = optarg;
5813+
}
5814+
if (*optarg == 0 || *key_file_ == 0) {
5815+
die(421, LOG_ERR, MSG_CONF_ERR ": TLS");
5816+
}
58055817
if ((cert_file = strdup(optarg)) == NULL) {
58065818
die_mem();
58075819
}
5808-
key_file = cert_file;
5820+
if ((key_file = strdup(key_file_)) == NULL) {
5821+
die_mem();
5822+
}
58095823
break;
5824+
}
58105825
case '3':
58115826
tls_extcert_parse(optarg);
58125827
use_extcert++;

0 commit comments

Comments
 (0)