Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conf/apache-ssl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ if [[ -f "$CONF" ]]; then
ssl_protocol="# Hardened TKL default\nSSLProtocol -all +TLSv1.2 +TLSv1.3"
sed -Ei "\|^SSLProtocol| s|^(.*)|#\1\n$ssl_protocol|" "$CONF"

cipher_suites=$(cat <<EOF
cipher_suites=$(cat <<'EOF' | sed ':a;N;s/\n/\\n/g;ta'
# Explict Cipher suites recommended by Mozilla
# https://ssl-config.mozilla.org/#server=apache&version=2.4.65&config=intermediate&openssl=3.5.1&guideline=5.7
# (updated by TurnKey "common/conf/turnkey.d/zz-ssl-ciphers" script)
SSLCipherSuite ZZ_SSL_CIPHERS
EOF
)
sed -Ei "\|^SSLCipherSuite| s|^(.*)|#\1\n$cipher_suites|" "$CONF"
sed -i "s/ZZ_SSL_CIPHERS/$(cat /tmp/ZZ_SSL_CIPHERS)/g" "$CONF"

cat >> "$CONF" <<EOF

Expand Down
9 changes: 3 additions & 6 deletions conf/bootstrap_apt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -ex

# create apt sources
# environment variables:
Expand Down Expand Up @@ -26,9 +26,6 @@
# - if not the same as guest, apply relevant transition changes
# - NO_TURNKEY_APT_REPO <optional>:
# - disable TurnKey apt repos - useful during early transition
# - NO_PROXY <optional>:
# - same as APT_PROXY_OVERRIDE=disable (will override APT_PROXY_OVERRIDE
# if both set to different values)

# Note, to install packages from backports:
# - set 'BACKPORTS=y'; and either:
Expand Down Expand Up @@ -112,13 +109,13 @@ fi

if [[ $deb_ver -le 10 ]] && [[ "$distro" == 'debian' ]]; then
sec_repo="$CODENAME/updates"
PROXY_PORT=8124
PROXY_PORT="$(echo "$FAB_HTTPS_PROXY" | sed -En 's/.*:([0-9]+).*/\1/p')"
elif [[ $deb_ver -ge 11 ]] || [[ "$distro" == 'ubuntu' ]]; then
sec_repo="$CODENAME-security"
PROXY_PORT=3128
fi

if [[ "${APT_PROXY_OVERRIDE,,}" == "disable" ]] || [[ -n "$NO_PROXY" ]]; then
if [[ "${APT_PROXY_OVERRIDE,,}" == "disable" ]]; then
PROXY_PORT=
elif [[ -n $APT_PROXY_OVERRIDE ]]; then
PROXY_PORT=$APT_PROXY_OVERRIDE
Expand Down
14 changes: 3 additions & 11 deletions conf/mysql
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
#!/bin/bash -e

# download mysqltuner
dl() {
if [[ "$FAB_HTTP_PROXY" ]]; then
PROXY=(--proxy "$FAB_HTTP_PROXY")
fi
cd "$2"
curl -L -f -O "${PROXY[@]}" "$1"
cd -
}
. /usr/local/src/tkl-bashlib/init.sh

# Install mysqltuner at "latest" tag (via gh_releases) and from core dev's
# repo[1] - rather than separate "org" repo[2]
#
# [1] https://github.com/jmrenouard/MySQLTuner-perl
# [2] https://github.com/major/MySQLTuner-perl
BIN=/usr/local/bin
VERSION=$(gh_releases jmrenouard/MySQLTuner-perl | sort -V | tail -1)
VERSION=master
REPO="jmrenouard/MySQLTuner-perl"
URL="https://raw.githubusercontent.com/$REPO/refs/tags/$VERSION"
URL="https://raw.githubusercontent.com/$REPO/refs/heads/$VERSION"
dl "$URL/mysqltuner.pl" $BIN
mv "$BIN/mysqltuner.pl" $BIN/mysqltuner
chmod +x "$BIN/mysqltuner"
Expand Down
10 changes: 2 additions & 8 deletions conf/turnkey.d/zz-ssl-ciphers
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ if [[ -f "$CONF" ]]; then
sed -i "/tls_medium_cipherlist/ s|ZZ_SSL_CIPHERS|$SECURE_CIPHER_LIST|" $CONF
fi

# Apache2
CONF="/etc/apache2/mods-available/ssl.conf"
if [[ -f "$CONF" ]]; then
sed -i "s|^\(\s*SSLCipherSuite\s\+\).*$|\1${SECURE_CIPHER_LIST}|g" $CONF
a2enmod ssl
a2enconf security
fi

# Nginx
CONF="/etc/nginx/snippets/ssl.conf"
if [[ -f "$CONF" ]]; then
Expand Down Expand Up @@ -69,3 +61,5 @@ if [ -d "$PUREFTPDDIR" ]; then
echo 1 > ${PUREFTPDDIR}/TLS
echo HIGH:\!TLSv1:\!TLSv1.1:\!SSLv2:\!SSLv3:${SECURE_CIPHER_LIST} > ${PUREFTPDDIR}/TLSCipherSuite
fi

echo "$SECURE_CIPHER_LIST" > /tmp/ZZ_SSL_CIPHERS
2 changes: 1 addition & 1 deletion mk/turnkey/apache.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMON_OVERLAYS += apache
COMMON_CONF += apache-vhost apache-headers apache-security
COMMON_CONF += apache-vhost apache-headers apache-security apache-ssl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export DEBIAN_FRONTEND=noninteractive

# functions for errors and warnings
fatal() { echo "FATAL: ${@}" >&2; exit 1; }
warn() { echo "WARN: ${@}" >&2; exit 1; }
warn() { echo "WARN: ${@}" >&2; }

# check for integers
# if any elements of $@ are _not_ integers - will return 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# (c) 2026 - TurnKey GNU/Linux - all rights reserved
#
# This script is part of TKLDev BashLib.
#
# The source can be located locally on TKLDev:
# ${FAB_PATH}/common/overlays/turnkey.d/tkl-bashlib
#
# To use it within a conf script, first source the base 'init' script:
#
# source /usr/local/src/tkl-bashlib/init
#
# For more info, including licence, please see the README.rst (should be in
# the same dir as this file).

dl() {
cd "$2"
if [[ "$FAB_HTTP_PROXY" ]]; then
http_proxy="$FAB_HTTP_PROXY" https_proxy="$FAB_HTTPS_PROXY" wget "$1"
else
wget "$1"
fi
cd -
}