Linux Apache SSL PHP/FI frontpage mini-HOWTO: Putting it all together

Next Previous Contents

## 3. Putting it all together

## 3.1 Apache modules to try

The modules I use besides SSL, PHP and frontpage are:

    Module env_module          mod_env.o
    Module config_log_module   mod_log_config.o
    Module mime_module         mod_mime.o
    Module negotiation_module  mod_negotiation.o
    Module dir_module          mod_dir.o
    Module cgi_module          mod_cgi.o
    Module asis_module         mod_asis.o
    Module imap_module         mod_imap.o
    Module action_module       mod_actions.o
    Module alias_module        mod_alias.o
    Module rewrite_module      mod_rewrite.o
    Module access_module       mod_access.o
    Module auth_module         mod_auth.o
    Module anon_auth_module    mod_auth_anon.o
    Module digest_module       mod_digest.o
    Module expires_module      mod_expires.o
    Module headers_module      mod_headers.o
    Module browser_module      mod_browser.o

## 3.2 Giving CGI's more security

If you are an ISP (you probably are when you read this) you will want to improve security. The suexec utility allows you to do so; it will execute cgi's under the UID of the webowner instead of executing it under the webservers UID. Go to `/usr/src/apache_1.2.6/support` and `make suexec`. `chmod 4711 suxec` and copy it to the location specified in `../src/httpd.h` which is `/usr/local/etc/httpd/sbin/suexec` by default. If the path seems a little cryptic to you - it did to me - edit `httpd.h` and set the path to a more comfortable value.

## 3.3 Compiling and installing the server daemon

Enter `/usr/src/apache_1.2.6/src` and edit `Configuration` to set all the Modules you want to include in your Apache daemon. When done, run `./Configure` and `make`. This is the last (and most complicated) compilation step, so cross your fingers. If it succeeds, `cp httpsd` to `/usr/sbin`. The daemon is somewhat big, consider this when assembling your webserver. Create the directory `/var/httpd` with subdirectories `cgi-bin`, `conf`, `htdocs`, `icons`, `virt1`, `virt2` and `logs`. In `/usr/src/apache_1.2.6/conf` edit `access.conf-dist`, `mime.types` and `srm.conf-dist` to suit your needs and copy them to `var/httpd/conf/access.conf`, `srm.conf` and `mime.types`. Copy the `httpsd.pem` you created with `make certificate` to `/var/httpd/conf`. Use the following `httpd.conf`:

    ServerType standalone
    Port 80
    Listen 80
    Listen 443
    User wwwrun
    Group wwwrun
    ServerAdmin webmaster@yourhost.com
    ServerRoot /var/httpd
    ErrorLog logs/error_log
    TransferLog logs/access_log
    PidFile logs/httpd.pid
    ServerName www.yourhost.com
    MinSpareServers 3
    MaxSpareServers 20
    StartServers 3

    SSLCACertificatePath /var/httpd/conf
    SSLCACertificateFile /var/httpd/conf/httpsd.pem
    SSLCertificateFile /var/httpd/conf/httpsd.pem
    SSLLogFile /var/httpd/logs/ssl.log

    <VirtualHost www.virt1.com>
    SSLDisable
    ServerAdmin webmaster@virt1.com
    DocumentRoot /var/httpd/virt1
    ScriptAlias /cgi-bin/ /var/httpd/virt1/cgi-bin/
    ServerName www.virt1.com
    ErrorLog logs/virt1-error.log
    TransferLog logs/virt1-access.log
    User virt1admin
    Group users
    </VirtualHost>

    <VirtualHost www.virt1.com:443>
    ServerAdmin webmaster@virt1.com
    DocumentRoot /var/httpd/virt1
    ScriptAlias /cgi-bin/ /var/httpd/virt1/cgi-bin/
    ServerName www.virt1.com
    ErrorLog logs/virt1-ssl-error.log
    TransferLog logs/virt1-ssl-access.log
    User virt1admin
    Group users
    SSLCACertificatePath /var/httpd/conf
    SSLCACertificateFile /var/httpd/conf/httpsd.pem
    SSLCertificateFile /var/httpd/conf/httpsd.pem
    SSLLogFile /var/httpd/logs/virt1-ssl.log
    SSLVerifyClient 0
    SSLFakeBasicAuth
    </VirtualHost>

    <VirtualHost www.virt2.com>
    SSLDisable
    ServerAdmin webmaster@virt2.com
    DocumentRoot /var/httpd/virt2
    ScriptAlias /cgi-bin/ /var/httpd/virt2/cgi-bin/
    ServerName www.virt2.com
    ErrorLog logs/virt2-error.log
    TransferLog logs/virt2-access.log
    </VirtualHost>

Depending on the modules compiled in, not all directives may be available. You can retrieve a list of available directives with `httpsd -h`.

## 3.4 Adding frontpage support to a web

Enter `/usr/local/frontpage/version3.0/bin` and load `./fpsrvadm`. Choose `install` and `apache-fp`. The next questions should be answered the following way:

    Enter server config filename: /var/httpd/conf/httpd.conf
    Enter host name for multi-hosting []: www.virt2.com
    Starting install, port: www.virt2.com:80, web: ""
    Enter user's name []: virt2admin
    Enter user's password:
    Confirm password:
    Creating root web
    Recalculate links for root web
    Install completed.

The user name must be the unix login of the webowner. The password does not necessarily have to match the system password. You have to manually add `sendmailcommand:/usr/sbin/sendmail %r` to `/usr/local/frontpage/www.virt2.com:80.conf`, otherwise your users will not be able to send web-generated eMails. `kill -HUP` your `httpsd` to make fp reread its config. You can now access `www.virt2.com` with your frontpage client.

Under some circumstances `fpsrvadm` complaints that a root web has to be installed first. This is pretty useless, but you should do so to silence `fpsrvadm`.

## 3.5 Starting the daemon

Start Apache with `httpsd -f /var/httpd/conf/httpd.conf`. You can now access `www.virt1.com` both through http and https which is pretty cool. Of course you have to pay for a real certificate if you want to offer webwide SSL or users might laugh at you.

Copy one of the demo files from the php examples directory to `virt1` to test phtml.

## 3.6 Some considerations left

Do not use frontpage 97 extensions. They do not work, at least under Linux. When installing specific versions of the c++ libraries, they appear to work but your logs will soon fill with `premature end of script headers` and your mailbox will fill with complaints. Do not use frontpage 98 extensions before version 3.0.2.1330. Do not be confused, version numbers are somewhat inheterogenous. When telnetting to port 80, typing "get / http/1.0" and hitting return twice, you get a version number 3.0.4 for frontpage.

You can find out the more specific version number by executing `/usr/local/frontpage/currentversion/exes/_vti_bin/shtml.exe -version`. Older versions have a nasty bug that requires httpd.conf to be writable by the gid of the webserver. This should make you scream if you are at all concerned about security. Versions since 3.0.2.1330 are more usable.

## 3.7 Known bugs

When touching `Recalculate Links` in the frontpage client, the server starts a process that consumes 99% cpu cycles and some 10 mb of memory. But even for medium-sized webs and fast machines, the client sometimes recieves a timeout message, though the calculation will be finished correctly. Inform frontpage users to be patient and not to hit `Recalculate Links` several times. Inform yourself to equip the server with at least 64MB.

Please note that at the time of writing both SSL and frontpage work, but not at the same time, that means you can neither publish your web using ssl nor make use of the webbots through https. You can publish your web on port 80 and access it encrypted on port 443, but your counters etc. will be broken. I consider this a bug. This problem shall be fixed in SSL 0.9.0.

## 3.8 The final word

For those who think the title of this howto is nearly as long as the document: Did you ever listened to Meat Loaf?

O.K. readers, you're done for today. Feel free to send me your feedback, eternal gratitude, flowers, ecash, cars, oil sources etc.

Next Previous Contents