|
This page discusses and outlines a text-mode install of Fedora Core 4 similar to that done in class,
using a 'generic' PC with a 400 MHz Celeron, a half Gig of RAM, and two NICs to make a firewall/router.
'eth0' is attached to The Internet,
'eth1' is attached to a hub for a small LAN.
The installation is on the machine labeled 'Linux Firewall/Router' in this diagram: There is a server shown in the schematic at .10that is shown operating 'behind the firewall' with the notebooks, but wasn't on the cart. I've put it there since the StartFirewall script shown later has a section of 'commented out' rules that apply to another server behind the firewall. Depending on the security requirements, it might be a good idea to provide another firewall for _that_ server, too, providing a DMZ type environment where there is additional protection for the 'internal server' from users of the LAN. This is a text mode install since it's somewhat exotic to those who have never seen a character-based interface, & so we could more quickly get through the install and get to more ethereal topics, like securing the server and checking out port & packet sniffing software. Also, one of the common strains I hear about recent graduates from some other schools is that 'they have no experience at the command line.' Getting some experience there, and getting your eyes on the logs of an internet-connected *ix machine, will help differentiate you from other applicants who might roll their eyes and giggle at the mention of 'the command line' and not realize that industrial-strength networking is done at the command line. I say there is 'value in learning this stuff' because some of the students I've seen get into network management & security careers in the past few years have built and operated Linux & Windows servers at home and/or at friends' places, watched their logs (Windoze logs stuff too!) to gain familiarity with internet & ethernet protocols, and mastered the art of keeping systems secure. This kind of familiarity with networking & security makes for a dynamite behavioral, technical interview, and helps substitute for some of the experience other have in the field. The Core 4 text install choosing no GUI options takes a little less than 10 minutes. The step-by-step install procedure begins a ways down the page. First, we'll run through some topics for consideration as you set out to make your Linux installation... Considerations for your installation: Unless you're already skilled with the command line & character-based editors, learn vi, mc, or joe so you'll be comfortable editing the text files used to configure a *ix, or other command-line oriented, system with no GUI. You're welcome to develop your skills with your ssh account at info300.net. There is probably the most value in learning 'vi', Visual Editor (actually vim on Fedora, vi IMproved) if you're wanting to go into networking, since it is available on _all_ *ix machines and with a little practice it be run from any keyboard. vi requires some practice since it requires getting into Insert, Replace, or Append mode to put or change text in a file & Escaping from that 'mode' to move the cursor. Commands, like the one to save a file and get _out_ of vi, wq, are entered only after hitting the : to get to a command prompt. There are plenty of vi tutorials, and some links for them on my Linux Links page. The other editor choices mentioned here use Function Keys & don't require jumping in & out of this or that mode so they are simpler to master. But, they are not an 'official' *ix OS component like vi. 'joe' is a simple, character-based editor built for the PC keyboard's edit and function keys so it's less of a learning curve than vi. 'mc', Midnight Commander, provides a dual-'pane' interface so two directories can be juxtaposed and their contents copied/moved among them easily. A selected item is easily edited by hitting F4, then mc provides an easy-to-use text editor that provides syntax highlighting for html & php. The Internet is a dangerous place, so don't start off displaying vulnerabilities by letting old distros run unattended while attached The Internet. Most older distros have easily detectable vulnerabilities (in components like mail, httpd, ssl, ssh, &c) and trying to upgrade the vulnerable components can lead to a 'dependency storm' that may take days to resolve. Whatever your chosen Linux distro, start with the 'latest stable release' until you're ready to shake the 'development tree' and try stuff _really_ at the bleeding edge. Always ally yourself with lists that will keep you noticed about vulnerabilities that apply to your particular distro. There are a couple of good lists for Linux-related & security issues in general on my Linux Links page. For daily and seasonal reporting about the locations of networks from which probes and cracks, manual & automated, arise at The Internet Storm Center. They publish a list of subnets worth 'blackholing' in your hosts.deny and/or iptables script. There's more to running a server than learning it's text editors. System Administration in general and specifically for Linux is found in the LAME, Linux Admin Made Easy, which is a classic introduction to the diligence of running a Linux server. YoLinux's Internet Security Tute is a good place to start into Internet and Linux security. Hacking Linux Exposed is another good intro if you want to spend a few $ for an introductory book, although I'm distressed they may characterize the 'hacker' as a bad guy, where many believe hackers wear white hats and crackers wear the black. Insecure.org is a mecca for hackers and crackers alike, has gifted us with nmap, and also keeps us posted on current threats from the crackers who use it. The most useful installation for learning to run and secure a server is on a machine with a fixed IP address & a full-time internet connection. Some of our cable & DSL providers will provide these for their subscribers to run modest web-servers, others won't. If you're in the dorms, don't misbehave since you'll be on Vernon's radar in no time at all, but you're welcome to run benign services and your system will regularly be port scanned and checked for open mail relays. If you can get the fixed IP, register a URL with godaddy.com or another reputable registrar. Use a domain registrar that provides 'full DNS control' so you can reference your IP in the DNS settings and make an MX (Mail eXchange) record that points to your URL so your email will not be shot down as spam. With this rig, you can be root on your own machine and run tcpdump, tethereal, nmap, snort, and otherwise do stuff you can't do on anybody else's web server. If you don't have the fixed IP, and even if you use a dial-up connection, you can still do all this stuff, but it becomes a bit more complex. If your ISP's DHCP gives out a public, routable IP address, noip.com and other 'dynamic DNS' sites let you get past the lack of a static IP gracefully enough that you can setup, develop, and debug web services. It is a special challenge to set up a Linux machine so that it will work to share an DHCP-leased IP connection, firewall it, and watch the logs while you're connected. Unless you've got a lot of bandwidth at home, use the machines in the 4th floor lab to get the Fedora Core 4 iso images from ftp://mirror.vcu.edu/pub/linux/fedora/4/i386/iso, where they will download in several minutes each and you can burn the isos onto your blank CDRs. If you get them from somewhere else, make sure to follow a similar path. Make sure to use whatever options are needed to 'burn an iso image' of the filesystem onto the CD, since the default options of most CD-burners will usually just put the iso into the root directory of a blank, new filesystem they create. In the labs, use Roxio, started from the Programs menu, and choose 'write cd image' from the File menu. XP's CD writer doesn't burn iso images. If you're already on a Linux machine use cdrecord if you're brave or XCDRoast if you're GUI. Learn more than one distro of Linux while you've got the time. Get into MySQL & PHP. Learn to administer Windows Server2003 & SQLServer2003 & .net while they're free from MSDNAA. Figure out what's the best for which situations and develop deep technical skills that are always in demand. I've used Fedora here because it's similar to the Red Hat Enterprise that's required by IBM for some commercial applications I support, and I've got little time for hard knocks from more than two *ix flavors per season. Also, it's free and it's easy to keep it updated. 'yum', Yellow Dog Update Manager, works for Fedora and RedHat's upd2date does, too, just not as fast as the download sites they provide for RedHatEnterprise subscribers. Fedora promises a 'bleeding edge' release cycle of less than a year, and most of the free distros are similarly turbulent. For longer release cycles, Red Hat Enterprise is available at an Educational discount for $50. There are other free Linux distros that are well supported by their community & easy to keep updated. Check out the links to other distro on my Linux Links page. If you want to build secure systems you'll need kernel-honing and other skills that go beyond this quick intro. Get started... The Fedora Project and Red Hat Enterprise recently added a new wrinkle to the Linux file system: the Logical Volume Manager. This makes the dialog with the Druid (Fedora's fdisker & formatter) look somewhat different than the earlier installations since there is are now 'physical' and 'logical' views of the disk devices. Someone who clearly understands RAID & recovery of disks can use the LVM to excellent advantage, especially with these new hot-swappable SATA drives. So, I suggest you set up RAIDs, sacrifice disk drives (power them down) with abandon, and figure all this stuff out. Meanwhile, the default 'auto partition' I suggest using for this quick demo/first time thru uses the LVM and it works fine, so I don't recommend trying to get along without it. If you're installing on a GigaHz or better machine with plenty of RAM consider putting a Workstation install on it so you can get some experience with a Gnome and/or KDE desktop. A full graphic install may take 30, 45, or more minutes depending on how quick your machine is. Just like Windoze, the Linux GUI thrives on GHz & GBytes so more is better for a desktop machine. The GUI, Gnome, 'front ends' for ethereal, for example, are really an improvement over the text-based tool and is much easier to use. gkrellm is a fine GUI network & cpu performance monitor that will use Fedora's new instrumentation to show fan speed, CPU temperature, &c. If you've also got an older machine or two you can make a server farm of your own and fine-tune your kernel-building and security skills as you customize each for its purpose. You can run a honeynet/dmz from which you can start to experience security-related stuff and develop security skills by watching for incursions by the hordes at the digital frontier and protecting your systems from them. Will you be running a web server? In class I'm installing & running httpd on this machine that's otherwise being set up as a firewall/router so we can see Fedora's web document root and what happens if it's empty or an error is delivered, where you inform the world the exact version of your web server... For max security, it's probably not a good idea to run other services that _might_ be compromised on the machine that's going to protect you from bandits. You will still get to observe te effects of virii & worms ancient and new, from Nimda through RedWorm, Slapper, and the more virulent & effuse forms constantly thrown past us by pirates in WindowsLand. Will you be running a mail server? Sendmail, the default out-of-the-box mail server for Fedora, is difficult to configure and of little use without having a registered internet domain and control over the DNS so that you can set the MX record to point to that domain, so leave it out if you aren't going to register a domain for your IP. (I'll demo godaddy.com in class) If you want to access an email account on your server via an email client like OutlookExpress or Eudora, you'll need to make sure to load the imap package and configure pop3 and/or imap so they running. The 'imap' package handles POP3 & IMAP. Sendmail is no longer configured as an 'open relay' out of the box, and it needs to be opened up to relay mail from anywhere except localhost so if you want to relay mail out of your LAN you'll need to bone up on this simple manipulation of sendmail.mc. Other services like DNS (bind), DHCP, and Samba are cool so you can learn how to run a Domain Name Server, make your firewall do DHCP for the machines behind it, and let the linux server show up in a Windoze Workgroup and participate in an SMB, peer-to-peer network as well as The Internet. Plan to leave your new server unattached from the internet until id and essential services have been setup and you're ready to check out its 'internet profile' that will be clearly visible to the crackers roaming your subnet at will. In class I did this by running nmap against it from one of the servers in my office, before & after running setup to deselect un-needed services. Plan to reboot a few times to make sure everything works from bootup. Don't install boot passwords unless you're always going to be there to supply them at reboot. If you've got the house or the office LAN running through your firewall/gateway you probably want it to restart unattended when the power starts flowing again. The server's IP 'web identity' & security environment are mostly set by editing configuration files in /etc. Here are the files affected by the installation They will need editing if something was screwed up during the install, or if this installation is going to get the users & data from some other installation:
Plan to run only essential services and don't plug the server into The Internet until unessential/insecure services have been shut off. Fewer are left running in today's distros, but there are still some that should be turned off unless you're willing to police their use. Services can be configured in /etc/xinetd and other config files and directories in /etc, but for just turning them on or off it's easy to use the text-based 'setup' command available to su. The list of 'essential services' down in the installation steps is somewhat longer that the one we used to use in RedHat 7 and beyond, but several of the newer services that popped up with the Fedora Core series provide the instrumentation for better reporting of kernel and other system activity and I want to learn how to use them. Use F1 & google as you work through the services to learn more of what they do. Remember, some services are inherently insecure (like telnet, ftp, and the 'r processes' like rsh) and shouldn't be used unless there's a good reason and someone to tail their logs for signs of abuse. After the CDs have run through, plan to choose essential services by running 'setup' from the command line, choosing 'system services' from its menu, using the space bar to select/deselect services, and navigating to the OK button to save them. Below, there is a list of 'essential' services to turn on. Everything else should be turned off unless you're sure you need it, and either know it's secure from The Internet or you know how to keep it secure. The firewall/router startup is handled by an 'iptables script': /root/Added/StartFirewall. If you'll be using this script, copy/paste/save it somewhere you can get it and copy it to your firewall easily when its needed after the OS install. Your /etc/rc.d/rc.local will need to be edited to make /root/Added/StartFirewall its last line. These steps are included below, but will be easier if anticipated. Upgrading an existing server: If this is an upgrade of some existing server running an earlier version or different distro, spend some time discovering the differences between the OSs so you won't be surprised. Check for different places where the document root for the web server or other configuration files are kept. These have changed out from under me a few times since RedHat 4 days... It's safer to make a fresh OS install and check it out your migration path while the old server is still doing its stuff than it is to 'do an upgrade' on the old server. If this is an emergency restore of a dead server, I hope you've got the essential stuff on tape, CD, or maybe on the Internet somewhere? If this is a new linux install without any 'legacy' to support, have at it. Don't expect there will be no differences in configuration files like sendmail.cf, httpd.conf, or any others, since they may vary wildly between distros and releases of key components like mail, web, ssh, or other services. Test them individually before setting out to put them into production. For these, and more subtle, reasons it is not wise to expect to backup the entire contents of /etc, or /var, or other directories and install them on the new machine. Ditto this for a DBMS's files, which might not survive a bump up in the Rev# and it might require using the DBMS's dump and reload features to migrate the database. It's nice when the entire migration can be done by saying 'tar -zxvf' but that's the exception rather than the rule. Don't assume that a tar archive produced on one *ix flavor will be readable on another *ix. There may be subtle formatting or big-endian/little-endian issues moving from one processor family to another. Other methods, like cpio, may produce a more compatible tape or disk file. Click here for some sample scripts & techniques for backing up the 'essential stuff' from the old server so it can be restored on a new server. Starting the Core 4 install:
Securing the server
Fedora runs 'logwatch', which reviews, on a nitely basis, /var/log/messages & secure, your httpd & mail logs, and other places to advise you of anything out of line. Check email for root, mail -uroot, after you su into root and you'll get this advice every morning. Check your log files, expecially messages & secure, to get more details about what you see reported. Update me, please, with your experience using this for installing Fedora Core 4. It was put together on June 24th & feedback will be helpful. |