PolyculeConnect
Find a file
Melora Hugues 64e48a5689 Add basic way to get backend from query (#48)
Because polyculeconnect is a OIDC proxy, we need to know which auth
backend to use. This is provided using a query param or a form, so we
need to get it from our own middleware.

This commit adds the following elements:
 - basic DB storage for the backends
 - support for DB migrations and a first test migration (not definitive)
 - middleware to get the backend from the request and put it in the
   context
 - test that the backend exists in the auth flow
2024-08-16 11:29:19 +02:00
.forgejo/workflows Chore: replace woodpecker with forgejo actions 2024-08-10 16:41:55 +02:00
polyculeconnect Add basic way to get backend from query (#48) 2024-08-16 11:29:19 +02:00
.envrc Allow using config file as well as env variables 2024-08-10 15:46:16 +02:00
.gitignore chore: add vscode to gitignore 2023-10-22 14:18:11 +02:00
docker-compose.yml Fix dockerfile and add compose 2023-10-19 18:33:46 +02:00
Dockerfile Fix docker image not compatible with non static compilation 2023-11-04 17:59:34 +01:00
LICENSE chore: add license file 2023-10-21 21:24:35 +02:00
README.md Chore: replace woodpecker with forgejo actions 2024-08-10 16:41:55 +02:00

PolyculeConnect

status-badge

Project logo

Description

TODO

Configuration

As a temporary solution, the list of backends and applications, as well as the openconnect configuration can only be handled through the JSON config file.

{
    "openconnect": {
        "issuer": "https://polyculeconnect.domain",
        "clients": [
            {
                "name": "<name>",
                "id": "<client_id>",
                "secret": "<client_secret>",
                "redirectURIs": [
                    "<redirect_uri>"
                ]
            }
        ],
        "backends": [
            {
                "id": "<unique_id>",
                "name": "<human_readable_name>",
                "local": true,
                "type": "oidc",
                "config": {
                    "issuer": "https://polyculeconnect.domain",
                    "clientID": "<client_id>",
                    "clientSecret": "<client_secret>",
                    "redirectURI": "<redirect_uri>"
                }
            }
        ]
    }
}

The rest of the configuration is handled through environment variables

# Can be debug,info,warning,error
LOG_LEVEL = "info"

ISSUER = "http://localhost"

# Can be net,unix
SERVER_MODE = "net"
SERVER_HOST = "0.0.0.0"
SERVER_PORT = "5000"
# SERVER_SOCK_PATH = ""

STORAGE_TYPE = "sqlite"
STORAGE_FILEPATH = "./build/polyculeconnect.db"
# STORAGE_HOST = "127.0.0.1"
# STORAGE_PORT = "5432"
# STORAGE_DB = "polyculeconnect"
# STORAGE_USER = "polyculeconnect"
# STORAGE_PASSWORD = "polyculeconnect"
# STORAGE_SSL_MODE = "disable"
# STORAGE_SSL_CA_FILE = ""

You can register multiple backend and multiple clients (applications)

Running the server

Running from sources

# clone the directory
git clone https://git.faercol.me/PolyculeConnect/polycule-connect.git

cd polycule-connect

# build the sources
make -C polyculeconnect build

# edit the configuration file
vim config.json

# run the application
./polyculeconnect/build/polyculeconnect -config config.json

Running from docker image

# edit the configuration file
mkdir -p config
vim config/config.json

# run the docker container
docker run -v ./config/:/config -p 5000:5000 -it git.faercol.me/polyculeconnect/polyculeconnect:latest

Or using the example docker compose docker compose up