Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d0ec8bf
The cert and chain need to be combined in the same file. cat cert.pem…
mikaelfrykholm Oct 7, 2024
bcc69a8
Test on modern versions of python.
mikaelfrykholm Oct 7, 2024
53a5510
Try to test with the unreleased version of python3.13.
mikaelfrykholm Oct 7, 2024
e8c3b98
Start wiring up container build and test.
mikaelfrykholm Oct 7, 2024
eb13d86
Correct branch.
mikaelfrykholm Oct 7, 2024
3b17d2c
Make the container entity_id settable via env variables.
mikaelfrykholm Oct 11, 2024
6dbf680
Fix quoting and make the domain overridable with env variable for eas…
mikaelfrykholm Oct 11, 2024
baaa276
Hack in the flask_wallet from another repo.
mikaelfrykholm Oct 15, 2024
3e9b9a5
More hacking to get stuff to work.
mikaelfrykholm Oct 15, 2024
5a48d63
Wrong relative path.
mikaelfrykholm Oct 15, 2024
a996931
Don't try to change the template path.
mikaelfrykholm Oct 15, 2024
7d38d13
Enable flask_wallet example now that we ship it with the container.
mikaelfrykholm Oct 15, 2024
e063163
Add trust_anchors to flask_wallet.
mikaelfrykholm Oct 15, 2024
c640baf
Leave original views.py alone.
mikaelfrykholm Oct 16, 2024
e8f64c9
Help more to set up credential issuer in satosa.
mikaelfrykholm Oct 16, 2024
c3aefd3
Syntax error.
mikaelfrykholm Oct 16, 2024
ab1c1c0
Merge branch 'rohe:master' into master
mikaelfrykholm Nov 13, 2024
f23dc18
Change the example key so it won't be masrshalled to a number in python.
mikaelfrykholm Nov 15, 2024
e670a12
Add a bit clearer instructions when bootstrapping the federation.
mikaelfrykholm Nov 15, 2024
024ec01
Merge branch 'rohe:master' into master
mikaelfrykholm Nov 18, 2024
cd70ace
Merge branch 'rohe:master' into master
mikaelfrykholm Dec 6, 2024
11fbdad
Merge branch 'rohe:master' into master
mikaelfrykholm Dec 6, 2024
4f15c7b
[message] Updated metadata
rohe Dec 10, 2024
776dfc3
[combo.__init__] RPHandler does not have the get_metadata method
rohe Dec 11, 2024
6253041
[entity.__init__] Pick a trust chain from the stored.
rohe Dec 13, 2024
2ff20cd
documentation
rohe Dec 13, 2024
5f94f9c
documentation
rohe Dec 13, 2024
d15cc09
Add console logging to DC4EU wallet provider configuration
s-hal Jan 22, 2025
6ce8f71
Should not need to specify egg.
mikaelfrykholm Feb 6, 2025
64ee218
Revert "Should not need to specify egg."
mikaelfrykholm Feb 6, 2025
2aba632
New dependency location.
mikaelfrykholm Feb 6, 2025
94495bf
Can't mix editable an non editable requirements in the same world.
mikaelfrykholm Feb 7, 2025
598898f
Merge branch 'SUNET:master' into master
mikaelfrykholm Feb 10, 2025
5372ce8
Merge branch 'SUNET:master' into master
mikaelfrykholm Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-and-test-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file docker/fedservice.Dockerfile --tag fedservice:$(date +%s)
5 changes: 4 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13-dev'

steps:
- uses: actions/checkout@v2
Expand Down
88 changes: 88 additions & 0 deletions dc4eu_federation/bootstrap-dockers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/usr/bin/env bash
set -eo pipefail
DOMAIN="${DOMAIN:-$(hostname -f)}"
TRUST_ANCHOR="https://${DOMAIN}:7001"
TRUST_MARK_ISSUER="https://${DOMAIN}:6001"
WALLET_PROVIDER="https://${DOMAIN}:5001"

# Get Trust Anchor
#
docker_args="run --rm -i -v .:/workdir --entrypoint python3 docker.sunet.se/fedservice:latest fedservice/dc4eu_federation"
docker $docker_args/get_info.py -k -t $TRUST_ANCHOR > trust_anchor.json

# Add Anchor to Trust Mark Issuer
docker ${docker_args}/add_info.py -s /workdir/trust_anchor.json -t /workdir/trust_mark_issuer/trust_anchors
rm -r trust_mark_issuer/authority_hints
echo -e "${TRUST_ANCHOR}" >> trust_mark_issuer/authority_hints

#./entity.py trust_mark_issuer &
#sleep 2
#
docker ${docker_args}/get_info.py -k -s "${TRUST_MARK_ISSUER}" > trust_mark_issuer.json
docker ${docker_args}/add_info.py -s /workdir/trust_mark_issuer.json -t workdir/trust_anchor/subordinates

#FIXME: Special stuff here to get the paths right
docker run --rm -i -v .:/workdir -v ./trust_mark_issuer:/trust_mark_issuer --entrypoint python3 docker.sunet.se/fedservice:latest fedservice/dc4eu_federation/issuer.py /trust_mark_issuer > trust_mark_issuers.json
docker ${docker_args}/add_info.py -s workdir/trust_mark_issuers.json -t workdir/trust_anchor/trust_mark_issuers
#
## Wallet Provider
docker ${docker_args}/add_info.py -s workdir/trust_anchor.json -t workdir/wallet_provider/trust_anchors
rm -r wallet_provider/authority_hints
echo -e "${TRUST_ANCHOR}" >> wallet_provider/authority_hints
#
#./entity.py wallet_provider &
#sleep 2
#
docker ${docker_args}/get_info.py -k -s ${WALLET_PROVIDER} > wallet_provider.json
docker ${docker_args}/add_info.py -s /workdir/wallet_provider.json -t workdir/trust_anchor/subordinates
if [ ! -d flask_wallet/trust_anchors ]; then
mkdir flask_wallet/trust_anchors
fi
cp -a wallet_provider/trust_anchors/* flask_wallet/trust_anchors/
echo "Place this into oidc_frontend.yaml. Add below:"
echo "config: "
echo " op: "
echo " server_info: "
echo " trust_anchors:"
docker ${docker_args}/convert_json_to_yaml.py workdir/trust_anchor.json

echo "Also add authority_hints:"
echo " - ${TRUST_ANCHOR} "

echo "Also add trust_marks:"
echo " <TRUST_MARKS>"
docker run --rm -ti -v .:/workdir --entrypoint bash docker.sunet.se/fedservice:latest -c "cd workdir;/fedservice/dc4eu_federation/create_trust_mark.py -m http://dc4eu.example.com/PersonIdentificationData/se -d trust_mark_issuer -e $1"
cat << EOF
On Satosa, copy /etc/satosa/public/pid_fed_keys.json and add to
{
"$1": {
"entity_types": [
"federation_entity",
"openid_credential_issuer",
"oauth_authorization_server"
],
"jwks": {
EOF

echo "docker ${docker_args}/add_info.py -s /workdir/ci.json -t workdir/trust_anchor/subordinates"
## Query Server
#./add_info.py -s trust_anchor.json -t query_server/trust_anchors
#rm -r query_server/authority_hints
#echo -e "https://127.0.0.1:7003" >> query_server/authority_hints
#
#./entity.py query_server &
#sleep 2
#
#./get_info.py -k -s https://127.0.0.1:6005 > tmp.json
#./add_info.py -s tmp.json -t trust_anchor/subordinates

## PID Issuer
#./add_info.py -s trust_anchor.json -t pid_issuer/trust_anchors
#rm -r pid_issuer/authority_hints
#echo -e "https://127.0.0.1:7003" >> pid_issuer/authority_hints
#
#./entity.py pid_issuer &
#sleep 2
#
#./get_info.py -k -s https://127.0.0.1:6001 > tmp.json
#./add_info.py -s tmp.json -t trust_anchor/subordinates
9 changes: 9 additions & 0 deletions dc4eu_federation/convert_json_to_yaml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
import json
import sys

import yaml

fp = open(sys.argv[1], "r")
_dict = json.load(fp)
print(yaml.dump(_dict))
4 changes: 1 addition & 3 deletions dc4eu_federation/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ def init_app(dir_name, **kwargs) -> Flask:
if __name__ == "__main__":
print(sys.argv)
directory_name = sys.argv[1]
template_dir = os.path.join(directory_name, 'templates')
app = init_app(directory_name, template_folder=template_dir)
app = init_app(directory_name)
if "logging" in app.cnf:
configure_logging(config=app.cnf["logging"])
_web_conf = app.cnf["webserver"]
if os.environ.get('FEDSERVICE_WEBCERT_KEY'):
_web_conf['server_key'] = os.environ.get('FEDSERVICE_WEBCERT_KEY')
_web_conf['server_chain'] = os.environ.get('FEDSERVICE_WEBCERT_CHAIN')
_web_conf['server_cert'] = os.environ.get('FEDSERVICE_WEBCERT_CERT')
context = create_context(dir_path, _web_conf)
_cert = "{}/{}".format(dir_path, lower_or_upper(_web_conf, "server_cert"))
Expand Down
15 changes: 15 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
#!/bin/bash
set -eo pipefail
git clone --no-checkout --depth 1 --sparse --filter=blob:none https://github.com/rohe/satosa-openid4vci
pushd satosa-openid4vci
git sparse-checkout init --cone
git sparse-checkout add example/flask_wallet/
git checkout main
cp -a example/flask_wallet ../../dc4eu_federation
popd
rm -rf satosa-openid4vci
pushd ../dc4eu_federation/flask_wallet
mv templates templates.orig
mv templates_simplified templates
mv conf_simplified.json conf.json
#mv views_simplified.py views.py
popd
docker build -t fedservice -f ./fedservice.Dockerfile .. --no-cache
53 changes: 25 additions & 28 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ services:
ports:
- "5001:5001"
environment:
FEDSERVICE_ENTITYID: https://example.com:5001
FEDSERVICE_ENTITYID: https://${DOMAIN:-localhost}:5001
FEDSERVICE_WEBCERT_KEY: /certs/privkey.pem
FEDSERVICE_WEBCERT_CHAIN: /certs/chain.pem
FEDSERVICE_WEBCERT_CERT: /certs/cert.pem
FEDSERVICE_SECRET_KEY: 12345678909987654321
FEDSERVICE_WEBCERT_CERT: /certs/cert+chain.pem
FEDSERVICE_SECRET_KEY: A2345678909987654321
FEDSERVICE_DEBUG: true
FEDSERVICE_PORT: 5001
FEDSERVICE_BIND: 0.0.0.0
Expand All @@ -22,11 +21,10 @@ services:
ports:
- "6001:6001"
environment:
FEDSERVICE_ENTITYID: https://example.com:6001
FEDSERVICE_ENTITYID: https://${DOMAIN:-localhost}:6001
FEDSERVICE_WEBCERT_KEY: /certs/privkey.pem
FEDSERVICE_WEBCERT_CHAIN: /certs/chain.pem
FEDSERVICE_WEBCERT_CERT: /certs/cert.pem
FEDSERVICE_SECRET_KEY: 12345678909987654321
FEDSERVICE_WEBCERT_CERT: /certs/cert+chain.pem
FEDSERVICE_SECRET_KEY: B2345678909987654321
FEDSERVICE_DEBUG: true
FEDSERVICE_PORT: 6001
FEDSERVICE_BIND: 0.0.0.0
Expand All @@ -39,31 +37,30 @@ services:
ports:
- "7001:7001"
environment:
FEDSERVICE_ENTITYID: https://example.com:7001
FEDSERVICE_ENTITYID: https://${DOMAIN:-localhost}:7001
FEDSERVICE_WEBCERT_KEY: /certs/privkey.pem
FEDSERVICE_WEBCERT_CHAIN: /certs/chain.pem
FEDSERVICE_WEBCERT_CERT: /certs/cert.pem
FEDSERVICE_SECRET_KEY: 12345678909987654321
FEDSERVICE_WEBCERT_CERT: /certs/cert+chain.pem
FEDSERVICE_SECRET_KEY: C12345678909987654321
FEDSERVICE_DEBUG: true
FEDSERVICE_PORT: 7001
FEDSERVICE_BIND: 0.0.0.0
volumes:
- ./trust_anchor:/trust_anchor:rw
- ./certificates:/certs:ro
# flask_wallet:
# image: fedservice
# command: "flask_wallet"
# ports:
# - "5005:5005"
# environment:
# FEDSERVICE_ENTITYID: https://example.com:5005
# FEDSERVICE_WEBCERT_KEY: /cert/privkey.pem
# FEDSERVICE_WEBCERT_CHAIN: /cert/chain.pem
# FEDSERVICE_SECRET_KEY: 12345678909987654321
# FEDSERVICE_DEBUG: true
# FEDSERVICE_PORT: 5005
# FEDSERVICE_BIND: 0.0.0.0
# volumes:
# - ./flask_wallet:/flask_wallet:rw
# - ./certificates:/certs:ro
flask_wallet:
image: fedservice
command: "flask_wallet"
ports:
- "5005:5005"
environment:
FEDSERVICE_ENTITYID: https://${DOMAIN:-localhost}:5005
FEDSERVICE_WEBCERT_KEY: /certs/privkey.pem
FEDSERVICE_WEBCERT_CERT: /certs/cert+chain.pem
FEDSERVICE_SECRET_KEY: D12345678909987654321
FEDSERVICE_DEBUG: true
FEDSERVICE_PORT: 5005
FEDSERVICE_BIND: 0.0.0.0
volumes:
- ./flask_wallet:/flask_wallet:rw
- ./certificates:/certs:ro

3 changes: 2 additions & 1 deletion docker/fedservice.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libffi-dev \
libssl-dev \
xmlsec1 \
libyaml-dev
libyaml-dev \
jq
RUN pip3 install --upgrade pip setuptools
COPY . /fedservice
RUN pip3 install -r fedservice/docker/requirements.docker
Expand Down
6 changes: 3 additions & 3 deletions docker/requirements.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e git+https://github.com/IdentityPython/idpy-oidc.git@issuer_metadata#egg=idpyoidc
-e git+https://github.com/rohe/openid4v.git#egg=openid4v
-e git+https://github.com/rohe/idpy-sdjwt.git#egg=idpysdjwt
git+https://github.com/IdentityPython/idpy-oidc.git@issuer_metadata#egg=idpyoidc
git+https://github.com/SUNET/openid4v.git#egg=openid4v
git+https://github.com/SUNET/idpy-sdjwt.git#egg=idpysdjwt
flask
20 changes: 12 additions & 8 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/bash
set -eo pipefail

for file in conf.json views.py; do
if [ ! -f /"${1}"/"${file}" ]; then
echo "No ${file} found, copying to /${1}/"
cp /fedservice/dc4eu_federation/"${1}"/"${file}" /"${1}"/
else
echo "${file} found, leaving alone. Beware when upgrading."

fi
if [ -f /"${1}"/"${file}" ]; then
echo "${file} found, leaving alone. Beware when upgrading."
continue
fi
echo "No ${file} found, copying to /${1}/"
if [ $file = conf.json ]; then
jq --arg a "$FEDSERVICE_ENTITYID" ' .entity.entity_id = $a' /fedservice/dc4eu_federation/"${1}/${file}" > "${1}/${file}"
else
cp /fedservice/dc4eu_federation/"${1}/${file}" /"${1}"/
fi
done
echo "Starting $@."
echo "Starting ${1}."
/fedservice/dc4eu_federation/entity.py "$@"
Loading