ID:752332
 
Years ago I wrote and released an application called "DreamConfig". It's intended purpose was to provide an easy-to-use command for adding/deleting hostbans that didn't make you think about flags, line formatting, and all that jazz. It had what was probably all of one user (myself).

With the most recent update, hostban.txt now gets reloaded (in 30s intervals) if a change is made. This allows for us to actually use session-based bans. Because of this, I decided to re-write DreamConfig and open-source it this time. I wanted to get some pre-release testing done, if I could, to make sure I didn't miss anything. I've already done some testing myself, but there's no real test better than normal usage.

You can grab the binary that I compiled and packaged with tar here. There might be some issues with glibc versions, so let me know and I can re-compile it with an earlier version. If for some reason you don't want to trust my compiled version, or you can't get it to work and want to compile it yourself, the source can be found here. Once you have git installed, it's as simple as:

git clone git://git.audeuro.com/dreamconfig.git


And some usage information:

DreamConfig [action] [options]
        action:
                ban
                unban

        options:
                -a
                -key banKey
                -ip banIp
                -type banType
                -reason banReason
                -message banMessage
                -pid sessionPid
                -time expirationTime

        banType: (Optional) Must be one of: 'sticky' or 'key'.
        sessionPid: The PID of the Dream Daemon process that this ban should apply to.
        expirationTime: The length of time (in seconds) from now that this ban should last.

* If the -a flag is set, only sets options that are present.
* banMessage and banReason must be enclosed in quotes.
* banMessage is displayed to the user.
* If expirationTime is not expired, the ban will be permanant.


I removed the friends functionality that was in the first version for now. Any suggestions or feedback you're welcome to post in this thread.
After I used
git clone git://git.audeuro.com/dreamconfig.git
And received the files, how do I install/use them?


root@CENSORED_IP:~/dreamconfig# DreamConfig ban -key MasterSpectra -time 60 -reason "Because I can"
-bash: DreamConfig: command not found
From there, you have to compile it. You can either use premake4 if you have it, or you can just compile it by hand.

For premake4, the following commands in the root directory (that is, the dreamconfig directory) will produce an executable in bin/debug:

premake4 gmake
make


Or, you can do it the manual way. Again, from the root directory:

cd src
g++ config.cpp dir.cpp hostban.cpp main.cpp -O2 -o DreamConfig

Both work just fine.
root@CENSORED_IP:~/dreamconfig/src# g++ config.cpp dir.cpp hostban.cpp main.cpp -O2 -o DreamConfig
dir.cpp: In static member function 'static std::string Directory::ResolvePath(const std::string&)':
dir.cpp:15:33: warning: ignoring return value of 'char* realpath(const char*, char*)', declared with attribute warn_unused_result
It should have still spit out the "DreamConfig" binary in the 'src' directory.
kk . . So far so good.

root@CENSORED_IP:~/dreamconfig/src# ./DreamConfig ban -key "MasterSpectra" -type sticky -time "60"
adding


And that's it? adding. And nothing happens ingame, though I haven't tried rebooting yet.
I need to make the time stuff a little bit friendlier, I suspect. It's actually specified in seconds from now, so your ban would last for roughly 60 seconds then dissipate. Now, the hostban file gets reloaded every 30 seconds or so if it's changed, so it's likely you wouldn't notice the ban for a little bit and then only for a little bit longer after that.

To verify, though, try the following command:

cat ~/.byond/cfg/hostban.txt

and post the results? If it's an empty file, the ban expired.
kk, I typed ./DreamConfig ban -key "MasterSpectra" -time "600" -type sticky

Then waited 1 minute, after that I checked did that and the result was:


cat: /root/.byond/cfg/hostban.txt: No such file or directory
I've fixed the error in my git repo, the fix is pretty simple:

Line 20 of hostban.cpp, should look like:

return Directory::ResolvePath(homedir + "/.byond/cfg/hostban.txt");

Change it to:

return Directory::ResolvePath(homedir + "/.byond/cfg") + "/hostban.txt";

This is pretty much a direct result of fixing that warning that was stopping your compilation previously, heh.