~evilham/cdist-evilham

77788cf30f6a7c356bdd6795e25f0ad2f1826755 — Evilham 1 year, 1 month ago ad44c13
forgejo_ldap: support FreeBSD

while there improve the type docs.
M type/__evilham_forgejo_ldap/explorer/auth => type/__evilham_forgejo_ldap/explorer/auth +3 -1
@@ 1,7 1,9 @@
#!/bin/sh -eu

ETC_DIR="/usr/local/etc"

USER="$(cat "${__object}/parameter/user")"
AUTH="$(su - ${USER} -c "forgejo -c /etc/forgejo.conf admin auth list" | grep ldap | cut -f1|| true)"
AUTH="$(su - ${USER} -c "forgejo -c '${ETC_DIR}/forgejo.conf' admin auth list" | grep ldap | cut -f1|| true)"

echo "${AUTH}"


M type/__evilham_forgejo_ldap/gencode-remote => type/__evilham_forgejo_ldap/gencode-remote +4 -2
@@ 14,17 14,19 @@ PORT="$(cat "${__object}/parameter/port")"
USER_FILTER="$(cat "${__object}/parameter/user-filter")"
CUSTOM_ARGS="$(cat "${__object}/parameter/custom-args" || true)"

ETC_DIR='/usr/local/etc'

if [ -z "${AUTH_STATE}" ]; 
	then
       		#Configuration doesn't exists	
		echo "su - ${USER} -c \"forgejo -c /etc/forgejo.conf admin auth add-ldap --name '${NAME}'\
		echo "su - ${USER} -c \"forgejo -c '${ETC_DIR}/forgejo.conf' admin auth add-ldap --name '${NAME}'\
		       	--email-attribute  '${EMAIL}' --security-protocol '${SECURITY_PROTOCOL}'\
		       	--user-search-base '${USER_SEARCH_BASE}' --host '${HOST}' --port '${PORT}'\
		       	--user-filter '${USER_FILTER}' ${CUSTOM_ARGS} \"" 
	else	
		if grep -qs "^__file/var/lib/forgejo/secret/ldap.conf" "$__messages_in" ; then
			cat <<-DONE
			su - ${USER} -c "forgejo -c /etc/forgejo.conf admin auth update-ldap --name '${NAME}'\
			su - ${USER} -c "forgejo -c '${ETC_DIR}/forgejo.conf' admin auth update-ldap --name '${NAME}'\
		       	--email-attribute  '${EMAIL}' --security-protocol '${SECURITY_PROTOCOL}'\
		       	--user-search-base '${USER_SEARCH_BASE}' --host '${HOST}' --port '${PORT}'\
			--user-filter '${USER_FILTER}' ${CUSTOM_ARGS} --id '${AUTH_STATE}'"

M type/__evilham_forgejo_ldap/man.rst => type/__evilham_forgejo_ldap/man.rst +2 -1
@@ 32,7 32,8 @@ port
    Port that forgejo will use to connect with ldap.

security-protocol
    Name of the secutiry protocol to use in the authentication service.
    Name of the security protocol to use in the authentication service.
    One of: `Unencrypted`, `LDAPS` or `StartTLS`.

user-filter
    LDAP filter to specify user attributes to look for when authenticating.