Fix non SSL for kalkun. Add default contact group. Add new user in contact group

This commit is contained in:
poka 2019-12-18 01:53:42 +01:00
parent 031d8680fb
commit 27d6fd33fe
9 changed files with 27 additions and 16 deletions

View File

@ -70,7 +70,6 @@ php() {
sudo apt -y install lsb-release apt-transport-https ca-certificates || err+="Install apt-transport-https"
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg || err+="Download PHP key"
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 || err+="Download PHP key"
sudo apt update
sudo apt -y install software-properties-common dirmngr nginx php7.3 php7.3-common php7.3-gettext php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-imap php7.3-mbstring php7.3-xml php7.3-cli mariadb-server || err+="Install PHP and MySQL"
else

View File

@ -38,6 +38,8 @@ if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'outbox';") ]]; then
fi
if [[ -z $(sudo mysql gammu -e "SHOW TABLES LIKE 'kalkun';") ]]; then
echo -e "${c_yellow}Importation du dump kalkun...$c_"
[[ ! $ADRESSE ]] && ADRESSE=G1GROUPE
sed -i "s/_GROUPDEF/$ADRESSE/g" $MY_PATH/templates/4a/kalkun.sql
sudo mysql gammu < $MY_PATH/templates/4a/kalkun.sql || err+="Import dump Kalkun"
fi

View File

@ -51,6 +51,7 @@ create_certificate() {
case $action in
on)
sudo sed -i 's/ #if/ if/g' /etc/nginx/conf.d/$APP.conf
sudo sed -i 's/ #add/ add/g' /etc/nginx/conf.d/$APP.conf
sudo sed -i "s/listen 443;/listen 443 ssl;/g" /etc/nginx/conf.d/$APP.conf
[[ ! -d /etc/nginx/includes ]] && sudo mkdir /etc/nginx/includes
@ -60,6 +61,8 @@ on)
off)
sudo sed -i "s/ if/ #if/g" /etc/nginx/conf.d/$APP.conf
sudo sed -i "s/ add/ #add/g" /etc/nginx/conf.d/$APP.conf
sudo sed -i "/ssl.conf;/d" /etc/nginx/conf.d/$APP.conf
sudo sed -i "/ssl_certificate/d" /etc/nginx/conf.d/$APP.conf
;;

View File

@ -4,9 +4,7 @@ server {
listen [::]:443 ssl;
server_name _DOMAIN;
add_header Content-Security-Policy upgrade-insecure-requests;
# add_header 'Access-Control-Allow-Origin' '*';
#add_header Content-Security-Policy upgrade-insecure-requests;
#if ($http_x_forwarded_proto = "http") { return 301 https://$server_name$request_uri; }
location / {

View File

@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `user` (
--
INSERT INTO `user` (`id_user`, `username`, `realname`, `password`, `phone_number`, `level`) VALUES
(1, 'kalkun', 'Kalkun SMS', 'f0af18413d1c9e0366d8d1273160f55d5efeddfe', '123456789', 'admin');
(1, 'admin', 'G1Admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', '0600000000', 'admin');
-- --------------------------------------------------------
@ -147,9 +147,9 @@ CREATE TABLE IF NOT EXISTS `user_settings` (
`paging` int(2) NOT NULL DEFAULT '10',
`bg_image` varchar(50) NOT NULL,
`delivery_report` enum('default','yes','no') NOT NULL DEFAULT 'default',
`language` varchar(20) NOT NULL DEFAULT 'english',
`language` varchar(20) NOT NULL DEFAULT 'french',
`conversation_sort` enum('asc','desc') NOT NULL DEFAULT 'asc',
`country_code` varchar(2) NOT NULL DEFAULT 'US',
`country_code` varchar(2) NOT NULL DEFAULT 'FR',
PRIMARY KEY (`id_user`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@ -158,7 +158,7 @@ CREATE TABLE IF NOT EXISTS `user_settings` (
--
INSERT INTO `user_settings` (`id_user`, `theme`, `signature`, `permanent_delete`, `paging`, `bg_image`, `delivery_report`, `language`, `conversation_sort`) VALUES
(1, 'green', 'false;--\nPut your signature here', 'false', 20, 'true;background.jpg', 'default' , 'english', 'asc');
(1, 'green', 'false;--\nVotre signature ici', 'false', 20, 'true;background.jpg', 'default' , 'french', 'asc');
-- --------------------------------------------------------
@ -329,3 +329,12 @@ CREATE TABLE `ci_sessions` (
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Insert default contact group
--
INSERT INTO `pbk_groups` (`ID`, `Name`, `id_user`, `is_public`) VALUES
('1', 'Blois', '1', 'false');

View File

@ -629,7 +629,7 @@ function add_contact(){
local reqPhoneExist="SELECT * FROM pbk WHERE Number=$PHONE"
if [[ -z $($sql "$reqPhoneExist") ]]; then
local reqAddContact="INSERT INTO pbk (GroupID, Name, Number, id_user, is_public) VALUES ('-1', '$MEMBERUID', '$PHONE', '1', 'false')"
local reqAddContact="INSERT INTO pbk (GroupID, Name, Number, id_user, is_public) VALUES ('1', '$MEMBERUID', '$PHONE', '1', 'false')"
$sql "$reqAddContact" || exit 1
else
log "${red}Contact already exist$c_"

View File

@ -1,6 +1,6 @@
#!/bin/bash
##################################################################
# Author: Fred (support@qo-op.com)
# Author: poka (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
##################################################################
@ -61,13 +61,13 @@ fi
export NODECOMM=10
##################################################################
# SMS SIM Card Phone Number
export MASTERPHONE="+33651136520"
export ADRESSE="G1_Fablab_Toulouse"
export MASTERPHONE="+3368818767"
export ADRESSE="Blois"
export G1DAB="NO"
##################################################################
# ADMIN COMMAND PHONE ORIGIN
export ADMINPHONE="+33647683646"
export ADMINPSEUDO="Fred"
export ADMINPHONE="+33650573417"
export ADMINPSEUDO="poka"
##################################################################
# DUNITER/CESIUM+ DEFAULT SERVERS
export DUNITER="https://g1.duniter.org"

View File

@ -72,7 +72,7 @@ $back"
sms_SEND "$PHONE" "$mess"
# Remove contact from database
rm_contact $MEMBERUID $PHONE && log "${c_green}Contact has been deleted from database$c_" || "${c_red}Contact can't be deleted database$c_"
rm_contact $MEMBERUID $PHONE && log "${c_green}Contact has been deleted from database$c_" || log "${c_red}Contact can't be deleted database$c_"
log "${c_yellow}__SUB:sms_DESTROY.sh: END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~$c_"
exit

View File

@ -52,7 +52,7 @@ sms_SEND "$PHONE" "Compte relié? $MEMBER $MAIL
$MEMRIB"
# Add contact to database
add_contact $MEMBERUID $PHONE && log "${c_green}Contact has been added to database$c_" || "${c_red}Contact can't be added to database$c_"
add_contact $MEMBERUID $PHONE && log "${c_green}Contact has been added to database$c_" || log "${c_red}Contact can't be added to database$c_"
log "${c_yellow}END sms_NEW.sh$c_"
log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"