From 1997b706416324bded467d7abf34667dfe4b6ff2 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 5 Apr 2007 21:03:35 +0000 Subject: Add feature outlined in bug #192, give a notice showing cipher on connect to users. Its not possible (without something really spammy and ugly) to show it to opers, and its no use showing it to opers anyway, this would just be a silly vanity feature :p (admins know its working - people are connecting on the ssl port!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6736 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 7 +++++++ src/modules/extra/m_ssl_openssl.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 6abc5c1de..def9abdd2 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -657,6 +657,13 @@ class ModuleSSLGnuTLS : public Module DELETE(metadata); VerifyCertificate(&sessions[user->GetFd()],user); + if (sessions[user->GetFd()].sess) + { + std::string cipher = gnutls_kx_get_name(gnutls_kx_get(sessions[user->GetFd()].sess)); + cipher.append("-").append(gnutls_cipher_get_name(gnutls_cipher_get(sessions[user->GetFd()].sess))).append("-"); + cipher.append(gnutls_mac_get_name(gnutls_mac_get(sessions[user->GetFd()].sess))); + user->WriteServ("NOTICE %s :*** You are connected using SSL cipher \"%s\"", user->nick, cipher.c_str()); + } } } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index def8a0061..ee672b798 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -107,6 +107,7 @@ class ModuleSSLOpenSSL : public Module SSL_CTX* clictx; char* dummy; + char cipher[MAXBUF]; std::string keyfile; std::string certfile; @@ -746,6 +747,8 @@ class ModuleSSLOpenSSL : public Module DELETE(metadata); VerifyCertificate(&sessions[user->GetFd()], user); + if (sessions[user->GetFd()].sess) + user->WriteServ("NOTICE %s :*** You are connected using SSL cipher \"%s\"", user->nick, SSL_get_cipher(sessions[user->GetFd()].sess)); } } -- cgit v1.2.3