Skip to content

Commit 66e3af3

Browse files
committed
ad
1 parent 7fbc4b5 commit 66e3af3

File tree

14 files changed

+84
-15
lines changed

14 files changed

+84
-15
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ Vous etes pret
6363
docker exec sesame-daemon yarn start:dev
6464
````
6565

66+
### complation du daemon en un executable
6667

68+
```
69+
#npm i -g pkg
70+
#pkg dist/main.js -o sesame-daemon
71+
```
6772

6873
### Installation système
6974
#### Debian

backends/01ad/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Backend AD
2+
## Installation
3+
### Debian
4+
```
5+
#apr-get install jq
6+
```
7+
8+

backends/01ad/bin/changepasswd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
JSON=`cat -`
3+
DIR=`dirname $0`
4+
. $DIR/../etc/config.conf
5+
USER=`echo $JSON|jq -r '.uid'`
6+
OLDPWD=`echo $JSON|jq -r '.oldPassword'`
7+
NEWPWD=`echo $JSON|jq -r '.newPassword'`
8+
# copy script ps1
9+
scp $DIR/changepassword.ps1 $SSH:.
10+
ERRORFILE=/tmp/sesame-backend-ad-$$
11+
ssh $SSH "chcp 65001 >NUL && powershell -ExecutionPolicy Bypass -NonInteractive -File changepassword.ps1 $USER $OLDPWD $NEWPWD" 2>$ERRORFILE
12+
ERR=$?
13+
cat $ERRORFILE| tr -d "\r\n" |cut -d'|' -f2 1>&2
14+
rm -f $ERRORFILE
15+
exit $ERR
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
param (
2+
[string]$user,
3+
[string]$oldp,
4+
[string]$newp
5+
)
6+
$ErrorActionPreference = 'Continue'
7+
try{
8+
Set-ADUser -Identity $user -CannotChangePassword $false
9+
Set-ADAccountPassword -Identity $user -OldPassword (ConvertTo-SecureString -AsPlainText $oldp -Force) -NewPassword (ConvertTo-SecureString -AsPlainText $newp -Force)
10+
$r=0
11+
$erreur=""
12+
}catch{
13+
$erreur=$_.Exception.Message
14+
$r=2
15+
}
16+
Set-ADUser -Identity $user -CannotChangePassword $true
17+
if ($r -ne 0){
18+
$ErrorActionPreference = 'Continue'
19+
write-Error "| $erreur |"
20+
}else{
21+
write-output "OK"
22+
}
23+
Exit $r

backends/01ad/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
name: 'AD'
3+
description: 'Backend for AD'
4+
active: 1
5+
actions:
6+
CHANGEPWD:
7+
exec: "changepasswd"
8+
onError: 'stop'
9+
ADDIDENT:
10+
exec: 'dummy.sh'
11+
UPDATEIDENT:
12+
exec: 'dummy.sh'
13+
DELIDENT:
14+
exec: 'dummy.sh'
15+
PING:
16+
exec: 'ping.sh'
17+

backends/01ad/etc/config.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
SSH=administrateur@***REMOVED***
4+
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
name: 'openldap'
33
description: 'Backend for openldap'
4-
active: 1
4+
active: 0
55
actions:
66
CHANGEPWD:
77
exec: "changepasswd"

backends/backend1/bin/exemple.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/sh
22
echo "Hello Word"
3-
sleep 2
4-
echo "j'ai recu :"
5-
cat -
6-
echo "je provoque une erreur " >&2
7-
exit 255
3+
4+
echo dir : `dirname $0`
5+
exit 0

0 commit comments

Comments
 (0)