diff options
Diffstat (limited to 'services')
45 files changed, 431 insertions, 1226 deletions
diff --git a/services/base-config b/services/base-config deleted file mode 100644 index ccd1e1b..0000000 --- a/services/base-config +++ /dev/null @@ -1,5 +0,0 @@ -CRUPEST_DOMAIN=crupest.life -CRUPEST_EMAIL=crupest@crupest.life -CRUPEST_GITHUB=https://github.com/crupest -CRUPEST_SERVICES_DIR=services -CRUPEST_DATA_DIR=data diff --git a/services/config.template b/services/config.template index 7b3d1dc..77be817 100644 --- a/services/config.template +++ b/services/config.template @@ -1,11 +1,13 @@ -CRUPEST_MAIL_SERVER_DOMAIN=mail.@@CRUPEST_DOMAIN@@ +CRUPEST_SERVICES_DIR=services +CRUPEST_DATA_DIR=data CRUPEST_ROOT_URL=https://@@CRUPEST_DOMAIN@@ +CRUPEST_MAIL_SERVER_DOMAIN=mail.@@CRUPEST_DOMAIN@@ CRUPEST_DOCKER_DIR=@@CRUPEST_SERVICES_DIR@@/docker -CRUPEST_SERVICES_STATE_DIR=@@CRUPEST_SERVICES_DIR@@/state CRUPEST_DATA_SECRET_DIR=@@CRUPEST_DATA_DIR@@/secret CRUPEST_DATA_CERTBOT_DIR=@@CRUPEST_DATA_DIR@@/certbot CRUPEST_DATA_GIT_DIR=@@CRUPEST_DATA_DIR@@/git -CRUPEST_DATA_MAILSERVER_DIR=@@CRUPEST_DATA_DIR@@/dms +CRUPEST_DATA_MAIL_SERVER_DIR=@@CRUPEST_DATA_DIR@@/mail-server CRUPEST_DATA_ROUNDCUBE_DIR=@@CRUPEST_DATA_DIR@@/roundcube CRUPEST_GENERATED_DIR=@@CRUPEST_SERVICES_DIR@@/generated -CRUPEST_GENERATED_NGINX_DIR=@@CRUPEST_GENERATED_DIR@@/nginx +CRUPEST_SSL_FULLCHAIN_FILE=@@CRUPEST_DATA_CERTBOT_DIR@@/certs/live/@@CRUPEST_DOMAIN@@/fullchain.pem +CRUPEST_SSL_PRIVATE_KEY_FILE=@@CRUPEST_DATA_CERTBOT_DIR@@/certs/live/@@CRUPEST_DOMAIN@@/privkey.pem diff --git a/services/docker/auto-backup/daemon.bash b/services/docker/auto-backup/daemon.bash index da9f853..c82e2d0 100755 --- a/services/docker/auto-backup/daemon.bash +++ b/services/docker/auto-backup/daemon.bash @@ -15,9 +15,7 @@ success() { echo -e "\033[32mSuccess: " "$@" "\033[0m" } -if [[ -z "$CRUPEST_AUTO_BACKUP_INTERVAL" ]]; then - die "Backup interval not set, please set it!" -fi +[[ -n "$CRUPEST_AUTO_BACKUP_INTERVAL" ]] || die "Backup interval not set, please set it!" note "Checking secrets..." [[ -n "$RCLONE_S3_PROVIDER" ]] || die "S3 provider not set!" diff --git a/services/docker/auto-backup/rclone.conf b/services/docker/auto-backup/rclone.conf index bfcbbc3..0cf3b64 100644 --- a/services/docker/auto-backup/rclone.conf +++ b/services/docker/auto-backup/rclone.conf @@ -1,4 +1,4 @@ [remote] type = s3 env_auth = true -no_head = true +no_check_bucket = true diff --git a/services/docker/debian-dev/Dockerfile b/services/docker/debian-dev/Dockerfile deleted file mode 100644 index 8114c56..0000000 --- a/services/docker/debian-dev/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM debian:latest - -ARG USER=crupest -ARG IN_CHINA= - -ENV CRUPEST_DEBIAN_DEV_USER=${USER} -ENV CRUPEST_DEBIAN_DEV_IN_CHINA=${IN_CHINA} - -ADD bootstrap /bootstrap -RUN /bootstrap/setup.bash - -ENV LANG=en_US.utf8 -USER ${USER} -WORKDIR /home/${USER} - -RUN --mount=type=secret,id=code-server-password,required=true,env=CRUPEST_CODE_SERVER_PASSWORD \ - mkdir -p ${HOME}/.config/code-server && \ - echo -e "auth: password\nhashed-password: " >> ${HOME}/.config/code-server/config.yaml && \ - echo -n "$CRUPEST_CODE_SERVER_PASSWORD" | argon2 $(shuf -i 10000000-99999999 -n 1 --random-source /dev/urandom) -e >> ${HOME}/.config/code-server/config.yaml - -EXPOSE 4567 -VOLUME [ "/home/${USER}" ] - -CMD [ "tini", "--", "/usr/bin/code-server", "--bind-addr", "0.0.0.0:4567" ] diff --git a/services/docker/debian-dev/bootstrap/extra/setup-cmake.bash b/services/docker/debian-dev/bootstrap/extra/setup-cmake.bash deleted file mode 100755 index 76c1ae4..0000000 --- a/services/docker/debian-dev/bootstrap/extra/setup-cmake.bash +++ /dev/null @@ -1,9 +0,0 @@ -#! /usr/bin/env bash - -set -e - -CMAKE_VERSION=$(curl -s https://api.github.com/repos/Kitware/CMake/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') -wget -O cmake-installer.sh https://github.com/Kitware/CMake/releases/download/v"$CMAKE_VERSION"/cmake-"$CMAKE_VERSION"-linux-x86_64.sh -chmod +x cmake-installer.sh -./cmake-installer.sh --skip-license --prefix=/usr -rm cmake-installer.sh diff --git a/services/docker/debian-dev/bootstrap/extra/setup-dotnet.bash b/services/docker/debian-dev/bootstrap/extra/setup-dotnet.bash deleted file mode 100755 index 0ef7743..0000000 --- a/services/docker/debian-dev/bootstrap/extra/setup-dotnet.bash +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env bash - -set -e - -wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -dpkg -i packages-microsoft-prod.deb -rm packages-microsoft-prod.deb - -apt-get update -apt-get install -y dotnet-sdk-7.0 diff --git a/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash b/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash deleted file mode 100755 index 48dde86..0000000 --- a/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env bash - -set -e - -LLVM_VERSION=18 - -. /bootstrap/func.bash - -if is_true "$CRUPEST_DEBIAN_DEV_IN_CHINA"; then - base_url=https://mirrors.tuna.tsinghua.edu.cn/llvm-apt -else - base_url=https://apt.llvm.org -fi - -wget "$base_url/llvm.sh" -chmod +x llvm.sh -./llvm.sh $LLVM_VERSION all -m "$base_url" -rm llvm.sh - -update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 \ - --slave /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION \ - --slave /usr/bin/clangd clangd /usr/bin/clangd-$LLVM_VERSION \ - --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-$LLVM_VERSION \ - --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VERSION \ - --slave /usr/bin/lldb lldb /usr/bin/lldb-$LLVM_VERSION \ - --slave /usr/bin/lld lld /usr/bin/lld-$LLVM_VERSION diff --git a/services/docker/debian-dev/bootstrap/home/.bashrc b/services/docker/debian-dev/bootstrap/home/.bashrc deleted file mode 100644 index 3646ee2..0000000 --- a/services/docker/debian-dev/bootstrap/home/.bashrc +++ /dev/null @@ -1,117 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - #alias grep='grep --color=auto' - #alias fgrep='fgrep --color=auto' - #alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# some more ls aliases -#alias ll='ls -l' -#alias la='ls -A' -#alias l='ls -CF' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - -alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" -. /usr/share/bash-completion/completions/quilt -complete -F _quilt_completion $_quilt_complete_opt dquilt diff --git a/services/docker/debian-dev/bootstrap/home/.quiltrc-dpkg b/services/docker/debian-dev/bootstrap/home/.quiltrc-dpkg deleted file mode 100644 index e8fc3c5..0000000 --- a/services/docker/debian-dev/bootstrap/home/.quiltrc-dpkg +++ /dev/null @@ -1,13 +0,0 @@ -d=. -while [ ! -d $d/debian -a `readlink -e $d` != / ]; - do d=$d/..; done -if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then - # if in Debian packaging tree with unset $QUILT_PATCHES - QUILT_PATCHES="debian/patches" - QUILT_PATCH_OPTS="--reject-format=unified" - QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" - QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" - QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:" - QUILT_COLORS="${QUILT_COLORS}diff_ctx=35:diff_cctx=33" - if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi -fi diff --git a/services/docker/debian-dev/bootstrap/official.sources b/services/docker/debian-dev/bootstrap/official.sources deleted file mode 100644 index c9aa9a0..0000000 --- a/services/docker/debian-dev/bootstrap/official.sources +++ /dev/null @@ -1,23 +0,0 @@ -Types: deb -URIs: http://deb.debian.org/debian -Suites: bookworm bookworm-updates bookworm-backports -Components: main contrib non-free non-free-firmware -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg - -Types: deb-src -URIs: http://deb.debian.org/debian -Suites: bookworm bookworm-updates bookworm-backports -Components: main contrib non-free non-free-firmware -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg - -Types: deb -URIs: http://deb.debian.org/debian-security -Suites: bookworm-security -Components: main contrib non-free non-free-firmware -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg - -Types: deb-src -URIs: http://deb.debian.org/debian-security -Suites: bookworm-security -Components: main contrib non-free non-free-firmware -Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg diff --git a/services/docker/debian-dev/bootstrap/setup-apt.bash b/services/docker/debian-dev/bootstrap/setup-apt.bash deleted file mode 100755 index 38cba05..0000000 --- a/services/docker/debian-dev/bootstrap/setup-apt.bash +++ /dev/null @@ -1,41 +0,0 @@ -#! /usr/bin/env bash -# shellcheck disable=1090,1091 - -set -e - -if [[ $EUID -ne 0 ]]; then - die "This script must be run as root." -fi - -script_dir=$(dirname "$0") - -old_one="/etc/apt/sources.list" -new_one="/etc/apt/sources.list.d/debian.sources" - -echo "Setup apt sources ..." - -echo "Backup old ones to .bak ..." -if [[ -f "$old_one" ]]; then - mv "$old_one" "$old_one.bak" -fi - -if [[ -f "$new_one" ]]; then - mv "$new_one" "$new_one.bak" -fi - -echo "Copy the new one ..." -cp "$script_dir/official.sources" "$new_one" - -if [[ -n "$CRUPEST_DEBIAN_DEV_IN_CHINA" ]]; then - echo "Replace with China mirror ..." - china_mirror="mirrors.ustc.edu.cn" - sed -i "s|deb.debian.org|${china_mirror}|" "$new_one" -fi - -echo "Try to use https ..." -apt-get update -apt-get install -y apt-transport-https ca-certificates - -sed -i 's|http://|https://|' "$new_one" - -echo "APT source setup done!" diff --git a/services/docker/debian-dev/bootstrap/setup.bash b/services/docker/debian-dev/bootstrap/setup.bash deleted file mode 100755 index 65aabbb..0000000 --- a/services/docker/debian-dev/bootstrap/setup.bash +++ /dev/null @@ -1,56 +0,0 @@ -#! /usr/bin/env bash -# shellcheck disable=1090,1091 - -set -e -o pipefail - -die() { - echo "$@" >&2 - exit 1 -} - -if [[ $EUID -ne 0 ]]; then - die "This script must be run as root." -fi - -script_dir=$(dirname "$0") - -os_release_file="/etc/os-release" -if [[ -f "$os_release_file" ]]; then - debian_version=$(. "$os_release_file"; echo "$VERSION_CODENAME") - if [[ "$debian_version" != "bookworm" ]]; then - die "This script can only be run on Debian Bookworm. But it is $debian_version" - fi -else - die "$os_release_file not found. Failed to get debian version." -fi - -script_dir=$(dirname "$0") - -export DEBIAN_FRONTEND=noninteractive - -echo "Begin to setup debian..." - -bash "$script_dir/setup-apt.bash" - -echo "Installing packages..." -apt-get update -apt-get install -y \ - tini locales procps sudo vim less man bash-completion curl wget \ - build-essential git devscripts debhelper quilt argon2 - -echo "Setting up locale..." -localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 - -echo "Setting up sudo..." -sed -i.bak 's|%sudo[[:space:]]\+ALL=(ALL:ALL)[[:space:]]\+ALL|%sudo ALL=(ALL:ALL) NOPASSWD: ALL|' /etc/sudoers - -echo "Creating user $CRUPEST_DEBIAN_DEV_USER ..." -useradd -m -G sudo -s /usr/bin/bash "$CRUPEST_DEBIAN_DEV_USER" - -echo "Setting up code-server..." -curl -fsSL https://code-server.dev/install.sh | sh - -echo "Cleaning up apt source index..." -rm -rf /var/lib/apt/lists/* - -echo "Setup debian done." diff --git a/services/docker/mail-server/Dockerfile b/services/docker/mail-server/Dockerfile new file mode 100644 index 0000000..8ac8792 --- /dev/null +++ b/services/docker/mail-server/Dockerfile @@ -0,0 +1,11 @@ +FROM denoland/deno AS deno-build +COPY --from=deno . /workdir/ +WORKDIR /workdir +RUN deno install +RUN deno task compile:mail + +FROM dovecot/dovecot:latest-root +COPY --from=deno-build /workdir/mail/out/crupest-mail /app/ +ADD dovecot.conf /etc/dovecot/dovecot.conf +ADD app/* /app/ +CMD ["/app/main.bash"] diff --git a/services/docker/mail-server/app/main.bash b/services/docker/mail-server/app/main.bash new file mode 100755 index 0000000..2dfc2ee --- /dev/null +++ b/services/docker/mail-server/app/main.bash @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +set -e -o pipefail + +die() { + echo "$@" >&2 + exit 1 +} + +/app/crupest-mail serve --real & + +/dovecot/sbin/dovecot -F diff --git a/services/docker/mail-server/aws-lambda.js b/services/docker/mail-server/aws-lambda.js new file mode 100644 index 0000000..d240c1a --- /dev/null +++ b/services/docker/mail-server/aws-lambda.js @@ -0,0 +1,23 @@ +export const handler = async (event, context, callback) => { + const sesNotification = event.Records[0].ses; + console.log("SES Notification:\n", JSON.stringify(sesNotification, null, 2)); + + const res = await fetch( + `https://mail.crupest.life/${process.env.CRUPEST_MAIL_SERVER_AWS_INBOUND_PATH}`, + { + method: "POST", + headers: { + "content-type": "application/json", + "Authorization": process.env.CRUPEST_MAIL_SERVER_AWS_INBOUND_KEY, + }, + body: JSON.stringify({ + key: sesNotification.mail.messageId, + recipients: sesNotification.receipt.recipients, + }), + }, + ); + console.log(res); + console.log(res.text()); + + callback(null, { "disposition": "CONTINUE" }); +}; diff --git a/services/docker/mail-server/dovecot.conf b/services/docker/mail-server/dovecot.conf new file mode 100644 index 0000000..0c5ec30 --- /dev/null +++ b/services/docker/mail-server/dovecot.conf @@ -0,0 +1,197 @@ +dovecot_config_version = 2.4.1 +dovecot_storage_version = 2.4.0 + +base_dir = /run/dovecot +state_dir = /run/dovecot +log_path = /dev/stdout + +protocols = imap submission lmtp sieve +sendmail_path = /app/out/crupest-mail sendmail +submission_relay_host = 127.0.0.1 +submission_relay_port = 2346 +submission_relay_trusted = yes + +mail_driver = maildir +mail_home = /data/vmail/%{user | domain}/%{user | username} +mail_path = ~/mail +mail_log_events = delete undelete expunge save copy mailbox_create mailbox_delete mailbox_rename flag_change + +# Setup default mailboxes for inbox namespace +@mailbox_defaults = english + +namespace inbox { + mailbox Archive { + special_use = "\\Archive" + } +} + +mail_plugins { + fts = yes + fts_flatcurve = yes + mail_log = yes + notify = yes +} + +fts_autoindex = yes +fts_autoindex_max_recent_msgs = 999 +fts_search_add_missing = yes +language_filters = normalizer-icu snowball stopwords + +language_tokenizers = generic email-address +language_tokenizer_generic_algorithm = simple + +language en { + default = yes + filters = lowercase snowball english-possessive stopwords +} + +fts flatcurve { + substring_search = yes +} + +auth_mechanisms = plain login + +passdb passwd-file { + passwd_file_path = /data/userdb + default_password_scheme = SHA512-CRYPT +} + +userdb passwd-file { + passwd_file_path = /data/userdb + fields { + uid:default = vmail + gid:default = vmail + home:default = /data/vmail/%{user | domain}/%{user | username} + } +} + +ssl = yes +ssl_server { + cert_file = /etc/dovecot/ssl/tls.crt + key_file = /etc/dovecot/ssl/tls.key +} + +protocol imap { + mail_plugins { + imap_sieve = yes + imap_filter_sieve = yes + } +} + +protocol lmtp { + mail_plugins { + sieve = yes + } +} + +protocol lda { + mail_plugins { + sieve = yes + } +} + +service imap-login { + process_min_avail = 1 + client_limit = 100 +} + +service pop3-login { + process_min_avail = 1 + client_limit = 100 +} + +service submission-login { + process_min_avail = 1 + client_limit = 100 + + inet_listener submissions { + port = 465 + ssl = yes + } +} + +service managesieve-login { + process_min_avail = 1 + client_limit = 100 +} + +sieve_plugins = sieve_imapsieve sieve_extprograms + +event_exporter log { + format = json + time_format = rfc3339 +} + +# Add default backend metrics +@metric_defaults = backend + +# Log auth failures +metric auth_failures { + filter = event=auth_request_finished AND NOT success=yes + exporter = log +} + +metric imap_command { + filter = event=imap_command_finished + group_by cmd_name { + method discrete { + } + } + group_by tagged_reply_state { + method discrete { + } + } +} + +metric smtp_command { + filter = event=smtp_server_command_finished and protocol=submission + group_by cmd_name { + method discrete { + } + } + group_by status_code { + method discrete { + } + } + group_by duration { + method exponential { + base = 10 + min_magnitude = 1 + max_magnitude = 5 + } + } +} + +metric lmtp_command { + filter = event=smtp_server_command_finished and protocol=lmtp + group_by cmd_name { + method discrete { + } + } + group_by status_code { + method discrete { + } + } + group_by duration { + method exponential { + base = 10 + min_magnitude = 1 + max_magnitude = 5 + } + } +} + +# Add duration metrics for deliveries +metric mail_deliveries { + filter = event=mail_delivery_finished + group_by duration { + method exponential { + base = 10 + min_magnitude = 1 + max_magnitude = 5 + } + } +} + +!include_try vendor.d/*.conf +!include_try conf.d/*.conf diff --git a/services/docker/nginx/Dockerfile b/services/docker/nginx/Dockerfile index 77398cd..3169e00 100644 --- a/services/docker/nginx/Dockerfile +++ b/services/docker/nginx/Dockerfile @@ -6,6 +6,5 @@ FROM nginx:mainline RUN apt update && apt-get install -y tini certbot && rm -rf /var/lib/apt/lists/* ADD mail-robots.txt /srv/mail/robots.txt ADD certbot.bash nginx-wrapper.bash /app/ -COPY configs/. /etc/nginx/ COPY --from=build-www /project/public /srv/www CMD ["/usr/bin/tini", "--", "/app/nginx-wrapper.bash"] diff --git a/services/docker/nginx/configs/templates/code.conf.template b/services/docker/nginx/configs/templates/code.conf.template deleted file mode 100644 index aa70ebc..0000000 --- a/services/docker/nginx/configs/templates/code.conf.template +++ /dev/null @@ -1,6 +0,0 @@ -server { - server_name code.${CRUPEST_DOMAIN}; - include common/http-listen; - - include common/acme-challenge; -} diff --git a/services/docker/nginx/configs/templates/mail.conf.template b/services/docker/nginx/configs/templates/mail.conf.template deleted file mode 100644 index 7f5f215..0000000 --- a/services/docker/nginx/configs/templates/mail.conf.template +++ /dev/null @@ -1,29 +0,0 @@ -server { - server_name mail.${CRUPEST_DOMAIN}; - include common/https-listen; - - location = /robots.txt { - root /srv/mail; - } - - location / { - include common/proxy-common; - proxy_pass http://roundcubemail:80/; - } - - location /rspamd/ { - include common/proxy-common; - proxy_pass http://mailserver:11334/; - } - - client_max_body_size 5G; -} - - -server { - server_name mail.${CRUPEST_DOMAIN}; - include common/http-listen; - - include common/https-redirect; - include common/acme-challenge; -} diff --git a/services/docker/nginx/configs/templates/root.conf.template b/services/docker/nginx/configs/templates/root.conf.template deleted file mode 100644 index e3e93ad..0000000 --- a/services/docker/nginx/configs/templates/root.conf.template +++ /dev/null @@ -1,45 +0,0 @@ -server { - server_name ${CRUPEST_DOMAIN}; - include common/https-listen; - - location / { - root /srv/www; - } - - location /2fa/ { - include common/proxy-common; - proxy_pass http://2fauth:8000/; - } - - location /git/ { - include common/proxy-common; - client_max_body_size 5G; - proxy_pass http://git-server:3636; - } - - location = /github { - return 301 ${CRUPEST_GITHUB}; - } - - location = /github/ { - return 301 ${CRUPEST_GITHUB}; - } - - location /_${CRUPEST_V2RAY_PATH} { - if ($http_upgrade != "websocket") { - return 404; - } - - proxy_redirect off; - include common/proxy-common; - proxy_pass http://v2ray:10000; - } -} - -server { - server_name ${CRUPEST_DOMAIN}; - include common/http-listen; - - include common/https-redirect; - include common/acme-challenge; -} diff --git a/services/docker/nginx/configs/templates/timeline.conf.template b/services/docker/nginx/configs/templates/timeline.conf.template deleted file mode 100644 index a467594..0000000 --- a/services/docker/nginx/configs/templates/timeline.conf.template +++ /dev/null @@ -1,6 +0,0 @@ -server { - server_name timeline.${CRUPEST_DOMAIN}; - include common/http-listen; - - include common/acme-challenge; -} diff --git a/services/docker/nginx/nginx-wrapper.bash b/services/docker/nginx/nginx-wrapper.bash index c848287..a4a19ec 100755 --- a/services/docker/nginx/nginx-wrapper.bash +++ b/services/docker/nginx/nginx-wrapper.bash @@ -7,10 +7,6 @@ die() { exit 1 } -[[ -n "$CRUPEST_DOMAIN" ]] || die "CRUPEST_DOMAIN is not set. It is used as root domain." -[[ -n "$CRUPEST_GITHUB" ]] || die "CRUPEST_GITHUB is not set. It is used as GitHub redirection." -[[ -n "$CRUPEST_V2RAY_PATH" ]] || die "CRUPEST_V2RAY_PATH is not set. It is used as v2ray tunnel endpoint." - /app/certbot.bash & /docker-entrypoint.sh nginx "-g" "daemon off;" diff --git a/services/manage b/services/manage index 4589475..18b3d0f 100755 --- a/services/manage +++ b/services/manage @@ -2,23 +2,17 @@ set -e -python3 --version >/dev/null 2>&1 || ( - echo Error: failed to run Python with python3 --version. +deno --version >/dev/null 2>&1 || ( + echo "Error: failed to run deno --version." + echo "If deno is not installed, install it with:" + echo " curl -fsSL https://deno.land/install.sh | sh" exit 1 ) -script_dir="$(dirname "$0")" - -# shellcheck disable=SC2046 -export $(xargs <"${script_dir:?}/base-config") - -CRUPEST_PROJECT_DIR="$(realpath "$script_dir/..")" +CRUPEST_PROJECT_DIR="$(dirname "$0")/.." export CRUPEST_PROJECT_DIR -export PYTHONPATH="$CRUPEST_PROJECT_DIR/python:$PYTHONPATH" +echo "Detected project Dir: $CRUPEST_PROJECT_DIR" +echo -if [[ "$#" != "0" ]] && [[ "$1" == "gen-tmpl" ]]; then - python3 -m cru.service template generate "${@:2}" -else - python3 -m cru.service "$@" -fi +exec deno run -A "$CRUPEST_PROJECT_DIR/deno/tools/main.ts" service --project-dir "$CRUPEST_PROJECT_DIR" "$@" diff --git a/services/templates/disabled/docker-compose.yaml b/services/templates/disabled/docker-compose.yaml index 565ca49..0cd2256 100644 --- a/services/templates/disabled/docker-compose.yaml +++ b/services/templates/disabled/docker-compose.yaml @@ -1,22 +1,4 @@ services: - debian-dev: - pull_policy: build - build: - context: ./docker/debian-dev - dockerfile: Dockerfile - pull: true - args: - - USER=crupest - tags: - - "crupest/debian-dev:latest" - container_name: debian-dev - init: true - command: [ "/bootstrap/start/code-server.bash" ] - volumes: - - ./data/debian-dev:/data - - debian-dev-home:/home/crupest - restart: on-failure:3 - timeline: image: crupest/timeline:latest pull_policy: always @@ -27,6 +9,3 @@ services: - TIMELINE_DisableAutoBackup=true volumes: - ./data/timeline:/root/timeline - -volumes: - debian-dev-home: diff --git a/services/templates/disabled/nginx/code.conf.template b/services/templates/disabled/nginx/code.conf.template deleted file mode 100644 index 0abe042..0000000 --- a/services/templates/disabled/nginx/code.conf.template +++ /dev/null @@ -1,20 +0,0 @@ -server { - server_name code.@@CRUPEST_DOMAIN@@; - include common/https-listen; - - location / { - include common/proxy-common; - proxy_pass http://debian-dev:8080/; - } - - client_max_body_size 5G; -} - - -server { - server_name code.@@CRUPEST_DOMAIN@@; - include common/http-listen; - - include common/https-redirect; - include common/acme-challenge; -} diff --git a/services/templates/disabled/nginx/timeline.conf.template b/services/templates/disabled/nginx/timeline.conf.template index ce7341b..086c1f7 100644 --- a/services/templates/disabled/nginx/timeline.conf.template +++ b/services/templates/disabled/nginx/timeline.conf.template @@ -2,9 +2,9 @@ server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name timeline.@@CRUPEST_DOMAIN@@; - + location / { - include common/reverse-proxy; + include conf.d/common/reverse-proxy; proxy_pass http://timeline:5000/; } @@ -16,6 +16,6 @@ server { listen [::]:80; server_name timeline.@@CRUPEST_DOMAIN@@; - include common/https-redirect; - include common/acme-challenge; + include conf.d/common/https-redirect; + include conf.d/common/acme-challenge; } diff --git a/services/templates/docker-compose.yaml.template b/services/templates/docker-compose.yaml.template index ddd3c95..b81875b 100644 --- a/services/templates/docker-compose.yaml.template +++ b/services/templates/docker-compose.yaml.template @@ -3,9 +3,9 @@ services: nginx: pull_policy: build build: - context: ./@@CRUPEST_DOCKER_DIR@@/nginx + context: "./@@CRUPEST_DOCKER_DIR@@/nginx" additional_contexts: - - www=./www + - "www=./www" dockerfile: Dockerfile pull: true ports: @@ -13,102 +13,117 @@ services: - "443:443" - "443:443/udp" env_file: - - ./@@CRUPEST_GENERATED_DIR@@/envs/nginx.env - - ./@@CRUPEST_GENERATED_DIR@@/envs/v2ray-common.env + - "./@@CRUPEST_GENERATED_DIR@@/envs/v2ray-common.env" + - "./@@CRUPEST_GENERATED_DIR@@/envs/mail-server-common.env" volumes: + - "./@@CRUPEST_GENERATED_DIR@@/nginx:/etc/nginx/conf.d" - "./@@CRUPEST_DATA_CERTBOT_DIR@@/certs:/etc/letsencrypt" - "./@@CRUPEST_DATA_CERTBOT_DIR@@/data:/var/lib/letsencrypt" - - "./@@CRUPEST_DATA_CERTBOT_DIR@@/webroot:/srv/acme:ro" - "./@@CRUPEST_DATA_CERTBOT_DIR@@/webroot:/var/www/certbot" - restart: on-failure:3 + networks: + default: + ipv4_address: "172.21.5.2" + restart: "on-failure:3" - v2ray: + mail-server: pull_policy: build build: - context: ./@@CRUPEST_DOCKER_DIR@@/v2ray + context: "./@@CRUPEST_DOCKER_DIR@@/mail-server" + additional_contexts: + - "deno=./deno" dockerfile: Dockerfile pull: true - hostname: v2ray + container_name: mail-server + hostname: mail + domainname: "@@CRUPEST_DOMAIN@@" env_file: - - ./@@CRUPEST_GENERATED_DIR@@/envs/v2ray-common.env - - ./@@CRUPEST_GENERATED_DIR@@/envs/v2ray.env - restart: on-failure:3 - - auto-backup: - pull_policy: build - env_file: ./@@CRUPEST_GENERATED_DIR@@/envs/auto-backup.env - build: - context: ./@@CRUPEST_DOCKER_DIR@@/auto-backup - dockerfile: Dockerfile - pull: true - volumes: - - "./data:/data:ro" - - "./data/auto-backup:/data/auto-backup" - restart: on-failure:3 - - mailserver: - image: ghcr.io/docker-mailserver/docker-mailserver:latest - pull_policy: always - container_name: mailserver - hostname: mail.@@CRUPEST_DOMAIN@@ - env_file: ./@@CRUPEST_GENERATED_DIR@@/envs/mailserver.env - # More information about the mail-server ports: - # https://docker-mailserver.github.io/docker-mailserver/edge/config/security/understanding-the-ports/ - # To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks. + - "./@@CRUPEST_GENERATED_DIR@@/envs/mail-server-common.env" + - "./@@CRUPEST_GENERATED_DIR@@/envs/mail-server.env" ports: - - "25:25" # SMTP (explicit TLS => STARTTLS) - "143:143" # IMAP4 (explicit TLS => STARTTLS) - - "465:465" # ESMTP (implicit TLS) - - "587:587" # ESMTP (explicit TLS => STARTTLS) - "993:993" # IMAP4 (implicit TLS) + - "587:587" # ESMTP (explicit TLS => STARTTLS) + - "465:465" # ESMTP (implicit TLS) - "4190:4190" # manage sieve protocol volumes: - - ./@@CRUPEST_DATA_MAILSERVER_DIR@@/mail-data/:/var/mail/ - - ./@@CRUPEST_SERVICES_STATE_DIR@@/mail-state/:/var/mail-state/ - - ./@@CRUPEST_DATA_MAILSERVER_DIR@@/mail-logs/:/var/log/mail/ - - ./@@CRUPEST_DATA_MAILSERVER_DIR@@/config/:/tmp/docker-mailserver/ - - ./@@CRUPEST_DATA_CERTBOT_DIR@@/certs:/etc/letsencrypt - - /etc/localtime:/etc/localtime:ro - restart: on-failure:3 + - "./@@CRUPEST_DATA_MAIL_SERVER_DIR@@:/data" + - "./@@CRUPEST_SSL_FULLCHAIN_FILE@@:/etc/dovecot/ssl/tls.crt" + - "./@@CRUPEST_SSL_PRIVATE_KEY_FILE@@:/etc/dovecot/ssl/tls.key" + - "/etc/localtime:/etc/localtime:ro" + networks: + default: + ipv4_address: "172.21.5.3" + restart: "on-failure:3" stop_grace_period: 1m - healthcheck: - test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1" - timeout: 3s - retries: 0 git-server: pull_policy: build build: - context: ./@@CRUPEST_DOCKER_DIR@@/git-server + context: "./@@CRUPEST_DOCKER_DIR@@/git-server" dockerfile: Dockerfile pull: true hostname: git-server environment: - - CRUPEST_ROOT_URL=@@CRUPEST_ROOT_URL@@ + - "CRUPEST_ROOT_URL=@@CRUPEST_ROOT_URL@@" volumes: - "./@@CRUPEST_DATA_GIT_DIR@@:/git" + networks: + default: + ipv4_address: "172.21.5.4" restart: on-failure:3 roundcubemail: - image: roundcube/roundcubemail:latest + image: "roundcube/roundcubemail" pull_policy: always hostname: roundcubemail - env_file: ./@@CRUPEST_GENERATED_DIR@@/envs/roundcubemail.env + env_file: + - "./@@CRUPEST_GENERATED_DIR@@/envs/roundcubemail.env" volumes: - - ./@@CRUPEST_DATA_SECRET_DIR@@/gnupg:/gnupg - - ./@@CRUPEST_DATA_ROUNDCUBE_DIR@@/www/html:/var/www/html - - ./@@CRUPEST_DATA_ROUNDCUBE_DIR@@/db:/var/roundcube/db - - ./@@CRUPEST_DATA_ROUNDCUBE_DIR@@/config:/var/roundcube/config - - roundcubemail-temp:/tmp/roundcube-temp + - "./@@CRUPEST_GENERATED_DIR@@/my-roundcube.inc.php:/var/roundcube/config/my-roundcube.inc.php" + - "./@@CRUPEST_DATA_SECRET_DIR@@/gnupg:/var/roundcube/enigma" + - "./@@CRUPEST_DATA_ROUNDCUBE_DIR@@/www/html:/var/www/html" + - "./@@CRUPEST_DATA_ROUNDCUBE_DIR@@/db:/var/roundcube/db" + - "roundcubemail-temp:/tmp/roundcube-temp" + networks: + default: + ipv4_address: "172.21.5.5" restart: on-failure:3 - 2fauth: - image: 2fauth/2fauth - pull_policy: always - hostname: 2fauth - env_file: ./@@CRUPEST_GENERATED_DIR@@/envs/2fauth.env + v2ray: + pull_policy: build + build: + context: "./@@CRUPEST_DOCKER_DIR@@/v2ray" + dockerfile: Dockerfile + pull: true + hostname: v2ray + env_file: + - "./@@CRUPEST_GENERATED_DIR@@/envs/v2ray-common.env" + - "./@@CRUPEST_GENERATED_DIR@@/envs/v2ray.env" + networks: + default: + ipv4_address: "172.21.5.6" + restart: "on-failure:3" + + auto-backup: + pull_policy: build + build: + context: "./@@CRUPEST_DOCKER_DIR@@/auto-backup" + dockerfile: Dockerfile + pull: true + env_file: + - "./@@CRUPEST_GENERATED_DIR@@/envs/auto-backup.env" volumes: - - ./data/2fauth:/2fauth + - "./data:/data:ro" + - "./data/auto-backup:/data/auto-backup" + restart: "on-failure:3" volumes: roundcubemail-temp: + +networks: + default: + enable_ipv6: false + ipam: + config: + - subnet: "172.21.5.0/24" + ip_range: "172.21.5.64/26" diff --git a/services/templates/envs/2fauth.env.template b/services/templates/envs/2fauth.env.template deleted file mode 100644 index de2ad3a..0000000 --- a/services/templates/envs/2fauth.env.template +++ /dev/null @@ -1,15 +0,0 @@ -APP_NAME=2FAuth-crupest -APP_TIMEZONE=UTC -SITE_OWNER=@@CRUPEST_EMAIL@@ -APP_KEY=@@CRUPEST_2FAUTH_APP_KEY@@ -APP_URL=@@CRUPEST_ROOT_URL@@/2fa -APP_SUBDIRECTORY=2fa -MAIL_MAILER=smtp -MAIL_HOST=@@CRUPEST_MAIL_SERVER_DOMAIN@@ -MAIL_PORT=465 -MAIL_USERNAME=@@CRUPEST_2FAUTH_MAIL_USERNAME@@ -MAIL_PASSWORD=@@CRUPEST_2FAUTH_MAIL_PASSWORD@@ -MAIL_ENCRYPTION=ssl -MAIL_FROM_NAME=2FAuth-crupest -MAIL_FROM_ADDRESS=@@CRUPEST_2FAUTH_MAIL_USERNAME@@ -TRUSTED_PROXIES=* diff --git a/services/templates/envs/mail-server-common.env.template b/services/templates/envs/mail-server-common.env.template new file mode 100644 index 0000000..0905af6 --- /dev/null +++ b/services/templates/envs/mail-server-common.env.template @@ -0,0 +1 @@ +CRUPEST_MAIL_SERVER_AWS_INBOUND_PATH=@@CRUPEST_MAIL_SERVER_AWS_INBOUND_PATH@@ diff --git a/services/templates/envs/mail-server.env.template b/services/templates/envs/mail-server.env.template new file mode 100644 index 0000000..9ad1c58 --- /dev/null +++ b/services/templates/envs/mail-server.env.template @@ -0,0 +1,8 @@ +CRUPEST_MAIL_SERVER_MAIL_DOMAIN=@@CRUPEST_DOMAIN@@ +CRUPEST_MAIL_SERVER_DATA_PATH=/data/crupest-mail/ +CRUPEST_MAIL_SERVER_INBOUND_FALLBACK=crupest@crupest.life +CRUPEST_MAIL_SERVER_AWS_INBOUND_KEY=@@CRUPEST_MAIL_SERVER_AWS_INBOUND_KEY@@ +CRUPEST_MAIL_SERVER_AWS_REGION=@@CRUPEST_MAIL_SERVER_AWS_REGION@@ +CRUPEST_MAIL_SERVER_AWS_USER=@@CRUPEST_MAIL_SERVER_AWS_USER@@ +CRUPEST_MAIL_SERVER_AWS_PASSWORD=@@CRUPEST_MAIL_SERVER_AWS_PASSWORD@@ +CRUPEST_MAIL_SERVER_AWS_MAIL_BUCKET=@@CRUPEST_MAIL_SERVER_AWS_MAIL_BUCKET@@ diff --git a/services/templates/envs/mailserver.env.template b/services/templates/envs/mailserver.env.template deleted file mode 100644 index dffb0e8..0000000 --- a/services/templates/envs/mailserver.env.template +++ /dev/null @@ -1,661 +0,0 @@ -# ----------------------------------------------- -# --- Mailserver Environment Variables ---------- -# ----------------------------------------------- - -# DOCUMENTATION FOR THESE VARIABLES IS FOUND UNDER -# https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/ - -# ----------------------------------------------- -# --- General Section --------------------------- -# ----------------------------------------------- - -# empty => uses the `hostname` command to get the mail server's canonical hostname -# => Specify a fully-qualified domainname to serve mail for. This is used for many of the config features so if you can't set your hostname (e.g. you're in a container platform that doesn't let you) specify it in this environment variable. -OVERRIDE_HOSTNAME= - -# REMOVED in version v11.0.0! Use LOG_LEVEL instead. -DMS_DEBUG=0 - -# Set the log level for DMS. -# This is mostly relevant for container startup scripts and change detection event feedback. -# -# Valid values (in order of increasing verbosity) are: `error`, `warn`, `info`, `debug` and `trace`. -# The default log level is `info`. -LOG_LEVEL=info - -# critical => Only show critical messages -# error => Only show erroneous output -# **warn** => Show warnings -# info => Normal informational output -# debug => Also show debug messages -SUPERVISOR_LOGLEVEL= - -# Support for deployment where these defaults are not compatible (eg: some NAS appliances): -# /var/mail vmail User ID (default: 5000) -DMS_VMAIL_UID= -# /var/mail vmail Group ID (default: 5000) -DMS_VMAIL_GID= - -# **empty** => use FILE -# LDAP => use LDAP authentication -# OIDC => use OIDC authentication (not yet implemented) -# FILE => use local files (this is used as the default) -ACCOUNT_PROVISIONER= - -# empty => postmaster@domain.com -# => Specify the postmaster address -POSTMASTER_ADDRESS= - -# Check for updates on container start and then once a day -# If an update is available, a mail is sent to POSTMASTER_ADDRESS -# 0 => Update check disabled -# 1 => Update check enabled -ENABLE_UPDATE_CHECK=1 - -# Customize the update check interval. -# Number + Suffix. Suffix must be 's' for seconds, 'm' for minutes, 'h' for hours or 'd' for days. -UPDATE_CHECK_INTERVAL=1d - -# Set different options for mynetworks option (can be overwrite in postfix-main.cf) -# **WARNING**: Adding the docker network's gateway to the list of trusted hosts, e.g. using the `network` or -# `connected-networks` option, can create an open relay -# https://github.com/docker-mailserver/docker-mailserver/issues/1405#issuecomment-590106498 -# The same can happen for rootless podman. To prevent this, set the value to "none" or configure slirp4netns -# https://github.com/docker-mailserver/docker-mailserver/issues/2377 -# -# none => Explicitly force authentication -# container => Container IP address only -# host => Add docker container network (ipv4 only) -# network => Add all docker container networks (ipv4 only) -# connected-networks => Add all connected docker networks (ipv4 only) -PERMIT_DOCKER=none - -# Set the timezone. If this variable is unset, the container runtime will try to detect the time using -# `/etc/localtime`, which you can alternatively mount into the container. The value of this variable -# must follow the pattern `AREA/ZONE`, i.e. of you want to use Germany's time zone, use `Europe/Berlin`. -# You can lookup all available timezones here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List -TZ= - -# In case you network interface differs from 'eth0', e.g. when you are using HostNetworking in Kubernetes, -# you can set NETWORK_INTERFACE to whatever interface you want. This interface will then be used. -# - **empty** => eth0 -NETWORK_INTERFACE= - -# empty => modern -# modern => Enables TLSv1.2 and modern ciphers only. (default) -# intermediate => Enables TLSv1, TLSv1.1 and TLSv1.2 and broad compatibility ciphers. -TLS_LEVEL= - -# Configures the handling of creating mails with forged sender addresses. -# -# **0** => (not recommended) Mail address spoofing allowed. Any logged in user may create email messages with a forged sender address (see also https://en.wikipedia.org/wiki/Email_spoofing). -# 1 => Mail spoofing denied. Each user may only send with their own or their alias addresses. Addresses with extension delimiters(http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages. -SPOOF_PROTECTION= - -# Enables the Sender Rewriting Scheme. SRS is needed if your mail server acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/main/README.rst) for further explanation. -# - **0** => Disabled -# - 1 => Enabled -ENABLE_SRS=0 - -# Enables the OpenDKIM service. -# **1** => Enabled -# 0 => Disabled -ENABLE_OPENDKIM=0 - -# Enables the OpenDMARC service. -# **1** => Enabled -# 0 => Disabled -ENABLE_OPENDMARC=0 - - -# Enabled `policyd-spf` in Postfix's configuration. You will likely want to set this -# to `0` in case you're using Rspamd (`ENABLE_RSPAMD=1`). -# -# - 0 => Disabled -# - **1** => Enabled -ENABLE_POLICYD_SPF=0 - -# Enables POP3 service -# - **0** => Disabled -# - 1 => Enabled -ENABLE_POP3= - -# Enables IMAP service -# - 0 => Disabled -# - **1** => Enabled -ENABLE_IMAP=1 - -# Enables ClamAV, and anti-virus scanner. -# 1 => Enabled -# **0** => Disabled -ENABLE_CLAMAV=0 - -# Add the value of this ENV as a prefix to the mail subject when spam is detected. -# NOTE: This subject prefix may be redundant (by default spam is delivered to a junk folder). -# It provides value when your junk mail is stored alongside legitimate mail instead of a separate location (like with `SPAMASSASSIN_SPAM_TO_INBOX=1` or `MOVE_SPAM_TO_JUNK=0` or a POP3 only setup, without IMAP). -# NOTE: When not using Docker Compose, other CRI may not support quote-wrapping the value here to preserve any trailing white-space. -SPAM_SUBJECT= - -# Enables Rspamd -# **0** => Disabled -# 1 => Enabled -ENABLE_RSPAMD=1 - -# When `ENABLE_RSPAMD=1`, an internal Redis instance is enabled implicitly. -# This setting provides an opt-out to allow using an external instance instead. -# 0 => Disabled -# 1 => Enabled -ENABLE_RSPAMD_REDIS= - -# When enabled, -# -# 1. the "[autolearning][rspamd-autolearn]" feature is turned on; -# 2. the Bayes classifier will be trained when moving mails from or to the Junk folder (with the help of Sieve scripts). -# -# **0** => disabled -# 1 => enabled -RSPAMD_LEARN=1 - -# This settings controls whether checks should be performed on emails coming -# from authenticated users (i.e. most likely outgoing emails). The default value -# is `0` in order to align better with SpamAssassin. We recommend reading -# through https://rspamd.com/doc/tutorials/scanning_outbound.html though to -# decide for yourself whether you need and want this feature. -# -# Note that DKIM signing of e-mails will still happen. -RSPAMD_CHECK_AUTHENTICATED=0 - -# Controls whether the Rspamd Greylisting module is enabled. -# This module can further assist in avoiding spam emails by greylisting -# e-mails with a certain spam score. -# -# **0** => disabled -# 1 => enabled -RSPAMD_GREYLISTING=0 - -# Can be used to enable or disable the Hfilter group module. -# -# - 0 => Disabled -# - **1** => Enabled -RSPAMD_HFILTER=1 - -# Can be used to control the score when the HFILTER_HOSTNAME_UNKNOWN symbol applies. A higher score is more punishing. Setting it to 15 is equivalent to rejecting the email when the check fails. -# -# Default: 6 -RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE=6 - -# Can be used to enable or disable the (still experimental) neural module. -# -# - **0** => Disabled -# - 1 => Enabled -RSPAMD_NEURAL=0 - -# Amavis content filter (used for ClamAV & SpamAssassin) -# 0 => Disabled -# 1 => Enabled -ENABLE_AMAVIS=0 - -# -1/-2/-3 => Only show errors -# **0** => Show warnings -# 1/2 => Show default informational output -# 3/4/5 => log debug information (very verbose) -AMAVIS_LOGLEVEL=0 - -# This enables DNS block lists in Postscreen. -# Note: Emails will be rejected, if they don't pass the block list checks! -# **0** => DNS block lists are disabled -# 1 => DNS block lists are enabled -ENABLE_DNSBL=0 - -# If you enable Fail2Ban, don't forget to add the following lines to your `compose.yaml`: -# cap_add: -# - NET_ADMIN -# Otherwise, `nftables` won't be able to ban IPs. -ENABLE_FAIL2BAN=0 - -# Fail2Ban blocktype -# drop => drop packet (send NO reply) -# reject => reject packet (send ICMP unreachable) -FAIL2BAN_BLOCKTYPE=drop - -# 1 => Enables Managesieve on port 4190 -# empty => disables Managesieve -ENABLE_MANAGESIEVE=1 - -# **enforce** => Allow other tests to complete. Reject attempts to deliver mail with a 550 SMTP reply, and log the helo/sender/recipient information. Repeat this test the next time the client connects. -# drop => Drop the connection immediately with a 521 SMTP reply. Repeat this test the next time the client connects. -# ignore => Ignore the failure of this test. Allow other tests to complete. Repeat this test the next time the client connects. This option is useful for testing and collecting statistics without blocking mail. -POSTSCREEN_ACTION=enforce - -# empty => all daemons start -# 1 => only launch postfix smtp -SMTP_ONLY= - -# Please read [the SSL page in the documentation](https://docker-mailserver.github.io/docker-mailserver/latest/config/security/ssl) for more information. -# -# empty => SSL disabled -# letsencrypt => Enables Let's Encrypt certificates -# custom => Enables custom certificates -# manual => Let's you manually specify locations of your SSL certificates for non-standard cases -# self-signed => Enables self-signed certificates -SSL_TYPE=letsencrypt - -# These are only supported with `SSL_TYPE=manual`. -# Provide the path to your cert and key files that you've mounted access to within the container. -SSL_CERT_PATH= -SSL_KEY_PATH= -# Optional: A 2nd certificate can be supported as fallback (dual cert support), eg ECDSA with an RSA fallback. -# Useful for additional compatibility with older MTA and MUA (eg pre-2015). -SSL_ALT_CERT_PATH= -SSL_ALT_KEY_PATH= - -# Set how many days a virusmail will stay on the server before being deleted -# empty => 7 days -VIRUSMAILS_DELETE_DELAY= - -# Configure Postfix `virtual_transport` to deliver mail to a different LMTP client (default is a dovecot socket). -# Provide any valid URI. Examples: -# -# empty => `lmtp:unix:/var/run/dovecot/lmtp` (default, configured in Postfix main.cf) -# `lmtp:unix:private/dovecot-lmtp` (use socket) -# `lmtps:inet:<host>:<port>` (secure lmtp with starttls) -# `lmtp:<kopano-host>:2003` (use kopano as mailstore) -POSTFIX_DAGENT= - -# Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default). Size is in bytes. -# -# empty => 0 -POSTFIX_MAILBOX_SIZE_LIMIT= - -# See https://docker-mailserver.github.io/docker-mailserver/latest/config/account-management/overview/#quotas -# 0 => Dovecot quota is disabled -# 1 => Dovecot quota is enabled -ENABLE_QUOTAS=1 - -# Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!). Size is in bytes. -# -# empty => 10240000 (~10 MB) -POSTFIX_MESSAGE_SIZE_LIMIT= - -# Mails larger than this limit won't be scanned. -# ClamAV must be enabled (ENABLE_CLAMAV=1) for this. -# -# empty => 25M (25 MB) -CLAMAV_MESSAGE_SIZE_LIMIT= - -# Enables regular pflogsumm mail reports. -# This is a new option. The old REPORT options are still supported for backwards compatibility. If this is not set and reports are enabled with the old options, logrotate will be used. -# -# not set => No report -# daily_cron => Daily report for the previous day -# logrotate => Full report based on the mail log when it is rotated -PFLOGSUMM_TRIGGER= - -# Recipient address for pflogsumm reports. -# -# not set => Use REPORT_RECIPIENT or POSTMASTER_ADDRESS -# => Specify the recipient address(es) -PFLOGSUMM_RECIPIENT= - -# Sender address (`FROM`) for pflogsumm reports if pflogsumm reports are enabled. -# -# not set => Use REPORT_SENDER -# => Specify the sender address -PFLOGSUMM_SENDER= - -# Interval for logwatch report. -# -# none => No report is generated -# daily => Send a daily report -# weekly => Send a report every week -LOGWATCH_INTERVAL= - -# Recipient address for logwatch reports if they are enabled. -# -# not set => Use REPORT_RECIPIENT or POSTMASTER_ADDRESS -# => Specify the recipient address(es) -LOGWATCH_RECIPIENT= - -# Sender address (`FROM`) for logwatch reports if logwatch reports are enabled. -# -# not set => Use REPORT_SENDER -# => Specify the sender address -LOGWATCH_SENDER= - -# Defines who receives reports if they are enabled. -# **empty** => ${POSTMASTER_ADDRESS} -# => Specify the recipient address -REPORT_RECIPIENT= - -# Defines who sends reports if they are enabled. -# **empty** => mailserver-report@${DOMAINNAME} -# => Specify the sender address -REPORT_SENDER= - -# Changes the interval in which log files are rotated -# **weekly** => Rotate log files weekly -# daily => Rotate log files daily -# monthly => Rotate log files monthly -# -# Note: This Variable actually controls logrotate inside the container -# and rotates the log files depending on this setting. The main log output is -# still available in its entirety via `docker logs mail` (Or your -# respective container name). If you want to control logrotation for -# the Docker-generated logfile see: -# https://docs.docker.com/config/containers/logging/configure/ -# -# Note: This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger). -LOGROTATE_INTERVAL=weekly - -# Defines how many log files are kept by logrorate -LOGROTATE_COUNT=4 - - -# If enabled, employs `reject_unknown_client_hostname` to sender restrictions in Postfix's configuration. -# -# - **0** => Disabled -# - 1 => Enabled -POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME=0 - -# Choose TCP/IP protocols for postfix to use -# **all** => All possible protocols. -# ipv4 => Use only IPv4 traffic. Most likely you want this behind Docker. -# ipv6 => Use only IPv6 traffic. -# -# Note: More details at http://www.postfix.org/postconf.5.html#inet_protocols -POSTFIX_INET_PROTOCOLS=all - -# Enables MTA-STS support for outbound mail. -# More details: https://docker-mailserver.github.io/docker-mailserver/v13.3/config/best-practices/mta-sts/ -# - **0** ==> MTA-STS disabled -# - 1 => MTA-STS enabled -ENABLE_MTA_STS=0 - -# Choose TCP/IP protocols for dovecot to use -# **all** => Listen on all interfaces -# ipv4 => Listen only on IPv4 interfaces. Most likely you want this behind Docker. -# ipv6 => Listen only on IPv6 interfaces. -# -# Note: More information at https://dovecot.org/doc/dovecot-example.conf -DOVECOT_INET_PROTOCOLS=all - -# ----------------------------------------------- -# --- SpamAssassin Section ---------------------- -# ----------------------------------------------- - -ENABLE_SPAMASSASSIN=0 - -# KAM is a 3rd party SpamAssassin ruleset, provided by the McGrail Foundation. -# If SpamAssassin is enabled, KAM can be used in addition to the default ruleset. -# - **0** => KAM disabled -# - 1 => KAM enabled -# -# Note: only has an effect if `ENABLE_SPAMASSASSIN=1` -ENABLE_SPAMASSASSIN_KAM=0 - -# deliver spam messages to the inbox (tagged using SPAM_SUBJECT) -SPAMASSASSIN_SPAM_TO_INBOX=1 - -# spam messages will be moved in the Junk folder (SPAMASSASSIN_SPAM_TO_INBOX=1 required) -MOVE_SPAM_TO_JUNK=1 - -# spam messages will be marked as read -MARK_SPAM_AS_READ=0 - -# add 'spam info' headers at, or above this level -SA_TAG=2.0 - -# add 'spam detected' headers at, or above this level -SA_TAG2=6.31 - -# triggers spam evasive actions -SA_KILL=10.0 - -# ----------------------------------------------- -# --- Fetchmail Section ------------------------- -# ----------------------------------------------- - -ENABLE_FETCHMAIL=0 - -# The interval to fetch mail in seconds -FETCHMAIL_POLL=300 -# Use multiple fetchmail instances (1 per poll entry in fetchmail.cf) -# Supports multiple IMAP IDLE connections when a server is used across multiple poll entries -# https://otremba.net/wiki/Fetchmail_(Debian)#Immediate_Download_via_IMAP_IDLE -FETCHMAIL_PARALLEL=0 - -# Enable or disable `getmail`. -# -# - **0** => Disabled -# - 1 => Enabled -ENABLE_GETMAIL=0 - -# The number of minutes for the interval. Min: 1; Default: 5. -GETMAIL_POLL=5 - -# ----------------------------------------------- -# --- OAUTH2 Section ---------------------------- -# ----------------------------------------------- - -# empty => OAUTH2 authentication is disabled -# 1 => OAUTH2 authentication is enabled -ENABLE_OAUTH2= - -# Specify the user info endpoint URL of the oauth2 provider -# Example: https://oauth2.example.com/userinfo/ -OAUTH2_INTROSPECTION_URL= - -# ----------------------------------------------- -# --- LDAP Section ------------------------------ -# ----------------------------------------------- - -# A second container for the ldap service is necessary (i.e. https://hub.docker.com/r/bitnami/openldap/) - -# empty => no -# yes => LDAP over TLS enabled for Postfix -LDAP_START_TLS= - -# empty => mail.example.com -# Specify the `<dns-name>` / `<ip-address>` where the LDAP server is reachable via a URI like: `ldaps://mail.example.com`. -# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`). -LDAP_SERVER_HOST= - -# empty => ou=people,dc=domain,dc=com -# => e.g. LDAP_SEARCH_BASE=dc=mydomain,dc=local -LDAP_SEARCH_BASE= - -# empty => cn=admin,dc=domain,dc=com -# => take a look at examples of SASL_LDAP_BIND_DN -LDAP_BIND_DN= - -# empty** => admin -# => Specify the password to bind against ldap -LDAP_BIND_PW= - -# e.g. `"(&(mail=%s)(mailEnabled=TRUE))"` -# => Specify how ldap should be asked for users -LDAP_QUERY_FILTER_USER= - -# e.g. `"(&(mailGroupMember=%s)(mailEnabled=TRUE))"` -# => Specify how ldap should be asked for groups -LDAP_QUERY_FILTER_GROUP= - -# e.g. `"(&(mailAlias=%s)(mailEnabled=TRUE))"` -# => Specify how ldap should be asked for aliases -LDAP_QUERY_FILTER_ALIAS= - -# e.g. `"(&(|(mail=*@%s)(mailalias=*@%s)(mailGroupMember=*@%s))(mailEnabled=TRUE))"` -# => Specify how ldap should be asked for domains -LDAP_QUERY_FILTER_DOMAIN= - -# ----------------------------------------------- -# --- Dovecot Section --------------------------- -# ----------------------------------------------- - -# empty => no -# yes => LDAP over TLS enabled for Dovecot -DOVECOT_TLS= - -# e.g. `"(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"` -DOVECOT_USER_FILTER= - -# e.g. `"(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"` -DOVECOT_PASS_FILTER= - -# Define the mailbox format to be used -# default is maildir, supported values are: sdbox, mdbox, maildir -DOVECOT_MAILBOX_FORMAT=maildir - -# empty => no -# yes => Allow bind authentication for LDAP -# https://doc.dovecot.org/2.4.0/core/config/auth/databases/ldap.html#authentication-bind -DOVECOT_AUTH_BIND= - -# ----------------------------------------------- -# --- Postgrey Section -------------------------- -# ----------------------------------------------- - -ENABLE_POSTGREY=0 -# greylist for N seconds -POSTGREY_DELAY=300 -# delete entries older than N days since the last time that they have been seen -POSTGREY_MAX_AGE=35 -# response when a mail is greylisted -POSTGREY_TEXT="Delayed by Postgrey" -# whitelist host after N successful deliveries (N=0 to disable whitelisting) -POSTGREY_AUTO_WHITELIST_CLIENTS=5 - -# ----------------------------------------------- -# --- SASL Section ------------------------------ -# ----------------------------------------------- - -ENABLE_SASLAUTHD=0 - -# empty => pam -# `ldap` => authenticate against ldap server -# `shadow` => authenticate against local user db -# `mysql` => authenticate against mysql db -# `rimap` => authenticate against imap server -# Note: can be a list of mechanisms like pam ldap shadow -SASLAUTHD_MECHANISMS= - -# empty => None -# e.g. with SASLAUTHD_MECHANISMS rimap you need to specify the ip-address/servername of the imap server ==> xxx.xxx.xxx.xxx -SASLAUTHD_MECH_OPTIONS= - -# empty => Use value of LDAP_SERVER_HOST -# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`). -SASLAUTHD_LDAP_SERVER= - -# empty => Use value of LDAP_BIND_DN -# specify an object with privileges to search the directory tree -# e.g. active directory: SASLAUTHD_LDAP_BIND_DN=cn=Administrator,cn=Users,dc=mydomain,dc=net -# e.g. openldap: SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=mydomain,dc=net -SASLAUTHD_LDAP_BIND_DN= - -# empty => Use value of LDAP_BIND_PW -SASLAUTHD_LDAP_PASSWORD= - -# empty => Use value of LDAP_SEARCH_BASE -# specify the search base -SASLAUTHD_LDAP_SEARCH_BASE= - -# empty => default filter `(&(uniqueIdentifier=%u)(mailEnabled=TRUE))` -# e.g. for active directory: `(&(sAMAccountName=%U)(objectClass=person))` -# e.g. for openldap: `(&(uid=%U)(objectClass=person))` -SASLAUTHD_LDAP_FILTER= - -# empty => no -# yes => LDAP over TLS enabled for SASL -# If set to yes, the protocol in SASLAUTHD_LDAP_SERVER must be ldap:// or missing. -SASLAUTHD_LDAP_START_TLS= - -# empty => no -# yes => Require and verify server certificate -# If yes you must/could specify SASLAUTHD_LDAP_TLS_CACERT_FILE or SASLAUTHD_LDAP_TLS_CACERT_DIR. -SASLAUTHD_LDAP_TLS_CHECK_PEER= - -# File containing CA (Certificate Authority) certificate(s). -# empty => Nothing is added to the configuration -# Any value => Fills the `ldap_tls_cacert_file` option -SASLAUTHD_LDAP_TLS_CACERT_FILE= - -# Path to directory with CA (Certificate Authority) certificates. -# empty => Nothing is added to the configuration -# Any value => Fills the `ldap_tls_cacert_dir` option -SASLAUTHD_LDAP_TLS_CACERT_DIR= - -# Specify what password attribute to use for password verification. -# empty => Nothing is added to the configuration but the documentation says it is `userPassword` by default. -# Any value => Fills the `ldap_password_attr` option -SASLAUTHD_LDAP_PASSWORD_ATTR= - -# empty => `bind` will be used as a default value -# `fastbind` => The fastbind method is used -# `custom` => The custom method uses userPassword attribute to verify the password -SASLAUTHD_LDAP_AUTH_METHOD= - -# Specify the authentication mechanism for SASL bind -# empty => Nothing is added to the configuration -# Any value => Fills the `ldap_mech` option -SASLAUTHD_LDAP_MECH= - -# ----------------------------------------------- -# --- SRS Section ------------------------------- -# ----------------------------------------------- - -# envelope_sender => Rewrite only envelope sender address (default) -# header_sender => Rewrite only header sender (not recommended) -# envelope_sender,header_sender => Rewrite both senders -# An email has an "envelope" sender (indicating the sending server) and a -# "header" sender (indicating who sent it). More strict SPF policies may require -# you to replace both instead of just the envelope sender. -SRS_SENDER_CLASSES=envelope_sender - -# empty => Envelope sender will be rewritten for all domains -# provide comma separated list of domains to exclude from rewriting -SRS_EXCLUDE_DOMAINS= - -# empty => generated when the image is built -# provide a secret to use in base64 -# you may specify multiple keys, comma separated. the first one is used for -# signing and the remaining will be used for verification. this is how you -# rotate and expire keys -SRS_SECRET= - -# ----------------------------------------------- -# --- Default Relay Host Section ---------------- -# ----------------------------------------------- - -# Setup relaying all mail through a default relay host -# -# Set a default host to relay all mail through (optionally include a port) -# Example: [mail.example.com]:587 -DEFAULT_RELAY_HOST=@@CRUPEST_MAIL_SERVER_RELAY@@ - -# ----------------------------------------------- -# --- Multi-Domain Relay Section ---------------- -# ----------------------------------------------- - -# Setup relaying for multiple domains based on the domain name of the sender -# optionally uses usernames and passwords in postfix-sasl-password.cf and relay host mappings in postfix-relaymap.cf -# -# Set a default host to relay mail through -# Example: mail.example.com -RELAY_HOST= - -# empty => 25 -# default port to relay mail -RELAY_PORT=@@CRUPEST_MAIL_SERVER_RELAY_PORT@@ - -# ----------------------------------------------- -# --- Relay Host Credentials Section ------------ -# ----------------------------------------------- - -# Configure a relay user and password to use with RELAY_HOST / DEFAULT_RELAY_HOST - -# empty => no default -RELAY_USER=@@CRUPEST_MAIL_SERVER_RELAY_USER@@ - -# empty => no default -RELAY_PASSWORD=@@CRUPEST_MAIL_SERVER_RELAY_PASSWORD@@ diff --git a/services/templates/envs/nginx.env.template b/services/templates/envs/nginx.env.template deleted file mode 100644 index 55143ab..0000000 --- a/services/templates/envs/nginx.env.template +++ /dev/null @@ -1,2 +0,0 @@ -CRUPEST_DOMAIN=@@CRUPEST_DOMAIN@@ -CRUPEST_GITHUB=@@CRUPEST_GITHUB@@ diff --git a/services/templates/my-roundcube.inc.php b/services/templates/my-roundcube.inc.php new file mode 100644 index 0000000..c07aff9 --- /dev/null +++ b/services/templates/my-roundcube.inc.php @@ -0,0 +1,3 @@ +<?php + +$config['managesieve_host'] = 'tls://%h'; diff --git a/services/docker/nginx/configs/common/acme-challenge b/services/templates/nginx/common/acme-challenge index 26054b8..8280cd8 100644 --- a/services/docker/nginx/configs/common/acme-challenge +++ b/services/templates/nginx/common/acme-challenge @@ -1,3 +1,3 @@ location /.well-known/acme-challenge { - root /srv/acme; + root /var/www/certbot; } diff --git a/services/docker/nginx/configs/common/http-listen b/services/templates/nginx/common/http-listen index 76cb18d..76cb18d 100644 --- a/services/docker/nginx/configs/common/http-listen +++ b/services/templates/nginx/common/http-listen diff --git a/services/docker/nginx/configs/common/https-listen b/services/templates/nginx/common/https-listen index db2f68e..db2f68e 100644 --- a/services/docker/nginx/configs/common/https-listen +++ b/services/templates/nginx/common/https-listen diff --git a/services/docker/nginx/configs/common/https-redirect b/services/templates/nginx/common/https-redirect index 56d095d..56d095d 100644 --- a/services/docker/nginx/configs/common/https-redirect +++ b/services/templates/nginx/common/https-redirect diff --git a/services/docker/nginx/configs/common/proxy-common b/services/templates/nginx/common/reverse-proxy index 4193548..4193548 100644 --- a/services/docker/nginx/configs/common/proxy-common +++ b/services/templates/nginx/common/reverse-proxy diff --git a/services/docker/nginx/configs/conf.d/default.conf b/services/templates/nginx/default.conf index 515942b..515942b 100644 --- a/services/docker/nginx/configs/conf.d/default.conf +++ b/services/templates/nginx/default.conf diff --git a/services/templates/nginx/mail.conf.template b/services/templates/nginx/mail.conf.template new file mode 100644 index 0000000..1c2a2ca --- /dev/null +++ b/services/templates/nginx/mail.conf.template @@ -0,0 +1,29 @@ +server { + server_name mail.@@CRUPEST_DOMAIN@@; + include conf.d/common/https-listen; + + location = /robots.txt { + root /srv/mail; + } + + location = /@@CRUPEST_MAIL_SERVER_AWS_INBOUND_PATH@@ { + include conf.d/common/reverse-proxy; + proxy_pass http://mail-server:2345/@@CRUPEST_MAIL_SERVER_AWS_INBOUND_PATH@@; + } + + location / { + include conf.d/common/reverse-proxy; + proxy_pass http://roundcubemail:80/; + } + + client_max_body_size 5G; +} + + +server { + server_name mail.@@CRUPEST_DOMAIN@@; + include conf.d/common/http-listen; + + include conf.d/common/https-redirect; + include conf.d/common/acme-challenge; +} diff --git a/services/templates/nginx/root.conf.template b/services/templates/nginx/root.conf.template new file mode 100644 index 0000000..db28f00 --- /dev/null +++ b/services/templates/nginx/root.conf.template @@ -0,0 +1,40 @@ +server { + server_name @@CRUPEST_DOMAIN@@; + include conf.d/common/https-listen; + + location / { + root /srv/www; + } + + location /git/ { + include conf.d/common/reverse-proxy; + client_max_body_size 5G; + proxy_pass http://git-server:3636; + } + + location = /github { + return 301 @@CRUPEST_GITHUB@@; + } + + location = /github/ { + return 301 @@CRUPEST_GITHUB@@; + } + + location /_@@CRUPEST_V2RAY_PATH@@ { + if ($http_upgrade != "websocket") { + return 404; + } + + proxy_redirect off; + include conf.d/common/reverse-proxy; + proxy_pass http://v2ray:10000; + } +} + +server { + server_name @@CRUPEST_DOMAIN@@; + include conf.d/common/http-listen; + + include conf.d/common/https-redirect; + include conf.d/common/acme-challenge; +} diff --git a/services/docker/nginx/configs/templates/ssl.conf.template b/services/templates/nginx/ssl.conf.template index 54205f1..181a1af 100644 --- a/services/docker/nginx/configs/templates/ssl.conf.template +++ b/services/templates/nginx/ssl.conf.template @@ -4,8 +4,8 @@ # the up-to-date file that you will need to refer to when manually updating # this file. Contents are based on https://ssl-config.mozilla.org -ssl_certificate /etc/letsencrypt/live/${CRUPEST_DOMAIN}/fullchain.pem; -ssl_certificate_key /etc/letsencrypt/live/${CRUPEST_DOMAIN}/privkey.pem; +ssl_certificate /etc/letsencrypt/live/@@CRUPEST_DOMAIN@@/fullchain.pem; +ssl_certificate_key /etc/letsencrypt/live/@@CRUPEST_DOMAIN@@/privkey.pem; ssl_session_cache shared:le_nginx_SSL:10m; ssl_session_timeout 1440m; diff --git a/services/templates/nginx/timeline.conf.template b/services/templates/nginx/timeline.conf.template new file mode 100644 index 0000000..3414510 --- /dev/null +++ b/services/templates/nginx/timeline.conf.template @@ -0,0 +1,6 @@ +server { + server_name timeline.@@CRUPEST_DOMAIN@@; + include conf.d/common/http-listen; + + include conf.d/common/acme-challenge; +} diff --git a/services/docker/nginx/configs/conf.d/websocket.conf b/services/templates/nginx/websocket.conf index 32af4c3..32af4c3 100644 --- a/services/docker/nginx/configs/conf.d/websocket.conf +++ b/services/templates/nginx/websocket.conf |