| 1 |
This text intends to be helpful in the verification of the |
| 2 |
utilities found within GNU Inetutils. The source archive |
| 3 |
does contain a small set of test, but they are never able |
| 4 |
to test all desirable abilities, so this text is collected |
| 5 |
in the hope that an administrator or packager find hints on |
| 6 |
important steps to verify claimed abilities. One upstream |
| 7 |
author found himself overlooking a serious fault, until |
| 8 |
rethinking procedures similar to the following. This is |
| 9 |
all the more relevant since GNU Inetutils aims at portability |
| 10 |
to different operating systems, intending identical abilities |
| 11 |
for simplification in heterogeneous environments. |
| 12 |
|
| 13 |
Most executables delivered by GNU Inetutils depend on only |
| 14 |
a few, and immediately recognizable, settings or mechanisms. |
| 15 |
Others, like `ftpd', `telnetd', and `rlogind', depend on |
| 16 |
multiple configuration files, or depend on external programs |
| 17 |
that may differ slightly from system to system. Executables |
| 18 |
in the latter class include all those with Kerberos abilities. |
| 19 |
|
| 20 |
Of particular importance, and difficulty to verify, is the |
| 21 |
server executable `ftpd'. This will be discussed at length |
| 22 |
below, but let us start with some simpler cases. |
| 23 |
|
| 24 |
1. rlogind and telnetd |
| 25 |
|
| 26 |
The server executables `telnetd' and `rlogind' are the only |
| 27 |
ones depending on the system executable `/bin/login`, or |
| 28 |
sometimes `/usr/bin/login'. This system program is heavily |
| 29 |
system dependent, and at present we are aware that login(1) |
| 30 |
of Solaris and of `util-linux', as found in Arch Linux, is |
| 31 |
not completely functional in all intended use cases. |
| 32 |
|
| 33 |
2. rcp and rsh |
| 34 |
|
| 35 |
The client programs `rcp' and `rsh', certainly when built |
| 36 |
with Kerberos support, need care since they delegate work |
| 37 |
via PATH_RSH and PATH_RLOGIN, respectively. All testing |
| 38 |
efforts must be aware of this. Both locations are settable |
| 39 |
at configuration time using `--with-path-rsh=...' and |
| 40 |
`--with-path-rlogin=...'. Bear in mind that BSD systems |
| 41 |
assign values to those two macros by inspecting <paths.h>, |
| 42 |
and that these values are used unless overridden. |
| 43 |
|
| 44 |
3. syslogd |
| 45 |
|
| 46 |
The included test script for `syslogd' is in fact using |
| 47 |
command line switches to override the defaults for configu- |
| 48 |
ration file and ditto directory. The mechanisms should |
| 49 |
work, but their default settings must be checked for use |
| 50 |
in prebuilt packages. Again, `--with-path-logconf' and |
| 51 |
`--with-path-logconfd' are the way to go. |
| 52 |
|
| 53 |
The auto-build system Hydra, of NixOS' origin, is known |
| 54 |
to fail occasionally at reusing a logging file after |
| 55 |
receiving SIGHUP, but this has never happened during |
| 56 |
manual checks. Ideas on resolving this matter are most |
| 57 |
welcome. There could be some dead-lock involved here. |
| 58 |
|
| 59 |
4. ftpd |
| 60 |
|
| 61 |
As already stated, the server `ftpd' is particularly picky |
| 62 |
to verify reliably. The main obstacle lies in its use of |
| 63 |
four different files for configuration, or in user inter- |
| 64 |
action. The standard macros PATH_FTPUSERS, PATH_FTPCHROOT, |
| 65 |
and PATH_FTPWELCOME, PATH_FTPLOGINMESG are relevant here, |
| 66 |
where the first two are of critical concern for reasons of |
| 67 |
security. In addition, also `/etc/shells' is referenced. |
| 68 |
|
| 69 |
Every packager and administrator _must_ check that the files |
| 70 |
`ftpusers' and `ftpchroot' are assigned the right locations: |
| 71 |
|
| 72 |
$ strings ftpd/ftpd | grep '/etc' |
| 73 |
|
| 74 |
Let us sketch a limited set-up intended to uncover faults |
| 75 |
in `ftpd' while handling `ftpusers' and `ftpchroot'. The |
| 76 |
file locations below are chosen for brevity, rather than |
| 77 |
best practice. |
| 78 |
|
| 79 |
### /etc/passwd |
| 80 |
root:x:0:0::/root:/bin/sh |
| 81 |
# Invalid interpreter |
| 82 |
aaa:x:11111:101::/home/aaa:/bin/false |
| 83 |
# To be denied access. |
| 84 |
bbb:x:11112:101::/home/bbb:/bin/sh |
| 85 |
ccc:x:11113:102::/home/ccc:/bin/sh |
| 86 |
# To be chrooted. |
| 87 |
ddd:x:11114:101::/home/ddd:/bin/sh |
| 88 |
eee:x:11115:103::/home/eee:/bin/sh |
| 89 |
|
| 90 |
### /etc/group |
| 91 |
passes:x:101: |
| 92 |
banned:x:102: |
| 93 |
chroot:x:103: |
| 94 |
|
| 95 |
### /etc/ftpusers |
| 96 |
root |
| 97 |
bbb |
| 98 |
@banned |
| 99 |
|
| 100 |
### /etc/ftpchroot |
| 101 |
ddd |
| 102 |
@chroot |
| 103 |
|
| 104 |
With this set-up, the users `aaa' should be denied access |
| 105 |
due to an invalid shell, while `bbb' and `ccc' should be |
| 106 |
reject for being mentioned in `ftpusers', the latter though |
| 107 |
his group membership. Furthermore, `ddd' and `eee' should |
| 108 |
be admitted access, but be confined within a chrooted subtree, |
| 109 |
recognizable by issuing `pwd' in an FTP-session. Here, `eee' |
| 110 |
is to be chrooted based on its group membership. |
| 111 |
|
| 112 |
A final remark regarding the chrooted mode. On GNU systems |
| 113 |
and Solaris systems, the above templates `/etc/passwd' and |
| 114 |
`/etc/group', positioned below the chroot directory, would |
| 115 |
suffice to allow the list command `ls' to resolve numbers as |
| 116 |
group and user names in directory listings, but they do not |
| 117 |
suffice on BSD systems. For those unices, `/etc/passwd' is |
| 118 |
completely irrelevant, and is to be replaced by `/etc/pwd.db'. |
| 119 |
Starting from a template for `master.passwd', BSD systems need |
| 120 |
to call pwd_mkdb(8) to generate a minimally usable `/etc/pwd.db'. |
| 121 |
A responsible BSD administrator is expected to master this! |
| 122 |
|
| 123 |
Ideally, the administrator should also check that expired |
| 124 |
accounts and expired passwords also lead to denied access. |
| 125 |
The tools vary widely, but usermod(8) and its variants |
| 126 |
are useful. |