Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
90d9342
Initial commit
bluesbird Nov 27, 2024
8b41d9c
init project
bluesbird Dec 4, 2024
24342b3
add VitruvServerApp
bluesbird Dec 4, 2024
98ad45d
fix dependency resolution?
larsk21 Dec 4, 2024
53bfe98
Merge remote-tracking branch 'origin/main'
larsk21 Dec 4, 2024
b92565f
fix: add missing repository for dependency resolution
bluesbird Dec 4, 2024
ae95fcc
refactor VitruvServerApp
bluesbird Dec 4, 2024
d6b05fa
add .gitignore
bluesbird Dec 4, 2024
63d6a22
clean code
bluesbird Dec 4, 2024
7f81cb9
configure VitruvServerApp as main class in pom
bluesbird Dec 4, 2024
14f1793
add init Dockerfile
bluesbird Dec 4, 2024
c9c9670
adjust Dockerfile
bluesbird Dec 6, 2024
ae30fc4
reconfigure pom: add maven-dependency-plugin and other small adjustments
bluesbird Dec 10, 2024
33c4804
add config.properties to specify the port
bluesbird Dec 10, 2024
8ed12b9
add logger: SLF4J with Log4j2 (with logback as backup (does not work …
bluesbird Dec 10, 2024
5527947
add info that server is still running
bluesbird Dec 10, 2024
1b609f7
try to fix problem: No SLF4J providers were found (does not work if m…
bluesbird Dec 10, 2024
203d8fd
adjust Dockerfile: add libs to container (used in entrypoint)
bluesbird Dec 10, 2024
b06199b
update README: add link to latest docker image
bluesbird Dec 10, 2024
da6cc97
refactoring and javadoc
bluesbird Dec 11, 2024
0d3098b
modify config.properties: add https server port
bluesbird Dec 12, 2024
4f5d334
modify pom: update maven-compiler-plugin to use Java 11 (source/targe…
bluesbird Dec 12, 2024
fe5b0b5
enhance VitruvServerApp: add HTTPS server and redirect request to Vit…
bluesbird Dec 12, 2024
542a349
add self-signed certificate keystore.p12
bluesbird Dec 13, 2024
4d15ca4
refactoring: add java doc
bluesbird Dec 13, 2024
a4ba090
refactoring: add warnings to empty override methods
bluesbird Dec 13, 2024
56f43b9
update README
bluesbird Dec 13, 2024
a4d7f56
increase scheduler period to 10s
bluesbird Dec 13, 2024
8992c00
refactoring comments/logs
bluesbird Dec 13, 2024
56d7fa0
clean code in Dockerfile
bluesbird Dec 14, 2024
f0e95c8
refactor VitruvServerApp: outsource code in methods
bluesbird Dec 18, 2024
add14f9
log response type
bluesbird Dec 18, 2024
3ba6735
refactoring: finalize variables
bluesbird Jan 7, 2025
ce3666a
modify config.properties: add comments
bluesbird Jan 7, 2025
d4eca91
update logger: save server log in file
bluesbird Jan 7, 2025
49267f1
modify pom: set source/target of maven-compiler-plugin to java 17
bluesbird Jan 11, 2025
2fdc341
modify log4j2: add code as comment for rolling file logging
bluesbird Jan 11, 2025
d427e49
refactor: split VitruvServerApp into multiple classes for improved mo…
bluesbird Jan 21, 2025
e72d82f
pom: add nimbusds dependencies
bluesbird Jan 21, 2025
0aa78c9
integrate oidc client
bluesbird Jan 21, 2025
6d24f22
Dockerfile: adjust entrypoint
bluesbird Jan 21, 2025
790d3ee
update gitignore: add zIgnore folder
bluesbird Jan 21, 2025
fd982e6
add class for auth endpoint
bluesbird Jan 22, 2025
1ab9bd1
add class for auth endpoint
bluesbird Jan 22, 2025
85fa043
VitruvServerApp: adjust callback url
bluesbird Jan 22, 2025
1b9eefd
improve logging
bluesbird Jan 22, 2025
bdfd902
OIDCClient: adjust validateIDToken method
bluesbird Jan 25, 2025
81ee874
CallbackEndpointHandler: add cookie: id token & access token (insecure)
bluesbird Jan 25, 2025
fe47580
clean code
bluesbird Jan 25, 2025
c4b7a44
VitruvServerApp: increase status info "still running.." to 1min
bluesbird Jan 25, 2025
0787c83
CallbackEndpointHandler: includes id, access and refresh token in coo…
bluesbird Jan 25, 2025
92c1d37
clean code
bluesbird Jan 25, 2025
c4cfe98
integrate TokenValidationHandler middleware/wrapper for access token …
bluesbird Jan 25, 2025
b010571
clean code
bluesbird Jan 25, 2025
11dfce3
CallbackEndpointHandler: adjust response body
bluesbird Jan 25, 2025
754560a
Merge pull request #1 from bluesbird/refactor/split-vitruvserverapp-c…
bluesbird Jan 25, 2025
e523ecd
Merge pull request #2 from bluesbird/oidc-integration
bluesbird Jan 25, 2025
142b7a2
TokenValidationHandler: improve logging
bluesbird Jan 25, 2025
8162614
config.properties: add FeLS config
bluesbird Jan 29, 2025
5a51eb4
TokenValidationHandler: add try&catch to token extraction
bluesbird Jan 29, 2025
8e3599c
refactor package names
bluesbird Jan 29, 2025
4964f55
clean code
bluesbird Jan 29, 2025
55cebaf
refresh_token: remove path
bluesbird Jan 29, 2025
38322bf
add path to Tokens
bluesbird Feb 1, 2025
19b585d
OIDCClient: add logic for refresh_token usage
bluesbird Feb 1, 2025
292d933
TokenValidationHandler: add Refresh Token validation AND remove ID To…
bluesbird Feb 1, 2025
bce4f01
improve logging AND ignore favicon requests
bluesbird Feb 1, 2025
be8d5c8
TokenValidationHandler: clean code
bluesbird Feb 1, 2025
f6591b2
config.properties: add domain config
bluesbird Feb 5, 2025
6143176
config.properties: refactor names
bluesbird Feb 5, 2025
7c81892
config.properties: add ssl certificate paths
bluesbird Feb 6, 2025
acf9c3a
VitruvServerApp: make config globally accessible
bluesbird Feb 8, 2025
14a5a0a
HttpsServerManager: use certbot certificate (read from resources)
bluesbird Feb 8, 2025
686f087
.gitignore: ignore certs and private keys
bluesbird Feb 8, 2025
918a646
HttpsRequestHandler: handle root request '/'
bluesbird Feb 8, 2025
c08facc
Merge pull request #3 from bluesbird/integrate-lets-encrypt-certificate
bluesbird Feb 8, 2025
ea5c4b6
outsource oidc credentials
bluesbird Feb 28, 2025
883c592
add docker-compose.yml
bluesbird Feb 28, 2025
50e5330
config.properties: change domain to vitruv-server.org
bluesbird Feb 28, 2025
e8a06ec
exchange metadata url
bluesbird Feb 28, 2025
99118d5
increase scheduler to 10min
bluesbird Feb 28, 2025
dec864e
CallbackEndpointHandler: update token response
bluesbird Mar 3, 2025
a5a5b92
TokenValidationHandler: outsource validation logic and token extracti…
bluesbird Mar 3, 2025
dd95d54
add TokenUtils: add token extraction functionality
bluesbird Mar 3, 2025
f7bef54
OIDCClient: add access token validation logic
bluesbird Mar 3, 2025
00c0b28
HttpsServerManager: use mounted SSL certificates, outsource privkey e…
bluesbird Mar 3, 2025
bf35daa
add SSLUtils for privkey extraction
bluesbird Mar 3, 2025
0bd52d4
rename package
bluesbird Mar 3, 2025
c0d6a2e
remove server stop methods
bluesbird Mar 3, 2025
7d431f0
VitruvServerApp: inline variables and increase notification scheduler…
bluesbird Mar 5, 2025
cdf7845
clean code
bluesbird Mar 5, 2025
b5e180e
add password for SSL context
bluesbird Mar 5, 2025
ed91fbb
clean code
bluesbird Mar 5, 2025
eaf25ab
SSLUtils: remove RSA algorithm (due EC is used)
bluesbird Mar 5, 2025
de43e6a
add secure (https) flag to cookies
bluesbird Mar 6, 2025
f52a9d2
clean code
bluesbird Mar 6, 2025
195ec08
integrate sec server with git history
bluesbird Mar 6, 2025
bb233b1
integrate sec server with git history
bluesbird Mar 6, 2025
f1da6e8
add Dockerfile
bluesbird Mar 7, 2025
1036f38
pom (root): add module secserver
bluesbird Mar 7, 2025
d5c8383
pom (secserver): adjust for integration
bluesbird Mar 7, 2025
14f9ea0
update docker-compose.yml
bluesbird Mar 7, 2025
5ac9f75
README: add useful links
bluesbird Mar 7, 2025
8edfeac
remove unnecessary files
bluesbird Mar 7, 2025
2b84924
add helpful files for deployment
bluesbird Mar 7, 2025
b3ade32
README: add guide "How to Deploy"
bluesbird Mar 7, 2025
9e8cb98
README: add short description
bluesbird Mar 7, 2025
7c97089
rename module to security-server
bluesbird Mar 7, 2025
ebb192b
add .env file (no sensitive data)
bluesbird Mar 7, 2025
d5e832a
refactor HttpsRequestHandler
bluesbird Mar 8, 2025
001f5ef
refactor CallbackEndpointHandler
bluesbird Mar 8, 2025
67d3cee
refactor TokenValidationHandler
bluesbird Mar 8, 2025
82d5a0d
OIDCClient: clean code
bluesbird Mar 8, 2025
3f91ea2
refactor OIDCClient
bluesbird Mar 8, 2025
c3b95c6
refactor HttpsServerManager
bluesbird Mar 8, 2025
5750071
VitruvServerManager: adjust comment for testing section
bluesbird Mar 8, 2025
f4a3851
refactor SSLUtils
bluesbird Mar 8, 2025
cc3f9ca
resources: remove unused files
bluesbird Mar 8, 2025
c51efa1
optimize imports
bluesbird Mar 8, 2025
c0739cc
VitruvServerManager: adjust comment
bluesbird Mar 9, 2025
b065552
README: add alternative way of monitoring
bluesbird Mar 9, 2025
6d284ef
Merge branch 'main' into integrate-security-server
bluesbird Mar 12, 2025
2635917
rename method
bluesbird Mar 12, 2025
85b4773
rename main class to VitruvSecurityServerApp
bluesbird Mar 12, 2025
d97f0b5
rename HttpsServerManager to SecurityServerManager
bluesbird Mar 12, 2025
1cb022e
rename SSL variables/methods to TLS
bluesbird Mar 12, 2025
720267e
rename HttpsRequestHandler to VitruvRequestHandler
bluesbird Mar 12, 2025
2e50566
refactoring and comments
bluesbird Mar 12, 2025
6358ecc
add new package 'interaction': outsource UserInteractorManager
bluesbird Mar 12, 2025
b838c87
small refactoring
bluesbird Mar 12, 2025
c505647
Merge branch 'main' into integrate-security-server
bluesbird Mar 24, 2025
eda48e4
ConfigManager: inline config.properties file
bluesbird Mar 12, 2025
0d5c3d1
refactoring: adjusts logs/comments
bluesbird Mar 24, 2025
1743b83
refactoring: outsource endpoints
bluesbird Mar 24, 2025
3387358
adds java doc
bluesbird Mar 24, 2025
7df5b82
add java doc
bluesbird Mar 26, 2025
bcf22bb
Merge branch 'main' into integrate-security-server
bluesbird Mar 26, 2025
884b225
remove deployment folder
bluesbird Mar 28, 2025
2efbcdb
optimize imports
bluesbird Mar 28, 2025
58715ee
add java doc
bluesbird Mar 28, 2025
2566385
clean code and small adjustments
bluesbird Mar 28, 2025
de64b5f
TokenValidationHandler: add debug logger for new tokens
bluesbird Mar 28, 2025
5667289
log4j2.xml: remove rolling file logging
bluesbird Mar 28, 2025
36055a0
clean up pom
bluesbird Mar 28, 2025
0ef8146
Dockerfile: adjust comment
bluesbird Mar 28, 2025
7159dc9
update README
bluesbird Mar 28, 2025
a582317
Merge branch 'main' into integrate-security-server
TomWerm Jul 21, 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
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM eclipse-temurin:17 AS builder
WORKDIR /app
COPY . .
# only build security-server module
RUN ./mvnw clean verify -pl security-server -am

FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=builder /app/security-server/target/security-server-3.2.0-SNAPSHOT.jar /app/app.jar
COPY --from=builder /app/security-server/target/libs /app/libs
ENTRYPOINT ["java", "-cp", "/app/app.jar:/app/libs/*", "app.VitruvSecurityServerApp"]
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<modules>
<module>remote</module>
<module>p2wrappers</module>
<module>security-server</module>
</modules>

<properties>
Expand Down
32 changes: 32 additions & 0 deletions security-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# VS Code
.vscode/

# Maven
target/
*.log
*.tmp
.mvn/wrapper/*.jar

# Eclipse
META-INF
build.properties
plugin.properties
.project
.classpath
.settings/
bin/

# IntelliJ
../.idea/
*.iml

# Project VitruvServer
zIgnore

# Let's Encrypt
certs/
*.pem
*.der

# OIDC-Provider data
*.env
169 changes: 169 additions & 0 deletions security-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Vitruv Security Server
Vitruv Security Server is a Java-based server application built with Maven,
that ensures secure communication between clients and the internal Vitruv Server.
It follows a lightweight and direct architecture without relying on frameworks like Spring.

The system is designed to:
- Authenticate clients via the _FeLS_ identity provider (using the OIDC protocol).
- Protect communication through TLS encryption.
- _Security Server_ checks if request is authorized.
- Forward authorized requests to the internal _Vitruv Server_.

The application runs containerized in a Docker environment on a bwCloud instance.
A cron job automatically renews the required TLS certificate from Let’s Encrypt via Certbot.

---
## Guide: How to Deploy

This guide explains step by setp how to deploy the Vitruv Security Server in a Docker environment.
Important files are located in the [`deployment/`](./deployment) directory.

### 1. Build a new Docker Image (optional)
_Only required if you need to modify or update the Vitruv Security Server._
#### 1.1 Build the image
Run the following command at the root level of the `Vitruv-Server` project:
```sh
docker build -t vitruv-security-server:vX.Y . #e.g.: v1.7
```
#### 1.2 Push to Docker Hub
```sh
docker login
docker tag vitruv-security-server:vX.Y bluesbird/vitruv-security-server:vX.Y
docker push bluesbird/vitruv-security-server:vX.Y
```
_Note: `bluesbird` has to be replaced with your Docker Hub username._

---

### 2. Pull Docker Image
The following steps are executed in the target environment (e.g. [bwCloud](https://www.bw-cloud.org/)).

1. Open an SSH session to your target VM:
```sh
ssh -i your_ssh_key [email protected] #user@your-server-ip
```

2. Pull latest Docker image:

```sh
docker pull bluesbird/vitruv-security-server:vX.Y
```

---

### 3. Get TLS Certificates from [Let's Encrypt](https://letsencrypt.org/)
Run the following command to generate TLS certificates via [Certbot](https://certbot.eff.org/):
```sh
certbot certonly --standalone -d <yourDomain>
```
Certificates are generated at `/etc/letsencrypt/live/<yourDomain>`.

_Note: `standalone` mode is used since no web server (such as Traefik or Nginx) is running.
For alternatives, see [Certbot documentation](https://eff-certbot.readthedocs.io/en/latest/using.html#getting-certificates-and-choosing-plugins)._

---

### 4. Copy and Configure important Files
**Note**: For this step you need OIDC client credentials for your domain.
In case you do did not receive them, contact Dr. Matthias Bonn ([[email protected]](https://www.scc.kit.edu/dienste/openid-connect.php#:~:text=matthias.bonn%40kit.edu)).

Copy the [`deployment/`](./deployment) directory to your target environment. This includes:
- [`.env`](./deployment/.env) &rarr; configure environment variables. This includes the OIDC client credentials.
- **Important: sensitive data** never commit this file!
Note: To recieve OIDC credentials request,
- [`docker-compose.yml`](./deployment/docker-compose.yml) &rarr; adjust the image name, tag and domain.
- [`renew_certificates.sh`](./deployment/renew_certificates.sh) &rarr; adjust paths and domain.

Follow the `TODO` comments in each file.
It is recommended to keep these files in the same directory.
Further information about these files is provided [here](#deployment-directory).

---

### 5. Start the Docker Container
1. Run the following command to start the container using [`docker-compose.yml`](./deployment/docker-compose.yml):
```sh
docker-compose up -d
```
_Note: `-d` flag for detached mode._


2. Monitor container (optional):
```sh
docker logs -f vitruv-security-server
```
Alternatively, the `server.log` file can be monitored inside the container:
```sh
docker exec -it vitruv-security-server /bin/bash
cat logs/server.log
```

---

### 6. Set Up Automatic Certificate Renewal
To automate the renewal process, add a cronjob that uses the [`renew_certificates.sh`](./deployment/renew_certificates.sh) script.
The script must be executable so that the cron daemon can run it without errors.

1. Make the script executable:
```sh
chmod 775 renew_certificates.sh
```
_Note: This sets read, write, and execute permissions._

2. Open the crontab:
```sh
crontab -e
```
3. Add the following line:
```sh
0 4 * * * /path/to/renew_certificates.sh >> /path/to/renew_certificates.log 2>&1
```
_Note: This cronjob runs daily at 4 AM and logs output to `/path/to/renew_certificates.log` (generated automatically)._

---
## Workflows
The following workflows illustrate the interaction as implemented between the client, the Security Server, the Vitruv Server, and FeLS.

### 1. Authentication Process via FeLS
This process occurs when no valid Access Token or Refresh Token is available.

1. The client sends an HTTPS request to the Security Server.
2. The Security Server detects that no valid Access Token or Refresh Token is present.
3. The client is redirected to the FeLS SSO authentication page for authentication.
4. After successful authentication, FeLS sends Access, ID and Refresh Tokens to the Security Server:
5. The Security Server validates the ID Token. If successful, all tokens are send to the client.
6. The client can now send authorized requests to the Vitruv Server (see [next](#2-request-handling-with-tokens) workflow).


### 2. Request Handling with Tokens
This process occurs when the client provides either a valid Access Token or a valid Refresh Token.

1. The client sends an HTTPS request with an Access Token to the Security Server.
2. The server checks the Access Token:
- If Access Token is valid &rarr; Request is forwarded to the Vitruv Server.
- If Access Token is invalid/missing:
- If a valid Refresh Token is available &rarr; The server attempts to refresh the Access Token and issue a new Refresh Token via FeLS before forwarding the request to the Vitruv Server.
- Else &rarr; The client is redirected to the FeLS SSO authentication page (&rarr; triggering the [Authentication Process](#1-authentication-process-via-fels)).
3. The Security Server returns the Vitruv Server's response to the client.
---

<!-- TOC --><a name="finding-refreshment-of-access-token"></a>
## Finding: Refreshment of Access Token
An unexpected behavior was observed when refreshing expired Access Tokens via the FeLS identity provider.
Instead of receiving a new JWT Access Token, the newly issued Access Token is an opaque token, similar to the Refresh Token.
This opaque token is immediately rejected as invalid when used, triggering a loop in the token refresh process.
While this does not affect the behaviour from an end user perspective, this is still a resource-wasting behaviour and a potential security risk.
The FeLS administrator confirmed this behavior is unintended and will investigate the issue.

**Update (27.02.2025):** After asking again, Mr. Michael Simon (SCC) said that changes were made and the issue should be re-tested.
A quick test revealed a change: no Access Token is returned at all, but the new Refresh Token remains functional and can still be used.
This needs further investigation.

---

## Further Useful Links
- **Live Server:** [www.vitruv-server.org](https://www.vitruv-server.org) (Hosted on [bwCloud](https://www.bw-cloud.org/))
- **Docker Images:** [Docker Hub - Vitruv Server](https://hub.docker.com/r/bluesbird/vitruvserver/tags)
- **OIDC Client Configuration:** [FeLS Project](https://fels.scc.kit.edu/project)
- **Original Development Repository:** [GitHub - Vitruv Server](https://github.com/bluesbird/VitruvServer)
- **Vitruv Repository:** [GitHub - Vitruv-Server](https://github.com/vitruv-tools/Vitruv-Server)
Loading