Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent bans #93

Open
CuriousMike56 opened this issue Jul 30, 2019 · 2 comments
Open

Persistent bans #93

CuriousMike56 opened this issue Jul 30, 2019 · 2 comments

Comments

@CuriousMike56
Copy link
Collaborator

Currently, server bans are cleared when the server restarts. It would be nice if they were stored in a file, by username & IP.

@CuriousMike56
Copy link
Collaborator Author

To expand on this, there should also be banned vehicles and usernames. The server scripts can ban vehicles, but the server must be restarted for the changes to apply.

@ohlidalp
Copy link
Member

ohlidalp commented Sep 25, 2019

Hi.

RoRserver has persistent state AUTH_BANNED(32) based on token in authfile - this is checked first when connecting.

There are also IP-bans which are created by "!ban " command and aren't persisted. Nickname is recorded but not checked:

// check if banned
SWBaseSocket::SWBaseError error;
if (Sequencer::IsBanned(sock->get_peerAddr(&error).c_str())) {
Logger::Log(LOG_VERBOSE, "rejected banned IP %s", sock->get_peerAddr(&error).c_str());
Messaging::SendMessage(sock, RoRnet::MSG2_BANNED, 0, 0, 0, 0);
return;
}

Draft

  • Maintain "blacklist.json" containing existing ban-records:
    struct ban_t {
    unsigned int uid; //!< userid
    char ip[40]; //!< ip of banned client
    char nickname[RORNET_MAX_USERNAME_LEN]; //!< Username, this is what they are called to
    char bannedby_nick[RORNET_MAX_USERNAME_LEN]; //!< Username, this is what they are called to
    char banmsg[256]; //!< why he got banned
    };
  • Add nick-blacklist by adding a "type {IP, NICK, BOTH}" field to the above struct.
  • Vehicle bans: add "![un]blacklist " commands, create new struct similar to ban_t and persist it in "blacklist.json" as well.
  • Vehicle bans: record { truckfile name/truck full name, GUID }, but those be easily faked, we may need to record node/beam/wheel/command/hydro counts, possibly with custom checksums - whatever data server has available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants