summaryrefslogtreecommitdiff
path: root/modules/encryption
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-09-11 15:45:26 +0100
committerSadie Powell <sadie@witchery.services>2020-09-28 15:28:26 +0100
commit8e0e1806a47e6fa78f884666b55c04edf11fd66c (patch)
treed1489041c56f995104b44047ff064afd65a890f9 /modules/encryption
parent7f39fb14f2d9963464165ae9112abe2e65bded8d (diff)
Require a secure password hashing algorithm for new accounts.
Insecure algorithms can still be used for existing accounts.
Diffstat (limited to 'modules/encryption')
-rw-r--r--modules/encryption/enc_md5.cpp3
-rw-r--r--modules/encryption/enc_none.cpp13
-rw-r--r--modules/encryption/enc_old.cpp2
-rw-r--r--modules/encryption/enc_sha1.cpp3
4 files changed, 8 insertions, 13 deletions
diff --git a/modules/encryption/enc_md5.cpp b/modules/encryption/enc_md5.cpp
index 3a20204ca..a35f4c802 100644
--- a/modules/encryption/enc_md5.cpp
+++ b/modules/encryption/enc_md5.cpp
@@ -345,7 +345,8 @@ class EMD5 : public Module
EMD5(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR),
md5provider(this)
{
-
+ if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+ throw ModuleException("enc_md5 is deprecated and can not be used as a primary encryption method");
}
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override
diff --git a/modules/encryption/enc_none.cpp b/modules/encryption/enc_none.cpp
index acf41b280..2a89c8486 100644
--- a/modules/encryption/enc_none.cpp
+++ b/modules/encryption/enc_none.cpp
@@ -14,7 +14,8 @@ class ENone : public Module
public:
ENone(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR)
{
-
+ if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+ throw ModuleException("enc_none is deprecated and can not be used as a primary encryption method");
}
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override
@@ -28,16 +29,6 @@ class ENone : public Module
return EVENT_ALLOW;
}
- EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) anope_override
- {
- if (!hashm.equals_cs("plain"))
- return EVENT_CONTINUE;
- size_t pos = src.find(':');
- Anope::string buf = src.substr(pos + 1);
- Anope::B64Decode(buf, dest);
- return EVENT_ALLOW;
- }
-
void OnCheckAuthentication(User *, IdentifyRequest *req) anope_override
{
const NickAlias *na = NickAlias::Find(req->GetAccount());
diff --git a/modules/encryption/enc_old.cpp b/modules/encryption/enc_old.cpp
index 47fab3e3b..234002671 100644
--- a/modules/encryption/enc_old.cpp
+++ b/modules/encryption/enc_old.cpp
@@ -44,6 +44,8 @@ class EOld : public Module
EOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR),
oldmd5provider(this)
{
+ if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+ throw ModuleException("enc_old is deprecated and can not be used as a primary encryption method");
ModuleManager::LoadModule("enc_md5", User::Find(creator, true));
if (!md5)
diff --git a/modules/encryption/enc_sha1.cpp b/modules/encryption/enc_sha1.cpp
index a84624fb6..098aeb938 100644
--- a/modules/encryption/enc_sha1.cpp
+++ b/modules/encryption/enc_sha1.cpp
@@ -205,7 +205,8 @@ class ESHA1 : public Module
ESHA1(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, ENCRYPTION | VENDOR),
sha1provider(this)
{
-
+ if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+ throw ModuleException("enc_sha1 is deprecated and can not be used as a primary encryption method");
}
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) anope_override