Skip to content

Commit 3494a05

Browse files
committed
install sur 2022
1 parent 25ce8eb commit 3494a05

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

copy_ssh_key.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@
1919
sshfile = client.open_sftp()
2020
with open(args.keyfile) as f: new_key = f.read()
2121
## ouverture sur windows du authorized_Keys
22-
with sshfile.open(".ssh/authorized_keys", mode="a") as message:
22+
with sshfile.open("c:/programdata/ssh/administrators_authorized_keys", mode="a") as message:
2323
message.write(new_key)
2424
message.close()
25-
del client
25+
command='powershell;icacls.exe c:/programdata/ssh/administrators_authorized_keys /inheritance:r /grant "*S-1-5-32-544:F" /grant "SYSTEM:F"'
26+
stdin, stdout, stderr = client.exec_command(command)
27+
content=stdout.read()
28+
print(content)
29+
del client, stdin, stdout, stderr
2630
except paramiko.ssh_exception.SSHException as e:
2731
e_dict = e.args[0]
28-
print("Erreur d'authentification")
32+
print(u.returncode(1, "Erreur d'authentification"))
2933
exit(1)
34+
35+
3036

install.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
echo "Deploiment du module AD"
33
echo "La position determinera l'ordre d'execution des backends (comme dans init.d)"
44
read -p "Numero de demarrage du module (2 positions):" NUM
5-
echo "installation dans backends/${NUM}openldap"
5+
echo "installation dans backends/${NUM}ad"
66
BACKEND=ad
77
INSTALL=../../backends/${NUM}${BACKEND}
88
if [ -d ../../backends/${NUM}${BACKEND} ];then
9-
echo "Repertoire deja existant choisissez un autre numéro"
10-
exit 1
11-
else
12-
mkdir ../../backends/${NUM}${BACKEND}
9+
read -p "Repertoire déjà existant voulez vous l'écraser ? (O/N)" -i "N" REPONSE
10+
if [ "$REPONSE" = "O" ];then
11+
rm -rf ../../backends/${NUM}${BACKEND}
12+
else
13+
exit 1
14+
fi
1315
fi
16+
mkdir ../../backends/${NUM}${BACKEND}
1417
echo "Copie des fichiers dans ${INSTALL}"
1518
mkdir $INSTALL/etc
1619
cp ./etc/* $INSTALL/etc
@@ -42,6 +45,7 @@ echo "Génération du fichier de configuration"
4245
CONFFILE=${INSTALL}/etc/config.conf
4346
echo "host=${HOST}" > ${CONFFILE}
4447
echo "user=${USER}" >> ${CONFFILE}
48+
#echo "password=${PASSWORD}" >> ${CONFFILE}
4549
echo "base=${BASE}" >> ${CONFFILE}
4650
echo "domain=${DOMAIN}" >> ${CONFFILE}
4751
echo "backendFor=adm,etd,esn" >> ${CONFFILE}
@@ -61,13 +65,14 @@ fi
6165
#test de connection
6266
echo "Test de connection"
6367
cd ${INSTALL}/bin
64-
./ping.py
68+
BINDDIR=`pwd`
69+
$BINDDIR/ping.py
6570
OK=$?
6671
if [ $OK -eq 0 ];then
6772
echo "Test de connexion OK "
6873
else
69-
echo" Erreur de connexion"
74+
echo " Erreur de connexion"
7075
fi
7176
systemctl restart sesame-daemon
7277
echo "Vous pouvez completer le fichier de configuration avec les parametres optionnels (voir README.md)"
73-
echo "Merci "
78+
echo "Merci "

0 commit comments

Comments
 (0)