Re: Feedback solicited - best way to harden a mail/web server?

From: teddy (mouschi@cheese-head-state.rr.com)
Date: 12/28/02


From: "teddy" <mouschi@cheese-head-state.rr.com>
Date: Fri, 27 Dec 2002 23:10:01 GMT


"Jared H." <jared@hwai.com> wrote:
> I've been rootkitted again; third time in the last six months. Advice
> sought. Here is my current setup:

Something very wrong here... 8-/

> RH 8.0
> ports 53 (TCP/UDP), 25, 443 open
> - this is a mail server primarily, running imap, Apache, PHP
> (Squirrelmail),
> Bastille firewall (I have my and my wife's workstations behind it). I
> hate to leave privileged ports open, but a server is no use if it can't
> communicate.
[SNIP]
> Assuming the intruder broke into Postfix (port 25) or Apache (port 443) or
> bind (port 53), would chrooting have done anything to minimize damage by a
> Trojan?

Okay, first rule (and argueably only rule): minimization.

Do you need bind? What are you using it for? You've said this is for "home
use," I've never heard of someone needing bind at home.

What kind of stuff you you have running with apache? mod_ssl? What do you
use it for? do you need any of those special modules?

What kind of extra stuff has been installed on this machine? Does it need X
windows? Do all of those files need to be suid? (a simple 'find
/ -perm -04000 > suids.txt' can be very revealing)

Does the machine need to be able to make outgoing connections to the
internet? (related: do you SEND mail from this machine or just recieve? i.e.
is mail sent using your ISP's mailservers?)

Is apache/php/squirrelmail needed or would a mere pop3/imap daemon do? err,
okay you already have imap running. Why do you need squirrelmail? wouldn't
just imap do for remote access?

-=-
Basically, you want to minimize the number of suid-root files and processes
running as root. then you want to make sure that those (hopefully few)
packages are kept up to date.

-Ted



Relevant Pages

  • Re[8]: mpd pppoe client problems
    ... If you bind, for example, apache to wildcard address 0.0.0.0, ... it will work with new interfaces and addresses. ... If you use some kind of ip-based virtualhost configuration, ...
    (freebsd-net)
  • RE: help about bind
    ... I assume you're using Apache. ... straightforward instructions... ... Christian ... Subject: help about bind ...
    (RedHat)
  • Re: Can I do this?
    ... > I want to replace a computer running FreeBSD 3.2 with one running FreeBSD ... > Once I add the Apache web server and Bind, can I then just copy config ... > copy my zone files over to the new system? ...
    (freebsd-questions)
  • [opensuse] Server cannot connect to itself
    ... One is running Bind 9.3.2 and the other is running ... Apache 2.1 and MySQL 5.0. ... Apache and Mysql from remote machines and ... The status never changed until the connection broke. ...
    (SuSE)
  • Re: [opensuse] Server cannot connect to itself
    ... One is running Bind 9.3.2 and the other is running ... Apache 2.1 and MySQL 5.0. ... Apache and Mysql from remote machines and ...
    (SuSE)