PHP Process killing
#1

hey i was wondering as i am coding my own server control panel for my hosting comapny i need to know how to kill samp without killing them all because the panel execute all the servers as root but i carnt figre out how to kill a individual one via php i know i would user shell_exec() but i dont know how to kill the one samp server that i needed because they will all be the same name :O so could anyone help? thanks
Reply
#2

I'll give you the answer, only after you read this:

You want your control panel to be usable, right? Just imagine that your control panel is a Russian hacker. You want to only allow certain files to be started with the script, in certain directories. Permissions are key. If a Russian hacker managed to get control of your control panel (and done nasty things with it), the integrity and security of all of the users files is at risk - the Russian hacker might download gamemodes, or just simply delete every single server.

[ rename ]
Reply
#3

I think I get what you mean Westie, Permissions?
Reply
#4

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
I'll give you the answer, only after you read this:

You want your control panel to be usable, right? Just imagine that your control panel is a Russian hacker. You want to only allow certain files to be started with the script, in certain directories. Permissions are key. If a Russian hacker managed to get control of your control panel (and done nasty things with it), the integrity and security of all of the users files is at risk - the Russian hacker might download gamemodes, or just simply delete every single server.

[ rename ]
fuckin racist'

anyways, ive already semi-answered this on xfire but i feel like going into depth.
you need to find the processid of the samp server when its started, and to record it (ie in a database), so that through a command later it could retrive the processid of the server and kill it using the linux command
kill [processid]

eh, also mlk you should note that you said your going to run these servers under your root account, thats going to screw with your system,
you want to create seperate ftp + user accounts for every customer on your box, and make sure they are set up to only have access to execute the samp02Xsvr file,
the ftp would be automatically chrooted if your using proftpd, the user accounts im not too sure of, but thats how industry control panels do it (ie swiftpanel), i'll try to see if i can find you something about the perm's that swiftpanel sets on the user accounts, i'll go digging in my box later today

update:
it seems that swiftpanel creates a seperate user and group for each customer/user on the box
theres a indepth listing on how users are created etc, on the swiftpanel forum site, but the main idea is that

when a panel like swiftpanel creates a new user account on the server, it runs this under root
Код:
useradd -d {homedir} -m {user}
wait...
passwd {user}
wait...
{password}
wait...
{password}
, it runs the game under the user account using this
Код:
screen -A -m -S {serverid}-{user}
wait...
{startline}
and it stops it using this, once again under the user account
Код:
kill -9 `screen -list | grep "{serverid}-{user}" | awk {'print $1'} | cut -d . -f1`
wait...
screen -wipe
i think the way swiftpanel kills it makes more sense, just incase you start 2 of the same process or something.
the seperate user accounts seems to make it easier,
and if i was coding a panel (hmm maybe thats a idea ) this is the way i would go

btw, those references were taken from the swiftpanel forums, its iframed so i cant send you a direct link
Reply
#5

It's not racist, It's the truth.
Reply
#6

Quote:
Originally Posted by iLinx
Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
I'll give you the answer, only after you read this:

You want your control panel to be usable, right? Just imagine that your control panel is a Russian hacker. You want to only allow certain files to be started with the script, in certain directories. Permissions are key. If a Russian hacker managed to get control of your control panel (and done nasty things with it), the integrity and security of all of the users files is at risk - the Russian hacker might download gamemodes, or just simply delete every single server.

[ rename ]
fuckin racist'
Calm down, it was just an example.
Reply
#7

Quote:
Originally Posted by Backwardsman97
Quote:
Originally Posted by iLinx
Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
I'll give you the answer, only after you read this:

You want your control panel to be usable, right? Just imagine that your control panel is a Russian hacker. You want to only allow certain files to be started with the script, in certain directories. Permissions are key. If a Russian hacker managed to get control of your control panel (and done nasty things with it), the integrity and security of all of the users files is at risk - the Russian hacker might download gamemodes, or just simply delete every single server.

[ rename ]
fuckin racist'
Calm down, it was just an example.
Alright then, I'll use 'faggot American hacker' then in future, just to keep you happy. Also, SwiftPanel uses SSH2.
Reply
#8

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
Alright then, I'll use 'faggot American hacker' then in future, just to keep you happy. Also, SwiftPanel uses SSH2.
>.> its the idea that counts

Reply
#9

To make your login more secure, use SSL, and make your control panel on a port, and host the files for the cpanel in a different place other than the website directory, like
location /usr/src/cpanel
port 2032
encryption SSL.
and make your cpanel use a SQL database to login, and IF you host more than 1 server, change the name of the server to like server23 and stopping the server will be easier. it will be like.
shell_exec('pkill -9 -f server23');
Trust me,Westie and I know what we are talking about, we both have coded a control panel before.
Reply
#10

Quote:
Originally Posted by iLinx
Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
Alright then, I'll use 'faggot American hacker' then in future, just to keep you happy. Also, SwiftPanel uses SSH2.
>.> its the idea that counts

DAMN DUTCH ASSHOLES sounds better!

XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)