endziu2222
Active Member
- Joined
- Nov 2, 2010
- Messages
- 181
- Solutions
- 1
- Reaction score
- 49
My server is not online yet to the public but for some reason I get logs from strange IP's.
I decided to change my code to the code bellow related to RSA. Can somebody tell if this is safe? as now if somebody try to login from dodgy client he will be banned for 7 days I mean IP. Code:
I decided to change my code to the code bellow related to RSA. Can somebody tell if this is safe? as now if somebody try to login from dodgy client he will be banned for 7 days I mean IP. Code:
Lua:
if (!Protocol::RSA_decrypt(msg)) {
if (auto connectionObject = getConnection()) {
uint32_t ip = connectionObject->getIP();
BanInfo banInfo;
if (IOBan::isIpBanned(ip, banInfo) && banInfo.expiresAt > time(nullptr)) {
disconnect();
return;
}
std::string ipStr = convertIPToString(ip);
g_logger().warn("Failed login attempt from IP: " + ipStr);
if (IOBan::addIpBan(ip, "Unauthorized access attempt", 7)) {
g_logger().warn("IP Banned for 7 days due to failed RSA decryption: " + ipStr);
}
}
disconnect();
return;
}