From 885d37630ef4b5b69c26c6eb3fc97e9cd2e35eae Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 7 Jun 2009 02:57:54 +0000 Subject: Allow SSL fingerprint-based server authentication git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11404 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 14 ++++++++++++++ src/modules/extra/m_ssl_openssl.cpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index c0cd05df5..1db4a84ca 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -402,6 +402,20 @@ class ModuleSSLGnuTLS : public Module } } } + else if (strcmp("GET_FP", request->GetId()) == 0) + { + if (ISR->Sock->GetFd() > -1) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + if (session->sess) + { + Extensible* ext = ISR->Sock; + ssl_cert* certinfo; + if (ext->GetExt("ssl_cert",certinfo)) + return certinfo->GetFingerprint().c_str(); + } + } + } return NULL; } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 53a0e241f..f468e3c53 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -407,6 +407,20 @@ class ModuleSSLOpenSSL : public Module return "OK"; } } + else if (strcmp("GET_FP", request->GetId()) == 0) + { + if (ISR->Sock->GetFd() > -1) + { + issl_session* session = &sessions[ISR->Sock->GetFd()]; + if (session->sess) + { + Extensible* ext = ISR->Sock; + ssl_cert* certinfo; + if (ext->GetExt("ssl_cert",certinfo)) + return certinfo->GetFingerprint().c_str(); + } + } + } return NULL; } -- cgit v1.3.1-10-gc9f91