Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 2470 2017-12-27 18:46:44Z richard $
|
2 |
# $Id: alcasar.sh 2471 2017-12-29 16:47:48Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
|
5 |
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (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 |
# team@alcasar.net
|
7 |
# team@alcasar.net
|
Line 1159... |
Line 1159... |
1159 |
WHERE username='%{\${key}}' \
|
1159 |
WHERE username='%{\${key}}' \
|
1160 |
AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%%b'),0)"
|
1160 |
AND UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%%b'),0)"
|
1161 |
EOF
|
1161 |
EOF
|
1162 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default ] || cp /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default
|
1162 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default ] || cp /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default
|
1163 |
cat << EOF > /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf
|
1163 |
cat << EOF > /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf
|
1164 |
# This is the query modified for ALCASAR needs (thanks to Daniel Laliberte --> authorized period after the first connection)
|
1164 |
# This query was modified for ALCASAR needs (amount of time the voucher is enabled --> rename it in the future : 'Expire_on_login')
|
1165 |
query = "\
|
1165 |
query = "\
|
1166 |
SELECT IFNULL((SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) \
|
1166 |
SELECT IFNULL((SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) \
|
1167 |
FROM radacct \
|
1167 |
FROM radacct \
|
1168 |
WHERE UserName='%{\${key}}' \
|
1168 |
WHERE UserName='%{\${key}}' \
|
1169 |
ORDER BY acctstarttime \
|
1169 |
ORDER BY acctstarttime \
|