Add audit log to other logs

This commit is contained in:
Micke Nordin 2024-09-24 15:36:06 +02:00
parent 663021dc61
commit 74768985cc
5 changed files with 22 additions and 4 deletions

View file

@ -148,7 +148,8 @@ define sunetdrive::app_type (
force => true, force => true,
owner => 'root', owner => 'root',
group => 'root', group => 'root',
content => "#This file is managed by puppet\n#filename:retention days:maxsize mb\n/opt/nextcloud/nextcloud.log:180:256\n", content => "#This file is managed by puppet
#filename:retention days:maxsize mb\n/opt/nextcloud/nextcloud.log:180:256\n/opt/nextcloud/audit.log:180:256\n",
mode => '0644', mode => '0644',
} }
file { '/opt/rotate/conf.d/redis.conf': file { '/opt/rotate/conf.d/redis.conf':
@ -199,6 +200,13 @@ define sunetdrive::app_type (
group => 'root', group => 'root',
mode => '0644', mode => '0644',
} }
file { '/opt/nextcloud/audit.log':
ensure => file,
force => true,
owner => 'www-data',
group => 'root',
mode => '0644',
}
file { '/opt/nextcloud/rclone.conf': file { '/opt/nextcloud/rclone.conf':
ensure => file, ensure => file,
owner => 'www-data', owner => 'www-data',

View file

@ -264,6 +264,7 @@ MACAddressPolicy=none'
$mail_from_address = hiera("mail_from_address_${environment}") $mail_from_address = hiera("mail_from_address_${environment}")
$mail_smtphost = hiera("mail_smtphost_${environment}") $mail_smtphost = hiera("mail_smtphost_${environment}")
$nextcloud_log_path ="/opt/multinode/${customer}/nextcloud.log" $nextcloud_log_path ="/opt/multinode/${customer}/nextcloud.log"
$audit_log_path ="/opt/multinode/${customer}/audit.log"
if $customer_config['nextcloud_version'] { if $customer_config['nextcloud_version'] {
$nextcloud_version = $customer_config['nextcloud_version'] $nextcloud_version = $customer_config['nextcloud_version']
} else { } else {
@ -384,6 +385,13 @@ MACAddressPolicy=none'
group => 'root', group => 'root',
mode => '0644', mode => '0644',
} }
file { $audit_log_path:
ensure => file,
force => true,
owner => 'www-data',
group => 'root',
mode => '0644',
}
file { $rclone_conf_path: file { $rclone_conf_path:
ensure => present, ensure => present,
owner => 'www-data', owner => 'www-data',

View file

@ -21,6 +21,7 @@ services:
- /opt/nextcloud/complete_reinstall.sh:/complete_reinstall.sh - /opt/nextcloud/complete_reinstall.sh:/complete_reinstall.sh
- /opt/nextcloud/config.php:/var/www/html/config/config.php - /opt/nextcloud/config.php:/var/www/html/config/config.php
- /opt/nextcloud/nextcloud.log:/var/www/html/data/nextcloud.log - /opt/nextcloud/nextcloud.log:/var/www/html/data/nextcloud.log
- /opt/nextcloud/audit.log:/var/www/html/data/audit.log
- /opt/nextcloud/rclone.conf:/rclone.conf - /opt/nextcloud/rclone.conf:/rclone.conf
<%- if @skeletondirectory -%> <%- if @skeletondirectory -%>
- /opt/nextcloud/skeleton:<%= @skeletondirectory %> - /opt/nextcloud/skeleton:<%= @skeletondirectory %>
@ -42,7 +43,7 @@ services:
ports: ports:
- 443:443 - 443:443
<%- end -%> <%- end -%>
command: sh -c 'tail -f /var/www/html/data/nextcloud.log | tee -a /proc/1/fd/2 & apachectl -D FOREGROUND' command: sh -c 'tail -F /var/www/html/data/nextcloud.log /var/www/html/data/audit.log| tee -a /proc/1/fd/2 & apachectl -D FOREGROUND'
tty: true tty: true
<%- if !@hostnet -%> <%- if !@hostnet -%>

View file

@ -5,7 +5,7 @@ no_files=30 # Keep this many files as an archive, script is run once a week
# a specific host, but will differ between hosts # a specific host, but will differ between hosts
sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk '{print $1}') / 2))m sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk '{print $1}') / 2))m
for logfile in $(ls /opt/multinode/*/{nextcloud.log,server/server.log}); do for logfile in $(ls /opt/multinode/*/{nextcloud.log,audit.log,server/server.log}); do
if [[ -f ${logfile}.gz.${no_files} ]]; then if [[ -f ${logfile}.gz.${no_files} ]]; then
rm ${logfile}.gz.${no_files} rm ${logfile}.gz.${no_files}
fi fi

View file

@ -13,6 +13,7 @@ services:
- /opt/nextcloud/cli.php.ini:/etc/php/8.0/cli/php.ini - /opt/nextcloud/cli.php.ini:/etc/php/8.0/cli/php.ini
- <%= @config_php_path %>:/var/www/html/config/config.php - <%= @config_php_path %>:/var/www/html/config/config.php
- <%= @nextcloud_log_path %>:/var/www/html/data/nextcloud.log - <%= @nextcloud_log_path %>:/var/www/html/data/nextcloud.log
- <%= @audit_log_path %>:/var/www/html/data/audit.log
- <%= @rclone_conf_path %>:/rclone.conf - <%= @rclone_conf_path %>:/rclone.conf
environment: environment:
- NC_PASS=<%= @admin_password%> - NC_PASS=<%= @admin_password%>
@ -25,7 +26,7 @@ services:
- 89.32.32.32 - 89.32.32.32
ports: ports:
- <%= @https_port %>:443 - <%= @https_port %>:443
command: apachectl -D FOREGROUND command: sh -c 'tail -F /var/www/html/data/nextcloud.log /var/www/html/data/audit.log| tee -a /proc/1/fd/2 & apachectl -D FOREGROUND'
tty: true tty: true
networks: networks: