Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar.sh 1792 2016-02-08 14:15:25Z franck $
|
2 |
# $Id: alcasar.sh 1800 2016-02-28 18:02:27Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
|
5 |
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
Line 923... |
Line 923... |
923 |
$MYSQL="DROP DATABASE IF EXISTS test;DROP DATABASE IF EXISTS tmp;"
|
923 |
$MYSQL="DROP DATABASE IF EXISTS test;DROP DATABASE IF EXISTS tmp;"
|
924 |
$MYSQL="CONNECT mysql;DELETE from user where User='';DELETE FROM user WHERE User='root' AND Host NOT IN ('localhost','127.0.0.1','::1');FLUSH PRIVILEGES;"
|
924 |
$MYSQL="CONNECT mysql;DELETE from user where User='';DELETE FROM user WHERE User='root' AND Host NOT IN ('localhost','127.0.0.1','::1');FLUSH PRIVILEGES;"
|
925 |
# Create 'radius' database
|
925 |
# Create 'radius' database
|
926 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_RADIUS;GRANT ALL ON $DB_RADIUS.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES;"
|
926 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_RADIUS;GRANT ALL ON $DB_RADIUS.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES;"
|
927 |
# Add an empty radius database structure
|
927 |
# Add an empty radius database structure
|
928 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIR_CONF/radiusd-db-vierge.sql
|
928 |
mysql -u$DB_USER -p$radiuspwd $DB_RADIUS < $DIR_CONF/empty-radiusd-db.sql
|
929 |
# modify the start script in order to close accounting connexion when the system is comming down or up
|
929 |
# modify the start script in order to close accounting connexion when the system is comming down or up
|
930 |
[ -e /lib/systemd/system/mysqld.service.default ] || cp /lib/systemd/system/mysqld.service /lib/systemd/system/mysqld.service.default
|
930 |
[ -e /lib/systemd/system/mysqld.service.default ] || cp /lib/systemd/system/mysqld.service /lib/systemd/system/mysqld.service.default
|
931 |
$SED "/ExecStartPost=/a ExecStop=/usr/local/sbin/alcasar-mysql.sh -acct_stop" /usr/lib/systemd/system/mysqld.service
|
931 |
$SED "/ExecStartPost=/a ExecStop=/usr/local/sbin/alcasar-mysql.sh -acct_stop" /usr/lib/systemd/system/mysqld.service
|
932 |
$SED "/ExecStartPost=/a ExecStartPost=/usr/local/sbin/alcasar-mysql.sh -acct_stop" /lib/systemd/system/mysqld.service
|
932 |
$SED "/ExecStartPost=/a ExecStartPost=/usr/local/sbin/alcasar-mysql.sh -acct_stop" /lib/systemd/system/mysqld.service
|
933 |
/usr/bin/systemctl daemon-reload
|
933 |
/usr/bin/systemctl daemon-reload
|
Line 939... |
Line 939... |
939 |
## - Affectation du secret partagé entre coova-chilli et freeradius ##
|
939 |
## - Affectation du secret partagé entre coova-chilli et freeradius ##
|
940 |
## - Modification de fichier de conf pour l'accès à Mysql ##
|
940 |
## - Modification de fichier de conf pour l'accès à Mysql ##
|
941 |
##########################################################################
|
941 |
##########################################################################
|
942 |
radius ()
|
942 |
radius ()
|
943 |
{
|
943 |
{
|
944 |
cp -f $DIR_CONF/radiusd-db-vierge.sql /etc/raddb/
|
944 |
cp -f $DIR_CONF/empty-radiusd-db.sql /etc/raddb/
|
945 |
chown -R radius:radius /etc/raddb
|
945 |
chown -R radius:radius /etc/raddb
|
946 |
[ -e /etc/raddb/radiusd.conf.default ] || cp /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.default
|
946 |
[ -e /etc/raddb/radiusd.conf.default ] || cp /etc/raddb/radiusd.conf /etc/raddb/radiusd.conf.default
|
947 |
# Set radius.conf parameters
|
947 |
# Set radius.conf parameters
|
948 |
$SED "s?^[\t ]*#[\t ]*user =.*?user = radius?g" /etc/raddb/radiusd.conf
|
948 |
$SED "s?^[\t ]*#[\t ]*user =.*?user = radius?g" /etc/raddb/radiusd.conf
|
949 |
$SED "s?^[\t ]*#[\t ]*group =.*?group = radius?g" /etc/raddb/radiusd.conf
|
949 |
$SED "s?^[\t ]*#[\t ]*group =.*?group = radius?g" /etc/raddb/radiusd.conf
|
Line 1784... |
Line 1784... |
1784 |
{
|
1784 |
{
|
1785 |
# Create 'gammu' databse
|
1785 |
# Create 'gammu' databse
|
1786 |
MYSQL="/usr/bin/mysql -uroot -p$mysqlpwd --exec"
|
1786 |
MYSQL="/usr/bin/mysql -uroot -p$mysqlpwd --exec"
|
1787 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_GAMMU;GRANT ALL ON $DB_GAMMU.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES"
|
1787 |
$MYSQL="CREATE DATABASE IF NOT EXISTS $DB_GAMMU;GRANT ALL ON $DB_GAMMU.* TO $DB_USER@localhost IDENTIFIED BY '$radiuspwd';FLUSH PRIVILEGES"
|
1788 |
# Add a gammu database structure
|
1788 |
# Add a gammu database structure
|
1789 |
mysql -u$DB_USER -p$radiuspwd $DB_GAMMU < $DIR_CONF/gammu-smsd-db-vierge.sql
|
1789 |
mysql -u$DB_USER -p$radiuspwd $DB_GAMMU < $DIR_CONF/empty-gammu-smsd-db.sql
|
1790 |
|
1790 |
|
1791 |
# config file for the daemon
|
1791 |
# config file for the daemon
|
1792 |
cat << EOF > /etc/gammu_smsd_conf
|
1792 |
cat << EOF > /etc/gammu_smsd_conf
|
1793 |
[gammu]
|
1793 |
[gammu]
|
1794 |
port = /dev/ttyUSB0
|
1794 |
port = /dev/ttyUSB0
|