Skip to content

Commit

Permalink
update comments to have better readable_bash output
Browse files Browse the repository at this point in the history
  • Loading branch information
kiekerjan committed Jan 19, 2025
1 parent f8f865f commit 9ab3dfb
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 31 deletions.
9 changes: 8 additions & 1 deletion setup/additionals.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source /etc/mailinabox.conf
source setup/functions.sh

# ## Additional modifications

# Add additional packages
apt_install pflogsumm rkhunter

Expand All @@ -20,6 +22,8 @@ cat > /root/.forward << EOF;
administrator@$PRIMARY_HOSTNAME
EOF

# ### rkhunter configuration

# Adapt rkhunter cron job to reduce log file production
sed -i "s/--cronjob --report-warnings-only --appendlog/--cronjob --report-warnings-only --no-verbose-logging --appendlog/g" /etc/cron.daily/rkhunter

Expand Down Expand Up @@ -50,10 +54,13 @@ management/editconf.py /etc/default/rkhunter \
# Should be last, update expected output
rkhunter --propupd

# Install subnetblocker.
# ### Install Subnetblocker
# Regularly scan fail2ban log to capture whole subnets to block
hide_output install -m 755 tools/fail2ban-block-ip-range.py /usr/local/bin
cp -f conf/cron/miab-fail2ban-subnet-blocker /etc/cron.d/
# Logrotation is done via generic mail in a box logrotate config

# ### Install additional tools

# Install combine_certs.sh tool
hide_output install -m 755 tools/combine_certs.sh /usr/local/bin
7 changes: 2 additions & 5 deletions setup/dovecot-fts-xapian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ echo "Installing fts-xapian..."
apt_install dovecot-fts-xapian

# Update the dovecot plugin configuration
#
# Break-imap-search makes search work the way users expect, rather than the way
# the IMAP specification expects.
management/editconf.py /etc/dovecot/conf.d/10-mail.conf \
mail_plugins="fts fts_xapian" \
mail_home="$STORAGE_ROOT/mail/homes/%d/%n"
mail_plugins="fts fts_xapian"

# Install cronjobs to keep FTS up to date.
hide_output install -m 755 conf/cron/miab_dovecot /etc/cron.daily/
Expand Down Expand Up @@ -77,6 +73,7 @@ restart_service dovecot
hide_output doveadm fts rescan -A

# Adds unindexed files to the fts database
#
# * `-q`: Queues the indexing to be run by indexer process. (will background the indexing)
# * `-A`: All users
# * `'*'`: All folders
Expand Down
3 changes: 2 additions & 1 deletion setup/mail-dovecot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ sed -i "s/#mail_plugins = .*/mail_plugins = \$mail_plugins sieve/" /etc/dovecot/
# link here to the actual sieve script. It should not be in the mailbox directory
# (because then it might appear as a folder) and it should not be in the sieve_dir
# (because then I suppose it might appear to the user as one of their scripts).
#
# * `sieve_dir`: Directory for :personal include scripts for the include extension. This
# is also where the ManageSieve service stores the user's scripts.
cat > /etc/dovecot/conf.d/99-local-sieve.conf << EOF;
Expand All @@ -194,7 +195,7 @@ EOF
cp conf/sieve-spam.txt /etc/dovecot/sieve-spam.sieve
sievec /etc/dovecot/sieve-spam.sieve

# PERMISSIONS
# ### Permissions

# Ensure configuration files are owned by dovecot and not world readable.
chown -R mail:dovecot /etc/dovecot
Expand Down
2 changes: 1 addition & 1 deletion setup/mail-users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ driver = sqlite
connect = $db_path
default_pass_scheme = SHA512-CRYPT
password_query = SELECT email as user, password FROM users WHERE email='%u';
user_query = SELECT email AS user, "mail" as uid, "mail" as gid, "$STORAGE_ROOT/mail/homes/%d/%n" as home FROM users WHERE email='%u';
user_query = SELECT email AS user, "mail" as uid, "mail" as gid, "$STORAGE_ROOT/mail/mailboxes/%d/%n" as home FROM users WHERE email='%u';
iterate_query = SELECT email AS user FROM users;
EOF
chmod 0600 /etc/dovecot/dovecot-sql.conf.ext # per Dovecot instructions
Expand Down
56 changes: 33 additions & 23 deletions setup/nextcloud.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Nextcloud
# # Nextcloud
##########################

source setup/functions.sh # load our functions
Expand Down Expand Up @@ -65,6 +65,7 @@ user_external_hash=7f9d8f4dd6adb85a0e3d7622d85eeb7bfe53f3b4
# 5.3 You still can create, edit and delete users
# 5.4 Go to Administration > Logs and ensure no new errors are shown


# Clear prior packages and install dependencies from apt.
apt-get purge -qq -y owncloud* # we used to use the package manager

Expand Down Expand Up @@ -258,10 +259,13 @@ if [ ! -d $CLOUD_DIR ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; t
CURRENT_NEXTCLOUD_VER="21.0.7"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^21 ]]; then
# Nextcloud version 22
InstallNextcloud 22.2.3 58d2d897ba22a057aa03d29c762c5306211fefd2 4.0.7 45e7cf4bfe99cd8d03625cf9e5a1bb2e90549136 3.0.4 d0284b68135777ec9ca713c307216165b294d0fe 2.1.0 41d4c57371bd085d68421b52ab232092d7dfc882
CURRENT_NEXTCLOUD_VER="22.2.3"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^22 ]]; then
# Nextcloud version 23
# When installing this, we also remove the old php version
InstallNextcloud 23.0.12 d138641b8e7aabebe69bb3ec7c79a714d122f729 4.1.0 697f6b4a664e928d72414ea2731cb2c9d1dc3077 3.2.2 ce4030ab57f523f33d5396c6a81396d440756f5f 3.0.0 0df781b261f55bbde73d8c92da3f99397000972f
CURRENT_NEXTCLOUD_VER="23.0.12"

Expand All @@ -278,51 +282,57 @@ if [ ! -d $CLOUD_DIR ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; t
add-apt-repository --yes --remove ppa:ondrej/php
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^23 ]]; then
# Install nextcloud 24
InstallNextcloud 24.0.12 7aa5d61632c1ccf4ca3ff00fb6b295d318c05599 4.1.0 697f6b4a664e928d72414ea2731cb2c9d1dc3077 3.2.2 ce4030ab57f523f33d5396c6a81396d440756f5f 3.1.0 399fe1150b28a69aaf5bfcad3227e85706604a44
CURRENT_NEXTCLOUD_VER="24.0.12"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^24 ]]; then
# Install nextcloud 25
InstallNextcloud 25.0.7 a5a565c916355005c7b408dd41a1e53505e1a080 5.3.0 4b0a6666374e3b55cfd2ae9b72e1d458b87d4c8c 4.4.2 21a42e15806adc9b2618760ef94f1797ef399e2f 3.2.0 67ce8cbf8990b9d6517523d7236dcfb7f74b0201
CURRENT_NEXTCLOUD_VER="25.0.7"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^25 ]]; then
# Install nextcloud 26
InstallNextcloud 26.0.8 a8eacbd39cf4a34a6247d3bf479ff6efc0fef3c8 5.4.2 d38c9e16b377c05b5114e70b3b0c3d3f1f1d10f6 4.5.3 7c974d4f092886e8932c6c3ae34532c30a3fcea9 3.2.0 67ce8cbf8990b9d6517523d7236dcfb7f74b0201
CURRENT_NEXTCLOUD_VER="26.0.8"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^26 ]]; then
# Install nextcloud 27
InstallNextcloud 27.1.9 4797a2f1f7ffcedca7c0917f913d983b75ed22fd 5.5.3 799550f38e46764d90fa32ca1a6535dccd8316e5 4.7.2 9222953e5654c151604e082c0d5907dcc651d3d7 3.3.0 49800e8ca61391965ce8a75eaaf92a8037185375
CURRENT_NEXTCLOUD_VER="27.1.9"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^27 ]]; then
# Install nextcloud 28
InstallNextcloud 28.0.10 24edd63bdc005ff39607831ed6cc2cac7278d41a 5.5.3 799550f38e46764d90fa32ca1a6535dccd8316e5 4.7.16 1c39ce674027a8710800d056a7cdd0c5c974781d 3.4.0 7f9d8f4dd6adb85a0e3d7622d85eeb7bfe53f3b4
CURRENT_NEXTCLOUD_VER="28.0.10"
fi
fi

# ### Document nextcloud versions, php versions and user_external plugin compatibility
# nextcloud version - supported php versions
# 20 - 7.2, 7.3, 7.4
# 21 - 7.3, 7.4, 8.0
# 22 - 7.3, 7.4, 8.0
# 23 - 7.3, 7.4, 8.0
# 24 - 7.4, 8.0, 8.1
# 25 - 7.4, 8.0, 8.1
# 26 - 8.0, 8.1, 8.2
# 27 - 8.0 (d), 8.1, 8.2 (r)
# 28 - 8.0 (d), 8.1, 8.2 (r), 8.3
# 29 - 8.0 (d), 8.1, 8.2 (r), 8.3
# 30 - 8.1 (d), 8.2, 8.3 (r)
#
# ubuntu 18.04 has php 7.2
# ubuntu 22.04 has php 8.1
# ubuntu 24.04 has php 8.3
#
# user_external 2.1.0 supports version 21-22
# user_external 3.0.0 supports version 22-24
# user_external 3.1.0 supports version 22-25
# user_external 3.2.0 supports version 25-27
# user_external 3.3.0 supports version 25-28
# user_external 3.4.0 supports version 25-29

# * 20 - 7.2, 7.3, 7.4
# * 21 - 7.3, 7.4, 8.0
# * 22 - 7.3, 7.4, 8.0
# * 23 - 7.3, 7.4, 8.0
# * 24 - 7.4, 8.0, 8.1
# * 25 - 7.4, 8.0, 8.1
# * 26 - 8.0, 8.1, 8.2
# * 27 - 8.0 (d), 8.1, 8.2 (r)
# * 28 - 8.0 (d), 8.1, 8.2 (r), 8.3
# * 29 - 8.0 (d), 8.1, 8.2 (r), 8.3
# * 30 - 8.1 (d), 8.2, 8.3 (r)
# * ubuntu 18.04 has php 7.2
# * ubuntu 22.04 has php 8.1
# * ubuntu 24.04 has php 8.3
# * user_external 2.1.0 supports version 21-22
# * user_external 3.0.0 supports version 22-24
# * user_external 3.1.0 supports version 22-25
# * user_external 3.2.0 supports version 25-27
# * user_external 3.3.0 supports version 25-28
# * user_external 3.4.0 supports version 25-29

# ### Install latest nextcloud
InstallNextcloud $nextcloud_ver $nextcloud_hash $contacts_ver $contacts_hash $calendar_ver $calendar_hash $user_external_ver $user_external_hash
fi

Expand Down

0 comments on commit 9ab3dfb

Please sign in to comment.