View | Details | Raw Unified | Return to bug 51075
Collapse All | Expand All

(-)a/docs/conf/extra/httpd-ssl.conf.in (+6 lines)
Lines 147-152 SSLCertificateKeyFile "@exp_sysconfdir@/server.key" Link Here
147
#SSLVerifyClient require
147
#SSLVerifyClient require
148
#SSLVerifyDepth  10
148
#SSLVerifyDepth  10
149
149
150
#   TLS-SRP mutual authentication:
151
#   Enable TLS-SRP and set the path to the OpenSSL SRP verifier
152
#   file (containing login information for SRP user accounts). See
153
#   the mod_ssl FAQ for instructions on creating this file.
154
#SSLSRPVerifierFile "@exp_sysconfdir@/passwd.srpv"
155
150
#   Access Control:
156
#   Access Control:
151
#   With SSLRequire you can do per-directory access control based
157
#   With SSLRequire you can do per-directory access control based
152
#   on arbitrary complex boolean expressions containing server
158
#   on arbitrary complex boolean expressions containing server
(-)a/docs/manual/mod/mod_ssl.xml (+42 lines)
Lines 97-102 compatibility variables.</p> Link Here
97
<tr><td><code>SSL_SERVER_A_SIG</code></td>              <td>string</td>    <td>Algorithm used for the signature of server's certificate</td></tr>
97
<tr><td><code>SSL_SERVER_A_SIG</code></td>              <td>string</td>    <td>Algorithm used for the signature of server's certificate</td></tr>
98
<tr><td><code>SSL_SERVER_A_KEY</code></td>              <td>string</td>    <td>Algorithm used for the public key of server's certificate</td></tr>
98
<tr><td><code>SSL_SERVER_A_KEY</code></td>              <td>string</td>    <td>Algorithm used for the public key of server's certificate</td></tr>
99
<tr><td><code>SSL_SERVER_CERT</code></td>               <td>string</td>    <td>PEM-encoded server certificate</td></tr>
99
<tr><td><code>SSL_SERVER_CERT</code></td>               <td>string</td>    <td>PEM-encoded server certificate</td></tr>
100
<tr><td><code>SSL_SRP_USER</code></td>                  <td>string</td>    <td>SRP username</td></tr>
101
<tr><td><code>SSL_SRP_USERINFO</code></td>              <td>string</td>    <td>SRP user info</td></tr>
100
</table>
102
</table>
101
103
102
<p><em>x509</em> specifies a component of an X.509 DN; one of
104
<p><em>x509</em> specifies a component of an X.509 DN; one of
Lines 662-667 specify the preference and order for the ciphers (see <a href="#table1">Table Link Here
662
<tr><td><code>kDHr</code></td>   <td>Diffie-Hellman key exchange with RSA key</td></tr>
664
<tr><td><code>kDHr</code></td>   <td>Diffie-Hellman key exchange with RSA key</td></tr>
663
<tr><td><code>kDHd</code></td>   <td>Diffie-Hellman key exchange with DSA key</td></tr>
665
<tr><td><code>kDHd</code></td>   <td>Diffie-Hellman key exchange with DSA key</td></tr>
664
<tr><td><code>kEDH</code></td>   <td>Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)</td>   </tr>
666
<tr><td><code>kEDH</code></td>   <td>Ephemeral (temp.key) Diffie-Hellman key exchange (no cert)</td>   </tr>
667
<tr><td><code>kSRP</code></td>   <td>Secure Remote Password (SRP) key exchange</td></tr>
665
<tr><td colspan="2"><em>Authentication Algorithm:</em></td></tr>
668
<tr><td colspan="2"><em>Authentication Algorithm:</em></td></tr>
666
<tr><td><code>aNULL</code></td>  <td>No authentication</td></tr>
669
<tr><td><code>aNULL</code></td>  <td>No authentication</td></tr>
667
<tr><td><code>aRSA</code></td>   <td>RSA authentication</td></tr>
670
<tr><td><code>aRSA</code></td>   <td>RSA authentication</td></tr>
Lines 692-697 specify the preference and order for the ciphers (see <a href="#table1">Table Link Here
692
<tr><td><code>DH</code></td>     <td>all ciphers using Diffie-Hellman key exchange</td> </tr>
695
<tr><td><code>DH</code></td>     <td>all ciphers using Diffie-Hellman key exchange</td> </tr>
693
<tr><td><code>EDH</code></td>    <td>all ciphers using Ephemeral Diffie-Hellman key exchange</td> </tr>
696
<tr><td><code>EDH</code></td>    <td>all ciphers using Ephemeral Diffie-Hellman key exchange</td> </tr>
694
<tr><td><code>ADH</code></td>    <td>all ciphers using Anonymous Diffie-Hellman key exchange</td> </tr>
697
<tr><td><code>ADH</code></td>    <td>all ciphers using Anonymous Diffie-Hellman key exchange</td> </tr>
698
<tr><td><code>SRP</code></td>    <td>all ciphers using Secure Remote Password (SRP) key exchange</td> </tr>
695
<tr><td><code>DSS</code></td>    <td>all ciphers using DSS authentication</td> </tr>
699
<tr><td><code>DSS</code></td>    <td>all ciphers using DSS authentication</td> </tr>
696
<tr><td><code>NULL</code></td>   <td>all ciphers using no encryption</td> </tr>
700
<tr><td><code>NULL</code></td>   <td>all ciphers using no encryption</td> </tr>
697
</table>
701
</table>
Lines 1112-1117 SSLVerifyDepth 10 Link Here
1112
</directivesynopsis>
1116
</directivesynopsis>
1113
1117
1114
<directivesynopsis>
1118
<directivesynopsis>
1119
<name>SSLSRPVerifierFile</name>
1120
<description>Path to SRP verifier file</description>
1121
<syntax>SSLSRPVerifierFile <em>file-path</em></syntax>
1122
<contextlist><context>server config</context>
1123
<context>virtual host</context></contextlist>
1124
1125
<usage>
1126
<p>
1127
This directive enables TLS-SRP and sets the path to the OpenSSL SRP (Secure
1128
Remote Password) verifier file containing TLS-SRP usernames, verifiers, salts,
1129
and group parameters.</p>
1130
<example><title>Example</title>
1131
SSLSRPVerifierFile "/path/to/file.srpv"
1132
</example>
1133
</usage>
1134
</directivesynopsis>
1135
1136
<directivesynopsis>
1137
<name>SSLSRPUnknownUserSeed</name>
1138
<description>SRP unknown user seed</description>
1139
<syntax>SSLSRPUnknownUserSeed <em>secret-string</em></syntax>
1140
<contextlist><context>server config</context>
1141
<context>virtual host</context></contextlist>
1142
1143
<usage>
1144
<p>
1145
This directive sets the seed used to fake SRP user parameters for unknown
1146
users, to avoid leaking whether a given user exists. Specify a secret
1147
string. If this directive is not used, then Apache will return the
1148
UNKNOWN_PSK_IDENTITY alert to clients who specify an unknown username.
1149
</p>
1150
<example><title>Example</title>
1151
SSLSRPUnknownUserSeed "secret"
1152
</example>
1153
</usage>
1154
</directivesynopsis>
1155
1156
<directivesynopsis>
1115
<name>SSLOptions</name>
1157
<name>SSLOptions</name>
1116
<description>Configure various SSL engine run-time options</description>
1158
<description>Configure various SSL engine run-time options</description>
1117
<syntax>SSLOptions [+|-]<em>option</em> ...</syntax>
1159
<syntax>SSLOptions [+|-]<em>option</em> ...</syntax>
(-)a/docs/manual/ssl/ssl_faq.xml (+22 lines)
Lines 702-707 HTTPS to an Apache+mod_ssl server with Microsoft Internet Explorer (MSIE)?</titl Link Here
702
    or otherwise.</p>
702
    or otherwise.</p>
703
</section>
703
</section>
704
704
705
<section id="srp"><title>How do I enable TLS-SRP?</title>
706
<p>TLS-SRP (Secure Remote Password key exchange for TLS, specified in RFC 5054)
707
    can supplement or replace certificates in authenticating an SSL connection.
708
    To use TLS-SRP, set the
709
    <directive module="mod_ssl">SSLSRPVerifierFile</directive> directive to
710
    point to an OpenSSL SRP verifier file. To create the verifier file, use the
711
    <code>openssl</code> tool:
712
    <example>
713
    openssl srp -srpvfile passwd.srpv -add username
714
    </example>
715
    After creating this file, specify it in the SSL server configuration:
716
    <example>
717
    SSLSRPVerifierFile /path/to/passwd.srpv
718
    </example>
719
    To force clients to use non-certificate TLS-SRP cipher suites, use the
720
    following directive:
721
    <example>
722
    SSLCipherSuite "!DSS:!aRSA:SRP"
723
    </example>
724
</p>
725
</section>
726
705
</section>
727
</section>
706
<!-- /aboutssl -->
728
<!-- /aboutssl -->
707
729
(-)a/modules/ssl/mod_ssl.c (+9 lines)
Lines 133-138 static const command_rec ssl_config_cmds[] = { Link Here
133
    SSL_CMD_SRV(StrictSNIVHostCheck, FLAG,
133
    SSL_CMD_SRV(StrictSNIVHostCheck, FLAG,
134
                "Strict SNI virtual host checking")
134
                "Strict SNI virtual host checking")
135
135
136
#ifndef OPENSSL_NO_SRP
137
    SSL_CMD_SRV(SRPVerifierFile, TAKE1,
138
                "SRP verifier file "
139
                "('/path/to/file' - created by srptool)")
140
    SSL_CMD_SRV(SRPUnknownUserSeed, TAKE1,
141
                "SRP seed for unknown users (to avoid leaking a user's existence) "
142
                "('some secret text')")
143
#endif
144
136
    /*
145
    /*
137
     * Proxy configuration for remote SSL connections
146
     * Proxy configuration for remote SSL connections
138
     */
147
     */
(-)a/modules/ssl/ssl_engine_config.c (+38 lines)
Lines 145-150 static void modssl_ctx_init(modssl_ctx_t *mctx) Link Here
145
    mctx->stapling_responder_timeout      = UNSET;
145
    mctx->stapling_responder_timeout      = UNSET;
146
    mctx->stapling_force_url   		= NULL;
146
    mctx->stapling_force_url   		= NULL;
147
#endif
147
#endif
148
149
#ifndef OPENSSL_NO_SRP
150
    mctx->srp_vfile =           NULL;
151
    mctx->srp_unknown_user_seed=NULL;
152
    mctx->srp_vbase =           NULL;
153
#endif
148
}
154
}
149
155
150
static void modssl_ctx_init_proxy(SSLSrvConfigRec *sc,
156
static void modssl_ctx_init_proxy(SSLSrvConfigRec *sc,
Lines 260-265 static void modssl_ctx_cfg_merge(modssl_ctx_t *base, Link Here
260
    cfgMergeInt(stapling_responder_timeout);
266
    cfgMergeInt(stapling_responder_timeout);
261
    cfgMerge(stapling_force_url, NULL);
267
    cfgMerge(stapling_force_url, NULL);
262
#endif
268
#endif
269
270
#ifndef OPENSSL_NO_SRP
271
    cfgMergeString(srp_vfile);
272
    cfgMergeString(srp_unknown_user_seed);
273
#endif
263
}
274
}
264
275
265
static void modssl_ctx_cfg_merge_proxy(modssl_ctx_t *base,
276
static void modssl_ctx_cfg_merge_proxy(modssl_ctx_t *base,
Lines 1663-1668 const char *ssl_cmd_SSLStaplingForceURL(cmd_parms *cmd, void *dcfg, Link Here
1663
1674
1664
#endif /* HAVE_OCSP_STAPLING */
1675
#endif /* HAVE_OCSP_STAPLING */
1665
1676
1677
#ifndef OPENSSL_NO_SRP
1678
1679
const char *ssl_cmd_SSLSRPVerifierFile(cmd_parms *cmd, void *dcfg,
1680
                                       const char *arg)
1681
{
1682
    SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
1683
    const char *err;
1684
1685
    if ((err = ssl_cmd_check_file(cmd, &arg))) {
1686
      return err;
1687
    }
1688
1689
    sc->server->srp_vfile = arg;
1690
1691
    return NULL;
1692
}
1693
1694
const char *ssl_cmd_SSLSRPUnknownUserSeed(cmd_parms *cmd, void *dcfg,
1695
                                          const char *arg)
1696
{
1697
    SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
1698
    sc->server->srp_unknown_user_seed = arg;
1699
    return NULL;
1700
}
1701
1702
#endif /* OPENSSL_NO_SRP */
1703
1666
void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s)
1704
void ssl_hook_ConfigTest(apr_pool_t *pconf, server_rec *s)
1667
{
1705
{
1668
    if (!ap_exists_config_define("DUMP_CERTS")) {
1706
    if (!ap_exists_config_define("DUMP_CERTS")) {
(-)a/modules/ssl/ssl_engine_init.c (+38 lines)
Lines 467-472 static void ssl_init_ctx_tls_extensions(server_rec *s, Link Here
467
        modssl_init_stapling(s, p, ptemp, mctx);
467
        modssl_init_stapling(s, p, ptemp, mctx);
468
    }
468
    }
469
#endif
469
#endif
470
471
#ifndef OPENSSL_NO_SRP
472
    /*
473
     * TLS-SRP support
474
     */
475
    if (mctx->srp_vfile != NULL) {
476
        int rv;
477
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
478
                     "Using SRP verifier file [%s]", mctx->srp_vfile);
479
480
        if (!(mctx->srp_vbase = SRP_VBASE_new(mctx->srp_unknown_user_seed))) {
481
            ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
482
                         "Unable to initialize SRP verifier structure "
483
                         "[%s seed]",
484
                         mctx->srp_unknown_user_seed ? "with" : "without");
485
            ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
486
            ssl_die();
487
        }
488
489
        rv = SRP_VBASE_init(mctx->srp_vbase, mctx->srp_vfile);
490
        if (rv != SRP_NO_ERROR) {
491
            ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
492
                         "Unable to load SRP verifier file [error %d]", rv);
493
            ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
494
            ssl_die();
495
        }
496
497
        SSL_CTX_set_srp_username_callback(mctx->ssl_ctx, ssl_callback_SRPServerParams);
498
        SSL_CTX_set_srp_cb_arg(mctx->ssl_ctx, mctx);
499
    }
500
#endif
470
}
501
}
471
#endif
502
#endif
472
503
Lines 1409-1414 static void ssl_init_ctx_cleanup(modssl_ctx_t *mctx) Link Here
1409
    MODSSL_CFG_ITEM_FREE(X509_STORE_free, mctx->crl);
1440
    MODSSL_CFG_ITEM_FREE(X509_STORE_free, mctx->crl);
1410
1441
1411
    MODSSL_CFG_ITEM_FREE(SSL_CTX_free, mctx->ssl_ctx);
1442
    MODSSL_CFG_ITEM_FREE(SSL_CTX_free, mctx->ssl_ctx);
1443
1444
#ifndef OPENSSL_NO_SRP
1445
    if (mctx->srp_vbase != NULL) {
1446
        SRP_VBASE_free(mctx->srp_vbase);
1447
        mctx->srp_vbase = NULL;
1448
    }
1449
#endif
1412
}
1450
}
1413
1451
1414
static void ssl_init_ctx_cleanup_proxy(modssl_ctx_t *mctx)
1452
static void ssl_init_ctx_cleanup_proxy(modssl_ctx_t *mctx)
(-)a/modules/ssl/ssl_engine_kernel.c (-1 / +44 lines)
Lines 349-354 int ssl_hook_Access(request_rec *r) Link Here
349
        return DECLINED;
349
        return DECLINED;
350
    }
350
    }
351
351
352
#ifndef OPENSSL_NO_SRP
353
    /*
354
     * Support for per-directory reconfigured SSL connection parameters
355
     *
356
     * We do not force any renegotiation if the user is already authenticated
357
     * via SRP.
358
     *
359
     */
360
    if (SSL_get_srp_username(ssl)) {
361
        return DECLINED;
362
    }
363
#endif
364
352
    /*
365
    /*
353
     * Support for per-directory reconfigured SSL connection parameters.
366
     * Support for per-directory reconfigured SSL connection parameters.
354
     *
367
     *
Lines 1103-1108 static const char *ssl_hook_Fixup_vars[] = { Link Here
1103
    "SSL_SERVER_A_SIG",
1116
    "SSL_SERVER_A_SIG",
1104
    "SSL_SESSION_ID",
1117
    "SSL_SESSION_ID",
1105
    "SSL_SESSION_RESUMED",
1118
    "SSL_SESSION_RESUMED",
1119
#ifndef OPENSSL_NO_SRP
1120
    "SSL_SRP_USER",
1121
    "SSL_SRP_USERINFO",
1122
#endif
1106
    NULL
1123
    NULL
1107
};
1124
};
1108
1125
Lines 2255-2258 static int ssl_find_vhost(void *servername, conn_rec *c, server_rec *s) Link Here
2255
2272
2256
    return 0;
2273
    return 0;
2257
}
2274
}
2258
#endif
2275
2276
#endif /* OPENSSL_NO_TLSEXT */
2277
2278
#ifndef OPENSSL_NO_SRP
2279
2280
int ssl_callback_SRPServerParams(SSL *ssl, int *ad, void *arg)
2281
{
2282
    modssl_ctx_t *mctx = (modssl_ctx_t *)arg;
2283
    char *username = SSL_get_srp_username(ssl);
2284
    SRP_user_pwd *u;
2285
2286
    if ((u = SRP_VBASE_get_by_user(mctx->srp_vbase, username)) == NULL) {
2287
        *ad = SSL_AD_UNKNOWN_PSK_IDENTITY;
2288
        return SSL3_AL_FATAL;
2289
    }
2290
2291
    if (SSL_set_srp_server_param(ssl, u->N, u->g, u->s, u->v, u->info) < 0) {
2292
        *ad = SSL_AD_INTERNAL_ERROR;
2293
        return SSL3_AL_FATAL;
2294
    }
2295
2296
    /* reset all other options */
2297
    SSL_set_verify(ssl, SSL_VERIFY_NONE,  ssl_callback_SSLVerify);
2298
    return SSL_ERROR_NONE;
2299
}
2300
2301
#endif /* OPENSSL_NO_SRP */
(-)a/modules/ssl/ssl_engine_vars.c (-1 / +13 lines)
Lines 386-392 static char *ssl_var_lookup_ssl(apr_pool_t *p, conn_rec *c, request_rec *r, Link Here
386
        flag = SSL_get_secure_renegotiation_support(ssl);
386
        flag = SSL_get_secure_renegotiation_support(ssl);
387
#endif
387
#endif
388
        result = apr_pstrdup(p, flag ? "true" : "false");
388
        result = apr_pstrdup(p, flag ? "true" : "false");
389
    }                             
389
    }
390
#ifndef OPENSSL_NO_SRP
391
    else if (ssl != NULL && strcEQ(var, "SRP_USER")) {
392
        if ((result = SSL_get_srp_username(ssl)) != NULL) {
393
            result = apr_pstrdup(p, result);
394
        }
395
    }
396
    else if (ssl != NULL && strcEQ(var, "SRP_USERINFO")) {
397
        if ((result = SSL_get_srp_userinfo(ssl)) != NULL) {
398
            result = apr_pstrdup(p, result);
399
        }
400
    }
401
#endif
390
402
391
    return result;
403
    return result;
392
}
404
}
(-)a/modules/ssl/ssl_private.h (+14 lines)
Lines 523-528 typedef struct { Link Here
523
    const char *stapling_force_url;
523
    const char *stapling_force_url;
524
#endif
524
#endif
525
525
526
#ifndef OPENSSL_NO_SRP
527
    char *srp_vfile;
528
    char *srp_unknown_user_seed;
529
    SRP_VBASE  *srp_vbase;
530
#endif
531
526
    modssl_auth_ctx_t auth;
532
    modssl_auth_ctx_t auth;
527
533
528
    BOOL ocsp_enabled; /* true if OCSP verification enabled */
534
    BOOL ocsp_enabled; /* true if OCSP verification enabled */
Lines 641-646 const char *ssl_cmd_SSLOCSPResponseMaxAge(cmd_parms *cmd, void *dcfg, const char Link Here
641
const char *ssl_cmd_SSLOCSPResponderTimeout(cmd_parms *cmd, void *dcfg, const char *arg);
647
const char *ssl_cmd_SSLOCSPResponderTimeout(cmd_parms *cmd, void *dcfg, const char *arg);
642
const char *ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, int flag);
648
const char *ssl_cmd_SSLOCSPEnable(cmd_parms *cmd, void *dcfg, int flag);
643
649
650
#ifndef OPENSSL_NO_SRP
651
const char *ssl_cmd_SSLSRPVerifierFile(cmd_parms *cmd, void *dcfg, const char *arg);
652
const char *ssl_cmd_SSLSRPUnknownUserSeed(cmd_parms *cmd, void *dcfg, const char *arg);
653
#endif
654
644
const char *ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag);
655
const char *ssl_cmd_SSLFIPS(cmd_parms *cmd, void *dcfg, int flag);
645
656
646
/**  module initialization  */
657
/**  module initialization  */
Lines 682-687 void ssl_callback_Info(MODSSL_INFO_CB_ARG_TYPE, int, int); Link Here
682
#ifndef OPENSSL_NO_TLSEXT
693
#ifndef OPENSSL_NO_TLSEXT
683
int          ssl_callback_ServerNameIndication(SSL *, int *, modssl_ctx_t *);
694
int          ssl_callback_ServerNameIndication(SSL *, int *, modssl_ctx_t *);
684
#endif
695
#endif
696
#ifndef OPENSSL_NO_SRP
697
int          ssl_callback_SRPServerParams(SSL *, int *, void *);
698
#endif
685
699
686
/**  Session Cache Support  */
700
/**  Session Cache Support  */
687
void         ssl_scache_init(server_rec *, apr_pool_t *);
701
void         ssl_scache_init(server_rec *, apr_pool_t *);
(-)a/modules/ssl/ssl_toolkit_compat.h (+8 lines)
Lines 57-62 Link Here
57
#define OPENSSL_NO_EC
57
#define OPENSSL_NO_EC
58
#endif
58
#endif
59
59
60
/* SRP support came in OpenSSL 1.0.1 */
61
#if (OPENSSL_VERSION_NUMBER < 0x10001000)
62
#define OPENSSL_NO_SRP
63
#endif
64
#ifndef OPENSSL_NO_SRP
65
#include <openssl/srp.h>
66
#endif
67
60
/** Avoid tripping over an engine build installed globally and detected
68
/** Avoid tripping over an engine build installed globally and detected
61
 * when the user points at an explicit non-engine flavor of OpenSSL
69
 * when the user points at an explicit non-engine flavor of OpenSSL
62
 */
70
 */

Return to bug 51075