ConfigServer Scripts Forum

View unanswered posts | View active topics It is currently Wed Sep 08, 2010 5:12 pm



Reply to topic  [ 4 posts ] 
 CXS and account suspend 
Author Message
Junior Member

Joined: Mon Dec 11, 2006 2:00 am
Posts: 5
Post CXS and account suspend
I would like if is possible to have a option to automatically suspend an account when detect exploits or regall argument. Something like to append to the scanner like /scripts/suspendacct <username> .It doesn't matter if is a false positive. I can test for you the script with this option on my server if you want. It will help a lot. I had a user who tried to upload 900 times, can you imagine that?

Regards,
George B.


Thu Jun 24, 2010 1:23 am
Profile
Moderator

Joined: Sat Dec 09, 2006 7:13 pm
Posts: 2522
Post 
We're going to look at providing an external script hook that cxs can call when it identifies a suspicious file. You can then code whatever actions you want in that external script. Bear in mind that the script will run under the context of the user account it is run, so if it's a web upload script, this will be the nobody user (ModSecurity) and won't have privileges to do much. FTP and manual scans run under root, so should not be an issue.


Sun Jul 04, 2010 4:32 pm
Profile
Junior Member

Joined: Mon Dec 11, 2006 2:00 am
Posts: 5
Post 
chirpy wrote:
We're going to look at providing an external script hook that cxs can call when it identifies a suspicious file. You can then code whatever actions you want in that external script. Bear in mind that the script will run under the context of the user account it is run, so if it's a web upload script, this will be the nobody user (ModSecurity) and won't have privileges to do much. FTP and manual scans run under root, so should not be an issue.


Thanks for this great option but a question. How can I use a variable in my script with the line /scripts/suspendacct <username> to get the account name in my script.

I just wanted to tel you that I tried $1 $2 $3 $4 (4 is empty * file has option --all). That I wrote a small script I tested and it is ok. Maybe somebody else will use my script or maybe your suggest more simple:


#!/bin/sh
USR=`echo $1 | cut -d'/' -f3` #I am taking username from file line
if [ -e /var/cpanel/suspended/${USR} ] ; then
mail -s "Account ${USR} is already suspended!" root
else
/scripts/suspendacct ${USR}
mail -s "Account ${USR} was suspended because of [$3] !" root
fi


regards,
George B.


Thu Jul 08, 2010 12:32 am
Profile
Moderator

Joined: Sat Dec 09, 2006 7:13 pm
Posts: 2522
Post 
Thank you for posting your example, it shows what you can do with the feature nicely.


Mon Jul 26, 2010 9:17 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.