- Timestamp:
- Dec 16, 2007, 4:04:11 AM (15 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, main, master, msva, proxy-ticket, upstream
- Children:
- e6f648a
- Parents:
- 8bd529f
- git-author:
- Nikos Mavrogiannopoulos <nmav@…> (12/16/07 04:04:11)
- git-committer:
- Nokis Mavrogiannopoulos <nmav@…> (12/16/07 04:04:11)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gnutls_config.c
r8bd529f r2b3a248b 1 1 /** 2 2 * Copyright 2004-2005 Paul Querna 3 * Copyright 2007 Nikos Mavrogiannopoulos 3 4 * 4 5 * Licensed under the Apache License, Version 2.0 (the "License"); … … 230 231 } 231 232 232 233 233 ret = 234 234 gnutls_openpgp_crt_import(sc->cert_pgp, &data, GNUTLS_OPENPGP_FMT_BASE64); … … 451 451 } 452 452 453 rv = gnutls_openpgp_keyring_init(&sc->pgp_list); 454 if (rv < 0) { 455 return apr_psprintf(parms->pool, "GnuTLS: Failed to initialize" 456 "keyring: (%d) %s", rv, gnutls_strerror(rv)); 457 } 458 453 459 rv = gnutls_openpgp_keyring_import(sc->pgp_list, &data, GNUTLS_OPENPGP_FMT_BASE64); 454 460 if (rv < 0) { -
src/gnutls_hooks.c
r8bd529f r2b3a248b 72 72 #endif 73 73 74 if (gnutls_check_version(LIBGNUTLS_VERSION)==NULL) { 75 fprintf(stderr, "gnutls_check_version() failed. Required: gnutls-%s Found: gnutls-%s\n", 76 LIBGNUTLS_VERSION, gnutls_check_version(NULL)); 77 return -3; 78 } 79 74 80 ret = gnutls_global_init(); 75 if (ret < 0) /* FIXME: can we print here? */{81 if (ret < 0) { 76 82 fprintf(stderr, "gnutls_global_init: %s\n", gnutls_strerror(ret)); 77 83 return -3; … … 79 85 80 86 ret = gnutls_global_init_extra(); 81 if (ret < 0) { /* FIXME: can we print here? */87 if (ret < 0) { 82 88 fprintf(stderr, "gnutls_global_init_extra: %s\n", gnutls_strerror(ret)); 83 89 return -3; … … 94 100 gnutls_global_set_log_level(9); 95 101 gnutls_global_set_log_function(gnutls_debug_log_all); 102 apr_file_printf(debug_log_fp, "gnutls: %s\n", gnutls_check_version(NULL)); 96 103 #endif 97 104 … … 104 111 mgs_srvconf_rec *tsc; 105 112 int ret; 106 int cprio[ 3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 };113 int cprio[2]; 107 114 108 115 ctxt = gnutls_transport_get_ptr(session); … … 136 143 */ 137 144 ret = gnutls_priority_set(session, ctxt->sc->priorities); 138 139 /* Do not allow the user to override certificate priorities. We know 140 * better if the certificate of certain type is enabled. */ 141 if (ctxt->sc->cert_pgp != NULL && ctxt->sc->certs_x509[0] != NULL) { 142 gnutls_certificate_type_set_priority( session, cprio); 143 } else if (ctxt->sc->certs_x509[0] != NULL) { 145 /* actually it shouldn't fail since we have checked at startup */ 146 if (ret < 0) 147 return ret; 148 149 /* If both certificate types are not present disallow them from 150 * being negotiated. 151 */ 152 if (ctxt->sc->certs_x509[0] != NULL && ctxt->sc->cert_pgp == NULL) { 144 153 cprio[0] = GNUTLS_CRT_X509; 145 154 cprio[1] = 0; 146 155 gnutls_certificate_type_set_priority( session, cprio); 147 } else if (ctxt->sc->cert_pgp != NULL ) {156 } else if (ctxt->sc->cert_pgp != NULL && ctxt->sc->certs_x509[0]==NULL) { 148 157 cprio[0] = GNUTLS_CRT_OPENPGP; 149 158 cprio[1] = 0; … … 151 160 } 152 161 153 /* actually it shouldn't fail since we have checked at startup */154 if (ret < 0)155 return ret;156 162 157 163 … … 189 195 } 190 196 197 /* 2048-bit group parameters from SRP specification */ 191 198 const char static_dh_params[] = "-----BEGIN DH PARAMETERS-----\n" 192 199 "MIIBBwKCAQCsa9tBMkqam/Fm3l4TiVgvr3K2ZRmH7gf8MZKUPbVgUKNzKcu0oJnt\n" … … 412 419 if (sc->enabled == GNUTLS_ENABLED_TRUE) { 413 420 rv = read_crt_cn(s, p, sc->certs_x509[0], &sc->cert_cn); 414 if (rv < 0 ) /* try openpgp certificate */421 if (rv < 0 && sc->cert_pgp != NULL) /* try openpgp certificate */ 415 422 rv = read_pgpcrt_cn(s, p, sc->cert_pgp, &sc->cert_cn); 416 423 … … 978 985 } 979 986 980 /* FIXME: Allow client sending acertificate chain */987 /* TODO: Allow client sending a X.509 certificate chain */ 981 988 static int mgs_cert_verify(request_rec * r, mgs_handle_t * ctxt) 982 989 { … … 1047 1054 } 1048 1055 1049 1050 1056 if (rv < 0) { 1051 1057 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, 1052 1058 "GnuTLS: Failed to Verify Peer certificate: (%d) %s", 1053 1059 rv, gnutls_strerror(rv)); 1060 if (rv == GNUTLS_E_NO_CERTIFICATE_FOUND) 1061 ap_log_rerror(APLOG_MARK, APLOG_EMERG, 0, r, 1062 "GnuTLS: No certificate was found for verification. Did you set the GnuTLSX509CAFile or GnuTLSPGPKeyringFile directives?"); 1054 1063 ret = HTTP_FORBIDDEN; 1055 1064 goto exit; 1056 1065 } 1066 1067 /* TODO: X509 CRL Verification. */ 1068 /* May add later if anyone needs it. 1069 */ 1070 /* ret = gnutls_x509_crt_check_revocation(crt, crl_list, crl_list_size); */ 1057 1071 1058 1072 expired = 0; … … 1089 1103 "GnuTLS: Peer Certificate is revoked."); 1090 1104 } 1091 1092 /* TODO: Further Verification. */1093 /* Revocation is X.509 non workable paradigm, I really doubt implementation1094 * is worth doing --nmav1095 */1096 /// ret = gnutls_x509_crt_check_revocation(crt, crl_list, crl_list_size);1097 1098 // mgs_hook_fixups(r);1099 // rv = mgs_authz_lua(r);1100 1105 1101 1106 if (gnutls_certificate_type_get( ctxt->session) == GNUTLS_CRT_X509) -
src/mod_gnutls.c
r8bd529f r2b3a248b 65 65 RSRC_CONF, 66 66 "Set the CA File to verify Client Certificates"), 67 AP_INIT_TAKE1("GnuTLSX509CAFile", mgs_set_client_ca_file, 68 NULL, 69 RSRC_CONF, 70 "Set the CA File to verify Client Certificates"), 67 71 AP_INIT_TAKE1("GnuTLSPGPKeyringFile", mgs_set_keyring_file, 68 72 NULL, … … 80 84 NULL, 81 85 RSRC_CONF, 82 "SSL Server Certificate file"),86 "SSL Server X509 Certificate file"), 83 87 AP_INIT_TAKE1("GnuTLSKeyFile", mgs_set_key_file, 84 88 NULL, 85 89 RSRC_CONF, 86 "SSL Server Private Key file"), 90 "SSL Server X509 Private Key file"), 91 AP_INIT_TAKE1("GnuTLSX509CertificateFile", mgs_set_cert_file, 92 NULL, 93 RSRC_CONF, 94 "SSL Server X509 Certificate file"), 95 AP_INIT_TAKE1("GnuTLSX509KeyFile", mgs_set_key_file, 96 NULL, 97 RSRC_CONF, 98 "SSL Server X509 Private Key file"), 87 99 AP_INIT_TAKE1("GnuTLSPGPCertificateFile", mgs_set_pgpcert_file, 88 100 NULL,
Note: See TracChangeset
for help on using the changeset viewer.