#!/usr/bin/env bash script_name="$(basename $(realpath $0))" working_dir="$(dirname $(realpath $0))" LOCK_DIR="/tmp/$(basename $0).$$.LOCK" log_file="${LOCK_DIR}/${script_name%%.*}.log" # ---------- # Base Function(s) # ---------- usage() { [[ -n "$1" ]] && error "$1" [[ $terminal ]] && echo -e " \033[1mUsage:\033[m $(basename $0) [ OPTION [ OPTION .. ] ] \033[1mDescription\033[m Creates a fresh new schleuder3 list. Parameters not given at commandline will be asked for. \033[1mNotice\033[m At time, this script supports only SQLite list database. \033[1mOptions\033[m All options are optional. -d Domain part of list address. -e E-mail address of the list admin -f Full qualified path to the key file of the list admins gpg key. -h Prints out this help. -n Name part of list address. \033[1mExample:\033[m Create List 'testlist@cryptolists.so36.net': \033[1m$(basename $0) -n testlist -d cryptolists.so36.net\033[m " clean_up 1 } clean_up() { # Perform program exit housekeeping rm -rf "$LOCK_DIR" blank_line exit $1 } echononl(){ if $terminal ; then echo X\\c > /tmp/shprompt$$ if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then echo -e -n " $*\\c" 1>&2 else echo -e -n " $*" 1>&2 fi rm /tmp/shprompt$$ fi } fatal(){ echo "" if $terminal ; then echo -e " [ \033[31m\033[1mFatal\033[m ] $*" else echo -e " [ Fatal ] $*" fi echo "" if $terminal ; then echo -e " \033[1mScript was terminated\033[m.." else echo -e " Script was terminated.." fi echo "" rm -rf $LOCK_DIR exit 1 } error (){ echo "" if $terminal ; then echo -e " [ \033[31m\033[1mError\033[m ] $*" else echo " [ Error ] $*" fi echo "" } warn (){ echo "" if $terminal ; then echo -e " [ \033[33m\033[1mWarn\033[m ] $*" else echo " [ Warn ] $*" fi echo "" } echo_done() { if $terminal ; then echo -e "\033[75G[ \033[32mdone\033[m ]" fi } echo_ok() { if $terminal ; then echo -e "\033[75G[ \033[32mok\033[m ]" fi } echo_failed(){ if $terminal ; then echo -e "\033[75G[ \033[1;31mfailed\033[m ]" fi } echo_skipped() { if $terminal ; then echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]" fi } trim() { local var="$*" var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters echo -n "$var" } # - Check if a given array (parameter 2) contains a given string (parameter 1) # - containsElement () { local e for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done return 1 } blank_line() { if $terminal ; then echo "" fi } # ---------- # - Jobhandling # ---------- # - Run 'clean_up' for signals SIGHUP SIGINT SIGTERM # - trap clean_up SIGHUP SIGINT SIGTERM # - Create lock directory '$LOCK_DIR" # mkdir "$LOCK_DIR" # ---------- # - Some checks .. # ---------- # - Running in a terminal? # - if [[ -t 1 ]] ; then terminal=true else terminal=false fi # - Print help? # - if [[ "$(trim $*)" =~ "--help" ]] ; then usage fi # ========== # - Begin Main Script # ========== # ---------- # - Headline # ---------- clear if $terminal ; then echo "" echo -e "\033[1m----------\033[m" echo -e "\033[32m\033[1mRunning script \033[m\033[1m$script_name\033[32m .. \033[m" echo -e "\033[1m----------\033[m" fi # ---------- # Read Configurations from $conf_file # ---------- # - Give your default values here # - LOGGING=false BATCH_MODE=false DEFAULT_SCHLEUDER_HOME="/var/lib/schleuder" #DEFAULT_LIST_DOMAIN="cryptolists.so36.net" DEFAULT_LIST_DOMAIN="il-schleuder.de" DEFAULT_HAS_PREFIX=yes DEFAULT_SEND_ENCRYPTED_ONLY=yes DEFAULT_RECEIVE_ENCRYPTED_ONLY=yes DEFAULT_RECEIVE_SIGNED_ONLY=no DEFAULT_RECEIVE_AUTHENTICATED_ONLY=no DEFAULT_RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY=yes if [[ -f "$conf_file" ]]; then source "$conf_file" #else # warn "No configuration file '$conf_file' present.\n # Loading default values.." fi [[ -z "$SCHLEUDER_HOME" ]] && SCHLEUDER_HOME="$DEFAULT_SCHLEUDER_HOME" [[ -n "$SEND_ENCRYPTED_ONLY" ]] && DEFAULT_SEND_ENCRYPTED_ONLY="$SEND_ENCRYPTED_ONLY" [[ -n "$RECEIVE_ENCRYPTED_ONLY" ]] && DEFAULT_RECEIVE_ENCRYPTED_ONLY="$RECEIVE_ENCRYPTED_ONLY" [[ -n "$RECEIVE_SIGNED_ONLY" ]] && DEFAULT_RECEIVE_SIGNED_ONLY="$RECEIVE_SIGNED_ONLY" [[ -n "$RECEIVE_AUTHENTICATED_ONLY" ]] && DEFAULT_RECEIVE_AUTHENTICATED_ONLY="$RECEIVE_AUTHENTICATED_ONLY" [[ -n "$RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY" ]] && DEFAULT_RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY="$RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY" # ---------- # - Read commandline parameter # ---------- while getopts d:e:f:hn: opt ; do case $opt in d) LIST_DOMAIN="${OPTARG,,}" ;; e) LIST_ADMIN_EMAIL="${OPTARG,,}" ;; f) ADMIN_KEY_FILE="${OPTARG,,}" ;; n) LIST_NAME="${OPTARG,,}" ;; h) usage ;; \?) usage ;; esac done # - Print help? # - if [[ "$(trim $*)" =~ "--help" ]] ; then usage fi shift $(expr $OPTIND - 1) [[ $# -eq "0" ]] || usage "Wrong number of arguments!" domain_exists=false schleuder_domains="$(schleuder-cli lists list 2>/dev/null | cut -d '@' -f2 2>/dev/null | sort -u 2>/dev/null)" # - To avoid matching a substring we use an array # - declare -a schleuder_domain_arr=() if [[ -n "$schleuder_domains" ]] ; then for _domain in $schleuder_domains ; do schleuder_domain_arr+=("$_domain") done fi regex_name_part="^[A-Za-z0-9._+-]+$" regex_domain_part="^([A-Za-z0-9-]+\.)+[A-Za-z]{2,}$" regex_email="^[A-Za-z0-9._+-]+@([A-Za-z0-9-]+\.)+[A-Za-z]{2,}$" if [[ -n "$LIST_DOMAIN" ]] ; then if [[ ! "$LIST_DOMAIN" =~ $regex_domain_part ]] ; then warn "The given domain part of th new list address is not valid! Later, you will be requested for the domain part again.." LIST_DOMAIN="" fi fi if [[ -n "$LIST_NAME" ]] ; then if [[ ! "$LIST_NAME" =~ $regex_name_part ]] ; then warn "The given name part of the new list address is not valid! Later, you will be requested name part again.." LIST_NAME="" fi fi if [[ -n "$LIST_ADMIN_EMAIL" ]] ; then if [[ ! "$LIST_ADMIN_EMAIL" =~ $regex_email ]] ; then warn "The given admin address is not a valid e-mail address. Later, you will be requested for the admin address gain.." LIST_ADMIN_EMAIL="" fi fi if [[ -n "$LIST_NAME" ]] && [[ -n "$LIST_DOMAIN" ]] ; then FQ_LIST_ADDRESS="${LIST_NAME}@$LIST_DOMAIN" if $(schleuder-cli lists list | grep -q "$FQ_LIST_ADDRESS" 2> /dev/null) ; then fatal "List '$FQ_LIST_ADDRESS' already exists!" fi fi # ---------- # - Read in parameters given by user # ---------- if $terminal && ! $BATCH_MODE ; then echo "" echo "" echo -e " \033[1mRead in base settings for the new list ..\033[m" echo "" # - Already give at command line # - if [[ -n "$LIST_NAME" ]] ; then echo -e " \033[1mList name\033[m: ${LIST_NAME,,}" fi if [[ -n "$LIST_DOMAIN" ]] ; then echo -e " \033[1mList domain\033[m: ${LIST_DOMAIN,,}" fi if [[ -n "$LIST_ADMIN_EMAIL" ]] ; then echo -e " \033[1mList admin\033[m: ${LIST_ADMIN_EMAIL,,}" fi if [[ -n "$ADMIN_KEY_FILE" ]] ; then echo -e " \033[1mKey file list aadmin\033[m: ${ADMIN_KEY_FILE}" fi if [[ -z "$LIST_NAME" ]] ; then echo "" echo -e "\033[32m--\033[m" echo " Enter the name part of the new list (@)." echo "" echo "" while [[ -z "$(trim "$LIST_NAME")" ]]; do echononl "\033[1mName Part of list\033[m: " read LIST_NAME if [[ -z "$(trim "$LIST_NAME")" ]]; then echo "" echo -e " \033[33mThe name part of list is required! \033[m Try again.." echo "" continue fi if [[ ! "$LIST_NAME" =~ $regex_name_part ]]; then echo "" echo -e " \033[33mThe given name part of the new list address is not valid! \033[m Try again.." echo "" LIST_NAME="" continue fi done fi LIST_NAME="${LIST_NAME,,}" if [[ -z "$LIST_DOMAIN" ]] ; then echo "" echo -e "\033[32m--\033[m" echo " Enter the domain part of the new list (@)." if [[ ${#schleuder_domain_arr[@]} -gt 0 ]] ; then echo "" echo " Available List Domains:" echo "" for _dom in ${schleuder_domain_arr[@]} ; do echo -e " \033[33m$_dom\033[m" done fi echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" echo "" _LIST_DOMAIN="$DEFAULT_LIST_DOMAIN" while [[ -z "$(trim "$LIST_DOMAIN")" ]]; do echononl "\033[1mDomain part of the new list\033[m [$_LIST_DOMAIN]: " read LIST_DOMAIN if [[ -z "$(trim $LIST_DOMAIN)" ]] ; then LIST_DOMAIN="$DEFAULT_LIST_DOMAIN" fi if [[ ! "$LIST_DOMAIN" =~ $regex_domain_part ]]; then echo "" echo -e " \033[33mThe given domain part of the new list address is not valid! \033[m Try again.." echo "" LIST_DOMAIN="" fi done fi LIST_DOMAIN="${LIST_DOMAIN,,}" # - Some checks # - if containsElement "$LIST_DOMAIN" "${schleuder_domain_arr[@]}" ; then domain_exists=true fi FQ_LIST_ADDRESS="${LIST_NAME}@$LIST_DOMAIN" if $(schleuder-cli lists list | grep -q "$FQ_LIST_ADDRESS" 2> /dev/null) ; then fatal "List already exists!" fi if [[ -z "$LIST_ADMIN_EMAIL" ]] ; then echo "" echo -e "\033[32m--\033[m" echo " Enter the e-mail address for the list admin." echo "" echo "" while [[ -z "$(trim "$LIST_ADMIN_EMAIL")" ]]; do echononl "\033[1mE-mail address of list admin \033[m: " read LIST_ADMIN_EMAIL if [[ -z "$(trim "$LIST_ADMIN_EMAIL")" ]]; then echo "" echo -e " \033[33mA admin e-mail address for list is required!\033[m Try again.." echo "" LIST_ADMIN_EMAIL="" continue fi if [[ ! "$LIST_ADMIN_EMAIL" =~ $regex_email ]]; then echo "" echo -e " \033[33mGiven admin address is not valid e-mail address!\033[m Try again.." echo "" LIST_ADMIN_EMAIL="" continue fi done fi if [[ -z "$ADMIN_KEY_FILE" ]] ; then echo "" echo -e "\033[32m--\033[m" echo " Enter the full qualified path to the admin gpg key-file.." echo "" echo "" while [[ -z "$(trim "$ADMIN_KEY_FILE")" ]]; do echononl "\033[1mGPG key file for the admin address\033[m: " read ADMIN_KEY_FILE if [[ -z "$(trim "$ADMIN_KEY_FILE")" ]]; then echo "" echo -e " \033[33mA key file for the admin e-mail address is required !\033[m Try again.." echo "" continue fi if [[ ! -f "$(trim "$ADMIN_KEY_FILE")" ]]; then echo "" echo -e " \033[33mThe give key file was not found! \033[m Try again.." echo "" ADMIN_KEY_FILE="" continue fi if ! $(gpg "$ADMIN_KEY_FILE" 2> /dev/null | grep -q $LIST_ADMIN_EMAIL 2>/dev/null) ; then echo "" echo -e " \033[33mThe admin address dos not match the given key file! \033[m" echo " Try again or type ' + c'" echo "" ADMIN_KEY_FILE="" continue fi done fi echo "" echo "" echo -e " \033[1mRead in configuration parameters for the new list ..\033[m" echo "" echo -e "\033[32m--\033[m" echo " Should the list get a prefix? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." HAS_PREFIX=false echo "" YES_NO="" echononl "\033[1mList with subject prefix?\033[m [$DEFAULT_HAS_PREFIX]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_HAS_PREFIX" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " \033[33mWrong entry! \033[mTry again.." echononl "\033[1mList with subject prefix?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = 'yes' ]] && HAS_PREFIX=true if $HAS_PREFIX ; then PREFIX="" DEFAULT_PREFIX="[${LIST_NAME}]" echo "" echo "" echo -e "\033[32m--\033[m" echo " Enter the name of the Prefix" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" echononl "\033[1mList prefix\033[m [ $DEFAULT_PREFIX ]: " read PREFIX [[ -z "$(trim "$PREFIX")" ]] && PREFIX=$DEFAULT_PREFIX fi echo "" echo -e "\033[32m--\033[m" echo " Send only encrypted e-mails? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" YES_NO="" SEND_ENCRYPTED_ONLY=false echononl "\033[1mOnly send out enrypted e-mails to subscribers?\033[m [$DEFAULT_SEND_ENCRYPTED_ONLY]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_SEND_ENCRYPTED_ONLY" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " Wrong entry. try again.." echononl "\033[1mOnly send out enrypted e-mails to subscribers?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = "yes" ]] && SEND_ENCRYPTED_ONLY=true echo "" echo -e "\033[32m--\033[m" echo " Recieve only encrypted e-mails? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" YES_NO="" RECEIVE_ENCRYPTED_ONLY=false echononl "\033[1mAllow only encrypted incomming e-mails?\033[m [$DEFAULT_RECEIVE_ENCRYPTED_ONLY]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_RECEIVE_ENCRYPTED_ONLY" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " Wrong entry. try again.." echononl "\033[1mAllow only encrypted incomming e-mails?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = "yes" ]] && RECEIVE_ENCRYPTED_ONLY=true echo "" echo -e "\033[32m--\033[m" echo " Recieve only signed e-mails? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" YES_NO="" RECEIVE_SIGNED_ONLY=false echononl "\033[1mAllow only e-mails that are validly signed?\033[m [$DEFAULT_RECEIVE_SIGNED_ONLY]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_RECEIVE_SIGNED_ONLY" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " Wrong entry. try again.." echononl "\033[1mAllow only e-mails that are validly signed?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = "yes" ]] && RECEIVE_SIGNED_ONLY=true echo "" echo -e "\033[32m--\033[m" echo " Allow only emails that are validly signed by a subscriber's key? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" YES_NO="" RECEIVE_AUTHENTICATED_ONLY=false echononl "\033[1mAllow only e-mails validy signed from subscribed addresses?\033[m [$DEFAULT_RECEIVE_AUTHENTICATED_ONLY]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_RECEIVE_AUTHENTICATED_ONLY" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " Wrong entry. try again.." echononl "\033[1mAllow only e-mails validy signed from subscribed addresses?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = "yes" ]] && RECEIVE_AUTHENTICATED_ONLY=true echo "" echo -e "\033[32m--\033[m" echo " Allow only e-mails being sent from subscribed addresses? [yes/no]" echo "" echo -e " Type \033[33m\033[m to accept the default." echo "" YES_NO="" RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY=false echononl "\033[1mAllow only e-mails being sent from subscribed addresses?\033[m [$DEFAULT_RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY]: " read YES_NO if [[ -z "$(trim "$YES_NO")" ]]; then YES_NO="$DEFAULT_RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY" fi while [[ "${YES_NO,,}" != "yes" ]] && [[ "${YES_NO,,}" != "no" ]] ; do echo -e " Wrong entry. try again.." echononl "\033[1mAllow only e-mails being sent from subscribed addresses?\033[m [yes/no]: " read YES_NO done [[ "${YES_NO,,}" = "yes" ]] && RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY=true echo "" echo "" echo -e " \033[32m\033[1mParameter Summary:\033[m" echo "" echo " Full qualified new list address..............................: $FQ_LIST_ADDRESS" echo "" echo " E-Mail address of list admin.................................: $LIST_ADMIN_EMAIL" echo " GPG key file of admin address................................: $ADMIN_KEY_FILE" echo "" if $HAS_PREFIX ; then echo " Subject Prefix...............................................: $PREFIX" else echo -e " Subject Prefix...............................................: \033[33m- not set -\033[m" fi if $SEND_ENCRYPTED_ONLY ; then echo " Only send out enrypted emails to subscriptions...............: yes" else echo " Only send out enrypted emails to subscriptions...............: no" fi if $RECEIVE_ENCRYPTED_ONLY ; then echo " Allow only encrypted incomming e-mails?......................: yes" else echo " Allow only encrypted incomming e-mails?......................: no" fi if $RECEIVE_SIGNED_ONLY ; then echo " Allow only e-mails that are validly signed?..................: yes" else echo " Allow only e-mails that are validly signed?..................: no" fi if $RECEIVE_AUTHENTICATED_ONLY ; then echo " Allow only e-mails validy signed from subscribed addresses?..: yes" else echo " Allow only e-mails validy signed from subscribed addresses?..: no" fi if $RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY ; then echo " Allow only e-mails being sent from subscribed addresses?.....: yes" else echo " Allow only e-mails being sent from subscribed addresses?.....: no" fi if ! $domain_exists ; then warn "The Domain '$LIST_DOMAIN' of the new list address '$FQ_LIST_ADDRESS' does not exists yet! This is not an error, but if you continue, take care, postfix mailsystem is knowing tbout he new (schleuder) domain." fi echo "" echononl "Continue with this parameters? [\033[1myes/no\033[m]: " read OK while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do echononl "\033[33mWrong entry!\033[m [\033[1myes/no\033[m]: " read OK done [[ "${OK,,}" = "yes" ]] || fatal "Canceled by user input." fi # ---------- # - Main part of script # ---------- if $terminal ; then echo "" echo "" echo -e " \033[1mMain part of script ..\033[m" echo "" fi echononl "Create list '$FQ_LIST_ADDRESS' - this may take some time.." schleuder-cli lists new $FQ_LIST_ADDRESS $LIST_ADMIN_EMAIL $ADMIN_KEY_FILE > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" clean_up 1 fi blank_line echononl "Set Subject Prefix .." if $HAS_PREFIX ; then schleuder-cli lists set $FQ_LIST_ADDRESS subject_prefix $PREFIX > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi else echo_skipped fi echononl "Set parameter 'send_encrypted_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS send_encrypted_only $SEND_ENCRYPTED_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'receive_encrypted_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS receive_encrypted_only $RECEIVE_ENCRYPTED_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'receive_signed_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS receive_signed_only $RECEIVE_SIGNED_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'receive_authenticated_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS receive_authenticated_only $RECEIVE_AUTHENTICATED_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'receive_from_subscribed_emailaddresses_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS receive_from_subscribed_emailaddresses_only $RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'receive_from_subscribed_emailaddresses_only' .." schleuder-cli lists set $FQ_LIST_ADDRESS receive_from_subscribed_emailaddresses_only $RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi echononl "Set parameter 'public_footer' .." if ! $RECEIVE_FROM_SUBSCRIBED_EMAILADDRESSES_ONLY ; then public_footer="To get senders key, send an e-mail to ${LIST_NAME}-sendkey@${LIST_DOMAIN}" schleuder-cli lists set $FQ_LIST_ADDRESS public_footer "$public_footer" > "$log_file" 2>&1 if [[ $? -eq 0 ]] ; then echo_done else echo_failed error "$(cat "$log_file")" fi else echo_skipped fi echononl "Get fingerprint of the new list .." _FINGERPRINT="$(schleuder-cli keys list ${FQ_LIST_ADDRESS} 2>/dev/null \ | grep ${FQ_LIST_ADDRESS} 2>/dev/null \ | cut -d' ' -f1 2>/dev/null)" if [[ $? -eq 0 ]] ; then echo_done else echo_failed fi FINGERPRINT="" declare -i number=1 while read -n1 char ; do FINGERPRINT="${FINGERPRINT}$char" if [[ $(( $number % 4)) -eq 0 ]] ; then FINGERPRINT="${FINGERPRINT} " fi (( number++ )) done <<< $_FINGERPRINT echo " --- Wir haben Dir/Euch folgende Liste eingerichtet: $FQ_LIST_ADDRESS Der Fingerprint des Listenschlüssels ist: $FINGERPRINT Um den Listenschlüssel zu erhalten, schicke eine mail an ${LIST_NAME}-sendkey@${LIST_DOMAIN} Die Administrierungsadresse der Liste ist: $LIST_ADMIN_EMAIL " if $RECEIVE_SIGNED_ONLY || $RECEIVE_AUTHENTICATED_ONLY ; then echo " Alle E-Mails an die Liste müssen verschlüsselt und signiert werden. " fi echo " Wir nutzen dazu die Software 'schleuder' version 3: https://schleuder.org/ Die Liste unterstützt administrative Kommandos, die sogenannten 'special keywords' um verschiedene Aufgaben zu erledigen oder auch Informationen über subscribierte Adressen/Schlüssel zu erhalten. E-Mails, die solche Kommandos enthalten, werden an die Adresse ${LIST_NAME}-request@${LIST_DOMAIN} versendet und müssen - unabhängig von den Einstellungen der Liste selbst - IMMER *verschlüsselt und signiert* sein. Sie müssen aus Sicherheitsgründen zusätzlich zu dem/den Listemkommando(s) die Zeile x-list-name: $FQ_LIST_ADDRESS enhalten (z.Bsp. die ertse Zeile der E-Mail). Einge Kommandos (Adressen hinzufügen/löschen, Schlüssel löschen) sind der/den Admin Adresse(n) vrobehalten. Es sind mehrere Kommandos in einer 'request' E-Mail möglich. Siehe hierzu: https://schleuder.org/schleuder/docs/list-admins.html Die Liste unterstützt das sogenannte 'Resending', das Versenden von E-Mails an nicht subscribierte Adressen im Namen der Liste. Siehe hierzu: https://schleuder.org/schleuder/docs/subscribers.html Bei Fragen: einfach fragen!" exit 0 clean_up 0 # ---------- # - Some pre-script tasks .. # ---------- if $terminal ; then echo "" echo "" echo -e " \033[1mDoing some configuration tasks for new list ..\033[m" echo "" fi if $terminal ; then clean_up 0 echononl "Get a list of available list options .." list_options="$(schleuder-cli lists list-options 2> "${log_file}")" if [[ -s "$log_file" ]] ; then echo_failed fatal "Run this script as a user, who is allowed to maintain schleuder lists." else echo_done fi # - List present? # - if ! $(schleuder-cli lists list | grep -q -E "^${LIST_NAME}$" 2>/dev/null) ; then fatal "List '$LIST_NAME' not found at this server!" fi # ---------- # - Main part of script # ---------- if $terminal ; then echo "" echo "" echo -e " \033[1mParameter settings for list \033[32m\033[1m$LIST_NAME\033[32m ..\033[m" echo "" else echo "" echo " Parameter settings for list '$LIST_NAME':" fi for _option in $list_options ; do _val="$(schleuder-cli lists show $LIST_NAME $_option 2> $log_file)" if [[ -s "${log_file}" ]]; then error "$(cat "${log_file}")" clean_up 1 fi if $terminal ; then echo -en " ${_option}:\033[50G" if [[ -z "$_val" ]] ; then echo -en "\033[33m-- --" else echo -en "\033[32m${_val}" fi echo -e "\033[m" else echo " ${_option}: ${_val}" fi done clean_up 1