Compare commits
9 Commits
fature/gro
...
9.0.2+2025
| Author | SHA1 | Date | |
|---|---|---|---|
| 4824c7e587 | |||
|
c3065eee54
|
|||
|
5b5fd5cb2e
|
|||
| 35815281b6 | |||
|
8c3f3e04b6
|
|||
|
69e83844af
|
|||
|
611fe49295
|
|||
|
fde3efb0d0
|
|||
| 9d1d89ff81 |
212
abra.sh
212
abra.sh
@ -21,43 +21,40 @@ export PG_BACKUP_VERSION=v2
|
||||
export ENTRYPOINT_CSS_VERSION=v1
|
||||
|
||||
customize() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Usage: ... customize <assets_path>"
|
||||
exit 1
|
||||
fi
|
||||
asset_dir=$1
|
||||
for asset in $COPY_ASSETS; do
|
||||
source=$(echo $asset | cut -d "|" -f1)
|
||||
target=$(echo $asset | cut -d "|" -f2)
|
||||
echo copy $source to $target
|
||||
abra app cp $APP_NAME $asset_dir/$source $target
|
||||
done
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ... customize <assets_path>"
|
||||
exit 1
|
||||
fi
|
||||
asset_dir=$1
|
||||
for asset in $COPY_ASSETS; do
|
||||
source=$(echo $asset | cut -d "|" -f1)
|
||||
target=$(echo $asset | cut -d "|" -f2)
|
||||
echo copy $source to $target
|
||||
abra app cp $APP_NAME $asset_dir/$source $target
|
||||
done
|
||||
}
|
||||
|
||||
shell(){
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Usage: ... shell <python code>"
|
||||
exit 1
|
||||
fi
|
||||
ak shell -c "$1" 2>&1 | quieten
|
||||
shell() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ... shell <python code>"
|
||||
exit 1
|
||||
fi
|
||||
ak shell -c "$1" 2>&1 | quieten
|
||||
}
|
||||
|
||||
import_user() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Usage: ... import_user <users.csv>"
|
||||
exit 1
|
||||
fi
|
||||
source_file=$1
|
||||
filename=$(basename $source_file)
|
||||
abra app cp $APP_NAME $source_file worker:/tmp/
|
||||
abra app cmd -T $APP_NAME worker _import_user $filename
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ... import_user <users.csv>"
|
||||
exit 1
|
||||
fi
|
||||
source_file=$1
|
||||
filename=$(basename $source_file)
|
||||
abra app cp $APP_NAME $source_file worker:/tmp/
|
||||
abra app cmd -T $APP_NAME worker _import_user $filename
|
||||
}
|
||||
|
||||
_import_user() {
|
||||
/manage.py shell -c """
|
||||
/manage.py shell -c """
|
||||
import csv
|
||||
new_user = User()
|
||||
with open('/tmp/$1', newline='') as file:
|
||||
@ -84,10 +81,22 @@ with open('/tmp/$1', newline='') as file:
|
||||
""" 2>&1 | quieten
|
||||
}
|
||||
|
||||
set_user_pass() {
|
||||
username="$1"
|
||||
password="$2"
|
||||
/manage.py shell -c """
|
||||
user = User.objects.get(username='$username')
|
||||
user.set_password('$password')
|
||||
user.save()
|
||||
print('Changed $username password')
|
||||
""" 2>&1 | quieten
|
||||
|
||||
}
|
||||
|
||||
set_admin_pass() {
|
||||
password=$(cat /run/secrets/admin_pass)
|
||||
token=$(cat /run/secrets/admin_token)
|
||||
/manage.py shell -c """
|
||||
password=$(cat /run/secrets/admin_pass)
|
||||
token=$(cat /run/secrets/admin_token)
|
||||
/manage.py shell -c """
|
||||
import time
|
||||
i = 0
|
||||
while (not User.objects.filter(username='akadmin')):
|
||||
@ -122,45 +131,45 @@ else:
|
||||
}
|
||||
|
||||
rotate_db_pass() {
|
||||
db_password=$(cat /run/secrets/db_password)
|
||||
psql -U authentik -c """ALTER USER authentik WITH PASSWORD '$db_password';"""
|
||||
db_password=$(cat /run/secrets/db_password)
|
||||
psql -U authentik -c """ALTER USER authentik WITH PASSWORD '$db_password';"""
|
||||
}
|
||||
|
||||
# This function is for blueprints that are overwriting custom blueprints
|
||||
# It deactivates the affected custom blueprints to avoid changes to be reverted
|
||||
apply_blueprints() {
|
||||
update_and_disable_blueprint default/flow-password-change.yaml
|
||||
update_and_disable_blueprint default/flow-default-authentication-flow.yaml
|
||||
update_and_disable_blueprint default/flow-default-user-settings-flow.yaml
|
||||
update_and_disable_blueprint default/flow-default-source-enrollment.yaml
|
||||
|
||||
apply_blueprint 3_flow_translation.yaml
|
||||
apply_blueprint 2_flow_authentication.yaml
|
||||
update_and_disable_blueprint default/flow-password-change.yaml
|
||||
update_and_disable_blueprint default/flow-default-authentication-flow.yaml
|
||||
update_and_disable_blueprint default/flow-default-user-settings-flow.yaml
|
||||
update_and_disable_blueprint default/flow-default-source-enrollment.yaml
|
||||
|
||||
apply_blueprint 3_flow_translation.yaml
|
||||
apply_blueprint 2_flow_authentication.yaml
|
||||
}
|
||||
|
||||
update_and_disable_blueprint() {
|
||||
enable_blueprint $@ 2>&1 | quieten
|
||||
sleep 1
|
||||
apply_blueprint $@
|
||||
sleep 1
|
||||
disable_blueprint $@ 2>&1 | quieten
|
||||
enable_blueprint $@ 2>&1 | quieten
|
||||
sleep 1
|
||||
apply_blueprint $@
|
||||
sleep 1
|
||||
disable_blueprint $@ 2>&1 | quieten
|
||||
}
|
||||
|
||||
disable_blueprint() {
|
||||
blueprint_state False $@
|
||||
blueprint_state False $@
|
||||
}
|
||||
|
||||
enable_blueprint() {
|
||||
blueprint_state True $@
|
||||
blueprint_state True $@
|
||||
}
|
||||
|
||||
apply_blueprint() {
|
||||
echo apply blueprint $@
|
||||
ak apply_blueprint $@ 2>&1 | quieten
|
||||
echo apply blueprint $@
|
||||
ak apply_blueprint $@ 2>&1 | quieten
|
||||
}
|
||||
|
||||
blueprint_state() {
|
||||
/manage.py shell -c """
|
||||
/manage.py shell -c """
|
||||
import time
|
||||
blueprint_state=$1
|
||||
blueprint_path='$2'
|
||||
@ -178,9 +187,9 @@ print(f'{blueprint.name} enabled: {blueprint.enabled}')
|
||||
}
|
||||
|
||||
# This function adds each application with its name, slug and group if passed
|
||||
add_applications(){
|
||||
export APPLICATIONS
|
||||
/manage.py shell -c """
|
||||
add_applications() {
|
||||
export APPLICATIONS
|
||||
/manage.py shell -c """
|
||||
import json
|
||||
import os
|
||||
if os.environ['APPLICATIONS'] == '':
|
||||
@ -199,6 +208,7 @@ for name, details in applications.items():
|
||||
app.group = group
|
||||
print(f'Add {name}: {url} in group: {group}')
|
||||
else:
|
||||
app.group = ''
|
||||
print(f'Add {name}: {url}')
|
||||
app.open_in_new_tab = True
|
||||
app.save()
|
||||
@ -207,69 +217,66 @@ for name, details in applications.items():
|
||||
|
||||
## This function is for renaming apps - usage: rename "old name" "new name"
|
||||
rename() {
|
||||
/manage.py shell -c """
|
||||
old_name = '$1'
|
||||
new_name = '$2' if '$2' else old_name
|
||||
/manage.py shell -c """
|
||||
old_name = '$1'
|
||||
new_name = '$2' if '$2' else old_name
|
||||
|
||||
app = Application.objects.filter(name=old_name).first()
|
||||
if app:
|
||||
app.name = new_name
|
||||
app.save()
|
||||
print(f'Renamed application from {old_name} to {new_name}')
|
||||
else:
|
||||
print(f'No application found with name: {old_name}')
|
||||
""" > /dev/null 2>&1
|
||||
app = Application.objects.filter(name=old_name).first()
|
||||
if app:
|
||||
app.name = new_name
|
||||
app.save()
|
||||
print(f'Renamed application from {old_name} to {new_name}')
|
||||
else:
|
||||
print(f'No application found with name: {old_name}')
|
||||
""" 2>&1 | quieten
|
||||
}
|
||||
|
||||
|
||||
|
||||
quieten(){
|
||||
# 'SyntaxWarning|version_regex|"http\['
|
||||
# is a workaround to get rid of some verbose syntax warnings, this might be fixed with another version
|
||||
grep -Pv '"level": "(info|debug)"|SyntaxWarning|version_regex|"http\[|RuntimeWarning:'
|
||||
quieten() {
|
||||
# 'SyntaxWarning|version_regex|"http\['
|
||||
# is a workaround to get rid of some verbose syntax warnings, this might be fixed with another version
|
||||
grep -Pv '"level": "(info|debug)"|SyntaxWarning|version_regex|"http\[|RuntimeWarning:'
|
||||
}
|
||||
|
||||
add_email_templates(){
|
||||
for file_path in "$@"; do
|
||||
add_email_templates() {
|
||||
for file_path in "$@"; do
|
||||
echo copy template $file_path
|
||||
abra app cp $APP_NAME $file_path app:/templates/
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
set_icons(){
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
APP_ICONS="$1"
|
||||
fi
|
||||
for icon in $APP_ICONS; do
|
||||
set_icons() {
|
||||
if [ -n "$1" ]; then
|
||||
APP_ICONS="$1"
|
||||
fi
|
||||
for icon in $APP_ICONS; do
|
||||
app=$(echo $icon | cut -d ":" -f1)
|
||||
file_path=$(eval echo $(echo $icon | cut -d ":" -f2))
|
||||
file=$(basename $file_path)
|
||||
echo copy icon $file_path for $app
|
||||
abra app cp $APP_NAME $file_path app:/media/
|
||||
abra app cmd -T $APP_NAME app set_app_icon $app /media/$file
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
set_extra_icons(){
|
||||
if [ -z "$EXTRA_ICONS" ]
|
||||
then
|
||||
echo "Variable EXTRA_ICONS is not set"
|
||||
exit 1
|
||||
fi
|
||||
export EXTRA_ICONS
|
||||
icon_key_values=$(python3 -c "
|
||||
set_extra_icons() {
|
||||
if [ -z "$EXTRA_ICONS" ]; then
|
||||
echo "Variable EXTRA_ICONS is not set"
|
||||
exit 1
|
||||
fi
|
||||
export EXTRA_ICONS
|
||||
icon_key_values=$(python3 -c "
|
||||
import json
|
||||
import os
|
||||
for key, value in json.loads(os.environ['EXTRA_ICONS']).items():
|
||||
print(f'{key}:{value}')
|
||||
slug = key.replace(' ','-')
|
||||
print(f'{slug}:{value}')
|
||||
")
|
||||
set_icons "$icon_key_values"
|
||||
set_icons "$icon_key_values"
|
||||
}
|
||||
|
||||
set_app_icon() {
|
||||
TOKEN=$(cat /run/secrets/admin_token)
|
||||
python -c """
|
||||
TOKEN=$(cat /run/secrets/admin_token)
|
||||
python -c """
|
||||
import requests
|
||||
import os
|
||||
my_token = '$TOKEN'
|
||||
@ -288,18 +295,18 @@ with open(icon_path, 'rb') as img:
|
||||
}
|
||||
|
||||
blueprint_cleanup() {
|
||||
/manage.py shell -c """
|
||||
/manage.py shell -c """
|
||||
delete_flows = ['default-recovery-flow' , 'custom-authentication-flow' , 'invitation-enrollment-flow' , 'initial-setup']
|
||||
Flow.objects.filter(slug__in=delete_flows).delete()
|
||||
Stage.objects.filter(flow=None).delete()
|
||||
Prompt.objects.filter(promptstage=None).delete()
|
||||
Brand.objects.filter(default=True).delete()
|
||||
""" 2>&1 | quieten
|
||||
apply_blueprints
|
||||
apply_blueprints
|
||||
}
|
||||
|
||||
get_certificate() {
|
||||
/manage.py shell -c """
|
||||
/manage.py shell -c """
|
||||
provider_name='$1'
|
||||
if not provider_name:
|
||||
print('no Provider Name given')
|
||||
@ -312,7 +319,18 @@ print(''.join(cert.certificate_data.splitlines()[1:-1]))
|
||||
}
|
||||
|
||||
get_user_uid() {
|
||||
/manage.py shell -c """
|
||||
/manage.py shell -c """
|
||||
print(User.objects.filter(username='$1').first().uid)
|
||||
""" 2>&1 | quieten
|
||||
}
|
||||
|
||||
get_secrets() {
|
||||
grep "" -r /var/run/secrets
|
||||
}
|
||||
|
||||
fix_collation_mismatch() {
|
||||
psql -U ${POSTGRES_USER} -d authentik -c "ALTER DATABASE authentik REFRESH COLLATION VERSION;"
|
||||
psql -U ${POSTGRES_USER} -d authentik -c "REINDEX DATABASE authentik;"
|
||||
psql -U ${POSTGRES_USER} -d postgres -c "ALTER DATABASE postgres REFRESH COLLATION VERSION;"
|
||||
psql -U ${POSTGRES_USER} -d postgres -c "REINDEX DATABASE postgres;"
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ services:
|
||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect,${STACK_NAME}-frameOptions,${STACK_NAME}-redirect"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-frameOptions.headers.customFrameOptionsValue=SAMEORIGIN"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-frameOptions.headers.contentSecurityPolicy=frame-ancestors ${X_FRAME_OPTIONS_ALLOW_FROM}"
|
||||
- "coop-cloud.${STACK_NAME}.version=8.0.0+2025.8.1"
|
||||
- "coop-cloud.${STACK_NAME}.version=9.0.2+2025.8.1"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.regex=^https://(${REDIRECTS})/(.*)"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.replacement=https://${DOMAIN}/$${2}"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectregex.permanent=true"
|
||||
|
||||
12
icons/collectives.svg
Normal file
12
icons/collectives.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 16 16">
|
||||
<g>
|
||||
<path d="M2.9,8.8c0-1.2,0.4-2.4,1.2-3.3L0.3,6c-0.2,0-0.3,0.3-0.1,0.4l2.7,2.6C2.9,9,2.9,8.9,2.9,8.8z" />
|
||||
<path d="M8,3.7c0.7,0,1.3,0.1,1.9,0.4L8.2,0.6c-0.1-0.2-0.3-0.2-0.4,0L6.1,4C6.7,3.8,7.3,3.7,8,3.7z" />
|
||||
<path d="M3.7,11.5L3,15.2c0,0.2,0.2,0.4,0.4,0.3l3.3-1.7C5.4,13.4,4.4,12.6,3.7,11.5z" />
|
||||
<path d="M15.7,6l-3.7-0.5c0.7,0.9,1.2,2,1.2,3.3c0,0.1,0,0.2,0,0.3l2.7-2.6C15.9,6.3,15.9,6.1,15.7,6z" />
|
||||
<path d="M12.3,11.5c-0.7,1.1-1.8,1.9-3,2.2l3.3,1.7c0.2,0.1,0.4-0.1,0.4-0.3L12.3,11.5z" />
|
||||
<path d="M9.6,10.1c-0.4,0.5-1,0.8-1.6,0.8c-1.1,0-2-0.9-2.1-2C5.9,7.7,6.8,6.7,8,6.7c0.6,0,1.1,0.3,1.5,0.7
|
||||
c0.1,0.1,0.1,0.1,0.2,0.1h1.4c0.2,0,0.4-0.2,0.3-0.5c-0.7-1.3-2.1-2.2-3.8-2.1C5.8,5,4.3,6.6,4.1,8.5C4,10.8,5.8,12.7,8,12.7
|
||||
c1.6,0,2.9-0.9,3.5-2.3c0.1-0.2-0.1-0.4-0.3-0.4H9.9C9.8,10,9.7,10,9.6,10.1z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 917 B |
Reference in New Issue
Block a user