make authentik for all new users

This commit is contained in:
Arya 2023-01-23 14:25:11 +05:30
parent ce9fb00a46
commit a5d6546df5
Signed by: arya
GPG Key ID: 842D12BDA50DF120
1 changed files with 3 additions and 0 deletions

View File

@ -19,3 +19,6 @@ sed -i 's/REPLACEME/{{username}}/g' /home/username/{meta-info.env,Caddyfile}
sed -i 's/EMAIL=/EMAIL={{email}}/' /home/{{username}}/meta-info.env
loginctl enable-linger {{username}}
setquota -u {{username}} 20G 20G 0 0 /
a=$(curl -X POST "https://auth.p.projectsegfau.lt/api/v3/core/users/" -H "accept: application/json" -H "content-type: application/json" -H "Authorization: Bearer $(</root/pass/authentiktoken)" -d '{"username":"{{username}}","name":"{{username}}","is_active":true,"groups":["57fe5750-5ac6-46ff-95bc-298cbff0b340"],"email":"{{email}}","attributes":{},"path":"users"}')
pk=$(echo $a | jq '.pk')
curl -X POST "https://auth.p.projectsegfau.lt/api/v3/core/users/${pk}/set_password" -H "accept: application/json" -H "content-type: application/json" -H "Authorization: Bearer $(</root/pass/authentiktoken)" -d "{\"password\": \"${pass}\"}"