#include "icp_opcode.h"
#include "ip/Address.h"
+// XXX: make this security/forward.h instead
+#include "security/PeerOptions.h"
+
//TODO: remove, it is unconditionally defined and always used.
#define PEER_MULTICAST_SIBLINGS 1
bool waitingForClose; ///< a conn must close before we open a standby conn
} standby; ///< optional "cache_peer standby=limit" feature
char *domain; /* Forced domain */
-#if USE_OPENSSL
- int use_ssl;
+ /// security settings for peer connection
+ Security::PeerOptions secure;
+
+#if USE_OPENSSL
char *sslcert;
char *sslkey;
int sslversion;
Config.ssl_client.sslContext = sslCreateClientContext(Config.ssl_client.cert, Config.ssl_client.key, Config.ssl_client.version, Config.ssl_client.cipher, Config.ssl_client.options, Config.ssl_client.flags, Config.ssl_client.cafile, Config.ssl_client.capath, Config.ssl_client.crlfile);
for (CachePeer *p = Config.peers; p != NULL; p = p->next) {
- if (p->use_ssl) {
+ if (p->secure.ssl) {
debugs(3, DBG_IMPORTANT, "Initializing cache_peer " << p->name << " SSL context");
p->sslContext = sslCreateClientContext(p->sslcert, p->sslkey, p->sslversion, p->sslcipher, p->ssloptions, p->sslflags, p->sslcafile, p->sslcapath, p->sslcrlfile);
}
if (token[13])
p->domain = xstrdup(token + 13);
-#if USE_OPENSSL
+ } else if (strncmp(token, "ssl", 3) == 0) {
+#if !USE_OPENSSL
+ debugs(0, DBG_CRITICAL, "WARNING: cache_peer option '" << token << "' requires --with-openssl");
+#else
+ p->secure.ssl = true;
- } else if (strcmp(token, "ssl") == 0) {
- p->use_ssl = 1;
- } else if (strncmp(token, "sslcert=", 8) == 0) {
+ if (strncmp(token, "sslcert=", 8) == 0) {
safe_free(p->sslcert);
p->sslcert = xstrdup(token + 8);
} else if (strncmp(token, "sslkey=", 7) == 0) {
safe_free(p->sslcafile);
p->sslcafile = xstrdup(token + 10);
} else if (strncmp(token, "sslcapath=", 10) == 0) {
- safe_free(p->sslcapath);
- p->sslcapath = xstrdup(token + 10);
+ safe_free(p->sslcafile);
+ p->sslcafile = xstrdup(token + 10);
} else if (strncmp(token, "sslcrlfile=", 11) == 0) {
safe_free(p->sslcrlfile);
p->sslcrlfile = xstrdup(token + 11);
} else if (strncmp(token, "ssldomain=", 10) == 0) {
safe_free(p->ssldomain);
p->ssldomain = xstrdup(token + 10);
+ }
+#endif
+
+ } else if (strncmp(token, "tls", 3) == 0) {
+#if !USE_GNUTLS && !USE_OPENSSL
+ debugs(0, DBG_CRITICAL, "WARNING: cache_peer option '" << token << "' requires --with-gnutls or --with-openssl");
+#else
+ p->secure.tls = true;
#endif
} else if (strcmp(token, "front-end-https") == 0) {