This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Add a flag to read banned users from a defined file instead of from openttd.cfg #7957
Comments
Alternative idea: Have a pair of console commands, |
The problem is just being moved from the Your base problem is having the configuration mounted RO. The way I would build that would be: Changing the |
@LordAro What is an acceptable solution to this issue? Is it outputting ban information to log files? Is this card still a "good first issue"? |
There are so many ways to approach this :D If we pick the kubernetes use-case, there are many ways you can manage banlists. For example, I can imagine a CRD which states which IPs are banned, which is being fed into OpenTTD (via a controller connecting to the Admin part). This does mean we need a dynamic way to ban/unban (which we already have via console/admin). The main issue would be that you would have to list all bans, compare it with your "known lists for bans", and delta (add/remove) entries in OpenTTD. This is rather annoying and so far from an atomic operation, that I can imagine this being a pita to implement. Another use-case I can imagine is with Docker, where you minimize what files are readable/writable. I wouldn't want my Personally, I wouldn't go for the route of What @nielsm suggests is a bit of all worlds: let the user control it himself via a console/admin command, and we have startup/shutdown scripts that can automate this for the user. For example, this would be excellent to add in https://github.com/OpenTTD/OpenTTD/blob/master/bin/scripts/pre_dedicated.scr.example as example how to use such commands. Long story short, for me an acceptable solution would also be two new console commands (I would name them save/load, not read/write, but that is bikeshedding):
To retrieve the current list, This means it is a bit more effort for the server operator to get this to work, but as this is an advanced scenario anyway, I don't expect many issues from that. In other words: a long post to say: what @nielsmh suggests should work fine. @duckfullstop : do you agree? And yes, this is a "good first issue". It is fully isolated in the console command system, only adds functionality, and is closely scoped. So that should be a fantastic way to learn a bit about the console system, ini-files, etc :) |
In that case, I'll pick this up. Hope to have a PR open by Wednesday of this week. |
Hi if this issue has not been fixed, can you assign this to me and i can work on this? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The problem
Right now, OpenTTD writes banned users to the [bans] section of openttd.cfg. This works fine for simple dedicated servers and listen servers, but I'm looking to implement more advanced scenarios, like a Kubernetes deployment.
In Kubernetes, configurations can be loaded in with the
configMap
functionality, which mounts a defined file in the container's filesystem read-only. This works fine, up until the server wants to write stuff to it, at which point we're SOL.The OpenTTD binary already has the
-x
flag, which prevents "automatically sav(ing) to config file on exit", which gets us part way to the intended functionality but still means bans don't get saved.The proposed solution
Add a new flag, such as
-B
(-b
is taken), which reads a list of banned IP addresses (users) from a given file, such as bans.cfg, and adds them to the list defined inopenttd.cfg
. This will allow the main configuration file to retain static definitions and be mounted read-only, while moving the ban list to a dynamic file which can be loaded separately.Default functionality should remain loading the bans list exclusively from openttd.cfg to leave existing installations unaffected.
The text was updated successfully, but these errors were encountered: