diff options
| author | Antoine Ouvrard <antoine.ouvrard@zextras.fr> | 2023-03-09 17:36:57 +0100 |
|---|---|---|
| committer | Antoine Ouvrard <antoine.ouvrard@zextras.fr> | 2023-03-09 17:36:57 +0100 |
| commit | 06837625b122eb47d0dc6b0562e5d665a4c571c1 (patch) | |
| tree | 908a69c8333eb487590bbb7a9dea00b089980fcb /preauth.sh | |
| parent | 3fe3b6e90a664edc44aa4772d7d00e4f343f0467 (diff) | |
Diffstat (limited to 'preauth.sh')
| -rwxr-xr-x | preauth.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/preauth.sh b/preauth.sh new file mode 100755 index 0000000..1d219fe --- /dev/null +++ b/preauth.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ -z "$1" ]; then + echo "Il faut ajouter le path du pass en paramètre!" +fi + +ZM_ACC=$(pass $1 | awk '{print $1}') +ZM_KEY=$(pass $1 | awk '{print $2}') +TIMESTAMP=$(date +%s)000 + +CONCAT_SIMPL_DATA=$ZM_ACC"|name|0|"$TIMESTAMP +CONCAT_ADMIN_DATA=$ZM_ACC"|1|name|0|"$TIMESTAMP +HASH_SIMPL_PREAUTH=$(echo -n $CONCAT_SIMPL_DATA | openssl dgst -sha1 -hmac $ZM_KEY | awk '{print $2}') +HASH_ADMIN_PREAUTH=$(echo -n $CONCAT_ADMIN_DATA | openssl dgst -sha1 -hmac $ZM_KEY | awk '{print $2}') + +echo "---mailbox access---" +echo "/service/preauth?account=$ZM_ACC&expires=0×tamp=$TIMESTAMP&preauth=$HASH_SIMPL_PREAUTH" +echo "---admin acess---" +echo "/service/preauth?account=$ZM_ACC&admin=1&expires=0×tamp=$TIMESTAMP&preauth=$HASH_ADMIN_PREAUTH" + |
