Ask for SSL key password when started with -N but without sslpassword_program. Do not give SSL password-asking callback if sslpassword_program is not configured. OpenSSL should ask for the password itself then (which should work if Squid runs in foreground because of -N). The fix applies to Ssl::readCertChainAndPrivateKeyFromFiles() context only. This is not the only place where we read private keys. Some other places are working correctly, but others may need more work. Also, Ssl::readCertChainAndPrivateKeyFromFiles() may not really work if sslpassword_program _is_ configured because it will lack "user data" to record the password in. This change is for the better, but a complete fix needs investigation/testing and possibly more work. === modified file 'src/ssl/support.cc' --- src/ssl/support.cc 2013-05-14 17:15:02 +0000 +++ src/ssl/support.cc 2013-05-23 20:22:42 +0000 @@ -1545,41 +1545,44 @@ } } return certificate; } void Ssl::readCertChainAndPrivateKeyFromFiles(X509_Pointer & cert, EVP_PKEY_Pointer & pkey, X509_STACK_Pointer & chain, char const * certFilename, char const * keyFilename) { if (keyFilename == NULL) keyFilename = certFilename; if (certFilename == NULL) certFilename = keyFilename; debugs(83, DBG_IMPORTANT, "Using certificate in " << certFilename); if (!chain) chain.reset(sk_X509_new_null()); if (!chain) debugs(83, DBG_IMPORTANT, "WARNING: unable to allocate memory for cert chain"); - pkey.reset(readSslPrivateKey(keyFilename, ssl_ask_password_cb)); + // XXX: ssl_ask_password_cb needs SSL_CTX_set_default_passwd_cb_userdata() + // so this may not fully work iff Config.Program.ssl_password is set. + pem_password_cb *cb = ::Config.Program.ssl_password ? &ssl_ask_password_cb : NULL; + pkey.reset(readSslPrivateKey(keyFilename, cb)); cert.reset(readSslX509CertificatesChain(certFilename, chain.get())); if (!pkey || !cert || !X509_check_private_key(cert.get(), pkey.get())) { pkey.reset(NULL); cert.reset(NULL); } } bool Ssl::generateUntrustedCert(X509_Pointer &untrustedCert, EVP_PKEY_Pointer &untrustedPkey, X509_Pointer const &cert, EVP_PKEY_Pointer const & pkey) { // Generate the self-signed certificate, using a hard-coded subject prefix Ssl::CertificateProperties certProperties; if (const char *cn = CommonHostName(cert.get())) { certProperties.commonName = "Not trusted by \""; certProperties.commonName += cn; certProperties.commonName += "\""; } else if (const char *org = getOrganization(cert.get())) { certProperties.commonName = "Not trusted by \""; certProperties.commonName += org; certProperties.commonName += "\""; } else