/*
- * $Id$
+ * Copyright (c) 1996-2010 by the citadel.org team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdep.h"
SSL_CTX *ssl_ctx; /* SSL context */
pthread_mutex_t **SSLCritters; /* Things needing locking */
+char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
pthread_key_t ThreadSSL; /* Per-thread SSL context */
X509_NAME *name = NULL;
FILE *fp;
char buf[SIZ];
+ int rv = 0;
if (!access("/var/run/egd-pool", F_OK)) {
RAND_egd("/var/run/egd-pool");
SSL_load_error_strings();
ssl_method = SSLv23_server_method();
if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
- lprintf(3, "SSL_CTX_new failed: %s\n",
- ERR_reason_error_string(ERR_get_error()));
+ lprintf(3, "SSL_CTX_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+ return;
+ }
+
+ lprintf(9, "Requesting cipher list: %s\n", ssl_cipher_list);
+ if (!(SSL_CTX_set_cipher_list(ssl_ctx, ssl_cipher_list))) {
+ lprintf(3, "SSL_CTX_set_cipher_list failed: %s\n", ERR_reason_error_string(ERR_get_error()));
return;
}
*/
if (!strcasecmp(ctdlhost, "uds")) {
sprintf(buf, "%s/keys/citadel.key", ctdlport);
- symlink(buf, CTDL_KEY_PATH);
+ rv = symlink(buf, CTDL_KEY_PATH);
+ if (!rv) lprintf(1, "%s\n", strerror(errno));
sprintf(buf, "%s/keys/citadel.csr", ctdlport);
- symlink(buf, CTDL_CSR_PATH);
+ rv = symlink(buf, CTDL_CSR_PATH);
+ if (!rv) lprintf(1, "%s\n", strerror(errno));
sprintf(buf, "%s/keys/citadel.cer", ctdlport);
- symlink(buf, CTDL_CER_PATH);
+ rv = symlink(buf, CTDL_CER_PATH);
+ if (!rv) lprintf(1, "%s\n", strerror(errno));
}
/*
NULL /* no callbk */
) != 1) {
lprintf(3, "Cannot write key: %s\n",
- ERR_reason_error_string(ERR_get_error()));
+ ERR_reason_error_string(ERR_get_error()));
unlink(CTDL_KEY_PATH);
}
fclose(fp);
if (pk=EVP_PKEY_new(), pk != NULL) {
EVP_PKEY_assign_RSA(pk, rsa);
if (req = X509_REQ_new(), req != NULL) {
-
+ const char *env;
/* Set the public key */
X509_REQ_set_pubkey(req, pk);
X509_REQ_set_version(req, 0L);
MBSTRING_ASC, "Mount Kisco", -1, -1, 0);
*/
+ env = getenv("O");
+ if (env == NULL)
+ env = "Organization name",
+
X509_NAME_add_entry_by_txt(
name, "O",
MBSTRING_ASC,
- (unsigned char*)"Organization name",
+ (unsigned char*)env,
-1, -1, 0
);
+ env = getenv("OU");
+ if (env == NULL)
+ env = "Citadel server";
+
X509_NAME_add_entry_by_txt(
name, "OU",
MBSTRING_ASC,
- (unsigned char*)"Citadel server1",
+ (unsigned char*)env,
-1, -1, 0
);
+ env = getenv("CN");
+ if (env == NULL)
+ env = "*";
+
X509_NAME_add_entry_by_txt(
name, "CN",
MBSTRING_ASC,
- (unsigned char*)"*", -1, -1, 0
+ (unsigned char*)env,
+ -1, -1, 0
);
X509_REQ_set_subject_name(req, name);