Impossible d’utiliser les DNS Jeedom ! Quel dommage : c’était les seuls compatibles avec le proxy de mon travail
Je ne sais pas comment faire pour les faire fonctionner :
J’ai pourtant bien un fichier SH qui se lance au démarrage du NAS comme quand j’étais en version DSM 6.2 et qui résolvait le probleme …
#!/bin/sh
# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
if ( [ ! -d /dev/net ] ); then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
fi
# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
insmod /lib/modules/tun.ko
fi
# Load iptables mangle is not already loaded
if ( !(lsmod |grep -q "^iptable_mangle\s") ); then
insmod /lib/modules/iptable_mangle.ko
fi
Voici la copie des logs :
Sun Apr 24 09:00:43 2022 WARNING: file '/tmp/jeedom/openvpn/openvpn_auth_EFuWMbgmZh9p7j7LMa11eLZ6WEVxw6.conf' is group or others accessible
Sun Apr 24 09:00:43 2022 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Apr 28 2021
Sun Apr 24 09:00:43 2022 library versions: OpenSSL 1.1.1d 10 Sep 2019, LZO 2.10
Sun Apr 24 09:00:43 2022 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Sun Apr 24 09:00:43 2022 OpenSSL: error:0200100D:system library:fopen:Permission denied
Sun Apr 24 09:00:43 2022 OpenSSL: error:2006D002:BIO routines:BIO_new_file:system lib
Sun Apr 24 09:00:43 2022 Cannot load CA certificate file /var/www/html/plugins/openvpn/core/class/../../data/ca_EFuWMbgmZh9p7j7LMa11eLZ6WEVxw6.crt (no entries were read)
Sun Apr 24 09:00:43 2022 Exiting due to fatal error
Pourtant la liaison au market est ok et mon docker apparait bien dans la liste des boxs liées à mon compte market…
Bonjour
tun.ko est bien dans le répertoire /lib/modules/ je viens de vérifier
Ce qui est étrange c’est que sous DSM6.2.x les DNS Jeedom fonctionnaient avec ce fichier SH au démarrage mais plus depuis le passage en DSM7… je ne comprends pas pourquoi
Assurez-vous qu’il ne fonctionne pas en mode privilégié et que « devices » (ajoutez un nouveau périphérique) a /dev/net/tun dans les deux zones de texte
La dernière chose est dans l’onglet « Capacités »:
Ajouter une nouvelle fonctionnalité « NET_ADMIN »
De ce que je crois comprendre, il faut modifier le fichier docker-compose
Pour commencer avec le paquet Docker j’ai désactivé « Executer le contener avec des privileges élevés » (alors que dans le doc jeedom il est demandé d’activé les privilèes élevés) et j’ai configuré les fonctionnalités ainsi : j’ai ajouté les 3 indiqués :
J’ai cliqué sur Ok et j’ai fait comme sous DSM 6.2.
Lancer le contener
Désinstallé le plugin OpenVPN
Redémarrer Jeedom
Activer la prise en charge des DNS Jeedom dans config / reseaux
Et relancé les DNS
et malheureusement toujours Erreur 500 : pas d’accès
J’ai recommencé en activant « Executer le contener avec des privileges élevés » : et idem ne fonctionne pas : pas d’accès par les DNS Jeedom…
.
Voici les logs « openvpn DNS Jeedom »
Tue Apr 26 06:18:55 2022 WARNING: file '/tmp/jeedom/openvpn/openvpn_auth_7mlryOMykYWCS5mZEMtYs1uvE96Y61.conf' is group or others accessible
Tue Apr 26 06:18:55 2022 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Apr 28 2021
Tue Apr 26 06:18:55 2022 library versions: OpenSSL 1.1.1d 10 Sep 2019, LZO 2.10
Tue Apr 26 06:18:55 2022 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Tue Apr 26 06:18:55 2022 OpenSSL: error:0200100D:system library:fopen:Permission denied
Tue Apr 26 06:18:55 2022 OpenSSL: error:2006D002:BIO routines:BIO_new_file:system lib
Tue Apr 26 06:18:55 2022 Cannot load CA certificate file /var/www/html/plugins/openvpn/core/class/../../data/ca_7mlryOMykYWCS5mZEMtYs1uvE96Y61.crt (no entries were read)
Tue Apr 26 06:18:55 2022 Exiting due to fatal error
et les logs "http erroe:
[Tue Apr 26 06:16:15.213512 2022] [core:warn] [pid 443] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Apr 26 06:16:15.221598 2022] [mpm_prefork:notice] [pid 443] AH00163: Apache/2.4.38 (Debian) configured -- resuming normal operations
[Tue Apr 26 06:16:15.221662 2022] [core:notice] [pid 443] AH00094: Command line: '/usr/sbin/apache2'
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Failed to talk to init daemon.
[Tue Apr 26 06:18:06.942463 2022] [php7:error] [pid 492] [client 172.17.0.1:49332] PHP Fatal error: Uncaught Error: Class 'openvpn' not found in /var/www/html/core/class/network.class.php:329
Stack trace:
#0 /var/www/html/core/class/network.class.php(444): network::dns_create()
#1 /var/www/html/core/class/config.class.php(343): network::dns_run()
#2 /var/www/html/core/class/config.class.php(105): config::postConfig_market_allowDns('1')
#3 /var/www/html/core/ajax/config.ajax.php(80): config::save('market::allowDN...', '1', 'core')
#4 {main}
thrown in /var/www/html/core/class/network.class.php on line 329, referer: http://192.168.1.30:9082/index.php?v=d&p=administration
.
.
.
.
Il reste la piste pour ajouter
- "/dev/net/tun"
il faut obligatoirement passer par un Docker Compose ? Je vais essayer de le faire
Mais n’y a t il pas moyen de modifier les paramètres environnement ? ou les liens ?
Et je crée l’image
puis le container et j’ai un souci avec le réseau bridge a priori:
je recommence du début avec un réseau MacVLan ! A priori le contener ne se lance pas :
Je viens de tester en DSM7 avec un réseau macvlan
j’ai lancé le script
#!/bin/sh
# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
if ( [ ! -d /dev/net ] ); then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
fi
# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
insmod /lib/modules/tun.ko
fi
# Load iptables mangle is not already loaded
if ( !(lsmod |grep -q "^iptable_mangle\s") ); then
insmod /lib/modules/iptable_mangle.ko
fi
Tu lances la commande docker-compose up -d Depuis quel répertoire ?
Tu as déjà réussi à faire fonctionner un conteneur suivant le tuto ?
Ou c’est la première fois
J’ai refait une Docker complet avec les fichiers utilisés la dernière fois (je les avais gardé précieusement) et effectivement la cela fonctionne : le Docker est en train de s’installer !
C’est le fichier init.sh qui est bien différent : voici le fichier avec lequel le docker : l’ancien fichier : init new ok fonctionne.txt (1,4 Ko)
il est bien différent
il y à le mot de passe au début
Et comme tu l’as dit cela fonctionne les DNS de Jeedom !
Fichier init du tuto qui ne fonctionne pas chez moi :
#!/bin/bash
echo 'Start init'
if [ -f /var/www/html/core/config/common.config.php ]; then
echo 'Jeedom is already install'
else
echo 'Start jeedom installation'
rm -rf /root/install.sh
wget https://raw.githubusercontent.com/jeedom/core/alpha/install/install.sh -O /root/install.sh
chmod +x /root/install.sh
/root/install.sh -s 6
if [ $(which mysqld | wc -l) -ne 0 ]; then
chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
service mysql restart
MYSQL_JEEDOM_PASSWD=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 15)
echo "DROP USER 'jeedom'@'localhost';" | mysql > /dev/null 2>&1
echo "CREATE USER 'jeedom'@'localhost' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';" | mysql
echo "DROP DATABASE IF EXISTS jeedom;" | mysql
echo "CREATE DATABASE jeedom;" | mysql
echo "GRANT ALL PRIVILEGES ON jeedom.* TO 'jeedom'@'localhost';" | mysql
cp /var/www/html/core/config/common.config.sample.php /var/www/html/core/config/common.config.php
sed -i "s/#PASSWORD#/${MYSQL_JEEDOM_PASSWD}/g" /var/www/html/core/config/common.config.php
sed -i "s/#DBNAME#/jeedom/g" /var/www/html/core/config/common.config.php
sed -i "s/#USERNAME#/jeedom/g" /var/www/html/core/config/common.config.php
sed -i "s/#PORT#/3306/g" /var/www/html/core/config/common.config.php
sed -i "s/#HOST#/localhost/g" /var/www/html/core/config/common.config.php
/root/install.sh -s 10
/root/install.sh -s 11
fi
fi
echo 'Start atd'
service atd restart
if [ $(which mysqld | wc -l) -ne 0 ]; then
echo 'Starting mysql'
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
service mysql restart
fi
if ! [ -f /.jeedom_backup_restore ]; then
if [ ! -z "${RESTOREBACKUP}" ] && [ "${RESTOREBACKUP}" != 'NO' ]; then
echo 'Need restore backup '${RESTOREBACKUP}
wget ${RESTOREBACKUP} -O /tmp/backup.tar.gz
php /var/www/html/install/restore.php backup=/tmp/backup.tar.gz
rm /tmp/backup.tar.gz
touch /.jeedom_backup_restore
if [ ! -z "${UPDATEJEEDOM}" ] && [ "${UPDATEJEEDOM}" != 'NO' ]; then
echo 'Need update jeedom'
php /var/www/html/install/update.php
fi
fi
fi
echo 'All init complete'
chmod 777 /dev/tty*
chmod 777 -R /tmp
chmod 755 -R /var/www/html
chown -R www-data:www-data /var/www/html
echo 'Start apache2'
sudo apachectl -f apache2.conf
cron -f
Et le fichier init qui fonctionne chez moi (fichier ancien)
#!/bin/bash
MYSQL_ROOT_PASSWD=$MYSQL_ROOT_PASSWD
log_file='/root/init.log'
exec >> $log_file 2>&1
echo 'Start init'
if [ -f /var/www/html/core/config/common.config.php ]; then
echo 'Jeedom is already install'
else
echo 'Start jeedom installation'
apt-get install -y apache2 apache2-utils libexpat1 ssl-cert
service apache2 start
rm -rf /tmp/install.sh
wget https://raw.githubusercontent.com/jeedom/core/V4-stable/install/install.sh -O /tmp/install.sh
chmod +x /tmp/install.sh
/tmp/install.sh -m $MYSQL_ROOT_PASSWD
fi
echo 'Start atd'
service atd restart
if [ $(which mysqld | wc -l) -ne 0 ]; then
echo 'Starting mysql'
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
service mysql restart
fi
if ! [ -f /.jeedom_backup_restore ]; then
if [ ! -z "${RESTOREBACKUP}" ] && [ "${RESTOREBACKUP}" != 'NO' ]; then
echo 'Need restore backup '${RESTOREBACKUP}
wget ${RESTOREBACKUP} -O /tmp/backup.tar.gz
php /var/www/html/install/restore.php backup=/tmp/backup.tar.gz
rm /tmp/backup.tar.gz
touch /.jeedom_backup_restore
if [ ! -z "${UPDATEJEEDOM}" ] && [ "${UPDATEJEEDOM}" != 'NO' ]; then
echo 'Need update jeedom'
php /var/www/html/install/update.php
fi
fi
fi
echo 'All init complete'
chmod 777 /dev/tty*
chmod 777 -R /tmp
chmod 755 -R /var/www/html
chown -R www-data:www-data /var/www/html
echo 'Start sshd'
service ssh start
echo 'Start apache2'
sudo apachectl -f apache2.conf
cron -f
Par contre le tuto donne le lien de téléchargement du fichier install-alpha.sh
Et celui-ci a été modifié depuis la création du tuto
J’ai lancé une nouvelle installation avec ce fichier et tout fonctionne correctement
D’ailleurs les nouveaux fichiers install-alpha.sh et install-v4-stable.sh sont les mêmes.
-----------Créer Docker en mode Bridge ------------
Source https://doc.jeedom.com/fr_FR/installation/synology
Activer le re démarrage auto si docker de prod
Privilège élevé à désactivé pour ajouter les fonctionnalités :
NET_ADMIN
SYS_PTRACE
SYS_ADMIN
Vérifier port 9081 pour docker de prod
Et ajout lien avec rep Docker :
db /var/lib/mysql
html /var/www/html
-----------Démarrer le Docker ------------
Se connecter à Jeedom : admin / admin
Attendre un peu : voir les logs et onglet santé et peut rétablir les droits des fichiers si besoin
Redémarrer Jeedom : voir les logs si tout est OK