2 Commits

Author SHA1 Message Date
4925af0003 Actualiser project.drone.yml 2024-01-27 12:18:07 +01:00
cc4497f288 Ajouter project.drone.yml 2024-01-27 11:12:33 +01:00
7 changed files with 64 additions and 35 deletions

View File

@@ -4,7 +4,7 @@ This repo contains an improved, free ldap authentication and authorisation
for sharelatex/[overleaf](https://github.com/overleaf/overleaf) community
edition. Currently this repo uses `sharelatex/sharelatex:4.2.0`.
The Initial idea for this implementation was taken from
The inital idea for this implementation was taken from
[worksasintended](https://github.com/worksasintended).
## BREAKING CHANGE
@@ -50,7 +50,7 @@ it tries to authenticate against the specified LDAP server.
*Important:*
Sharelatex/Overleaf uses the email address to identify users: If you change the email in the LDAP/OAuth you have to update the corresponding field in the mongo db.
```bash
```
docker exec -it mongo /bin/bash
mongo
use sharelatex
@@ -86,18 +86,17 @@ COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
ADMIN_IS_SYSADMIN=false
```
*LOGIN_TEXT* : displayed instead of email-address field (login.pug) <br/>
*LOGIN_TEXT* : displayed instead of email-adress field (login.pug) <br/>
*COLLAB_TEXT* : displayed for email invitation (share.pug)<br/>
*ADMIN_IS_SYSADMIN* : false or true (if ``false`` isAdmin group is allowed to add users to sharelatex and post messages. if ``true`` isAdmin group is allowed to logout other users / set maintenance mode)
### LDAP Configuration
Edit [docker-compose.traefik.yml](docker-compose.traefik.yml) or [docker-compose.certbot.yml](docker-compose.certbot.yml) to fit your local setup.
Edit [docker-compose.treafik.yml](docker-compose.traefik.yml) or [docker-compose.certbot.yml](docker-compose.certbot.yml) to fit your local setup.
```
LDAP_SERVER: ldaps://LDAPSERVER:636
LDAP_BASE: dc=DOMAIN,dc=TLD
LDAP_SERVER_CACERT: /etc/ssl/certs/LDAPCERT
# If LDAP_BINDDN is set, the ldap bind happens directly by using the provided DN
# All occurrences of `%u` get replaced by the entered uid.
# All occurrences of `%m`get replaced by the entered mail.
@@ -158,8 +157,6 @@ OAUTH2_TOKEN_URL: YOUR_OAUTH2_TOKEN_URL
# One of ["application/x-www-form-urlencoded", "application/json"]
# Default "application/x-www-form-urlencoded"
OAUTH2_TOKEN_CONTENT_TYPE: "application/x-www-form-urlencoded"
# OAUTH2_STATE_LENGTH: Length of the OAuth2 state
OAUTH2_STATE_LENGTH: 6
# Fetch user profile api endpoint
OAUTH2_PROFILE_URL: YOUR_OAUTH2_PROFILE_URL
@@ -219,39 +216,43 @@ Install the docker engine: https://docs.docker.com/engine/install/
Install docker-compose:
(If you need pip: apt install python3-pip)
(if you need pip: apt install python3-pip)
```bash
```
pip install docker-compose
```
Use the following commands to generate the ldap-overleaf-sl docker image:
use the following commands:
```bash
```
bash scripts/extract_files.sh 4.2.0
bash scripts/apply_diffs.sh
make
```
Use the following command to create a network for the docker instances:
to generate the ldap-overleaf-sl docker image.
```bash
use the command:
```
docker network create web
```
to create a network for the docker instances.
### Startup
#### Using without reverse proxy
#### Using without proxy
In most cases, you should use a gateway reverse proxy for your requests (see the next section), as they can offer many benefits such as enhanced security and easier SSL certificate updates. This simple startup method is used for 1. Development 2. When you know what you're doing, for example, when there is an additional gateway layer outside your server.
Start docker containers:
```bash
```
docker-compose up -d
```
#### Using reverse proxy
#### Using proxy
There are 2 different ways of starting either using Traefik or using Certbot. Adapt the one you want to use.
@@ -259,7 +260,7 @@ There are 2 different ways of starting either using Traefik or using Certbot. Ad
Then start docker containers (with loadbalancer):
```bash
```
export NUMINSTANCES=1
docker-compose -f docker-compose.traefik.yml up -d --scale sharelatex=$NUMINSTANCES
```
@@ -268,7 +269,7 @@ docker-compose -f docker-compose.traefik.yml up -d --scale sharelatex=$NUMINSTAN
Enable line 65/66 and 69/70 in ldapoverleaf-sl/Dockerfile and ``make`` again.
```bash
```
docker-compose -f docker-compose.certbot.yml up -d
```

View File

@@ -56,7 +56,6 @@ services:
LDAP_SERVER: ldaps://LDAPSERVER:636
LDAP_BASE: ou=people,dc=DOMAIN,dc=TLD
LDAP_SERVER_CACERT: /etc/ssl/certs/LDAPCERT
### There are to ways get users from the ldap server
@@ -91,7 +90,6 @@ services:
# OAUTH2_AUTHORIZATION_URL: YOUR_OAUTH2_AUTHORIZATION_URL
# OAUTH2_TOKEN_URL: YOUR_OAUTH2_TOKEN_URL
# OAUTH2_TOKEN_CONTENT_TYPE: # One of ['application/x-www-form-urlencoded', 'application/json']
# OAUTH2_STATE_LENGTH: Length of the OAuth2 state (default: 6)
# OAUTH2_PROFILE_URL: YOUR_OAUTH2_PROFILE_URL
# OAUTH2_USER_ATTR_EMAIL: email
# OAUTH2_USER_ATTR_UID: id

View File

@@ -137,7 +137,6 @@ services:
LDAP_SERVER: ldaps://LDAPSERVER:636
LDAP_BASE: ou=people,dc=DOMAIN,dc=TLD
LDAP_SERVER_CACERT: /etc/ssl/certs/LDAPCERT
### There are to ways get users from the ldap server
@@ -172,7 +171,6 @@ services:
# OAUTH2_AUTHORIZATION_URL: YOUR_OAUTH2_AUTHORIZATION_URL
# OAUTH2_TOKEN_URL: YOUR_OAUTH2_TOKEN_URL
# OAUTH2_TOKEN_CONTENT_TYPE: # One of ['application/x-www-form-urlencoded', 'application/json']
# OAUTH2_STATE_LENGTH: Length of the OAuth2 state (default: 6)
# OAUTH2_PROFILE_URL: YOUR_OAUTH2_PROFILE_URL
# OAUTH2_USER_ATTR_EMAIL: email
# OAUTH2_USER_ATTR_UID: id

View File

@@ -54,7 +54,6 @@ services:
LDAP_SERVER: ldaps://LDAPSERVER:636
LDAP_BASE: ou=people,dc=DOMAIN,dc=TLD
LDAP_SERVER_CACERT: /etc/ssl/certs/LDAPCERT
### There are to ways get users from the ldap server
@@ -89,7 +88,6 @@ services:
# OAUTH2_AUTHORIZATION_URL: YOUR_OAUTH2_AUTHORIZATION_URL
# OAUTH2_TOKEN_URL: YOUR_OAUTH2_TOKEN_URL
# OAUTH2_TOKEN_CONTENT_TYPE: # One of ['application/x-www-form-urlencoded', 'application/json']
# OAUTH2_STATE_LENGTH: Length of the OAuth2 state (default: 6)
# OAUTH2_PROFILE_URL: YOUR_OAUTH2_PROFILE_URL
# OAUTH2_USER_ATTR_EMAIL: email
# OAUTH2_USER_ATTR_UID: id

View File

@@ -19,18 +19,15 @@ RUN npm install -g npm && \
# npm cache clean --force && \
npm install ldap-escape ldapts-search ldapts@3.2.4 && \
# npm install bcrypt@5.0.0 && \
## This variant of updateing texlive does not work
# bash -c tlmgr install scheme-full && \
## try this one:
apt-get update && \
apt-get -y install libxml-libxslt-perl cpanminus libbtparse2 python-pygments && \
# now install latest texlive2023 from tlmgr
tlmgr update --self --all && \
tlmgr install scheme-full --verify-repo=none && \
apt-get -y install python-pygments && \
apt-get -y install texlive texlive-lang-german texlive-latex-extra texlive-full texlive-science && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# latex-bin must be on path to be found in compilation process
# needed for biber epstopdf and others
ENV PATH="/usr/local/texlive/2023/bin/x86_64-linux:${PATH};"
# overwrite some files
COPY sharelatex/AuthenticationManager.js /overleaf/services/web/app/src/Features/Authentication/
COPY sharelatex/AuthenticationController.js /overleaf/services/web/app/src/Features/Authentication/

View File

@@ -1,11 +1,10 @@
268a269,366
268a268,364
>
> // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> oauth2Redirect(req, res, next) {
> // random state
> const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
> const stateLength = Number(process.env.OAUTH2_STATE_LENGTH || 6)
> const state = new Array(stateLength).fill(0).map(() => characters.charAt(Math.floor(Math.random() * characters.length))).join("")
> const state = new Array(6).fill(0).map(() => characters.charAt(Math.floor(Math.random() * characters.length))).join("")
> req.session.oauth2State = state
>
> const redirectURI = encodeURIComponent(`${process.env.SHARELATEX_SITE_URL}/oauth/callback`)

38
project.drone.yml Normal file
View File

@@ -0,0 +1,38 @@
kind: pipeline
type: docker
name: build-images
platform:
os: linux
arch: amd64
volumes:
- name: dockersock
host:
path: /var/run/docker.sock
steps:
- name: prepare-image-source
- name: build-and-push-image
image: plugins/docker
privileged: true
volumes:
- name: dockersock
path: "/var/run/docker.sock"
settings:
username:
from_secret: registry_username
password:
from_secret: registry_pwd
repo: gargoton.coissac.eu/image/ldap-overleaf-sl-ci
registry: gargoton.coissac.eu
tags:
- nightbuild
dockerfile: ./Dockerfile # Where the Dockerfile is located in your git repository
trigger:
branch:
- main
event:
exclude:
- pull_request