From b162d5cacde85999353afa87a4210c5b5d42ceab Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 6 Oct 2006 22:12:14 +0000 Subject: added permission checking on configuration (both local and global) and keyring files --- firma | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 112 insertions(+), 15 deletions(-) (limited to 'firma') diff --git a/firma b/firma index bfa05f9..c14f3f6 100755 --- a/firma +++ b/firma @@ -33,6 +33,14 @@ # # And it may contain the following optional parameters: # +# USER= user that runs firma (usually the same as your MTA user); +# defaults to "nobody"; you can also specify this parameter +# in each mailing list config file if you plan to have one +# user per mailing list +# GROUP= group that runs firma (usually the same as your MTA group); +# defaults to "nogroup"; you can also specify this parameter +# in each mailing list config file if you plan to have one +# group per mailing list # LOG_TO_SYSLOG= set to "1" to log errors and warnings to syslog, else firma # will print errors to STDERR # LOGGER_BINARY= if logging to syslog, set the path to logger's binary @@ -175,6 +183,14 @@ WARNING: Setting LOG_TO_SYSLOG to '0'." fi fi + if [ -z "$USER" ]; then + USER="nobody" + fi + + if [ -z "$GROUP" ]; then + GROUP="nobody" + fi + return $return_code } @@ -838,28 +854,28 @@ function NewList { echo "Creating folder $LIST_PATH..." if mkdir "$LIST_PATH"; then # || (echo "$(basename $0): error creating $LIST_PATH: installation aborted"; exit 1) - echo "creating list config file and will ask some questions." + echo "Creating list config file and will ask some questions." read -rep " List keyring location: ("$LIST_PATH") " LIST_HOMEDIR LIST_HOMEDIR=${LIST_HOMEDIR:-"$LIST_PATH"} - # NAO USAR UTF-8 (VER DETAILS) + # Dont use UTF-8 (look at DETAILS) read -rep " List email address: " LIST_ADDRESS read -rep " List administrator(s) email address(es) (space delimited): " LIST_ADMIN read -rep " List description (optional): " DESCRIPTION read -resp " Passphrase to protect the list's secret key: " PASSPHRASE - # todo: key specs (size, expiry date...) + # TODO: key specs (size, expiry date...) - echo "creating your config..." + echo "Creating your config..." touch $LIST_CONFIG_FILE - chown root.root $LIST_CONFIG_FILE chmod 600 $LIST_CONFIG_FILE + chown $USER.$GROUP $LIST_CONFIG_FILE if [ -f "$LIST_CONFIG_FILE" ]; then DeclareGpgVars # removed: MAIL_AGENT=$MAIL_AGENT\nGPG_BINARY=$GPG_BINARY\n - echo -e "LIST_HOMEDIR=$LIST_HOMEDIR\nLIST_ADDRESS=$LIST_ADDRESS\nLIST_ADMIN=$LIST_ADMIN\nPASSPHRASE=$PASSPHRASE" > $LIST_CONFIG_FILE - echo "now generating your keyring..." + echo -e "LIST_HOMEDIR=\'$LIST_HOMEDIR\'\nLIST_ADDRESS=\'$LIST_ADDRESS\'\nLIST_ADMIN=\'$LIST_ADMIN\'\nPASSPHRASE=\'$PASSPHRASE\'" > $LIST_CONFIG_FILE + echo "Now generating your keyring..." $GPG --gen-key <&2 "$(basename $0): $ERROR_MESSAGE" fi -- cgit v1.2.3