Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
#
|
2 |
#
|
3 |
# $Id: alcasar-generate_log.sh 2719 2019-04-05 11:45:35Z tom.houdayer $
|
3 |
# $Id: alcasar-generate_log.sh 3269 2025-04-21 21:57:13Z rexy $
|
4 |
#
|
4 |
#
|
5 |
#Corrélation et Generation des logs d'imputabilité au format PDF.
|
5 |
#Corrélation et Generation des logs d'imputabilité au format PDF.
|
6 |
#Ce script permet de générer un fichier HTML qui sera converti en PDF a l'aide du RPM wkhtmltopdf.
|
6 |
#Ce script permet de générer un fichier HTML qui sera converti en PDF a l'aide du RPM wkhtmltopdf.
|
7 |
#Ce PDF sera placé dans une archive protégé par un mot de passe.
|
7 |
#Ce PDF sera placé dans une archive protégé par un mot de passe.
|
8 |
#Pour extraire ce fichier PDF, il faudra installer le paquet p7zip.
|
8 |
#Pour extraire ce fichier PDF, il faudra installer le paquet p7zip.
|
Line 74... |
Line 74... |
74 |
rm $ARCHIVE_LOCATION
|
74 |
rm $ARCHIVE_LOCATION
|
75 |
fi
|
75 |
fi
|
76 |
|
76 |
|
77 |
|
77 |
|
78 |
#get log information for each users
|
78 |
#get log information for each users
|
79 |
mysql -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
79 |
mariadb -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
80 |
|
80 |
|
81 |
#Create HTML document which contains every informations about users
|
81 |
#Create HTML document which contains every informations about users
|
82 |
echo "<!DOCTYPE html>" > $TMP_HTML
|
82 |
echo "<!DOCTYPE html>" > $TMP_HTML
|
83 |
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" >> $TMP_HTML
|
83 |
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" >> $TMP_HTML
|
84 |
echo "<TITLE>ALCASAR Report</TITLE>" >> $TMP_HTML
|
84 |
echo "<TITLE>ALCASAR Report</TITLE>" >> $TMP_HTML
|
Line 150... |
Line 150... |
150 |
echo "</body>" >> $TMP_HTML
|
150 |
echo "</body>" >> $TMP_HTML
|
151 |
echo "</HTML>" >> $TMP_HTML
|
151 |
echo "</HTML>" >> $TMP_HTML
|
152 |
|
152 |
|
153 |
# inform users about that by setting the Alcasar-Imputability-Warning attribute
|
153 |
# inform users about that by setting the Alcasar-Imputability-Warning attribute
|
154 |
QUERY="INSERT INTO radreply (username, attribute, value, op) SELECT ui.username, 'Alcasar-Imputability-Warning', '1' , '=' FROM userinfo ui LEFT JOIN radreply rr ON rr.username = ui.username AND rr.attribute = 'Alcasar-Imputability-Warning' WHERE rr.username IS NULL;"
|
154 |
QUERY="INSERT INTO radreply (username, attribute, value, op) SELECT ui.username, 'Alcasar-Imputability-Warning', '1' , '=' FROM userinfo ui LEFT JOIN radreply rr ON rr.username = ui.username AND rr.attribute = 'Alcasar-Imputability-Warning' WHERE rr.username IS NULL;"
|
155 |
mysql -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
155 |
mariadb -u root -p"$DB_ROOT_PW" -D radius -e "$QUERY"
|
156 |
|
156 |
|
157 |
/usr/bin/wkhtmltopdf $TMP_HTML $TMP_PDF
|
157 |
/usr/bin/wkhtmltopdf $TMP_HTML $TMP_PDF
|
158 |
|
158 |
|
159 |
|
159 |
|
160 |
/usr/bin/7za a -tzip -p"$1" -mem=AES256 $ARCHIVE_LOCATION $TMP_PDF
|
160 |
/usr/bin/7za a -tzip -p"$1" -mem=AES256 $ARCHIVE_LOCATION $TMP_PDF
|