What is active?
One can find out what processes are normally running via ps ux:
voyage:~# ps ux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.2 1940 588 ? Ss 17:34 0:01 init [2] root 2 0.0 0.0 0 0 ? S< 17:34 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S< 17:34 0:00 [ksoftirqd/0] root 4 0.0 0.0 0 0 ? S< 17:34 0:00 [events/0] root 5 0.0 0.0 0 0 ? S< 17:34 0:00 [khelper] root 36 0.0 0.0 0 0 ? S< 17:34 0:00 [kblockd/0] root 41 0.0 0.0 0 0 ? S< 17:34 0:00 [ata/0] root 42 0.0 0.0 0 0 ? S< 17:34 0:00 [ata_aux] root 44 0.0 0.0 0 0 ? S< 17:34 0:00 [kseriod] root 80 0.0 0.0 0 0 ? S 17:34 0:00 [pdflush] root 81 0.0 0.0 0 0 ? S 17:34 0:00 [pdflush] root 82 0.0 0.0 0 0 ? S< 17:34 0:00 [kswapd0] root 83 0.0 0.0 0 0 ? S< 17:34 0:00 [aio/0] root 707 0.0 0.0 0 0 ? S< 17:34 0:00 [kpsmoused] root 710 0.0 0.0 0 0 ? S< 17:34 0:00 [rpciod/0] root 1495 0.0 0.0 0 0 ? S< 17:34 0:00 [khubd] root 2909 0.0 0.2 1724 704 ? Ss 17:34 0:00 /sbin/syslogd root 2915 0.0 0.1 1576 384 ? Ss 17:34 0:00 /sbin/klogd -x root 3006 0.0 0.2 1736 552 ? Ss 17:34 0:00 /usr/sbin/pptpd root 3040 0.0 0.2 2192 768 ? Ss 17:34 0:00 /usr/sbin/cron root 3048 0.0 0.6 1620 1620 ? SLs 17:34 0:01 /usr/sbin/watchdog root 3062 0.0 0.8 4756 2120 ? Ss 17:34 0:00 /usr/sbin/apache root 3097 0.0 0.1 1572 500 ttyS0 Ss+ 17:34 0:00 /sbin/getty -L ttyS0 38400 root 3186 0.0 0.9 7624 2376 ? Ss 17:41 0:00 sshd: root@pts/0 root 3191 0.0 0.9 3516 2428 pts/0 Ss 17:41 0:00 -bash root 4447 0.0 0.2 2172 572 ? S<s 19:46 0:00 udevd --daemon root 6032 0.0 0.4 4852 1080 ? Ss 19:47 0:00 /usr/sbin/sshd root 8573 0.0 0.0 0 0 ? Z 21:09 0:00 [watchdog] <defunct> root 8574 0.0 0.3 2216 896 pts/0 R+ 21:09 0:00 ps ux
One can find the active Internet listeners via netstat -nlp:
voyage:~# netstat -nlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2830/portmap tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3062/apache tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 6063/dnsmasq tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 3006/pptpd tcp6 0 0 :::53 :::* LISTEN 6063/dnsmasq tcp6 0 0 :::22 :::* LISTEN 6032/sshd udp 0 0 0.0.0.0:53 0.0.0.0:* 6063/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 6063/dnsmasq udp 0 0 0.0.0.0:111 0.0.0.0:* 2830/portmap udp6 0 0 :::53 :::* 6063/dnsmasq Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path
Finding things
The data is kept in /usr/local/share/pinger/data/ with files of the form ping-yyyy-mm.txt where yyyy is the year and mm the month (1-12).
voyage:~# ls \-l /usr/local/share/pinger/data/ total 3404 -rw-r{-}{-}r-\- 1 root staff 3480630 May 18 17:31 ping-2009-05.txt voyage:~# date Mon May 18 21:43:31 GMT 2009
The CGI scripts are kept in /usr/lib/cgi-bin:
voyage:~# ls \-l /usr/lib/cgi-bin total 72 \-rwxr-xr-x 1 root root 15101 Jan 7 2000 cgi-lib.pl \-rwxr-xr-x 1 root root 20101 May 15 23:17 ping_data.pl \-rwxr-xr-x 1 root root 36226 May 12 22:00 traceroute.pl
Updating crontab
Edit /etc/crontab and save. then reboot to make the new version take effect (alternatively use kill -HUP <PID> to force an update of the crontab process, where you can find the PID from the ps ux command - see above).
Logs
The log is kept in /var/log/messages. We believe this is "rotated" (compressed, saved and deleted) automatically by syslog using /etc/logrotate.conf and /etc/syslog.conf, so memory is not eventually exhausted.
Applying Patches
On the one hand one wants to keep the system and applications patched to the latest releases. On the other hand this may require considerable bandwidth to download the patches, or timeouts, it could gobble up memory in the host etc.
To find out how much memory is available in the file system, use df -k:
voyage:~# df \-k Filesystem 1K-blocks Used Available Use% Mounted on rootfs 3853536 249880 3407904 7% / udev 10240 20 10220 1% /dev /dev/disk/by-label/ROOT_FS 3853536 249880 3407904 7% / /dev/disk/by-label/ROOT_FS 3853536 249880 3407904 7% /dev/.static/dev tmpfs 128416 0 128416 0% /lib/init/rw tmpfs 128416 0 128416 0% /dev/shm tmpfs 8192 412 7780 6% /rw
To get the latest patches use apt-get update:
voyage:~# apt-get update Get:1 [http://security.debian.org] etch/updates Release.gpg [197B] Hit [http://security.debian.org] etch/updates Release Ign [http://security.debian.org] etch/updates/main Packages/DiffIndex Hit [http://security.debian.org] etch/updates/main Packages Get:2 [http://www.voyage.hk] ./ Release.gpg [189B] Hit [http://www.voyage.hk] ./ Release Ign [http://www.voyage.hk] ./ Packages/DiffIndex Ign [http://www.voyage.hk] ./ Packages Hit [http://www.voyage.hk] ./ Packages Get:3 [http://ftp.hk.debian.org] etch Release.gpg [394B] Hit [http://ftp.hk.debian.org] etch Release Ign [http://ftp.hk.debian.org] etch/main Packages/DiffIndex Hit [http://ftp.hk.debian.org] etch/main Packages Fetched 3B in 6s (0B/s) Reading package lists... Done
One applies the patches using apt-get update. However this can take over 45KBytes of memory. We have not decided if or how to automate the patch process.