PDA

View Full Version : Perl and cgi script installation


linuxuser1
22nd March 2006, 12:35
Dear all,

I am trying trying to install a cgi script that provides free e-mail on my debian
server. I need to install some perl modules to get this to work. I have already installed ISPConfig, mysql and phpMyAdmin on my server as described in perfect setup debian and this is working quite fine.

I have also already installed ActivePerl on the server. It installed in /opt/Perl.
Going through the setup documentation,"Install some Perl Modules needed by SpamAssassin (comes with ISPConfig)

Installation using the Perl Shell

Login to your command line as root and run the following command to start the Perl shell:

perl -MCPAN -e shell" . It seems that Perl is already installed on my server

How i can

(1) install DBI
(2) install DBD-Mysql
(3) How do i set /opt/Perl as a path on the server. I understand i need to set the
system path for Perl so that it can be easily used by all users.
(4) How do i set Perl as path on the server
(5) What do i need to do so that my server can run cgi scripts for myself and for
others
(6) Can i upgrade my php4 to the latest release.

By the way am running the 2.02 of ISPConfig

Thanks for your kind help

till
22nd March 2006, 12:48
First, i recommend to uninstall active perl. ActivePerl is not needed at all because Debian has its own perl packages.

If you followed the howto, perl is already installed and configured on your server. Install the additional perl module with the apt-get command.

To install DBI and DBD-Mysql:

apt-get install libdbi-perl libdbd-mysql-perl

6) run:

apt-get update
apt-get -u upgrade

to update your server.

linuxuser1
22nd March 2006, 13:23
Thanks Till,

Will do that.

One other thing I want to confirm is that is my server now configured to run cgi and pl scripts? Can my customers (when i have one ) - also run cgi scripts securely as it is. The server is installed as par the perfect set up documents.

2) What do you think I should do to make my Debian server more secure now that am going to be allowing scripts to be run on it.

I am newbie to linux so your ISPConfig and this forum has gone a long way to help me to learn a lot. So thank you and Falko so much.



Thanks as always.

falko
22nd March 2006, 18:03
One other thing I want to confirm is that is my server now configured to run cgi and pl scripts? Can my customers (when i have one ) - also run cgi scripts securely as it is. The server is installed as par the perfect set up documents.Yes, if you followed the "Perfect Setup". Also have a look at the test files: http://www.howtoforge.com/forums/showthread.php?t=171

2) What do you think I should do to make my Debian server more secure now that am going to be allowing scripts to be run on it.

You can use suExec if you're using /var/www as web root for web sites created with ISPConfig. To do so, you must enable suExec under Management -> Server -> Setting -> Web.

linuxuser1
27th March 2006, 11:19
Dear Falko,

Thanks for your response.

I have tried to test with the test script at http://www.howtoforge.com/forums/showthread.php?t=171 and am getting 500 error - Internal Server Error!. You can see the url at http://www.alpharadiotv.org.uk/cgi-bin/hello_world.pl. I have enabled "Suexec" and I used this to build my server. - http://www.falkotimme.com/howtos/perfect_setup_debian_sarge/index.php.

I have also tried this http://www.alpharadiotv.org.uk/cgi-bin/messenger/messenger.cgi?Change_Setings. I also got Error 500.

The only thing I have done outside the setup documentation is that I installed - apt-get install libdbi-perl libdbd-mysql-perl

6) run:

apt-get update

Thanks for your kind help.

falko
27th March 2006, 15:09
Can you post the full path to the hello_world.pl script? Can you also post ls -la /path/to/hello_world.pl?
Might be a permissions problem. The script must be owned by the site admin and the web group.

linuxuser1
27th March 2006, 22:14
Hi Falko,

Here we go

Can you post the full path to the hello_world.pl script? - /var/www/web1/cgi-bin/hello_world.pl
ls output -rwxr-xr-x 1 root root 379 2004-06-04 18:11 /var/www/web1/cgi-bin/hello_world.pl l

Another script out put is :
-rwxr-xr-x 1 root root 91358 2006-03-26 23:29 /var/www/web1/cgi-bin/messenger/messenger.cgi

Thanks.

falko
28th March 2006, 11:55
The problem is your scripts belong to root:root instead of the owner and group of the web. You must change this because you have enabled suExec.

Please post the output of ls -la /var/www/web1

linuxuser1
28th March 2006, 12:48
Hi Falko,

Many thanks as always.

How do i change this permission. I am using WinSCP. When I looked at the properties of the script, I saw that is owed by root but I can only change the chmod numbers. The place to change the owner is greyed out. I will come back to you about the output of ls -la /var/www/web1

Thanks.

falko
28th March 2006, 21:11
You should try an SSH client like PuTTY so that you can work on the command line.
The command to change a file's ownership is chown <user>:<group> /path/to/file

linuxuser1
28th March 2006, 21:26
Hi falko,

This is the output of ls -la /var/www/web1
total 40
drwxr-xr-x 8 web1_alpharadio web1 4096 2006-03-27 21:12 .
drwxr-xr-x 6 root root 4096 2006-03-27 00:00 ..
drwxrwxr-x 3 web1_alpharadio web1 4096 2006-03-27 22:51 cgi-bin
-rw------- 1 web1_alpharadio web1 24 2006-03-27 21:12 .forward
drwxr-xr-x 2 web1_alpharadio web1 4096 2006-03-27 00:00 log
lrwxrwxrwx 1 root root 42 2006-03-27 21:12 Maildir -> /var/www/web 1/user/web1_alpharadio/Maildir
drwxrwxrwx 2 web1_alpharadio web1 4096 2006-03-28 09:20 phptmp
-rw-r--r-- 1 root root 486 2006-03-27 21:12 .procmailrc
drwxr-xr-x 2 web1_alpharadio web1 4096 2006-03-27 00:00 ssl
drwxr-xr-x 3 web1_alpharadio web1 4096 2006-03-27 00:00 user
lrwxrwxrwx 1 root root 50 2006-03-27 21:12 .vacation.cache -> /var /www/web1/user/web1_alpharadio/.vacation.cache
drwxrwxr-x 7 web1_alpharadio web1 4096 2006-03-27 22:19 web

Thanks.

linuxuser1
28th March 2006, 21:50
Hi Falko,

I have done the chown command as you said here is how the permission now looks:

debian:~#ls -la /var/www/web1/cgi-bin/messenger/messenger.cgi
-rwxr-xr-x 1 web1_alpharadio web1 91355 2006-03-27 21:13 /var/www/web1/cgi-bin/



debian:~# ls -la /var/www/web1 total 40
drwxr-xr-x 8 web1_alpharadio web1 4096 2006-03-27 21:12 .
drwxr-xr-x 6 root root 4096 2006-03-27 00:00 ..
drwxrwxr-x 3 web1_alpharadio web1 4096 2006-03-27 22:51 cgi-bin
-rw------- 1 web1_alpharadio web1 24 2006-03-27 21:12 .forward
drwxr-xr-x 2 web1_alpharadio web1 4096 2006-03-27 00:00 log
lrwxrwxrwx 1 root root 42 2006-03-27 21:12 Maildir -> /var/www/web1/user/web1_alpharadio/Maildir
drwxrwxrwx 2 web1_alpharadio web1 4096 2006-03-28 09:20 phptmp
-rw-r--r-- 1 root root 486 2006-03-27 21:12 .procmailrc
drwxr-xr-x 2 web1_alpharadio web1 4096 2006-03-27 00:00 ssl
drwxr-xr-x 3 web1_alpharadio web1 4096 2006-03-27 00:00 user
lrwxrwxrwx 1 root root 50 2006-03-27 21:12 .vacation.cache -> /var/www/web1/user/web1_alpharadio/.vacation.cache
drwxrwxr-x 7 web1_alpharadio web1 4096 2006-03-27 22:19 web

debian:~# ls -la /var/www/web1/cgi-bin/hello_world.pl
-rwxr-xr-x 1 web1_alpharadio web1 379 2004-06-04 18:11 /var/www/web1/cgi-bin/hello_world.pl

Thanks.

falko
29th March 2006, 15:06
debian:~# ls -la /var/www/web1/cgi-bin/hello_world.pl
-rwxr-xr-x 1 web1_alpharadio web1 379 2004-06-04 18:11 /var/www/web1/cgi-bin/hello_world.pl

Looks good. Did you test it?

linuxuser1
29th March 2006, 15:42
Hi Falko,

Yes. I tested it and still not working. Its here:-
http://www.alpharadiotv.org.uk/cgi-bin/hello_world.pl
http://www.alpharadiotv.org.uk/cgi-bin/messenger/messenger.cgi

Any other idea?

Thanks.

falko
29th March 2006, 21:07
Do you see anything in the Apache error log when you try to access these Perl scripts?

linuxuser1
30th March 2006, 12:40
Hi Falko,

The problem turned out to be with suexec. I install another debian server as per your perfect setup without suexec and this is now working quite well.

But I can I resolve the suexec problem because I will like to use this as am thinking it will be more secure.

Any thoughts.

Thanks as always.

till
30th March 2006, 13:33
Is your web root /home/www or /var/www ?

linuxuser1
30th March 2006, 15:26
Hi Till,

Using suexec my web root is /var/www ?. But because I could not get this to work, like i said i now set up another new server and the web root = /home/www and things are now working. Ut i will really love to use suexec if it will work.

Can i also ask please. How do i now set up my server to act as an smtp server because the script am running on the server needs the name/ip address of my smtp server. I put localhost in the script and it does not send any e-mail so am wondering what i need to do to enable smtp usage.

falko
30th March 2006, 16:06
Hi Till,

Using suexec my web root is /var/www ?. But because I could not get this to work, like i said i now set up another new server and the web root = /home/www and things are now working. Ut i will really love to use suexec if it will work.
Please post the output of updatedb
locate suexec

Can i also ask please. How do i now set up my server to act as an smtp server because the script am running on the server needs the name/ip address of my smtp server. I put localhost in the script and it does not send any e-mail so am wondering what i need to do to enable smtp usage.
Have a look at the Postfix section in the Debian tutorial: http://www.howtoforge.com/perfect_setup_debian_sarge_p4

linuxuser1
30th March 2006, 22:30
Hi,

The postfix section has alredy been implemented in my initial setup because i followed the perfect set up letter by letter and got the exact result expected as per the setup document.

Thanks.

falko
31st March 2006, 12:35
Then it might be a problem with your /etc/hosts file, i.e. localhost doesn't exist in it or points to a wrong IP address. What's in /etc/hosts?

linuxuser1
31st March 2006, 14:02
Hi falko,

etc/hosts is like this:

127.0.0.1 localhost.localdomain localhost debian1

192.168.21.233 debian1.mydomain.com debian1

192.168.21.234 virtual-ip1.mydomain.com virtual-ip1



# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

falko
31st March 2006, 19:07
Hm, looks ok... :confused:
I'd then use the IP address 127.0.0.1 in your script, that should work.

linuxuser1
3rd April 2006, 22:14
Hi Falko,

I am trying to install sendmail on another newly installed server following your perfect setup at http://www.falkotimme.com/howtos/sendmail_smtp_auth_tls/index.php. When i now try to test if its working and got this result:

debian:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server12.mydomain.com ESMTP Exim 4.50 Mon, 03 Apr 2006 20:11:29 +0100
ehlo localhost
250-server12.mydomain.com Hello localhost [127.0.0.1]
250-SIZE 52428800
250-PIPELINING
250 HELP


Thanks.

falko
4th April 2006, 19:34
What is the question?

linuxuser1
25th April 2006, 11:41
Hi Falko,

The question is when as per your perfect setup you tested with telnet,
you got many outputs like

250-ENHANCEDSTATUSCODES
PIPELINING
8BITTIME
DSN
ETRN
AUTH LOGIN PLAIN
STARTTLS
DELIVERY
HELP

whereas my own output on has
250-SIZE 52428800
250-PIPELINING
250 HELP
and am wondering why

Thank you

falko
25th April 2006, 16:48
What's the output of /usr/sbin/sendmail -d0.1 -bv root?

linuxuser1
25th April 2006, 17:41
Hi Falko,

Output as follows:

server1:~# /usr/sbin/sendmail -d0.1 -bv root
Version 8.13.6
Compiled with: DNSMAP LOG MATCHGECOS MILTER MIME7TO8 MIME8TO7
NAMED_BIND NETINET NETUNIX NEWDB PIPELINING SASLv2 SCANF
STARTTLS USERDB XDEBUG

============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = server1x
(canonical domain name) $j = server1.mydomain.com
(subdomain name) $m = mydomain.com
(node name) $k = server1.mydomain.com
================================================== ======

root... deliverable: mailer local, user root


Many Thanks.

falko
26th April 2006, 15:51
Looks ok. Did you create /etc/mail/sendmail.cf exactly as described in the tutorial?

linuxuser1
26th April 2006, 18:05
Hi Falko,

Yes exactly

Thanks

falko
27th April 2006, 00:09
Can you try the tutorial again? Please copy & paste from the tutorial.