diff --git a/type/__opendkim/files/opendkim.conf.sh b/type/__opendkim/files/opendkim.conf.sh index 468b262..52e51a5 100755 --- a/type/__opendkim/files/opendkim.conf.sh +++ b/type/__opendkim/files/opendkim.conf.sh @@ -3,6 +3,9 @@ echo "# Managed remotely, manual changes will be lost." +# Used for OS-specific configuration. +os=$(cat "${__global:?}/explorer/os") + # Optional chdir(2) if [ "$BASEDIR" ]; then @@ -63,3 +66,16 @@ if [ "$USERID" ]; then printf "UserID %s\n" "$USERID" fi + +if [ "$os" = "debian" ]; then + cat <<- EOF + # In Debian, opendkim runs as user "opendkim". A umask of 007 is required when + # using a local socket with MTAs that access the socket as a non-privileged + # user (for example, Postfix). You may need to add user "postfix" to group + # "opendkim" in that case. + UserID opendkim + UMask 007 + + PidFile /run/opendkim/opendkim.pid + EOF +fi diff --git a/type/__opendkim/man.rst b/type/__opendkim/man.rst index 996f16d..d800068 100644 --- a/type/__opendkim/man.rst +++ b/type/__opendkim/man.rst @@ -14,8 +14,8 @@ installation and basic configuration of an instance of OpenDKIM. Note that this type does not generate or ensure that a key is present: use `cdist-type__opendkim-genkey(7)` for that. -Note that this type is currently only implemented for Alpine Linux and FreeBSD. -Please contribute an implementation if you can. +Note that this type is currently only implemented for Debian, Alpine Linux and +FreeBSD. Please contribute an implementation if you can. REQUIRED PARAMETERS @@ -41,25 +41,21 @@ subdomains umask Set the umask for the socket and PID file. +userid + Change the user the opendkim program is to run as. + By default, Alpine Linux's OpenRC service will set this to `opendkim` on the + command-line and FreeBSD's rc will set it to `mailnull`. + custom-config The string following this parameter is appended as-is in the configuration, to enable more complex configurations. - BOOLEAN PARAMETERS ------------------ syslog Log to syslog. -DEPRECATED PARAMETERS ---------------------- -userid - Change the user the opendkim program is to run as. - By default, Alpine Linux's OpenRC service will set this to `opendkim` on the - command-line and FreeBSD's rc will set it to `mailnull`. - - EXAMPLES -------- diff --git a/type/__opendkim/manifest b/type/__opendkim/manifest index dbd9fc0..42bb96e 100755 --- a/type/__opendkim/manifest +++ b/type/__opendkim/manifest @@ -21,13 +21,20 @@ os=$(cat "${__global:?}/explorer/os") CFG_DIR="/etc/opendkim" +CFG_FILE="$CFG_DIR/opendkim.conf" service="opendkim" case "$os" in 'alpine') : ;; +'debian') + CFG_DIR="/etc/dkimkeys" + CFG_FILE="/etc/opendkim.conf" + ;; 'freebsd') CFG_DIR="/usr/local/etc/mail" + CFG_FILE="$CFG_DIR/opendkim.conf" + service="milter-opendkim" ;; *) @@ -75,7 +82,7 @@ fi # Generate and deploy configuration file. source_file="${__object:?}/files/opendkim.conf" -target_file="${CFG_DIR}/opendkim.conf" +target_file="${CFG_FILE}" mkdir -p "${__object:?}/files" diff --git a/type/__opendkim/parameter/deprecated/userid b/type/__opendkim/parameter/deprecated/userid deleted file mode 100644 index 1815a0a..0000000 --- a/type/__opendkim/parameter/deprecated/userid +++ /dev/null @@ -1,2 +0,0 @@ -This can cause inconsistencies with permissions and will stop being supported. -If you still need this, you can use --custom-config 'UserId $USERID'. diff --git a/type/__opendkim_genkey/explorer/key-state b/type/__opendkim_genkey/explorer/key-state deleted file mode 100755 index 75998f9..0000000 --- a/type/__opendkim_genkey/explorer/key-state +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -e -DIRECTORY="/var/db/dkim/" -if [ -f "${__object:?}/parameter/directory" ]; -then - # Be forgiving about a lack of trailing slash - DIRECTORY="$(sed -E 's!([^/])$!\1/!' < "${__object:?}/parameter/directory")" -fi - - -KEY_ID="$(echo "${__object_id:?)}" | tr '/' '_')" -DEFAULT_PATH="${DIRECTORY:?}${KEY_ID:?}.private" -if [ -s "${DEFAULT_PATH}" ]; then - # This is the main location for the key - FOUND_PATH="${DEFAULT_PATH}" -else - # This is a backwards-compatible location for the key - # Keys generated post March 2022 should not land here - if [ -f "${__object:?}/parameter/selector" ]; then - SELECTOR="$(cat "${__object:?}/parameter/selector")" - if [ -s "${DIRECTORY}${SELECTOR:?}.private" ]; then - FOUND_PATH="${DIRECTORY}${SELECTOR:?}.private" - fi - fi -fi - -if [ -n "${FOUND_PATH}" ]; then - printf "present\t%s" "${FOUND_PATH}" -else - # We didn't find the key - # We pass the default path here, to easen logic in the rest of the type - printf "absent\t%s" "${DEFAULT_PATH}" -fi diff --git a/type/__opendkim_genkey/gencode-remote b/type/__opendkim_genkey/gencode-remote index d2bea50..6cfbb3a 100755 --- a/type/__opendkim_genkey/gencode-remote +++ b/type/__opendkim_genkey/gencode-remote @@ -18,9 +18,33 @@ # along with cdist. If not, see . # +os=$(cat "${__global:?}/explorer/os") + + +case "$os" in +'debian') + KEYS_DIR="/etc/dkimkeys/" +;; +'freebsd'|'alpine') + KEYS_DIR="/var/db/dkim/" +;; +*) + cat <<- EOF >&2 + __opendkim_genkey does not support $os (yet). Exiting. + EOF + exit 1 +;; +esac + +if [ -f "${__object:?}/parameter/directory" ]; +then + # Be forgiving about a lack of trailing slash + KEYS_DIR="$(sed -E 's!([^/])$!\1/!' < "${__object:?}/parameter/directory")" +fi + # Required parameters -DOMAIN="$(cat "${__object:?}/domain")" -SELECTOR="$(cat "${__object:?}/selector")" +DOMAIN="$(cat "${__object:?}/parameter/domain")" +SELECTOR="$(cat "${__object:?}/parameter/selector")" # Optional parameters BITS= @@ -42,24 +66,9 @@ fi user="$(cat "${__object:?}/user")" group="$(cat "${__object:?}/group")" -KEY_STATE="$(cut -f 1 "${__object:?}/explorer/key-state")" -KEY_LOCATION="$(cut -f 2- "${__object:?}/explorer/key-state")" - -if [ "${KEY_STATE:?}" = "absent" ]; then - # opendkim-genkey(8) does not allow specifying the file name. - # To err on the safe side (and avoid potentially killing other keys) - # we operate on a temporary directory first, then move the resulting key - cat <<-EOF - tmp_dir="\$(mktemp -d cdist-dkim.XXXXXXXXXXX)" - opendkim-genkey $BITS --domain=${DOMAIN:?} --directory=\${tmp_dir:?} $RESTRICTED --selector=${SELECTOR:?} $SUBDOMAINS - # Relocate and ensure permissions - mv "\${tmp_dir:?}/${SELECTOR:?}.private" '${KEY_LOCATION:?}' - chown ${user}:${group} '${KEY_LOCATION}' - chmod 0600 '${KEY_LOCATION}' +if ! [ -f "${KEYS_DIR}${SELECTOR}.private" ]; then + echo "opendkim-genkey $BITS --domain=$DOMAIN --directory=$KEYS_DIR $RESTRICTED --selector=$SELECTOR $SUBDOMAINS" + echo "chown ${user}:${group} ${KEYS_DIR}${SELECTOR}.private" # This is usually generated, if it weren't we do not want to fail - mv "\${tmp_dir:?}/${SELECTOR:?}.txt" '${KEY_LOCATION%.private}.txt' || true - chown ${user}:${group} '${KEY_LOCATION%.private}.txt' || true - # Cleanup after ourselves - rmdir "\${tmp_dir:?}" || true - EOF + echo "chown ${user}:${group} ${KEYS_DIR}${SELECTOR}.txt || true" fi diff --git a/type/__opendkim_genkey/man.rst b/type/__opendkim_genkey/man.rst index 0d52ca3..3251ec1 100644 --- a/type/__opendkim_genkey/man.rst +++ b/type/__opendkim_genkey/man.rst @@ -10,27 +10,23 @@ DESCRIPTION ----------- This type uses the `opendkim-genkey(8)` to generate signing keys suitable for -usage by `opendkim(8)` to sign outgoing emails. +usage by `opendkim(8)` to sign outgoing emails. Then, a line with the domain, +selector and keyname in the `$selector._domainkey.$domain` format will be added +to the OpenDKIM key table located at `/etc/opendkim/KeyTable`. Finally, a line +will be added to the OpenDKIM signing table, using either the domain or the +provided key for the `domain:selector:keyfile` value in the table. An existing +key will not be overwritten. -It also manages the key, identified by its `$__object_id` in OpenDKIM's -KeyTable and sets its `s=` and `d=` parameters (see: `--selector` and -`--sigdomain` respectively). - -This type will also manage the entries in the OpenDKIM's SigningTable by -associating any given `sigkey` values to this key. - -Take into account that if you use this type without the `--domain` and -`--selector` parameters, the `$__object_id` must be in form `$domain/$selector`. - -Currently, this type is only implemented for Alpine Linux and FreeBSD. +Currently, this type is only implemented for Debian, Alpine Linux and FreeBSD. Please contribute an implementation if you can. -NOTE: the name of the key file under `--directory` will default to -`$__object_id.private`, but if that fails and `--selector` is used, -`SELECTOR.private` will be considered. -Take care when using unrelated keys that might collide this way. -For more information see: -https://code.ungleich.ch/ungleich-public/cdist-contrib/issues/20 +REQUIRED PARAMETERS +------------------- +domain + The domain to generate the key for. + +selector + The DKIM selector to generate the key for. OPTIONAL PARAMETERS @@ -42,36 +38,10 @@ bits directory The directory in which to generate the key, `/var/db/dkim/` by default. -domain - The domain to generate the key for. - If omitted, `--selector` must be omitted as well and `$__object_id` must be - in form: `$domain/$selector`. - -selector - The DKIM selector to generate the key for. - If omitted, `--domain` must be omitted as well and `$__object_id` must be - in form: `$domain/$selector`. - -sigdomain - Specified in the KeyTable, the domain to use in the signature's "d=" value. - Defaults to the specified domain. If `%`, it will be replaced by the apparent - domain of the sender when generating a signature. - Note you probably don't want to set both `--sigdomain` and `--sigkey` to `%`. - See `KeyTable` in `opendkim.conf(5)` for more information. - - -OPTIONAL MULTIPLE PARAMETERS ----------------------------- sigkey - The key used in the `SigningTable` for this signing key. Defaults to the + The key used in the SigningTable for this signing key. Defaults to the specified domain. If `%`, OpenDKIM will replace it with the domain found in the `From:` header. See `opendkim.conf(5)` for more options. - Note you probably don't want to set both `--sigdomain` and `--sigkey` to `%`. - This can be passed multiple times, resulting in multiple lines in the - SigningTable, which can be used to support signing of subdomains or multiple - domains with the same key; in that case, you probably want to set - `--sigdomain` to `%`, else the domains will not be aligned. - BOOLEAN PARAMETERS ------------------ @@ -87,7 +57,6 @@ EXAMPLES .. code-block:: sh - # Setup the OpenDKIM service __opendkim \ --socket inet:8891@localhost \ --basedir /var/lib/opendkim \ @@ -96,24 +65,14 @@ EXAMPLES --umask 002 \ --syslog - # Continue only after the service has been set up - export require="__opendkim" + require='__opendkim' \ + __opendkim_genkey default \ + --domain example.com \ + --selector default - # Generate a key for 'example.com' with selector 'default' - __opendkim_genkey default \ - --domain example.com \ - --selector default - - # Generate a key for 'foo.com' with selector 'backup' - __opendkim_genkey 'foo.com/backup' - - # Generate a key for 'example.org' with selector 'main' - # that can also sign 'cdi.st' and subdomains of 'example.org' - __opendkim_genkey 'example.org/main' \ - --sigdomain '%' \ - --sigkey 'example.org' \ - --sigkey '.example.org' \ - --sigkey 'cdi.st' + __opendkim_genkey myfoo \ + --domain foo.com \ + --selector backup SEE ALSO diff --git a/type/__opendkim_genkey/manifest b/type/__opendkim_genkey/manifest index 58e9b06..289e7fe 100755 --- a/type/__opendkim_genkey/manifest +++ b/type/__opendkim_genkey/manifest @@ -21,13 +21,18 @@ os=$(cat "${__global:?}/explorer/os") -CFG_DIR="/etc/opendkim" +CFG_DIR="/etc/opendkim/" +KEYS_DIR="/var/db/dkim/" user="opendkim" group="opendkim" case "$os" in 'alpine') : ;; +'debian') + CFG_DIR="/etc/dkimkeys/" + KEYS_DIR="/etc/dkimkeys/" +;; 'freebsd') CFG_DIR="/usr/local/etc/mail" user="mailnull" @@ -35,54 +40,22 @@ case "$os" in ;; *) cat <<- EOF >&2 - __opendkim_genkey currently only supports Alpine Linux and FreeBSD. - Please contribute an implementation for $os if you can. + __opendkim_genkey does not support $os (yet). Exiting. EOF exit 1 ;; esac +# Persist user and group for gencode-remote +printf '%s' "${user}" > "${__object:?}/user" +printf '%s' "${group}" > "${__object:?}/group" -# Logic to simplify the type as documented in -# https://code.ungleich.ch/ungleich-public/cdist-contrib/issues/20#issuecomment-14711 -DOMAIN="$(cat "${__object:?}/parameter/domain" 2>/dev/null || true)" -SELECTOR="$(cat "${__object:?}/parameter/selector" 2>/dev/null || true)" -if [ -z "${DOMAIN}${SELECTOR}" ]; then - # Neither SELECTOR nor DOMAIN were passed, try to use __object_id - if echo "${__object_id:?}" | \ - grep -qE '^[^/[:space:]]+/[^/[:space:]]+$'; then - # __object_id matches, let's get the data - DOMAIN="$(echo "${__object_id:?}" | cut -d '/' -f 1)" - SELECTOR="$(echo "${__object_id:?}" | cut -d '/' -f 2)" - else - # It doesn't match the pattern, this is sad - cat <<- EOF >&2 - The arguments --domain and --selector were not used. - So __object_id must match DOMAIN/SELECTOR. - But instead the type got: ${__object_id:?} - EOF - exit 1 - fi -elif [ -z "${DOMAIN}" ] || [ -z "${SELECTOR}" ]; then - # Only one was passed, this is sad :-( - cat <<- EOF >&2 - You must pass either both --selector and --domain or none of them. - If these arguments are absent, __object_id must match: DOMAIN/SELECTOR. - EOF - exit 1 -# else: both were passed -fi +SELECTOR="$(cat "${__object:?}/parameter/selector")" +DOMAIN="$(cat "${__object:?}/parameter/domain")" -# Persist data for gencode-remote -printf '%s' "${user:?}" > "${__object:?}/user" -printf '%s' "${group:?}" > "${__object:?}/group" -printf '%s' "${DOMAIN:?}" > "${__object:?}/domain" -printf '%s' "${SELECTOR:?}" > "${__object:?}/selector" - -DIRECTORY="/var/db/dkim/" if [ -f "${__object:?}/parameter/directory" ]; then # Be forgiving about a lack of trailing slash - DIRECTORY="$(sed -E 's!([^/])$!\1/!' < "${__object:?}/parameter/directory")" + KEYS_DIR="$(sed -E 's!([^/])$!\1/!' < "${__object:?}/parameter/directory")" fi SIGKEY="${DOMAIN:?}" @@ -90,50 +63,29 @@ if [ -f "${__object:?}/parameter/sigkey" ]; then SIGKEY="$(cat "${__object:?}/parameter/sigkey")" fi -SIGDOMAIN="${DOMAIN:?}" -if [ -f "${__object:?}/parameter/sigdomain" ]; -then - SIGDOMAIN="$(cat "${__object:?}/parameter/sigdomain")" -fi # Ensure the key-container directory exists with the proper permissions -__directory "${DIRECTORY}" \ +__directory "${KEYS_DIR}" \ --mode 0750 \ --owner "${user}" --group "${group}" # OS-specific code case "$os" in 'alpine') - # This is needed for opendkim-genkey __package opendkim-utils ;; +'debian') + __package opendkim-tools +;; esac key_table="${CFG_DIR}/KeyTable" signing_table="${CFG_DIR}/SigningTable" -KEY_STATE="$(cut -f 1 "${__object:?}/explorer/key-state")" -KEY_LOCATION="$(cut -f 2- "${__object:?}/explorer/key-state")" - -__line "__opendkim_genkey/${__object_id:?}" \ +__line "line-key-${__object_id:?}" \ --file "${key_table}" \ - --line "${__object_id:?} ${SIGDOMAIN:?}:${SELECTOR:?}:${KEY_LOCATION:?}" \ - --regex "^${__object_id:?}[[:space:]]" \ - --state 'replace' + --line "${SELECTOR:?}._domainkey.${DOMAIN:?} ${DOMAIN:?}:${SELECTOR:?}:${KEYS_DIR:?}${SELECTOR:?}.private" -sigtable_block() { - for sigkey in ${SIGKEY:?}; do - echo "${sigkey:?} ${__object_id:?}" - done -} -__block "__opendkim_genkey/${__object_id:?}" \ +__line "line-sig-${__object_id:?}" \ --file "${signing_table}" \ - --text "$(sigtable_block)" - -if [ "${KEY_STATE:?}" = "present" ]; then - # Ensure proper permissions for the key file - __file "${KEY_LOCATION}" \ - --owner "${user}" \ - --group "${group}" \ - --mode 0600 -fi + --line "${SIGKEY:?} ${SELECTOR:?}._domainkey.${DOMAIN:?}" diff --git a/type/__opendkim_genkey/parameter/optional b/type/__opendkim_genkey/parameter/optional index 9d9b6d1..e44793f 100644 --- a/type/__opendkim_genkey/parameter/optional +++ b/type/__opendkim_genkey/parameter/optional @@ -1,6 +1,4 @@ bits directory -domain unrestricted -selector -sigdomain +sigkey diff --git a/type/__opendkim_genkey/parameter/optional_multiple b/type/__opendkim_genkey/parameter/optional_multiple deleted file mode 100644 index 35978a9..0000000 --- a/type/__opendkim_genkey/parameter/optional_multiple +++ /dev/null @@ -1 +0,0 @@ -sigkey diff --git a/type/__opendkim_genkey/parameter/required b/type/__opendkim_genkey/parameter/required new file mode 100644 index 0000000..4dacb77 --- /dev/null +++ b/type/__opendkim_genkey/parameter/required @@ -0,0 +1,2 @@ +domain +selector diff --git a/type/__php_fpm/files/php.ini.sh b/type/__php_fpm/files/php.ini.sh deleted file mode 100755 index ec7e446..0000000 --- a/type/__php_fpm/files/php.ini.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -cat < - - -COPYING -------- -Copyright \(C) 2022 Joachim Desroches. You can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. diff --git a/type/__php_fpm/manifest b/type/__php_fpm/manifest deleted file mode 100644 index 9c32716..0000000 --- a/type/__php_fpm/manifest +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -os=$(cat "${__global:?}/explorer/os") - -PHPVER=$(cat "${__object:?}/parameter/php-version") -export PHPVER - -case "$os" in - 'alpine') - # Alpine packages looks like php81-fpm - we make sure to remove dots from user - # input. - PHPVER=$(echo "$PHPVER" | tr -d '.') - - package="php${PHPVER}-fpm" - opcache_package="php${PHPVER}-opcache" - apcu_package="php${PHPVER}-pecl-apcu" - - service="php-fpm${PHPVER}" - php_confdir="/etc/php${PHPVER}" - php_ini="${php_confdir:?}/php.ini" - - PHP_INCLUDEDIR="/usr/share/php${PHPVER:?}" - export PHP_INCLUDEDIR - ;; - 'debian'|'ubuntu') - package="php${PHPVER}-fpm" - opcache_package="php${PHPVER}-opcache" - apcu_package="php${PHPVER}-apcu" - - service="php${PHPVER}-fpm" - php_confdir="/etc/php/${PHPVER}" - php_ini="${php_confdir:?}/fpm/php.ini" - - PHP_INCLUDEDIR="/usr/share/php/${PHPVER:?}" - export PHP_INCLUDEDIR - ;; - *) - printf "Your operating system is currently not supported by this type\n" >&2 - printf "Please contribute an implementation for it if you can.\n" >&2 - exit 1 - ;; -esac - -__package "$package" -require="__package/$package" __start_on_boot "$service" - -if [ -f "${__object:?}/parameter/enable-opcache" ]; then - __package "$opcache_package" -fi - -if [ -f "${__object:?}/parameter/enable-apcu" ]; then - __package "$apcu_package" -fi - -MEMORY_LIMIT=$(cat "${__object:?}/parameter/memory-limit") -export MEMORY_LIMIT - -UPLOAD_MAX_FILESIZE=$(cat "${__object:?}/parameter/upload-max-filesize") -export UPLOAD_MAX_FILESIZE - -mkdir -p "${__object:?}/files" -"${__type:?}/files/php.ini.sh" >"${__object:?}/files/php.ini" - -require="__package/$package" __file "${php_ini:?}" \ - --mode 644 --source "${__object:?}/files/php.ini" \ - --onchange "service $service restart" - -require="__file/${php_ini:?}" __service "$service" --action start diff --git a/type/__php_fpm/parameter/boolean b/type/__php_fpm/parameter/boolean deleted file mode 100644 index 9964486..0000000 --- a/type/__php_fpm/parameter/boolean +++ /dev/null @@ -1,2 +0,0 @@ -enable-opcache -enable-apcu diff --git a/type/__php_fpm/parameter/default/memory-limit b/type/__php_fpm/parameter/default/memory-limit deleted file mode 100644 index d95fe12..0000000 --- a/type/__php_fpm/parameter/default/memory-limit +++ /dev/null @@ -1 +0,0 @@ -512M diff --git a/type/__php_fpm/parameter/default/upload-max-filesize b/type/__php_fpm/parameter/default/upload-max-filesize deleted file mode 100644 index 5fbcf1c..0000000 --- a/type/__php_fpm/parameter/default/upload-max-filesize +++ /dev/null @@ -1 +0,0 @@ -2M diff --git a/type/__php_fpm/parameter/optional b/type/__php_fpm/parameter/optional deleted file mode 100644 index a41a87c..0000000 --- a/type/__php_fpm/parameter/optional +++ /dev/null @@ -1,2 +0,0 @@ -upload-max-filesize -memory-limit diff --git a/type/__php_fpm/parameter/required b/type/__php_fpm/parameter/required deleted file mode 100644 index 173609d..0000000 --- a/type/__php_fpm/parameter/required +++ /dev/null @@ -1 +0,0 @@ -php-version diff --git a/type/__php_fpm/singleton b/type/__php_fpm/singleton deleted file mode 100644 index e69de29..0000000 diff --git a/type/__php_fpm_pool/files/www.conf.sh b/type/__php_fpm_pool/files/www.conf.sh deleted file mode 100755 index aa8fa7c..0000000 --- a/type/__php_fpm_pool/files/www.conf.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -cat < - - -COPYING -------- -Copyright \(C) 2022 Joachim Desroches. You can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. diff --git a/type/__php_fpm_pool/manifest b/type/__php_fpm_pool/manifest deleted file mode 100644 index 3c8491a..0000000 --- a/type/__php_fpm_pool/manifest +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -os=$(cat "${__global:?}/explorer/os") -name=${__object_id:?} - -PHPVER=$(cat "${__object:?}/parameter/php-version") -export PHPVER - -case "$os" in - 'alpine') - PHPVER=$(echo "$PHP_VERSION" | tr -d '.') - service="php-fpm${PHPVER}" - php_confdir="/etc/php${PHPVER}" - php_pooldir="${php_confdir:?}/php-fpm.d" - ;; - 'debian'|'ubuntu') - service="php${PHPVER}-fpm" - php_confdir="/etc/php/${PHPVER}" - php_pooldir="${php_confdir:?}/fpm/pool.d" - ;; - *) - printf "Your operating system is currently not supported by this type\n" >&2 - printf "Please contribute an implementation for it if you can.\n" >&2 - exit 1 - ;; -esac - -POOL_NAME="$name" -POOL_USER=$(cat "${__object:?}/parameter/pool-user") -POOL_GROUP=$(cat "${__object:?}/parameter/pool-group") -POOL_LISTEN_ADDR=$(cat "${__object:?}/parameter/pool-listen-addr") -POOL_LISTEN_OWNER=$(cat "${__object:?}/parameter/pool-listen-owner") -export POOL_USER POOL_GROUP POOL_LISTEN_ADDR POOL_LISTEN_OWNER POOL_NAME - -mkdir -p "${__object:?}/files" -"${__type:?}/files/www.conf.sh" >"${__object:?}/files/www.conf" - -__file "${php_pooldir:?}/${name}.conf" \ - --mode 644 --source "${__object:?}/files/www.conf" \ - --onchange "service $service reload" diff --git a/type/__php_fpm_pool/parameter/optional b/type/__php_fpm_pool/parameter/optional deleted file mode 100644 index 7adc0a3..0000000 --- a/type/__php_fpm_pool/parameter/optional +++ /dev/null @@ -1,2 +0,0 @@ -memory-limit -open-basedir diff --git a/type/__php_fpm_pool/parameter/required b/type/__php_fpm_pool/parameter/required deleted file mode 100644 index d247290..0000000 --- a/type/__php_fpm_pool/parameter/required +++ /dev/null @@ -1,5 +0,0 @@ -php-version -pool-user -pool-group -pool-listen-addr -pool-listen-owner