pthread_mutex_unlock(&ssl_locks[type]);
}
+static int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata) {
+ int pwdlen = strlen(userdata);
+ if (rwflag != 0 || pwdlen > size) /* not for decryption or too large */
+ return 0;
+ memcpy(buf, userdata, pwdlen);
+ return pwdlen;
+}
+
static int verify_cb(int ok, X509_STORE_CTX *ctx) {
char buf[256];
X509 *err_cert;
}
ctx = SSL_CTX_new(TLSv1_method());
+ if (options.tlscertificatekeypassword) {
+ SSL_CTX_set_default_passwd_cb_userdata(ctx, options.tlscertificatekeypassword);
+ SSL_CTX_set_default_passwd_cb(ctx, pem_passwd_cb);
+ }
if (SSL_CTX_use_certificate_chain_file(ctx, options.tlscertificatefile) &&
SSL_CTX_use_PrivateKey_file(ctx, options.tlscertificatekeyfile, SSL_FILETYPE_PEM) &&
SSL_CTX_check_private_key(ctx) &&
options.tlscertificatekeyfile = stringcopy(val, 0);
continue;
}
+ if (!strcasecmp(opt, "TLSCertificateKeyPassword")) {
+ options.tlscertificatekeypassword = stringcopy(val, 0);
+ continue;
+ }
if (!strcasecmp(opt, "UDPServerPort")) {
options.udpserverport = stringcopy(val, 0);
continue;
# You must specify the below for TLS, we will always present our certificate
TLSCertificateFile /etc/hostcertkey/host.example.com.pem
TLSCertificateKeyFile /etc/hostcertkey/host.example.com.key.pem
+# Optionally specify password if key is encrypted (not very secure)
+TLSCertificateKeyPassword follow the white rabbit
# You can optionally specify a non-standard UDP port to listen
#UDPServerPort 1814
char *tlscacertificatepath;
char *tlscertificatefile;
char *tlscertificatekeyfile;
+ char *tlscertificatekeypassword;
char *udpserverport;
};
-
+
/* requests that our client will send */
struct request {
unsigned char *buf;