Skip to content
Snippets Groups Projects
Commit c945b7d4 authored by Bob Mottram's avatar Bob Mottram
Browse files

matrix logging

parent 86371327
No related branches found
No related tags found
No related merge requests found
......@@ -228,6 +228,7 @@ function matrix_configure_homeserver_yaml {
sed -i "s|media_store_path:.*|media_store_path: \"${MATRIX_DATA_DIR}/media_store\"|g" "${filepath}"
sed -i "s|pid_file:.*|pid_file: \"${MATRIX_DATA_DIR}/homeserver.pid\"|g" "${filepath}"
sed -i "s|log_file:.*|log_file: \"/dev/null\"|g" "${filepath}"
sed -i "s|log_config:|#log_config:|g" "${filepath}"
sed -i 's|bind_address:.*|bind_address: 127.0.0.1|g' "${filepath}"
sed -i "s|bind_addresses:.*|bind_addresses: ['127.0.0.1']|g" "${filepath}"
sed -i 's|x_forwarded:.*|x_forwarded: false|g' "${filepath}"
......
......@@ -78,13 +78,16 @@ if [ ! "$1" ]; then
fi
if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
if [ -f /var/lib/matrix/homeserver.yaml ]; then
sed -i 's|log_file:.*|log_file: /etc/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
fi
fi
if [ -f /etc/fail2ban/fail2ban.conf ]; then
sed -i 's|loglevel.*|loglevel = 3|g' /etc/fail2ban/fail2ban.conf
sed -i 's|logtarget.*|logtarget = /var/log/fail2ban.log|g' /etc/fail2ban/fail2ban.conf
fi
if [ -f /var/lib/matrix/homeserver.yaml ]; then
sed -i 's|log_file:.*|log_file: /var/lib/matrix/homeserver.log|g' /var/lib/matrix/homeserver.yaml
fi
if [ -d /etc/tor ]; then
if [ ! -f /var/log/tor.log ]; then
touch /var/log/tor.log
......@@ -148,6 +151,15 @@ if [[ "$1" == "on" || "$1" == "On" || "$1" == "ON" ]]; then
else
if [ -f /var/lib/matrix/homeserver.yaml ]; then
sed -i 's|log_file:.*|log_file: /dev/null|g' /var/lib/matrix/homeserver.yaml
if ! grep -q "#log_config:" /var/lib/matrix/homeserver.yaml; then
sed -i 's|log_config:|#log_config:|g' /var/lib/matrix/homeserver.yaml
fi
if [ -f /etc/matrix/homeserver.log ]; then
shred -zu /etc/matrix/homeserver.log
fi
if [ -f /etc/matrix/homeserver.log.1 ]; then
shred -zu /etc/matrix/homeserver.log.1
fi
fi
if [ -d /etc/tor ]; then
sed -i 's|#Log notice file.*|Log notice file /dev/null|g' /etc/tor/torrc
......@@ -261,7 +273,7 @@ fi
if [ -d /etc/fail2ban ]; then
systemctl restart fail2ban
fi
if [ -f /var/lib/matrix/homeserver.yaml ]; then
if [ -d /etc/matrix ]; then
systemctl restart matrix
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment