Secure Network Documentation

Purpose

NSANet is designed to segment world-facing network services (such as servers) from network devices that non-csg people have no business being anywhere near.

Although most of these interfaces (e.g. the telnet console on switches) have passwords that isn't really fantasic security and for peace of mind it would be better that the public at large can't reach them.

A pair of bastion hosts (parakeet and firecrest) provide the only interface between the outside world and NSANet. NSANet packets move between switches on a private vlan that has no IP address and thus cannot be routed to or from. The only way to get NSANet access is via a port on a switch that has been configured to the NSANet vlan.

The bastion hosts also provide services within NSANet such as DNS (there is no DHCP), console server and UPS management.

NSANet Logical and Physical Layout

NSANet operates on 10.1.0.0/16 and devices have IP address thus:

CIDR RangeClass of Device
10.1.1.0/8Bastion hosts
10.1.2.0/8Cyclades serial servers
10.1.3.0/8APC UPSs
10.1.4.0/8APC MasterSwitches
10.1.5.0/8Other

The two bastion hosts and the cyclades are connected directly to the NSANet core switch which uplinks into the DoC (physical) network as a VLAN.

TFTP Services

Switches and Routers smart enough to do so can save their config via TFTP to a Bastion host. Since the NSANet isn't routed this takes place over the DoC network. As TFTP has no security access must be restricted in /etc/firewall.

The tftpd is run via xinetd and roots in /home/tftp. In that directory is a writable file for each switch number (200-254). TFTP will not create files; in order to write there must be an existing file which is world writable.

A cron job /etc/cron.daily/router_config_rotate calls /home/tftp/rotate_all.sh to spin the logs. The last 14 days worth of configs are kept in subdirectories.

The spun configs are world readable, thus TFTPable and are named 123/123.conf-2003-08-28 where 123 is the switch number.

Switches should be configured to upload their configuration at 222-200 minutes past two in the morning, where 222 is the switch number. Thus 146.169.11.222 would upload at 0222.

DNS Services

Both parakeet and firecrest provide DNS services and their DNS tables must be kept in sync. Given that the devices on the NSANet should be resonably static an automatic sync would be more trouble then it's worth.

The DNS config lives in /etc/djbdns/root/data and the format is very simple. To add a new host add a line of the form:

=hostname.nsanet.doc.ic.ac.uk:10.1.2.3:86400

The 86400 is the DNS TTL and really doesn't matter as nothing will be caching the record anyway. After editing the data file one must cd /etc/djbdns/root ; make ; svc -h /services/djbdns. And remember to make the same change on both bastions.

The bastions will only serve DNS requests to the NSANet, but will resolve anything (not just nsanet.doc.ic.ac.uk names). On the bastions it's important to give the nameservers by their NSANet address in resolv.conf.

Console Services

Consoles are either accessed over serial ports physically on one of the bastions (e.g. a Cyclades Z-series card) or via a Cyclades standonly serial server. A number of programs are involved in handling serial data. For example, in the serial server case the flow of data looks like:

Conceptual Diagram

Conserv Operation

To connect to a console simply run console lark where lark is the name of the console you want. If you don't have access rights it will quit.

You start off without control. If you try to type anything you will be warned that you do not have control. The escape sequence is ^E and the commands are:

Key followingActionDescription
?Print help
tTake controlFails if another user has control
dDrop control
sSnatch controlAlways succeeds. "Force attach" in conserver speak
fFlush bufferDelete the outgoing buffer that conserv is holding for you. Doesn't clear the kernel socket buffer.
SShow statsGives uptime and traffic counts
hHistoryDump the last 2k of data
wWelcomeShow the welcome data again. Includes user list.

To send a break type ^] b b in quick succession.

Host Setup

The following lines should be in the GRUB config (/boot/grub/menu.lst):

serial --unit=1 --speed=38400
terminal --timeout=10 serial console

The unit=1 option selects ttyS1 and you may have the change this for a given server. This is correct for the Intel RJ45-serial servers at least.

The options console=tty0 console=ttyS0,38400 should be passed to the kernel also.

/etc/inittab should have a line like 7:12345:respawn:/sbin/agetty -n -L -l /bin/serialbash 38400 ttyS1. The file /bin/serialbash should be as follows:

#!/bin/sh
exec /bin/bash --rcfile /etc/bashrc-serial

And /etc/bashrc-serial is:

sleep 1
/bin/stty sane
/usr/bin/reset
tset vt100
HOSTNAME=`/bin/hostname`
TTY=`/usr/bin/tty`
echo This is $HOSTNAME
export PS1='\u@\h # '

Deveation from these exact instructions will condem you to subtle-terminal-bug-hell.

Physical Setup

New Intel servers have an RJ45 port on the back that is labeled as a serial port. It is wired as a Sun Netra serial port and you must connect them with the correct cable. These cables are purple with a blue and an orange gland. Plug the blue end into the Cyclade and the orange end into the server. The wiring for these cables can be found in a Cyclades manual.

For devices with a real DB9 serial connector you will require a converter.

DB9

Null-Modem wireout (for Intel servers):

D-TypeWire ColourRJ45
8Brown1
1White2
2Black3
5Red4
7Green5
3Yellow6
4Blue7

Pass-Thru wireout (for Chaparrel RAID controllers)

D-TypeWire ColourRJ45
7Brown1
1White2
3Black3
5Red4
8Green5
2Yellow6
6Blue7

APC UPSes have their own pinout. Get a CPC part number CN04265 (black DB9->RJ45, male) and connect the wires thus:

DB9

CPC CN04265's are coloured like this:

RJ45 connector from the top
Pin NumberColour
1Blue
2Orange
3Black
4Red
5Green
6Yel
7Brown
8White

Cyclades Operation

The Cyclades run Linux and see their serial ports as normal ttySx devices. A process called portslave handles the exposure of the serial ports to the outside world. In NSANet configuration they are mapped to TCP ports 7001-7032. These ports are firewalled at the Cyclades INPUT interface against TCP SYN packets. Thus the only way to get at these ports is via an SSH tunnel.

For logging reasons the connections to the Cyclades are always open and the Cyclades only allow a single connection to a given serial port. The sshd on the Cyclades are configured for both TCP keepalive and SSH heartbeat so a failed bastion server shouldn't leave ssh processes locking the Cyclades up for too long.

Cyclades Setup

Put the Cyclade on a serial port and bring up minicom. They run 9600 8N1. Login as root (hopefully no password) and bring up eth0 with ifconfig. Set the root password.

Get zImage_ts_137.bin and boot_alt_ts_201.bin from /vol/source/cyclades-firmware/v1.3.7. SCP the two files to root@cyclade:/proc/flash/xyz where xyz is either zImage or boot_alt. This will take a while as the poor Cyclade is pretty slow.

Over serial type reboot and hope. You should see a message saying Restarting syst and the hardware startup will trigger. You can hit esc to abort the memory check. Always enable the watchdog and boot from firmware if it asks. The root password is now tslinux.

Over serial, bring up eth0 again and mkdir /root/.ssh. SCP cyc_authorized_keys_file in root@parakeet:/root/.ssh to root@cyclade:/root/.ssh/authorized_keys on the cyclade.

Add it to the NSANet DNS (see above).

On a bastion host edit serial_devices to add a device on the new Cyclade (make one up if need be) and reconfigure. This will setup the rest of the Cyclade and save config to flash.

Console config

The config.py script, in /etc/conserv reads in four config files, whose filenames are given on the command line. If you just run python config.py (i.e. without arguments) it will give a usage telling you the config files that it expects.

In the same directory there is a Makefile which will do everything you want if you just type make.

The config files are serial_devices, serial_types, access and consoles. Every serial device should be configured in serial_devices and the type column of which must match up against a row in serial_types. Those devices which are exposed via conguardian (UPSs and consoles) must be listed in consoles and the access_tag column of which references a line in access.

The lines in access consist of a tag name, followed by the members of that tag. Members can either be system usernames or previously defined tags.

The config.py script keeps cyclade configs in /var/cyc/config and diffs the generated config with the cached one. If there is a difference the new config is scp'ed to the Cyclade and saved to flash. The files /var/consoles/start.sh and /var/consoles/auth.sh are also written. The first starts all the consoles up and the second sets the access controls. The second can be run whenever the access controls are changed, and the first can be run to start any consoles that have died.

Site Map
/Root
     AlternateThe Weird and Wonderful
          BacklinksWhat are backlinks
          John GilmoreWhat's Wrong with Copy Protection
     ArchivesBlog Archives
          OneArchive 1
          TwoArchive 2
          ThreeArchive 3
          FourArchive 4
          FiveArchive 5
          SixArchive 6
          SevenArchive 7
          EightArchive 8
          NineArchive 9
          TenArchive 10
          ElevenArchive 11
          TwelveArchive 12
          ThirteenArchive 13
          FourteenArchive 14
          FifteenArchive 15
          SixteenArchive 16
          SeventeenArchive 17
          EighteenArchive 18
          NineteenArchive 19
          Twenty Archive 20
          Twenty OneArchive 21
          Twenty TwoArchive 22
          Twenty ThreeArchive 23
          Twenty FourArchive 24
          Twenty FiveArchive 25
          Twenty SixArchive 26
          Twenty SevenArchive 27
          Twenty EightArchive 28
          Twenty NineArchive 29
          Thirty Archive 30
          Thirty OneArchive 31
     PhotosPoor People Caught on Film
          Jack and the Beanstalk Jack and the Beanstalk
          RIP ScanResults of a Stage Scan Fire
          YosemiteYosemite National Park
     ProjectsIncomplete things from the lab
          Seagull's BaneLinux Automounter
          bttrackdBitTorrent Tracker
          CAPTCHACAPTCHA CGI script
          ConservConsole Serving
          DeerparkUsing Tor with Firefox/1.1 (Deerpark)
          DNSFixFixing DNS
          XoversXTA Crossover Control
          IAFSArchive Org Storage
          JBIG2JBIG2 Encoder
          VerifyPGP Key Verifier
          MaxFlowMaximal Flow in Python
          PyBloomBloom Filters in Python
          pyGnuTLSPython wrapping of GnuTLS
          SxmapApache SuEXEC Map
          HellardUnion Server Notes
     RecordingsFree recordings
          ICSM ChoirSt Paul's Church
     SchoolAncient School Stuff
     WritingsWho knows
          Cap SystemsCapability Systems
          IntroIntroduction to me
          SupremaJMC2 Group Project
          MP LettersLetters I've written to my MP
          SoundSound With Dramsoc
          SyncThreadingThe wonders of user-land threads