Using CiscoCD with linux
From Internetworkpro
This is taken from http://www.groupstudy.com/archives/ccielab/200108/msg00264.html
Read the link first.
Nowadays,its bzip and not gzip.
First install apache. I used 1.3. Assuming your document root is /var/www, which is the default for most apache installation. Fedora 8's default root is /var/www/html/, though.
Become the root user and:
Create the directory /var/www/cgi-bin/
mkdir /var/www/cgi-bin/
Create /var/www/cgi-bin/showcisco The content of the file should be:
#!/usr/bin/perl
$zippedhtmfile = $ENV{'DOCUMENT_ROOT'} . $ENV{'PATH_INFO'} ||
die "No path info\n";
-s $zippedhtmfile || die "No such file $zippedhtmfile\n";
chop($filetype = `file $zippedhtmfile`);
$| = 1; # make sure the header gets output first!
print "Content-type: text/html\r\n\r\n";
if ($filetype =~ /bzip/) {
system "bzcat $zippedhtmfile";
} else { system "cat $zippedhtmfile";
}
Now set the file to be executable:
chmod a+x /var/www/cgi-bin/showcisco
Now we need to edit the apache configuration file. It should be in one of the following locations: /etc/httpd/httpd.conf /etc/apache/httpd.conf /var/www/conf/httpd.conf /etc/httpd/conf/httpd.conf Anyway just find and edit it: Add the following line to load the actions module:
LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
Now set the cgi bin directory by changing the ScpriptAlias to:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
In Fedora 8, LoadModule and ScriptAlias are installed by default.
Now add the following lines at the end of the file:
AddType text/gzipped .htm Action text/gzipped /cgi-bin/showcisco
And to show the images:
RewriteEngine on RewriteRule ^/CiscoCD/illus.aspx.*$ /cgi-bin/illus.aspx$1 [PT] RewriteRule ^/illus.aspx.*$ /cgi-bin/illus.aspx$1 [PT]
Save and restart apache buy issuing one of the following commands:
apachectl restart httpdctl restart
Now find out where your CiscoCD is mounted. The followin example assumes its mounted on /media/cdrom Create a symbolic link in /var/www to the CiscoCD content (Fedora 8's default document directory is /var/www/html/):
ln -s /media/cdrom/Server/Content CiscoCD
This is NOT over, yet ....
The images are compressed too. And the link points to illus.aspx to extract them. Add illus.aspx to /var/www/cgi-bin/ (note that its not ASP.NET its a perl script I wrote:) ) :
#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
$store = param("store");
$file = param("file");
($a,$b) = split (/\//, $store);
$filename = "/var/www/CiscoCD/illus/" . $store . ".tar";
print "Content-type: image/jpeg\r\n\r\n";
system "tar -xOf $filename $b\/$file";
Make sure $filename matches the symbolic link's path if you created CiscoCD under /var/www/html/. <p> Now set the file to be executable:
chmod a+x /var/www/cgi-bin/illus.aspx
Now browse to http://127.0.0.1/CiscoCD/Home/home.htm
Enjoy!!!
danshtr
