Saturday, November 17, 2007

Running Apache and DHCP in Solaris 8

Quick Install

If you want to just get started and do not care about the details of what I did to create the Apache with mod_ssl package, you can do the following to install Apache:
Download (I will illustrate for Solaris 8 on SPARC):

apache-1.3.27-sol8-sparc-local.gzopenssl-0.9.6i-sol8-sparc-local.gz

Run
gunzip apache-1.3.27-sol8-sparc-local.gzgunzip openssl-0.9.6i-sol8-sparc-local.gz

and then, as root, run
pkgadd -d apache-1.3.27-sol8-sparc-localpkgadd -d openssl-0.9.6i-sol8-sparc-local


Put the directories, /usr/local/apache/bin and /usr/local/ssl/bin in your PATH. Put /usr/local/ssl/lib in your LD_LIBRARY_PATH:

vi /etc/profile
PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/local/ssl/bin:/usr/ccs/bin
LD_LIBRARY_PATH=/usr/lib:/usr/openwin/lib:/usr/dt/lib:/usr/ucblib:/usr/local/lib:/usr/local/ssl/lib
export PATH LD_LIBRARY_PATH


Set "Port 80, ServerAdmin admin@localhost" and "ServerName 127.0.0.1" in httpd.conf. Once you have the configuration the way you want it, you can run
/usr/local/apache/bin/apachectl start

tail /usr/local/apache/logs/error_log
[Sun Nov 18 00:26:35 2007] [error] mod_ssl: Init: Failed to generate temporary 512 bit RSA private key (OpenSSL library error follows)
[Sun Nov 18 00:26:35 2007] [error] OpenSSL: error:24064064:random number generator:SSLEAY_RAND_BYTES:PRNG not seeded
[Sun Nov 18 00:26:35 2007] [error] OpenSSL: error:04069003:rsa routines:RSA_generate_key:BN lib

Using "truss -d /usr/local/pache/bin/httpd" show that there is missing /dev/urandom. To rectify this problem you need to enable it by running:

ln -s /dev/random /dev/urandom

After that rerun /usr/local/apache/bin/apachectl start
telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.



Solaris DHCP Client
To set a Solaris box as a dhcp client (assuming the ethernet device ishme0), there are two ways:
1) Create an empty /etc/hostname.hme0 and /etc/dhcp.hme0
2) # ifconfig hme0 plumb # ifconfig hme0 dhcp start

However, this sets the hostname to unknown unless you specify somethinglike the following in the dhcp server config.

host netra {
hardware ethernet 08:00:20:da:63:96;
option host-name "netra";
}

Alternately, according to http://www.rite-group.com/rich/solaris_dhcp.html, you can download http://www.rite-group.com/rich/set_hostname to /etc/init.d, with a symbolic link to it from /etc/rc2.d/S70set_hostname. Put the hostname in /etc/nodename.


To disable dhcp in Solaris simply remove the two files mentioned above.