Open hirsty opened 8 years ago
webui would seem like an awesome concept but however I would never use it. No offence but to use such would be a security concern for the server as a whole however if you could work on the -webalerts part that would be awesome as all get out for us custom servers.
thoughts were about the clusters and some of the confusions with the GameUserSettings ini and Game.ini. Whats the current webalert stuff? Any current issues for reference?
most info i can grab from it is https://survivetheark.com/index.php?/forums/topic/71544-tutorial-set-up-web-notifications-properly-to-receive-e-mails/
ah ok fairly easy dunno if you have a domain for me to code on if we are making it central but my idea is that servers register then api and access code generated, with optional logo upload, users reg with steam login email and access code and can unsub using link in email
This would be nice, I have been trying to use the shell_exec of php to have access to the arkmanager stuff without success, still trying to figure this out hehe, allways get the same:
"[ [1;31m ERROR [0;39m ] Your SteamCMD root seems not valid. [ [1;31m ERROR [0;39m ] Your SteamCMD exec could not be found. [ [1;31m ERROR [0;39m ] You have not rights to write in the log directory."
PHP would be running under the apache
user, which wouldn't have access to the contents of your steam
user's home directory, especially if selinux is enabled.
You might want to use visudo
to add something like the following to /etc/sudoers
:
apache ALL=(steam) NOPASSWD: /usr/local/bin/arkmanager
Then you would use something like:
$arkmanagerUser = "steam";
$arkmanagerExec = "/usr/local/bin/arkmanager";
function arkmanager($args){
$cmd = "sudo -u " + escapeshellarg($arkmanagerUser) + " " + escapeshellarg($arkmanagerExec);
foreach ($args as $arg){
$cmd += " " + escapeshellarg($arg);
}
return shell_exec($cmd);
}
# examples:
arkmanager("status");
arkmanager("rconcmd", "broadcast hello");
If I use
<?php print_r(get_current_user()); '>
I will get a return of steam ( the user that is running the arkmanager) Thats why I rly don't understand what is going here hehe, but I will try to what u should told me to see if it works :D Thanks
BtW sorry forgot to mention, I did a user install, prefer this way :D
If you did a user-install, and removed $HOME/.config/arkmanager/instances/main.cfg
in #642, then you will need to refer to instance.cfg.example to add the necessary settings to $HOME/.arkmanager.cfg
@klightspeed
Was trying to refer to what you say for the
$arkmanagerExec = "/usr/local/bin/arkmanager";
Should not be:
$arkmanagerExec = "/home/steam/bin/arkmanager";
since its where the arkmanager file is ?
BtW allways get the "sh: 1: 0: not found" on error.log of apache, with the code you provide (even with the /usr/local/bin/arkmanager or with the one /home/steam/bin/arkmanager)
@klightspeed another small update.
If i direct on the shell_exec put this:
$output = shell_exec('sudo -u steam /home/steam/bin/arkmanager status');
I get this as result:
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
1) Respect the privacy of others.
2) Think before you type.
3) With great power comes great responsibility.
sudo: no tty present and no askpass program specified
D'oh - +
is for arithmetic, when I should have used .
(string concatenation).
$arkmanagerUser = "steam";
$arkmanagerExec = "/home/steam/bin/arkmanager";
function arkmanager($args){
$cmd = "sudo -u " . escapeshellarg($arkmanagerUser) . " " . escapeshellarg($arkmanagerExec);
foreach ($args as $arg){
$cmd .= " " . escapeshellarg($arg);
}
return shell_exec($cmd);
}
# examples:
arkmanager("status");
arkmanager("rconcmd", "broadcast hello");
@klightspeed allways get this :/
sudo: no tty present and no askpass program specified
have the code like yours, only did have to add the (array) cast for $args on the for each
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
function arkmanager($args){
$arkmanagerUser = "steam";
$arkmanagerExec = "/home/steam/bin/arkmanager";
$cmd = "sudo -u " . escapeshellarg($arkmanagerUser) . " " . escapeshellarg($arkmanagerExec);
foreach ((array)$args as $arg){
$cmd .= " " . escapeshellarg($arg) . "";
}
return shell_exec($cmd);
}
$output = arkmanager("status");
echo "<pre>$output</pre>";
arkmanager("rconcmd", "broadcast hello");
?>
Since you're running PHP under the steam
user, you don't need sudo
.
Try:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
function arkmanager(){
$arkmanagerExec = "/home/steam/bin/arkmanager";
$cmd = escapeshellarg($arkmanagerExec);
foreach (func_get_args() as $arg){
$cmd .= " " . escapeshellarg($arg) . "";
}
return shell_exec($cmd);
}
$output = arkmanager("status");
echo "<pre>$output</pre>";
?>
If you have PHP 5.6 or later, you can try:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
function arkmanager(...$args){
$arkmanagerExec = "/home/steam/bin/arkmanager";
$cmd = escapeshellarg($arkmanagerExec);
foreach ($args as $arg){
$cmd .= " " . escapeshellarg($arg) . "";
}
return shell_exec($cmd);
}
$output = arkmanager("status");
echo "<pre>$output</pre>";
?>
Fix it, the problem was with the sudoers file.
I did the whoami command with apache I got the return of www-data, and on the sudoers it was like this:
apache ALL=(steam) NOPASSWD: /usr/local/bin/arkmanager
and should be like
www-data ALL=(steam) NOPASSWD: /usr/local/bin/arkmanager
My head isn't thinking right any more hehe all most 3AM here -.- time to go to bet.
by the way the code that is working its like:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
function arkmanager($args){
$arkmanagerUser = "steam";
$arkmanagerExec = "/home/steam/bin/./arkmanager";
$cmd = "sudo -u " . escapeshellarg($arkmanagerUser) . " " . escapeshellarg($arkmanagerExec);
foreach ((array)$args as $arg){
$cmd .= " " . escapeshellarg($arg) . "";
}
return shell_exec($cmd);
}
# examples:
$output = arkmanager("status");
echo "<pre>$output</pre>";
?>
Well still waiting on what it is u guys are wanting - not worked on anything yet - is it just a notification thing you want or?
It work like I have told on the previous comment :D and what I did to "fix" it. The problem was the wrong permissions on the arkmanager on the sudoers file
orig q was do they want a WebGUI or a webnotification app
time to make a start on web alerts :D
ok the alpha stage is ready for anyone to try - no editing of content yet - just plain text :D http://webalarm.danielhirst.info
@hirsty were you trying to run the server directly using the -webalarm
option, and/or specifying the arkflag_webalarm=true
option in your arkmanager instance config?
@klightspeed using arkflag_webalarm=true, trying on TheIsland this morningg -did a tcpdump last night and saw no post logs
@hirsty Were any tripwires tripped or babies born during that time?
@klightspeed I intentionally triggered a tripwire alarm,
@klightspeed no one on the server right now to trigger it (if they fixed up self-triggering
ok so it doesnt trip if you trip over it
@klightspeed PROOF - seems to put everything in notetitle.....
And it is open to everyone to use so feel free to put it on the readme if you wish or something and close the issue :)
I found easy way to test tripwire alarms when I was implenting tripwire alarms to my server and website: spawn eg. dodo with admin command and make it walk trough the tripwire.
I wasted sometime too before I found that alarms are not sent if you trigger the tripwire yourself and if I recall correctly the alarm is not sent if the person who triggers it is from same tribe.
And pretty neat thing that which you made :thumbsup:
thanks @Lihis like i said, its open for anyone to use - and as im using an auth/api system - no messages will get mixed up and no1 can sign up as sum1 else so its quite secure that way
Did anyone do a WebGUI for arkmanager? Would be really usefull to see online users, kick, ban, change settings, restart, stop, start, logs, etc from a webpage
If you guys cvan think up the design, I do not mind createing the WebGUI would probs be Laravel/Bootstrap