diff options
| author | 2021-06-12 14:12:21 +0100 | |
|---|---|---|
| committer | 2021-06-21 18:52:00 +0100 | |
| commit | 2c5fdb670fe37d757e6d81b17c0e68e3b848c3fe (patch) | |
| tree | 075f2a920930c3186bb55343e748b614ed46d533 /src/modules/m_sslinfo.cpp | |
| parent | Add social media links to the readme. (diff) | |
Add 'if-host-match' option to m_sslinfo oper autologin configuration.
This adds an option to perform the source host check (which is usually
performed on manual oper login) in addition to the certificate fingerprint
check when automatically logging in opers upon connection to the ircd.
Diffstat (limited to 'src/modules/m_sslinfo.cpp')
| -rw-r--r-- | src/modules/m_sslinfo.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index ae3d2b7b6..28ba3f177 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -373,7 +373,23 @@ class ModuleSSLInfo { OperInfo* ifo = i->second; std::string fp = ifo->oper_block->getString("fingerprint"); - if (MatchFP(cert, fp) && ifo->oper_block->getBool("autologin")) + if (!MatchFP(cert, fp)) + continue; + + bool do_login = false; + const std::string autologin = ifo->oper_block->getString("autologin"); + if (stdalgo::string::equalsci(autologin, "if-host-match")) + { + const std::string& userHost = localuser->MakeHost(); + const std::string& userIP = localuser->MakeHostIP(); + do_login = InspIRCd::MatchMask(ifo->oper_block->getString("host"), userHost, userIP); + } + else if (ifo->oper_block->getBool("autologin")) + { + do_login = true; + } + + if (do_login) user->Oper(ifo); } } |
