12 Commits

Author SHA1 Message Date
Simon Ledoux
0fd1a2765e Make the oauth2 state length configurable (#65)
* Increase state lenght to 8

* feat: make the state length configurable
2024-11-23 16:09:43 +08:00
Zexin Yuan
f6aea77284 Update README.md 2024-11-12 19:23:49 +08:00
Zexin Yuan
e7e08626f2 Merge pull request #54 from Wurzelmann/patch-1
Added LDAP_SERVER_CACERT to  docker-compose.yml
2024-07-21 13:01:53 +08:00
Zexin Yuan
62eb2e7bad Merge pull request #57 from maxkratz/hotfix/typos
Fixes a traefik typo in README.md
2024-07-21 13:01:26 +08:00
Max Kratz
af11c26db3 Fixes a traefik typo in README.md 2024-07-20 19:42:28 +02:00
Wurzelmann
04e8b9d52e Added LDAP_SERVER_CACERT to Update README.md
Added LDAP_SERVER_CACERT to Update README.md to update documentation (see #20)
2024-07-12 06:43:46 +02:00
Wurzelmann
91699a4e54 Added LDAP_SERVER_CACERT to docker-compose.traefik.yml
Added LDAP_SERVER_CACERT to docker-compose.traefik.yml,  (see #20 )
2024-07-12 06:40:35 +02:00
Wurzelmann
1ff2863505 Added LDAP_SERVER_CACERT to docker-compose.certbot.yml
Added LDAP_SERVER_CACERT to docker-compose.certbot.yml
2024-07-12 06:38:45 +02:00
Wurzelmann
cba73f3889 Added LDAP_SERVER_CACERT to docker-compose.yml
Added LDAP_SERVER_CACERT to docker-compose.yaml (see #20 )
2024-07-11 17:36:20 +02:00
sym
09a38afa57 Merge pull request #48 from maurerle/patch-2
add texlive path - use latest texlive
2024-03-05 19:37:23 +01:00
yzx9
217e61d9ad Reduce RUN instruction 2024-03-05 22:55:25 +08:00
Florian Maurer
6a761aca54 fix path - use latest texlive
This commit moves to tlmgr to install the latest texlive version.
Somehow the bin of the latex install dir is not on the PATH so we add it.

An image installed from this has a size of about 6.8GB and includes all packages of a typical latex distribution
2024-02-29 14:02:09 +01:00
7 changed files with 35 additions and 64 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 inital idea for this implementation was taken from
The Initial 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,17 +86,18 @@ COLLAB_TEXT=Direct share with collaborators is enabled only for activated users!
ADMIN_IS_SYSADMIN=false
```
*LOGIN_TEXT* : displayed instead of email-adress field (login.pug) <br/>
*LOGIN_TEXT* : displayed instead of email-address 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.treafik.yml](docker-compose.traefik.yml) or [docker-compose.certbot.yml](docker-compose.certbot.yml) to fit your local setup.
Edit [docker-compose.traefik.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.
@@ -157,6 +158,8 @@ 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
@@ -216,43 +219,39 @@ 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:
Use the following commands to generate the ldap-overleaf-sl docker image:
```
```bash
bash scripts/extract_files.sh 4.2.0
bash scripts/apply_diffs.sh
make
```
to generate the ldap-overleaf-sl docker image.
Use the following command to create a network for the docker instances:
use the command:
```
```bash
docker network create web
```
to create a network for the docker instances.
### Startup
#### Using without proxy
#### Using without reverse 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 proxy
#### Using reverse proxy
There are 2 different ways of starting either using Traefik or using Certbot. Adapt the one you want to use.
@@ -260,7 +259,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
```
@@ -269,7 +268,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,6 +56,7 @@ 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
@@ -90,6 +91,7 @@ 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,6 +137,7 @@ 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
@@ -171,6 +172,7 @@ 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,6 +54,7 @@ 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
@@ -88,6 +89,7 @@ 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,15 +19,18 @@ 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 python-pygments && \
apt-get -y install texlive texlive-lang-german texlive-latex-extra texlive-full texlive-science && \
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 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,10 +1,11 @@
268a268,364
268a269,366
>
> // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> oauth2Redirect(req, res, next) {
> // random state
> const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
> const state = new Array(6).fill(0).map(() => characters.charAt(Math.floor(Math.random() * characters.length))).join("")
> 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("")
> req.session.oauth2State = state
>
> const redirectURI = encodeURIComponent(`${process.env.SHARELATEX_SITE_URL}/oauth/callback`)

View File

@@ -1,38 +0,0 @@
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