-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heavy refactoring: New CT API incl. token usage, async/await and more
- Loading branch information
Showing
18 changed files
with
1,039 additions
and
1,532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
.git | ||
.idea | ||
test/ | ||
.env | ||
.gitignore | ||
*.iml | ||
ctldap_raw.sh | ||
docker-compose.yml | ||
install.sh | ||
* | ||
!ctldap.js | ||
!ctldap.yml | ||
!package.json | ||
!yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
# Add debug infos to log | ||
DEBUG=false | ||
# Add debug infos to log, non-empty string means "true"! | ||
#DEBUG=true | ||
# This is required for clients using lowercase DNs, e.g. ownCloud/nextCloud | ||
IS_DN_LOWER_CASE=true | ||
# This is required for clients that need lowercase email addresses, e.g. Seafile | ||
IS_EMAIL_LOWER_CASE=true | ||
|
||
# LDAP admin user, can be a "virtual" root user or a ChurchTools user name (virtual root is recommended!) | ||
# LDAP admin user, can be a "virtual" root user or a ChurchTools username (virtual root is recommended!) | ||
LDAP_USER=root | ||
# The static password to be used for the ldap_user if it is NOT a CT account, or the account password of the chosen user otherwise | ||
# If you did not use install.sh, choose a LONG SECURE RANDOM password from a password generator like KeePass! | ||
LDAP_PW=XXXXXXXXXXXXXXXXXXXX | ||
# LDAP server port | ||
LDAP_PORT=1389 | ||
# LDAP base DN o=xxx, e.g. churchtools | ||
# The static password to be used for the virtual ldapUser, i.e. if that one is NOT a CT account. | ||
# Ideally, choose a LONG SECURE RANDOM password from a password generator like KeePass and hash it with argon2! | ||
LDAP_PW=some-bcrypt-hash-or-argon2-hash-or-plaintext-password | ||
# LDAP base DN, "o=<xxx>", e.g. "o=churchtools" | ||
LDAP_BASE_DN=churchtools | ||
|
||
# LDAP server ip to listen on, change it to 0.0.0.0 when external access required | ||
LDAP_IP=0.0.0.0 | ||
# LDAP server port, you may change this to the privileged default port 389. | ||
LDAP_PORT=1389 | ||
|
||
# The URI pointing to the root of your ChurchTools installation | ||
CT_URI=https://mysite.church.tools/ | ||
# This user credentials are used to authenticate against ChurchTools for API access | ||
# The user must be granted "churchcore:administer persons" and "churchdb:view" rights for the wrapper to work properly! | ||
CT_URI=https://mysite.church.tools | ||
# This access token is used to authenticate against ChurchTools for API access. | ||
# The backing user must be granted sufficient rights for the wrapper to work properly! Typically, these are: | ||
# churchdb:{ view | view alldata(-1) | view grouptype(-1) | security level person(1,2*) | security level group(1*) } | ||
# * = additional security levels might be required, depending on your ChurchTools settings. | ||
# IMPORTANT: It is strongly recommended to use a LONG SECURE RANDOM password from a generator like KeePass for this user! | ||
CT_USER=XXXXXXXXXXXXXXXXXXXX | ||
CT_PW=XXXXXXXXXXXXXXXXXXXX | ||
# You can obtain the API token from the API: | ||
# - Login via https://your.ct.domain/api > "General" > "login" (copy your "personId" from the shown output!) | ||
# - Get your token via "Person" > "/persons/{personId}/logintoken" | ||
API_TOKEN=">>>insert API token here<<<" | ||
|
||
# This controls (in milliseconds) how old the user/group data can be until it is fetched from ChurchTools again | ||
CACHE_LIVETIME=10000 | ||
CACHE_LIFETIME_MS=300000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/ctldap.config | ||
/ctldap.sh | ||
/node_modules | ||
/.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,30 @@ | ||
FROM node:12-alpine | ||
FROM node:18-alpine | ||
LABEL maintainer="Michael Lux <[email protected]>" | ||
|
||
RUN mkdir /app && chown node:node /app | ||
USER node | ||
WORKDIR /app | ||
RUN chown node:node /app | ||
USER node | ||
|
||
COPY . . | ||
COPY --chown=node:node package.json . | ||
COPY --chown=node:node yarn.lock . | ||
RUN yarn install | ||
|
||
COPY --chown=node:node ctldap.js . | ||
COPY --chown=node:node ctldap.yml . | ||
|
||
EXPOSE 1389 | ||
|
||
ENV DEBUG false | ||
ENV DEBUG "" | ||
ENV IS_DN_LOWER_CASE true | ||
ENV IS_EMAIL_LOWER_CASE true | ||
ENV LDAP_USER root | ||
ENV LDAP_PW XXXXXXXXXXXXXXXXXXXX | ||
ENV LDAP_PORT 1389 | ||
ENV LDAP_PW_BCRYPT "" | ||
ENV LDAP_BASE_DN churchtools | ||
ENV LDAP_IP 0.0.0.0 | ||
ENV LDAP_PORT 1389 | ||
ENV CT_URI https://mysite.church.tools/ | ||
ENV CT_USER XXXXXXXXXXXXXXXXXXXX | ||
ENV CT_PW XXXXXXXXXXXXXXXXXXXX | ||
ENV CACHE_LIVETIME 10000 | ||
ENV API_TOKEN "" | ||
ENV CACHE_LIFETIME_MS 10000 | ||
|
||
# Update config by environment variables and start ctldap server | ||
CMD cp ctldap.example.config ctldap.config && \ | ||
sed -i "s/^\(debug\s*=\s*\).*\$/\1$DEBUG/" ctldap.config && \ | ||
sed -i "s/^\(dn_lower_case\s*=\s*\).*\$/\1$IS_DN_LOWER_CASE/" ctldap.config && \ | ||
sed -i "s/^\(ldap_user\s*=\s*\).*\$/\1$LDAP_USER/" ctldap.config && \ | ||
sed -i "s/^\(ldap_password\s*=\s*\).*\$/\1$LDAP_PW/" ctldap.config && \ | ||
sed -i "s/^\(ldap_ip\s*=\s*\).*\$/\10.0.0.0/" ctldap.config && \ | ||
sed -i "s/^\(ldap_port\s*=\s*\).*\$/\1$LDAP_PORT/" ctldap.config && \ | ||
sed -i "s/^\(ldap_base_dn\s*=\s*\).*\$/\1$LDAP_BASE_DN/" ctldap.config && \ | ||
sed -i "s#^\(ct_uri\s*=\s*\).*\$#\1$CT_URI#" ctldap.config && \ | ||
sed -i "s/^\(api_user\s*=\s*\).*\$/\1$CT_USER/" ctldap.config && \ | ||
sed -i "s/^\(api_password\s*=\s*\).*\$/\1$CT_PW/" ctldap.config && \ | ||
sed -i "s/^\(cache_lifetime\s*=\s*\).*\$/\1$CACHE_LIVETIME/" ctldap.config && \ | ||
node ctldap.js | ||
CMD ["node", "ctldap.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.