Getting https pages with Perl

Perl’s LWP package is a great way to get web pages and display the content of the resulting http header. Out of the box it does not support https, the following describes how to configure perl to access https pages.

Configure CPAN

The first thing to do is to setup perl to manage modules using CPAN. As root run:

perl -MCPAN -e shell \;

run through the configuration if you haven’t done so.

Install LWP

Inside the CPAN shell run:

install LWP
This will install all then necessary modules for accessing websites. Make sure you select y for GET, POST and HEAD, these are great scripts for getting at web page information from the command line.

Install OpenSSL

If you don’t have openssl-devel installed on your system you will need to install it. Check using:

rpm -q openssl-devel

Install openssl-devel with up2date:

up2date openssl-devel

Install Crypt-SSL

Install Crypt-SSL with perl:

perl -MCPAN -e shell \;

inside the shell run:

install Crypt::SSLeay

Test

GET https://www.markcallen.com

 

Security failure. Data decryption error. When using IE on a Mac

On Mac OS X when opening a new IE window from a site running under https there is no content in the window and the following error message is displayed:

mac_decryption_error

This can be correct by changing the SSLSessionCache in the Apache httpd.conf file.
The error shows up when SSLSessionCache is set to none. If it is changed to:
SSLSessionCache dbm:/logs/ssl_scache
where is where apache is installed.
This will correct the problem.

Installing Java on Fedora Core 3 using JDK 1.4.2

Excellent Howto for setting up Tomcat5 from jpackage.org on RedHat Fedora Core3.

http://www.mksearch.mkdoc.org/howto/jpackage-sun-fc3/

But required JDK 1.4.2 to be used in place of 1.5

Downloaded http://mirrors.sunsite.dk/jpackage/1.6/generic/non-free/SRPMS/java-1.4.2-sun-1.4.2.07-1jpp.nosrc.rpm 

rpm -Uvh java-1.4.2-sun-1.4.2.07-1jpp.nosrc.rpm

Download the self extracting version j2dsk-1_4_2_07-linux-i586.bin from http://java.sun.com/products/archive/j2se/1.4.2_07/index.html

Moved it into /usr/src/redhat/SOURCE

cd /usr/src/redhat/SPECS

rpmbuild -ba java-1.4.2-sun.spec

Just need to install java and java-devel

cd /usr/src/redhat/RPMS/i586

rpm -Uvh –nodeps java-1.4.2-sun-1.4.2.07-1jpp.i586.rpm java-1.4.2-sun-devel-1.4.2.07-1jpp.i586.rpm

Need to use the –nodeps flag since the spec generates some dependicies that are only for Solaris.

After installing jta need to install xml-commons-apis before installing tomcat5

yum -y install xml-commons-apis

Then finally

yum -y install tomcat5 tomcat5-admin tomcat5-webapps

Setting up sshd for Public Key Authentication

To create key only authentication the users public key needs to be put on the server in their home directory under .ssh/authorizated_keys.

Create the users private key on their workstation:

# ssh-keygen -t rsa

Send the private key to the server:

# cat .ssh/id_rsa.pub | ssh newmachine “cat >> .ssh/authorized_keys”

Make sure the authorized_keys file it set to the correct permissions.

Login to the server and change the permissions.

chmod 644 .ssh/authorized_keys

Configured sshd to use the key autentication and disable password authentication

# vi /etc/ssh/sshd_config

Make sure the following lines are in the file:

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no

Save the file.

Restart sshd

/etc/init.d/sshd restart

Test by connecting from the users workstation. They should be logged in right away without the need for a password. Try to login from the server, there should be an error message.

See http://open.bsdcow.net/tutorials/ssh_pubkey_auth for more information.