Web Hosting Talk







View Full Version : CGI wrap ??!!!


kickster
04-26-2001, 04:48 PM
What does CGI wrap do? If I turn it off would I reduce my CPU load. My CPU is running around 3 to 5 and some times it jumps to 80. I am running only few scripts that get 5 hits every second. plus 35 accounts that get very little traffics. When I do a top this is what I get. Any ways to reduce the load? does adding ram helps? what about moving to a raq4? and finaly what is <defunct>

1310 admin 20 0 2500 2500 1028 R 0 5.4 1.9 0:00 clickthru.cgi
1344 admin 15 0 1936 1936 956 R 0 5.2 1.5 0:00 clickthru.cgi
1330 admin 14 0 1896 1896 996 R 0 5.0 1.4 0:00 zone_A.pl
1342 admin 13 0 1936 1936 956 R 0 5.0 1.5 0:00 clickthru.cgi
1325 admin 13 0 2316 2316 1132 R 0 4.6 1.8 0:00 zone_A.pl
1326 admin 13 0 1992 1992 996 R 0 4.6 1.5 0:00 zone_A.pl
1351 admin 15 0 1920 1920 996 R 0 4.6 1.4 0:00 zone_A.pl
1328 admin 13 0 1940 1940 956 R 0 4.4 1.5 0:00 clickthru.cgi
1332 admin 15 0 1704 1704 996 R 0 4.1 1.3 0:00 zone_A.pl
1341 admin 13 0 1784 1784 996 R 0 4.1 1.3 0:00 zone_A.pl
32234 httpd 16 0 6532 6532 6472 S 0 3.9 5.1 0:00 httpd
1315 admin 12 0 0 0 0 Z 0 3.7 0.0 0:00 zone_A.pl <defunct>
1317 admin 13 0 1940 1940 956 R 0 3.3 1.5 0:00 clickthru.cgi
1361 admin 19 0 1552 1552 940 R 0 3.3 1.2 0:00 clickthru.cgi
1271 mysql 12 5 1668 1668 1052 R N 0 3.1 1.3 0:00 mysqld
1298 admin 12 0 2800 2800 1140 S 0 2.7 2.1 0:00 clickthru.cgi
1349 admin 14 0 1412 1412 964 R 0 2.5 1.1 0:00 zone_A.pl
1359 admin 18 0 1484 1484 968 R 0 2.5 1.1 0:00 zone_A.pl
18609 admin 5 0 1084 1084 864 R 0 1.9 0.8 0:54 top
1352 admin 15 0 1356 1356 964 R 0 1.7 1.0 0:00 zone_A.pl
1308 admin 14 0 2280 2280 996 R 0 1.5 1.7 0:00 sale.cgi
1360 admin 16 0 1192 1192 904 R 0 1.1 0.9 0:00 clickthru.cgi
1354 admin 13 0 1016 1016 852 R 0 0.9 0.7 0:00 zone_A.pl
1355 admin 13 0 372 372 296 R 0 0.7 0.2 0:00 zone_A.pl
1358 admin 14 0 1056 1056 856 R 0 0.7 0.8 0:00 clickthru.cgi
1353 admin 13 0 1012 1012 856 R 0 0.5 0.7 0:00 Random_Link.pl
675 httpd 6 0 6284 6284 5928 S 0 0.3 4.9 0:00 httpd
1131 httpd 12 0 6276 6276 5968 S 0 0.3 4.9 0:00 httpd
1345 root 14 0 768 768 744 S 0 0.3 0.5 0:00 lcdstop
18570 root 0 0 776 776 612 S 0 0.1 0.6 0:02 in.telnetd
32377 httpd 11 0 6292 6292 5912 S 0 0.1 4.9 0:00 httpd
32450 httpd 10 0 6288 6288 5932 S 0 0.1 4.9 0:00 httpd
623 httpd 3 0 6276 6276 5964 S 0 0.1 4.9 0:00 httpd
661 httpd 12 0 6580 6580 5516 S 0 0.1 5.1 0:00 httpd
674 httpd 5 0 6276 6276 5972 S 0 0.1 4.9 0:00 httpd
1127 httpd 12 0 6272 6272 5964 S 0 0.1 4.8 0:00 httpd
1152 httpd 10 0 6272 6272 5968 S 0 0.1 4.8 0:00 httpd
1322 httpd 13 0 6264 6264 5964 S 0 0.1 4.8 0:00 httpd
1323 httpd 9 0 6276 6276 5976 S 0 0.1 4.9 0:00 httpd
1337 httpd 10 0 6096 6096 5968 S 0 0.1 4.7 0:00 httpd
1340 httpd 10 0 6096 6096 5968 S 0 0.1 4.7 0:00 httpd
1 root 0 0 384 376 324 S 0 0.0 0.2 0:05 init

bert
04-26-2001, 07:36 PM
I am not sure about the wrap. I think it is somewhat the same as the "wrapper executable concept" but I am definitely not sure. I know for a fact though that it adds a little security to your scripts. I disabled it on mine and I have a little over 200 sites on a RaQ4 with 256MB of RAM. Adding more RAM should definitely help, however if you can disable the wrap do it. ;)

huck
04-27-2001, 08:39 AM
CGIwrap Homepage
CGI-wrap's home page is at:
http://cgiwrap.unixtools.org/

Why CGIwrap?
GCIwrap intercepts cgi-bin requests and "wraps" them in a way to make cgi execution more secure. When you run a server where you trust all of the users not to do anything stupid, you do not need cgi wrap. But in the web hosting business, you may not know your clients that well. Giving them the ability to run cgi-bin scripts opens up security holes.

Security Issuses
The security problems arise from allowing arbitrary users to execute scripts. Without cgiwrap, calls to scripts in the cgi-bin directory are executed with the web server's user ID. Generally, the web server has greater access to the system than a normal user (e.g. reading config files, logs, etc). Without cgiwrap, a client, using a carefully written script, could obtain access to files that otherwise would be off limits. In fact, all files on the system to which the webserver has access so would your client's scripts.

CGIwrap's Solution
CGIwrap solves this problem by allowing cgi-bin requests to be executed with the user's ID instead of the web server's ID. This way the scripts only have access to the files that they have access to as users, thus making your sytem more secure.

huck
04-27-2001, 08:52 AM
I am not sure why you have all of these open scripts unless you are getting a lot of traffic. I am not sure if cgi-wrap results in a significant decrease in performance -- I assume there must be some trade-off but I know of some high-volume web hosting companies that use it.

You may want to see if there is a problem with the script dying off. Often, these types of problems come from poorly written scripts as opposed to web server problems.

mod_perl[b]
I also notice the same script over and over. You may want to consider moving the script to be ran under mod_perl. Especially for small cgi scripts, a large amount of time is spent in the preproccessing stages. With mod_perl, this script would get compiled into the server and would not have to relaunched with every request. Not only would you signifiantly reduce your CPU load but you would probably notice significant gains in speed.


[B]Process Command
Instead of using top, try using:
ps -axf

This will spit our all of the processes in a tree structure so that you can tell what spawned what....this can be helpful in looking for badly behaving scripts.

kickster
04-27-2001, 10:01 AM
"mod_perl[b]
I also notice the same script over and over. You may want to consider moving the script to be ran under mod_perl.
Especially for small cgi scripts, a large amount of time is spent in the preproccessing stages. With mod_perl, this script
would get compiled into the server and would not have to relaunched with every request. Not only would you
signifiantly reduce your CPU load but you would probably notice significant gains in speed. "

How do I do this? I dont know much about linux :)