hypernatic.net
02-08-2002, 08:59 AM
Hail all,
I was thinking of editing the Control Panel scripts of the RaQ, so it can add some extra stuff to for instance... httpd.conf or so...
What do you think? Any suggestions?
I know ASPCode.net (or something like that) did it (its a username btw)...
Can you remember what files I have to edit, ASPCode.net?
Thanks
ASPCode.net
02-08-2002, 09:18 AM
Sorry, now I remember I should come back with this info...I did try to look it up but found out I I had reformatted that disk, and didn't have the time to look on my RAQ server...
Anyway
/usr/lib/perl5/site_perl/5.005/Cobalt/Vsite.pm is the file.
In the beginning of the file is sub vsite_add which is where we should add some stuff. Scroll down to
$new_conf .= <<EOF;
<VirtualHost $addr>
ServerName $name
ServerAdmin $serveradmin
DocumentRoot $Htgroup_dir/$group/$Webdir
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$addr(:80)?$my
RewriteCond %{HTTP_HOST} !^$name(:80)?$my
RewriteRule ^/(.*) http://$name/\$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
</VirtualHost>
EOF
Here you can add your own things like,
$new_conf .= <<EOF;
<VirtualHost $addr>
ServerName $name
ServerAdmin $serveradmin
DocumentRoot $Htgroup_dir/$group/$Webdir
RewriteEngine on
RewriteCond %{HTTP_HOST} !^$addr(:80)?$my
RewriteCond %{HTTP_HOST} !^$name(:80)?$my
RewriteRule ^/(.*) http://$name/\$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
<IfModule mod_throttle.c>
ThrottlePolicy Volume 20G 30d
</IfModule>
<Location /throttle-me>
SetHandler throttle-me
</Location>
php_admin_value safe_mode 1
php_admin_value open_basedir $Htgroup_dir/$group/
</VirtualHost>
EOF
Here I have set mod_throttle, php safe_mode and php_opendir
hypernatic.net
02-08-2002, 09:21 AM
That's COOL :D
But I kinda wanted to make a field for bandwidth so I can change that every time..
So Kinda like this
<IfModule mod_throttle.c>
ThrottlePolicy Volume $trafficG 30d
</IfModule>
Get it?
Also,
php_admin_value safe_mode 1
php_admin_value open_basedir $Htgroup_dir/$group/
What does this do?...
Any other suggestions maybe?
ASPCode.net
02-08-2002, 09:33 AM
Well all variables comes from the RAQ CP inner workings and html forms, so adding a $traffic is hard. I use a default value and then manually edit httpd.conf afterwards. Cause it does not overwrite any manual changes you have made when you change something through the CP.
Safe mode:
In short. Disables a lot of PHP functions like
exec and such so a user cant sneak into your system by using PHP code.
Open base dir. Makes sure a user cant open and read files under someone elses webroot. Base dir means just that, when opening a file, make sure it is based under $Htgroup_dir/$group/
( which is for example /home/sites/home/site10 ) otherwise don't allow it.
And it does not only mean other websites, also system files such as /etc/passwd is possible to read by default. However both safe mode and open_basedir fixes that.
More on Safe mode. Now php.net is down so I could not give you the direct link, but search for safe_mode and you will find some good info on exactly which functions are disabled when running php in safe mode.
hypernatic.net
02-08-2002, 01:33 PM
Originally posted by ASPCode.net
Well all variables comes from the RAQ CP inner workings and html forms, so adding a $traffic is hard. I use a default value and then manually edit httpd.conf afterwards. Cause it does not overwrite any manual changes you have made when you change something through the CP.
HAVE you ever done it? If so... What should I do? :)
Are the HTML files/forms in the same directory?
ASPCode.net
02-08-2002, 02:56 PM
No, I have not done it automatically. Well, the truth is the Cobalt sourcefiles are a mess to follow, html files, Perl library modules and CGI scripts placed at a lot of different locations. Also, cgi-scripts are used to generate some forms etc so while I was gonna try to modify it I saimply gave up.