/alcasar.sh |
---|
862,6 → 862,9 |
$SED "s?^application/pkix-cert.*?application/pkix-cert der?g" /etc/mime.types |
# Launch after coova (in order to wait tun0 to be up) |
$SED "s?^After=.*?After=network.target remote-fs.target nss-lookup.target chilli.service?g" /lib/systemd/system/httpd.service |
# Log file for ACC access imputability |
[ -e /var/Save/security/acc_access.log ] || touch /var/Save/security/acc_access.log |
chmod 644 /var/Save/security/acc_access.log |
} # End of ACC () |
########################################################################## |
/conf/logrotate.d/php_admin_log |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/conf/logrotate.d/admin_log |
---|
0,0 → 1,7 |
/var/Save/security/acc_access.log{ |
rotate 12 |
monthly |
missingok |
notifempty |
endscript |
} |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/scripts/alcasar-activity_report.sh |
---|
567,13 → 567,13 |
ROWS="" |
while read -r access ; do |
access_datas=(${access//|||/ }) |
access_datas=(${access//|/ }) |
accces_date_intl=$(echo "${access_datas[0]} ${access_datas[1]}" | sed -E 's@^([0-9]{2})+/+([0-9]{2})+/+([0-9]{4})+@\3-\2-\1@') # Convert date format DD/MM/YYYY to YYYY-MM-DD |
access_date=$(date -d "$accces_date_intl" +%s) |
access_user=${access_datas[2]} |
access_ip=${access_datas[3]} |
access_agent=${access_datas[4]} |
if [ $access_date -lt $SECS_AGO ]; then |
break |
fi |
580,18 → 580,18 |
access_date_formatted=$(date -d @$access_date +"%x %X") |
ROWS="$ROWS<tr><td>$access_date_formatted</td><td>$access_user</td><td>$access_ip</td></tr>" |
done < <(cat /var/www/html/acc/admin_log.txt | sort -r) |
ROWS="$ROWS<tr><td>$access_date_formatted</td><td>$access_user</td><td>$access_ip</td><td>$access_agent</td></tr>" |
done < <(cat /var/Save/security/acc_access.log | sort -r) |
# TODO: Read archives if necessary |
if [ -z "$ROWS" ]; then |
ROWS="<tr><td colspan=\"3\" style=\"text-align: center;\">Aucune connexion</td></tr>" |
ROWS="<tr><td colspan=\"4\" style=\"text-align: center;\">Aucune connexion</td></tr>" |
fi |
# Create HTML document |
echo "<h2>Connexion à l'ALCASAR Control Center (ACC)</h2>" >> $HTML_REPORT |
echo "<table class=\"table table-striped\">" >> $HTML_REPORT |
echo "<thead><tr><th>Date</th><th>Utilisateur</th><th>Adresse IP</th></tr></thead><tbody>" >> $HTML_REPORT |
echo "<thead><tr><th>Date</th><th>Utilisateur</th><th>Adresse IP</th><th>Agent</th></tr></thead><tbody>" >> $HTML_REPORT |
echo $ROWS >> $HTML_REPORT |
echo "</tbody></table>" >> $HTML_REPORT |
/web/acc/admin_log.php |
---|
15,7 → 15,7 |
// Read access log |
$accessLogs = []; |
$accessLogFilename = 'admin_log.txt'; |
$accessLogFilename = '/var/Save/security/acc_access.log'; |
$filePtn = fopen($accessLogFilename, 'r'); |
if ($filePtn !== false){ |
while (!feof($filePtn)) { |
23,11 → 23,12 |
if (empty($ligne)) { |
continue; |
} |
$infos = explode('|||', $ligne); |
$infos = explode('|', $ligne); |
$accessLogs[] = (object) [ |
'date' => trim($infos[0]), |
'username' => trim($infos[1]), |
'ip' => trim($infos[2]) |
'date' => trim($infos[0]), |
'username' => trim($infos[1]), |
'ip' => trim($infos[2]), |
'user_agent' => trim($infos[3]) |
]; |
} |
fclose($filePtn); |
72,6 → 73,7 |
<th>Date</th> |
<th>User</th> |
<th>IP address</th> |
<th>Agent</th> |
</tr> |
</thead> |
<tbody> |
85,6 → 87,7 |
<td><?= $access->date ?></td> |
<td><?= $access->username ?></td> |
<td><?= $access->ip ?></td> |
<td><?= $access->user_agent ?></td> |
</tr> |
<?php endforeach; ?> |
<?php endif; ?> |
/web/acc/haut.php |
---|
1,26 → 1,14 |
<?php |
# $Id$ |
// Access counter incrementation |
$counterFilename = 'compteur.txt'; |
$fp = fopen($counterFilename, 'r+'); |
if ($fp === false) { |
exit(); |
} |
$nbAccess = intval(fgets($fp, 10)); |
$nbAccess++; |
rewind($fp); |
fputs($fp, $nbAccess.PHP_EOL); |
fclose($fp); |
// Inform admin log about his last connection |
$admin_log = 'admin_log.txt'; |
$admin_log = '/var/Save/security/acc_access.log'; |
$user_htdigest = $_SERVER['PHP_AUTH_USER']; |
$date_system = date('d/m/Y H:i:s'); |
$user_ip = $_SERVER['REMOTE_ADDR']; |
$text = $date_system . '|||' . $user_htdigest . '|||' . $user_ip; |
$user_agent = $_SERVER['HTTP_USER_AGENT']; |
$text = $date_system . '|' . $user_htdigest . '|' . $user_ip . '|' . $user_agent; |
file_put_contents($admin_log, $text.PHP_EOL, FILE_APPEND); |
?> |
<!doctype html> |
<!-- Writen by Rexy --> |
/web/acc/menu.php |
---|
1,13 → 1,20 |
<?php |
# $Id $ |
define ('CONF_FILE', '/usr/local/etc/alcasar.conf'); |
/******************** |
* READ CONF FILES * |
*********************/ |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
define ("ACC_ACCESS_LOG", "/var/Save/security/acc_access.log"); |
$conf_files=array(CONF_FILE,ACC_ACCESS_LOG); |
foreach ($conf_files as $file){ |
if (!file_exists($file)){ |
exit("Requested file ".$file." isn't present");} |
if (!is_readable($file)){ |
exit("Can't read the file ".$file);} |
} |
// Read CONF_FILE |
$file_conf = fopen(CONF_FILE, 'r'); |
if (!$file_conf) { |
exit('Error opening the file '.CONF_FILE); |
} |
$file_conf = fopen(CONF_FILE, 'r'); # retrieve the version number |
while (!feof($file_conf)) { |
$tampon = fgets($file_conf, 4096); |
if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) { |
26,8 → 33,7 |
<link rel="stylesheet" href="/css/style.css" type="text/css"> |
</HEAD> |
<? |
//determine le droit de l'utilisateur connecté via htdigest |
// retrieve the user's profil |
exec('sudo alcasar-profil.sh -l | cut -d":" -f2 2>&1', $output); |
$user_htdigest=$_SERVER['PHP_AUTH_USER']; |
69,7 → 75,7 |
$l_whitelist = "Liste blanche"; |
$l_network = "Réseau"; |
$l_ldap = "Ldap/A.D."; |
$l_access_nb = "Accès au centre"; |
$l_access_nb = "Nb d'accès à l'ACC"; |
$l_create_user = "Créer des utilisateurs"; |
$l_edit_user = "Gérer les utilisateurs"; |
$l_create_group = "Créer un groupe"; |
89,6 → 95,7 |
$l_backup_archive="Archives"; |
$l_activity_report="Rapport d'activité"; |
$l_backup_log="Journaux d'imputabilité"; |
$l_since="depuis le :"; |
} |
else |
{ |
104,7 → 111,7 |
$l_whitelist = "Whitelist"; |
$l_network = "Network"; |
$l_ldap = "Ldap/A.D."; |
$l_access_nb = "Access to center"; |
$l_access_nb = "ACC access Nbr"; |
$l_create_user = "Create users"; |
$l_edit_user = "Manage users"; |
$l_create_group = "Create a group"; |
122,6 → 129,7 |
$l_backup_archive="Archives"; |
$l_backup_log="Log generation"; |
$l_activity_report="Activity report"; |
$l_since="since"; |
} |
echo " |
<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=0> |
214,20 → 222,18 |
<tr bgcolor="#666666"><td> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0> |
<tr><td valign="middle" align="center"> |
<a href="admin_log.php" target="REXY2" > |
<? // Access counter |
$name_fic="compteur.txt"; |
if (($fp=fopen($name_fic,"r")) == false) exit; |
$nb=fgets($fp,10); |
fclose($fp); |
printf("%d", $nb); |
<a href="admin_log.php" target="REXY2"> |
<? |
$tab=file(ACC_ACCESS_LOG); |
$counter=count ($tab); |
$field=explode("|", $tab[1]); |
$first_date_time=$field[0]; |
$first_date=explode(" ", $first_date_time); |
echo "$counter</a><br>"; |
echo "$l_since $first_date[0]"; |
?> |
</a> |
<br>depuis le 13/08/2013<br></center></td></tr> |
</TABLE> |
</td></tr> |
</TABLE> |
</BODY> |
</HTML> |