Amandad Service Protocol
This article describes the way that amandad launches services like sendsize or amidxtaped. Amanda serves as a sort of amanda-specific inetd, but adds support for multiple parallel communication channels, authentication, and lots of crazy backward-compatibility hacks.
Note that most of amandad's activity takes place at connection set-up. There may be other pages on this wiki to describe the protocol observed by particular sevices. For example, amindexd protocol describes the protocol that amidxtaped speaks, and takes over where this page leaves off. Amandad is always on the receiving end of the Security API, so a familiarity with that API will help in reading this document.
Service Launch
File Descriptors
When amandad launches a service, the following file descriptors are open:
- 0 (stdin)
- read any request arguments here
- 1 (stdout)
- write a REP packet body here (see below)
- 2 (stderr)
- ??
- 50 (DATA_FD_OFFSET + 0*2 + 0)
- write fd for first stream
- 51 (DATA_FD_OFFSET + 0*2 + 1)
- read fd for first stream
- 52 (DATA_FD_OFFSET + 1*2 + 0)
- write fd for second stream
- 53 (DATA_FD_OFFSET + 1*2 + 1)
- read fd for second stream
- 54 (DATA_FD_OFFSET + 2*2 + 0)
- write fd for third stream
- 55 (DATA_FD_OFFSET + 2*2 + 1)
- read fd for third stream
more data streams can be added if necessary: they are limited by DATA_FD_COUNT, which is currently 3.
Note that OpenBSD's fake thread libraries have trouble dealing with nonstandard file descriptors open at process start; use fcntl(F_GETFD) to "notify" the runtime of these file descriptors before using them.
Command-line Arguments
The service is run with the following command-line arguments:
service amandad auth
and with a stripped-down, "safe" environment