1.1 --- a/README.txt Sat Sep 12 20:16:38 2015 +0200
1.2 +++ b/README.txt Sun Sep 13 00:50:38 2015 +0200
1.3 @@ -17,6 +17,17 @@
1.4 System User and Filesystem Access
1.5 ---------------------------------
1.6
1.7 +The data handled by imip-agent needs to be accessible to other software,
1.8 +notably mail handling software and Web server software. Two approaches are
1.9 +described here: LMTP delivery and local SMTP delivery.
1.10 +
1.11 +LMTP Delivery
1.12 +-------------
1.13 +
1.14 +Here, imip-agent's programs run in a way that permits LMTP delivery (requiring
1.15 +suitable local privileges to communicate with the mail storage solution)
1.16 +whilst allowing the Web server to read data written by those programs.
1.17 +
1.18 A system group needs to be created for LMTP delivery and for certain users to
1.19 share resources:
1.20
1.21 @@ -41,10 +52,32 @@
1.22 and published data so that new files and directories have the appropriate
1.23 group associated with them.
1.24
1.25 +It should be possible to omit all arguments to the init.sh script, but it is
1.26 +also worth reading the help message:
1.27 +
1.28 + tools/init.sh --help
1.29 +
1.30 Fixing ownership can be done using the tools/fix.sh script, in case some form
1.31 of modification has altered the ownership or membership of the created files
1.32 and directories.
1.33
1.34 +Local SMTP Delivery
1.35 +-------------------
1.36 +
1.37 +Here, imip-agent's programs run in a way that permits local SMTP delivery
1.38 +(which merely needs the ability to connect to a local network service) whilst
1.39 +allowing the Web server to read data written by those programs.
1.40 +
1.41 +A system user needs to be created and to belong to certain groups in order to
1.42 +deliver messages to mail stores and to publish resources on the Web:
1.43 +
1.44 + useradd -d /var/lib/imip-agent -m -U -G www-data -r imip-agent
1.45 +
1.46 +Again, the tools/init.sh script will initialise directories for stored and
1.47 +published data. For example:
1.48 +
1.49 + tools/init.sh imip-agent www-data
1.50 +
1.51 Installing the Software
1.52 -----------------------
1.53
2.1 --- a/conf/postfix/master.cf.items Sat Sep 12 20:16:38 2015 +0200
2.2 +++ b/conf/postfix/master.cf.items Sun Sep 13 00:50:38 2015 +0200
2.3 @@ -1,3 +1,4 @@
2.4 +# Replace lmtp with www-data if operating in local SMTP mode.
2.5 imip_resources unix - n n - - pipe
2.6 flags=FR user=imip-agent:lmtp argv=/var/lib/imip-agent/imip_resource.py
2.7 -o ${original_recipient}
3.1 --- a/tools/fix.sh Sat Sep 12 20:16:38 2015 +0200
3.2 +++ b/tools/fix.sh Sun Sep 13 00:50:38 2015 +0200
3.3 @@ -1,9 +1,28 @@
3.4 #!/bin/sh
3.5
3.6 -USER=imip-agent
3.7 -GROUP=lmtp
3.8 -INSTALL_DIR=/var/lib/imip-agent
3.9 -WEB_INSTALL_DIR=/var/www/imip-agent
3.10 +PROGNAME=`basename $0`
3.11 +
3.12 +DEFAULT_USER=imip-agent
3.13 +DEFAULT_GROUP=lmtp
3.14 +DEFAULT_INSTALL_DIR=/var/lib/imip-agent
3.15 +DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent
3.16 +
3.17 +if [ "$1" = "--help" ]; then
3.18 + cat 1>&2 <<EOF
3.19 +Usage: $PROGNAME [ <user> [ <group> [ <stored data directory> [ <published data directory> ] ] ] ]
3.20 +
3.21 +Fix permissions for the stored and published data directories, using the given
3.22 +user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted),
3.23 +and operating on the given stored data and published data directories (or,
3.24 +respectively, $DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted).
3.25 +EOF
3.26 + exit 1
3.27 +fi
3.28 +
3.29 +USER=${1:-$DEFAULT_USER}
3.30 +GROUP=${2:-$DEFAULT_GROUP}
3.31 +INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR}
3.32 +WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR}
3.33
3.34 chown -R "$USER" "$INSTALL_DIR"
3.35 chgrp -R "$GROUP" "$INSTALL_DIR"
4.1 --- a/tools/init.sh Sat Sep 12 20:16:38 2015 +0200
4.2 +++ b/tools/init.sh Sun Sep 13 00:50:38 2015 +0200
4.3 @@ -1,9 +1,37 @@
4.4 #!/bin/sh
4.5
4.6 -USER=imip-agent
4.7 -GROUP=lmtp
4.8 -INSTALL_DIR=/var/lib/imip-agent
4.9 -WEB_INSTALL_DIR=/var/www/imip-agent
4.10 +PROGNAME=`basename $0`
4.11 +
4.12 +DEFAULT_USER=imip-agent
4.13 +DEFAULT_GROUP=lmtp
4.14 +DEFAULT_INSTALL_DIR=/var/lib/imip-agent
4.15 +DEFAULT_WEB_INSTALL_DIR=/var/www/imip-agent
4.16 +
4.17 +if [ "$1" = "--help" ]; then
4.18 + cat 1>&2 <<EOF
4.19 +Usage: $PROGNAME [ <user> [ <group> [ <stored data directory> [ <published data directory> ] ] ] ]
4.20 +
4.21 +Initialise stored and published data directories with permissions set to the
4.22 +given user and group (or, respectively, $DEFAULT_USER and $DEFAULT_GROUP if omitted),
4.23 +and with the given stored data and published data directories (or, respectively,
4.24 +$DEFAULT_INSTALL_DIR and $DEFAULT_WEB_INSTALL_DIR if omitted).
4.25 +
4.26 +Within the stored data directory, the following directories are created:
4.27 +
4.28 + * $DEFAULT_INSTALL_DIR/store
4.29 + * $DEFAULT_INSTALL_DIR/preferences
4.30 +
4.31 +Within the published data directory, the following directory is created:
4.32 +
4.33 + * $DEFAULT_WEB_INSTALL_DIR/static
4.34 +EOF
4.35 + exit 1
4.36 +fi
4.37 +
4.38 +USER=${1:-$DEFAULT_USER}
4.39 +GROUP=${2:-$DEFAULT_GROUP}
4.40 +INSTALL_DIR=${3:-$DEFAULT_INSTALL_DIR}
4.41 +WEB_INSTALL_DIR=${4:-$DEFAULT_WEB_INSTALL_DIR}
4.42
4.43 for DIR in "$INSTALL_DIR"/store "$INSTALL_DIR"/preferences "$WEB_INSTALL_DIR"/static ; do
4.44 mkdir -p "$DIR"