Subversion Repositories ALCASAR

Rev

Rev 3265 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3265 Rev 3269
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-archive.sh 3265 2025-04-09 21:22:46Z rexy $
2
# $Id: alcasar-archive.sh 3269 2025-04-21 21:57:13Z rexy $
3
 
3
 
4
# alcasar-archive.sh
4
# alcasar-archive.sh
5
# by Franck BOUIJOUX and REXY
5
# by Franck BOUIJOUX and REXY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 93... Line 93...
93
# Cleanup of files older than 365 days
93
# Cleanup of files older than 365 days
94
		cleanup
94
		cleanup
95
# make an archive
95
# make an archive
96
		archive
96
		archive
97
# Saving of the database
97
# Saving of the database
98
		/usr/local/bin/alcasar-mysql.sh --dump
98
		/usr/local/bin/alcasar-mariadb.sh --dump
99
# Encryption of the archive
99
# Encryption of the archive
100
 		if [ -e /tmp/$FILE ]; then
100
 		if [ -e /tmp/$FILE ]; then
101
			if [ $CRYPT -eq "1" ]; then
101
			if [ $CRYPT -eq "1" ]; then
102
			{
102
			{
103
				# 1 ) chiffrement/signature =1 ==> gpg --encrypt avec test de la clé présente
103
				# 1 ) chiffrement/signature =1 ==> gpg --encrypt avec test de la clé présente
Line 124... Line 124...
124
		mkdir -p /tmp/live
124
		mkdir -p /tmp/live
125
		gap=7
125
		gap=7
126
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
126
		cd /var/log/nfsen/profiles-data/live/alcasar_netflow
127
		find . -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
127
		find . -mtime -$gap -name 'nfcapd.[0-9]*' | xargs tar -cf /tmp/live/traceability-ALL-$NOW.tar;
128
# Saving of the database
128
# Saving of the database
129
		/usr/local/bin/alcasar-mysql.sh --dump
129
		/usr/local/bin/alcasar-mariadb.sh --dump
130
		mv $(echo $(ls -rt $DIR_BASE/alcasar-users-database-*.sql.gz | tail -n 1 -)) /tmp/live/
130
		mv $(echo $(ls -rt $DIR_BASE/alcasar-users-database-*.sql.gz | tail -n 1 -)) /tmp/live/
131
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
131
		cp /var/log/firewall/traceability.log /tmp/live/traceability-HTTP-$NOW.log
132
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*
132
		tar -czf $DIR_ARCHIVE/traceability-$NOW.tar.gz /tmp/live/*
133
		rm -rf /tmp/live
133
		rm -rf /tmp/live
134
		;;
134
		;;