Mini Shell
bsock installation
$ make
$ make install
# Edit and add entries to /usr/local/etc/bsock
# Edit and add entries to /usr/local/etc/bsock.resvaddr (optional)
# Add bsock to your favorite set of system init scripts:
# /usr/local/sbin/bsock -d
# (Hint: start bsock after networking interfaces are configured)
# Configure syslog to log daemon.info (optional, but recommended)
# Configure privileged daemons to use bsock without running as root
# Add the role account running the daemon to group 'daemon'
# (or change secure-by-default permissions on socket -- see NOTES file)
# LD_PRELOAD=/usr/local/lib/libbsock_preload.so <daemon_program>
See NOTES for more technical (and probably less readable) details and features.
See Makefile for various overrides, such as alternate installation location.
bsock config file line format:
username address_family socket_type protocol service_or_port address
e.g. apache AF_INET SOCK_STREAM tcp 80 0.0.0.0
- specify separate lines for each difference, since exact match is performed
(and use single space character between fields; no leading or trailing space)
- strings are case-sensitive
use uppercase addr family, socktype constants (e.g. AF_INET, SOCK_STREAM)
use lowercase for protocol (e.g. tcp) or alias in /etc/protocols
- use port 0 if service_or_port does not apply to addr family (e.g. AF_UNIX)
- blank lines and comments (lines beginning with #) are skipped
- address must be an address string not a constant, e.g.
0.0.0.0 (for INADDR_ANY)
127.0.0.1 (for INADDR_LOOPBACK)
255.255.255.255 (for INADDR_BROADCAST)
:: (for IN6ADDR_ANY_INIT)
::1 (for IN6ADDR_LOOPBACK_INIT)
- config file updates should be made atomically with mv; config files
should not be updated in-place (prevent corruption during processing).
bsock.resvaddr config file line format:
- same as bsock config, except omit 'username' field
e.g. AF_INET SOCK_STREAM tcp 80 0.0.0.0
Building an RPM
##(fill in correct version)
$ version=0.03
##(set up RPM build environment, if not already configured)
$ echo %_topdir $HOME/rpm >> $HOME/.rpmmacros
$ cd $HOME && mkdir -p rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
##(begin with bsock-$version.tar.gz) or create tarball from source
$ rsync -avu --exclude=.git --delete /path/to/bsock/ bsock-$version
$ tar cvzf bsock-$version.tar.gz bsock-$version
$ rpmbuild -tb bsock-$version.tar.gz
##(multilib platforms might want both 32-bit and 64-bit bsock-libs RPM)
#$rpmbuild -tb bsock-$version.tar.gz --target=i686
#$rpmbuild -tb bsock-$version.tar.gz --target=x86_64
##(RPM for binary install now located in rpm/RPMS/<arch>/bsock-$version-*.rpm)
$ rpm -Uvh rpm/RPMS/*/bsock-$version-*.rpm
##(some clean up)
$ rm -rf bsock-$version
$ rm -f bsock-$version.tar.gz
Zerion Mini Shell 1.0