Skip to content

Commit 368e976

Browse files
authored
Merge pull request #337 from OnGle/lamp-fixes
Apache & Mysql Fixes
2 parents e9132dd + cc3881a commit 368e976

7 files changed

Lines changed: 35 additions & 28 deletions

File tree

conf/apache-ssl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ if [[ -f "$CONF" ]]; then
1010
ssl_protocol="# Hardened TKL default\nSSLProtocol -all +TLSv1.2 +TLSv1.3"
1111
sed -Ei "\|^SSLProtocol| s|^(.*)|#\1\n$ssl_protocol|" "$CONF"
1212

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

2223
cat >> "$CONF" <<EOF
2324

conf/bootstrap_apt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/bin/bash -ex
22

33
# create apt sources
44
# environment variables:
@@ -26,9 +26,6 @@
2626
# - if not the same as guest, apply relevant transition changes
2727
# - NO_TURNKEY_APT_REPO <optional>:
2828
# - disable TurnKey apt repos - useful during early transition
29-
# - NO_PROXY <optional>:
30-
# - same as APT_PROXY_OVERRIDE=disable (will override APT_PROXY_OVERRIDE
31-
# if both set to different values)
3229

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

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

121-
if [[ "${APT_PROXY_OVERRIDE,,}" == "disable" ]] || [[ -n "$NO_PROXY" ]]; then
118+
if [[ "${APT_PROXY_OVERRIDE,,}" == "disable" ]]; then
122119
PROXY_PORT=
123120
elif [[ -n $APT_PROXY_OVERRIDE ]]; then
124121
PROXY_PORT=$APT_PROXY_OVERRIDE

conf/mysql

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
#!/bin/bash -e
22

3-
# download mysqltuner
4-
dl() {
5-
if [[ "$FAB_HTTP_PROXY" ]]; then
6-
PROXY=(--proxy "$FAB_HTTP_PROXY")
7-
fi
8-
cd "$2"
9-
curl -L -f -O "${PROXY[@]}" "$1"
10-
cd -
11-
}
3+
. /usr/local/src/tkl-bashlib/init.sh
124

135
# Install mysqltuner at "latest" tag (via gh_releases) and from core dev's
146
# repo[1] - rather than separate "org" repo[2]
157
#
168
# [1] https://github.com/jmrenouard/MySQLTuner-perl
179
# [2] https://github.com/major/MySQLTuner-perl
1810
BIN=/usr/local/bin
19-
VERSION=$(gh_releases jmrenouard/MySQLTuner-perl | sort -V | tail -1)
11+
VERSION=master
2012
REPO="jmrenouard/MySQLTuner-perl"
21-
URL="https://raw.githubusercontent.com/$REPO/refs/tags/$VERSION"
13+
URL="https://raw.githubusercontent.com/$REPO/refs/heads/$VERSION"
2214
dl "$URL/mysqltuner.pl" $BIN
2315
mv "$BIN/mysqltuner.pl" $BIN/mysqltuner
2416
chmod +x "$BIN/mysqltuner"

conf/turnkey.d/zz-ssl-ciphers

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ if [[ -f "$CONF" ]]; then
3030
sed -i "/tls_medium_cipherlist/ s|ZZ_SSL_CIPHERS|$SECURE_CIPHER_LIST|" $CONF
3131
fi
3232

33-
# Apache2
34-
CONF="/etc/apache2/mods-available/ssl.conf"
35-
if [[ -f "$CONF" ]]; then
36-
sed -i "s|^\(\s*SSLCipherSuite\s\+\).*$|\1${SECURE_CIPHER_LIST}|g" $CONF
37-
a2enmod ssl
38-
a2enconf security
39-
fi
40-
4133
# Nginx
4234
CONF="/etc/nginx/snippets/ssl.conf"
4335
if [[ -f "$CONF" ]]; then
@@ -69,3 +61,5 @@ if [ -d "$PUREFTPDDIR" ]; then
6961
echo 1 > ${PUREFTPDDIR}/TLS
7062
echo HIGH:\!TLSv1:\!TLSv1.1:\!SSLv2:\!SSLv3:${SECURE_CIPHER_LIST} > ${PUREFTPDDIR}/TLSCipherSuite
7163
fi
64+
65+
echo "$SECURE_CIPHER_LIST" > /tmp/ZZ_SSL_CIPHERS

mk/turnkey/apache.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
COMMON_OVERLAYS += apache
2-
COMMON_CONF += apache-vhost apache-headers apache-security
2+
COMMON_CONF += apache-vhost apache-headers apache-security apache-ssl

overlays/turnkey.d/tkl-bashlib/usr/local/src/tkl-bashlib/init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export DEBIAN_FRONTEND=noninteractive
2525

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

3030
# check for integers
3131
# if any elements of $@ are _not_ integers - will return 1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# (c) 2026 - TurnKey GNU/Linux - all rights reserved
2+
#
3+
# This script is part of TKLDev BashLib.
4+
#
5+
# The source can be located locally on TKLDev:
6+
# ${FAB_PATH}/common/overlays/turnkey.d/tkl-bashlib
7+
#
8+
# To use it within a conf script, first source the base 'init' script:
9+
#
10+
# source /usr/local/src/tkl-bashlib/init
11+
#
12+
# For more info, including licence, please see the README.rst (should be in
13+
# the same dir as this file).
14+
15+
dl() {
16+
cd "$2"
17+
if [[ "$FAB_HTTP_PROXY" ]]; then
18+
http_proxy="$FAB_HTTP_PROXY" https_proxy="$FAB_HTTPS_PROXY" wget "$1"
19+
else
20+
wget "$1"
21+
fi
22+
cd -
23+
}

0 commit comments

Comments
 (0)