when i run this script key.cgi Iget in the browser Internal Server Error
and when I look in the log files error_log i see this :
[Sat Aug 27 12:41:36 2005] [error] [client 213.16.179.235] Premature end of script headers: key.cgi, referer: http://sip-info.gr/key.html
the script is :
#!/bin/bash
if [ "$REQUEST_METHOD" = 'POST' ]
then
export QUERY_STRING=`cat`
fi
export EMAIL=`perl -e '($_)=$ENV{QUERY_STRING}=~/(?:^|&)email=([^&]*)/;s/%(\w\w)/pack"H2",$1/eg;print'`
echo 'content-type:text/html'
if [ "$REQUEST_METHOD" = 'POST' ]
then
export QUERY_STRING=`cat`
fi
export EMAIL=`perl -e '($_)=$ENV{QUERY_STRING}=~/(?:^|&)email=([^&]*)/;s/%(\w\w)/pack"H2",$1/eg;print'`
echo 'content-type:text/html'
echo
echo ' Done! '
echo "The generated key was sent at this address : $EMAIL"
echo ''
cd ~
dir2=`pwd`
cd /tmp
/usr/bin/ssh-keygen -t dsa -b 512 -N "" -f id_dsa >> /var/log/sshkey 2>&1
cat id_dsa.pub >$dir2/.ssh/authorized_keys
rm id_dsa.pub
rm id_dsa
echo -e "Subject:Your SSH Key\nFrom:Tophost.gr \n"`cat $dir2/.ssh/authorized_keys` | /usr/sbin/sendmail $EMAIL
and it was working perfectly in another website in the server..