File tree Expand file tree Collapse file tree
overlays/turnkey.d/tkl-bashlib/usr/local/src/tkl-bashlib Expand file tree Collapse file tree Original file line number Diff line number Diff 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)
1717SSLCipherSuite ZZ_SSL_CIPHERS
1818EOF
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
Original file line number Diff line number Diff line change 1- #! /bin/bash -e
1+ #! /bin/bash -ex
22
33# create apt sources
44# environment variables:
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:
112109
113110if [[ $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 ' ) "
116113elif [[ $deb_ver -ge 11 ]] || [[ " $distro " == ' ubuntu' ]]; then
117114 sec_repo=" $CODENAME -security"
118115 PROXY_PORT=3128
119116fi
120117
121- if [[ " ${APT_PROXY_OVERRIDE,,} " == " disable" ]] || [[ -n " $NO_PROXY " ]] ; then
118+ if [[ " ${APT_PROXY_OVERRIDE,,} " == " disable" ]]; then
122119 PROXY_PORT=
123120elif [[ -n $APT_PROXY_OVERRIDE ]]; then
124121 PROXY_PORT=$APT_PROXY_OVERRIDE
Original file line number Diff line number Diff line change 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
1810BIN=/usr/local/bin
19- VERSION=$( gh_releases jmrenouard/MySQLTuner-perl | sort -V | tail -1 )
11+ VERSION=master
2012REPO=" jmrenouard/MySQLTuner-perl"
21- URL=" https://raw.githubusercontent.com/$REPO /refs/tags /$VERSION "
13+ URL=" https://raw.githubusercontent.com/$REPO /refs/heads /$VERSION "
2214dl " $URL /mysqltuner.pl" $BIN
2315mv " $BIN /mysqltuner.pl" $BIN /mysqltuner
2416chmod +x " $BIN /mysqltuner"
Original file line number Diff line number Diff line change @@ -30,14 +30,6 @@ if [[ -f "$CONF" ]]; then
3030 sed -i " /tls_medium_cipherlist/ s|ZZ_SSL_CIPHERS|$SECURE_CIPHER_LIST |" $CONF
3131fi
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
4234CONF=" /etc/nginx/snippets/ssl.conf"
4335if [[ -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
7163fi
64+
65+ echo " $SECURE_CIPHER_LIST " > /tmp/ZZ_SSL_CIPHERS
Original file line number Diff line number Diff line change 11COMMON_OVERLAYS += apache
2- COMMON_CONF += apache-vhost apache-headers apache-security
2+ COMMON_CONF += apache-vhost apache-headers apache-security apache-ssl
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export DEBIAN_FRONTEND=noninteractive
2525
2626# functions for errors and warnings
2727fatal () { 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
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments