Skip to content

Commit

Permalink
Merge branch 'indigo-iam:master' into 809_jdbc-session-separate-db
Browse files Browse the repository at this point in the history
  • Loading branch information
DonaldChung-HK authored Nov 11, 2024
2 parents e7c4bac + fbfaea8 commit 8a7bb09
Show file tree
Hide file tree
Showing 169 changed files with 8,064 additions and 1,598 deletions.
40 changes: 40 additions & 0 deletions .devcontainer/h2/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "IAM Dev Container - H2",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8080
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"java.configuration.updateBuildConfiguration": "automatic",
"java.format.settings.url": "https://raw.githubusercontent.com/italiangrid/codestyle/master/eclipse-google-java-codestyle-formatter.xml",
"java.format.settings.profile": "GoogleStyle (CNAF)",
"maven.settingsFile": ".mvn/cnaf-mirror-settings.xml",
"java.configuration.maven.userSettings": ".mvn/cnaf-mirror-settings.xml"
},
"extensions": [
"vmware.vscode-boot-dev-pack"
]
}
},
"containerEnv": {
"SPRING_PROFILES_ACTIVE": "h2-test,dev"
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
25 changes: 25 additions & 0 deletions .devcontainer/mysql/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
devcontainer:
image: mcr.microsoft.com/devcontainers/java:1-17-bookworm
volumes:
- ../..:/workspaces/iam
network_mode: service:db
user: vscode
depends_on:
- db
environment:
IAM_DB_HOST: db
IAM_DB_NAME: iam
IAM_DB_USERNAME: iam
IAM_DB_PASSWORD: pwd
SPRING_PROFILES_ACTIVE: mysql-test,dev
command: sleep infinity

db:
image: mariadb:latest
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: dev
MYSQL_DATABASE: iam
MYSQL_USER: iam
MYSQL_PASSWORD: pwd
40 changes: 40 additions & 0 deletions .devcontainer/mysql/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/java
{
"name": "IAM Dev Container - MySQL",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"dockerComposeFile": "compose.yaml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/iam",
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "none",
"installMaven": "true",
"installGradle": "false"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
8080
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "java -version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"java.configuration.updateBuildConfiguration": "automatic",
"java.format.settings.url": "https://raw.githubusercontent.com/italiangrid/codestyle/master/eclipse-google-java-codestyle-formatter.xml",
"java.format.settings.profile": "GoogleStyle (CNAF)",
"maven.settingsFile": ".mvn/cnaf-mirror-settings.xml",
"java.configuration.maven.userSettings": ".mvn/cnaf-mirror-settings.xml"
},
"extensions": [
"vmware.vscode-boot-dev-pack"
]
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "compose/voms-replica/voms-testsuite"]
path = compose/voms-replica/voms-testsuite
url = [email protected]:italiangrid/voms-testsuite.git
29 changes: 29 additions & 0 deletions .mvn/cnaf-mirror-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--<localRepository>/tmp/m2-repository</localRepository>-->
<interactiveMode>false</interactiveMode>
<mirrors>
<mirror>
<id>nexus</id>
<name>CNAF maven mirror</name>
<url>https://repo.cloud.cnaf.infn.it/repository/maven-public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--settings=./.mvn/cnaf-mirror-settings.xml
101 changes: 99 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,103 @@
# Changelog

## 1.10.2 (2024-09-30)

## What's Changed

* Add devcontainer configuration https://github.com/indigo-iam/iam/pull/835
* Track refresh tokens in access token AUDIT logs https://github.com/indigo-iam/iam/pull/838
* Combine CERN HR logic with internal life-cycle https://github.com/indigo-iam/iam/pull/844

## 1.10.1 (2024-08-22)

## What's Fixed

* Fix repeated suspensions https://github.com/indigo-iam/iam/pull/831
* Fix typo in AUDIT log for suspended accounts https://github.com/indigo-iam/iam/pull/832
* Upgrade AngularJS version https://github.com/indigo-iam/iam/pull/820
* Fix AUP signature validity https://github.com/indigo-iam/iam/pull/834

## 1.10.0 (2024-08-05)

### What's Changed

* Send an email when client status changes https://github.com/indigo-iam/iam/pull/802
* Add a statistical anonymous endpoint https://github.com/indigo-iam/iam/pull/790
* PATCH to change AUP signature time works also for client credentials https://github.com/indigo-iam/iam/pull/804
* Add AUP and user's lifecycle missing email notifications https://github.com/indigo-iam/iam/pull/787
* Add groups enrollment logic to be applied after users registration https://github.com/indigo-iam/iam/pull/793
* Add the organization name in all email notifications subjects https://github.com/indigo-iam/iam/pull/810
* Improve password quality check https://github.com/indigo-iam/iam/pull/719
* Allow to totally disable cache https://github.com/indigo-iam/iam/pull/778

### Bug Fixes

* Refresh token flow not allowed for suspended clients https://github.com/indigo-iam/iam/pull/814
* Update angular-jwt script link https://github.com/indigo-iam/iam/pull/822
* Fix error 500 on old mitreId user interface https://github.com/indigo-iam/iam/pull/808

### Configuration Fixes

* Prefix all necessary env variables with IAM_ https://github.com/indigo-iam/iam/pull/807
* As described into #807, the environment variables `DEFAULT_ACCESS_TOKEN_VALIDITY_SECONDS`, `DEFAULT_DEVICE_CODE_VALIDITY_SECONDS`, `DEFAULT_ID_TOKEN_VALIDITY_SECONDS` and `DEFAULT_REFRESH_TOKEN_VALIDITY_SECONDS` have been renamed with `IAM_` prefix.
* Fix client track-last-used setting location in .yaml https://github.com/indigo-iam/iam/pull/795
* The client's "last-used" tracking has been disabled by default. You can turn it on by setting `IAM_CLIENT_TRACK_LAST_USED` as true. This feature allows administrators to see how many days have last since last token was issued for each client.
* The `redis-cache.enabled` property has been moved to `cache.redis.enabled`. This property is set by the same environment variable `IAM_REDIS_CACHE_ENABLED` so configurations that relies on this variable are not affected.

### Documentation Fixes

* VOMS-AA replica deployment example provided https://github.com/indigo-iam/iam/pull/729

## 1.9.0 (2024-06-06)

### What's Changed

* Show unrestricted scopes into well-known endpoint https://github.com/indigo-iam/iam/pull/628
* Fix account lifecycle workflow https://github.com/indigo-iam/iam/pull/746
* Administrators can disable a client https://github.com/indigo-iam/iam/pull/747
* Change VOMS warning message when requesting a too long proxy https://github.com/indigo-iam/iam/pull/756
* VO members can re-sign the AUP at any time https://github.com/indigo-iam/iam/pull/757
* Add delete signature and sign on behalf https://github.com/indigo-iam/iam/pull/777
* Increase SAML response skew from 60 to 300 secs https://github.com/indigo-iam/iam/pull/780
* Multiplatform docker https://github.com/indigo-iam/iam/pull/761
* (_Experimental_\*) Fix audit log for issued access tokens and add refresh token event https://github.com/indigo-iam/iam/pull/774
* Fix authorization on SCIM me endpoint https://github.com/indigo-iam/iam/pull/764
* (_Experimental_\*) Add attributes and managed groups to the SCIM user https://github.com/indigo-iam/iam/pull/764
* (_Experimental_\*) Add authorities list to SCIM user https://github.com/indigo-iam/iam/pull/788
* Add last used property to clients https://github.com/indigo-iam/iam/pull/675
* Display how much time is left to AUP expiry https://github.com/indigo-iam/iam/pull/783
* Allow to add nickname as attribute during a registration request https://github.com/indigo-iam/iam/pull/789

\* The introduced AUDIT messages and info to the SCIM user must be considered as experimental and they may be changed in next RC/releases in a backward incompatible way

### Notes

SCIM users response can now be extended in order to list also:
- user's attributes
- user's authorities
- user's managed groups

In order to include authorities and|or managed groups into SCIM users details you need to enable them through the following properties:

```
scim:
include_authorities: true
include_managed_groups: true
```
or through the environment variables:

```
IAM_SCIM_INCLUDE_AUTHORITIES=true
IAM_SCIM_INCLUDE_MANAGED_GROUPS=true
```

Attributes can be included into SCIM user response in the same way the labels are:

```
scim.include_attributes[0].name=attribute-name
scim.include_attributes[1].name=another-attribute-name
```

## 1.8.4 (2024-03-25)

### Added
Expand Down Expand Up @@ -441,8 +539,6 @@ the interface back as soon as these issues are resolved (#211).

- IAM now depends on MitreID connect v. 1.3.2.cnaf.rc0 (#180)

[iam-docs]: https://indigo-iam.github.io/docs

## 1.1.0 (2017-9-29)

### Added
Expand Down Expand Up @@ -583,6 +679,7 @@ Dockerhub.
Documentation on how to build and run the service can be found in the [IAM
GitBook manual][gitbook-manual] or on [Github][github-doc].

[iam-docs]: https://indigo-iam.github.io/docs
[iam-image]: https://hub.docker.com/r/indigodatacloud/iam-login-service
[mitre]: https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server
[scim]: http://www.simplecloud.info
Expand Down
14 changes: 14 additions & 0 deletions compose/voms-replica/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
COMPOSE_PROJECT_NAME=voms
TRUST_IMAGE=indigoiam/egi-trustanchors
TRUST_IMAGE_TAG=igi-test-ca
DB_IMAGE=mysql
DB_IMAGE_TAG=8.3
NGINX_IMAGE=baltig.infn.it:4567/cnafsd/ngx_http_voms_module/nginx-httpg-voms
NGINX_IMAGE_TAG=latest
VOMS_AA_IMAGE=indigoiam/voms-aa-bp
VOMS_AA_IMAGE_TAG=v1.8.3
GRID_CLIENTS_IMAGE=indigoiam/robot-framework
GRID_CLIENTS_IMAGE_TAG=latest
IAM_IMAGE=indigoiam/iam-login-service
IAM_IMAGE_TAG=v1.8.3

95 changes: 95 additions & 0 deletions compose/voms-replica/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# VOMS-AA Replica

This folder contains a docker compose example to deploy three instances of VOMS-AA in two sites with a DB replica.

![Setup schema.](VOMS-AA_replica.png)

With this setup the VOMS-AA service can be replicated on one or more remote locations. If one location fails or is overloaded, a VOMS client can connect to the other locations.

## Deployment description

The `compose` file definises a few containers:

* `trust`: docker image for the GRID CA certificates plus the `igi-test-ca` used in this deployment for test certificates.

The actual VOMS services are virtually divided between three sites:

#### Site 1: CERN
* `db-primary`: a dump of the IAM db for test environment. In addition to the db populated with the iam `mysql-dev` profile, the user `test` has a certificate with DN `/C=IT/O=IGI/CN=test0` linked to his account and he also is part of the `indigo-dc` group (necessary to obtain VOMS proxies). A second SQL script creates a `replicator` user for replica.
* `db-replica`: a DB configured to replicate the statements of `db-primary`, from the initial one. It conects with SSL and is configured to be read-only. Only the IAM DB tables which are used by VOMS-AA are replicated. You can see them [here](assets/mysql-conf/replica.cnf).
* `vomsaa-primary` and `vomsaa-replica`: the main voms-aa microservices, each connected to their own DB.
* `ngx-primary` and `ngx-replica`: an extension to NGINX, used for TLS termination, reverse proxy and possibly VOMS proxies validation. They sends requests to the corresponding `vomsaa-primary` and `vomsaa-replica` services.


#### Site 2: CNAF
* `db-remote`: this is a full replica of `db-replica`. Only the tables used by VOMS-AA are present in `db-replica`, and thus we avoiding transmitting over the remote network useless information.
* `vomsaa-remote`
* `ngx-remote`

#### Site 3: Anywhere else
* `client`: it is a single container containing GRID clients (in particular `voms-proxy-init`) used to query both the VOMS services. It connects in round-robin fashion to each endpoint and when one fails it falls back to the others. Here a p12 file for the test user encrypted with the `pass` password is present in the well-known directory (`/home/test/.globus/usercred.p12`). It can be used to obtain a VOMS proxy by `voms-aa` serving a VO named `indigo-dc`.

### Networking

We use a few distinct networks, similar to a real scenario:

* `site1-lan` and `site2-lan`: The internal LAN of the two sites. These are used to connect the DB, VOMS-AA and NGINX between them inside the same site.
* `site-to-site-tunnel`: This is a VPN network or any tunnel network between the two sites, used by `db-remote` to connect to `db-replica`.
* `wan`: The NGINX servers are exposed on the public network so that the clients can connect from anywhere.

## Test

Run the docker-compose with

```
$ docker compose up -d
```

and wait for the `trust` service to finish; all the services will be available shortly afterwards.

To query the voms-aa using the VOMS client, run:

```
$ docker compose exec client voms-proxy-init -voms indigo-dc
Enter GRID pass phrase for this identity:
Contacting voms-remote.test.example:443 [/C=IT/O=IGI/CN=*.test.example] "indigo-dc"...
Remote VOMS server contacted succesfully.
Created proxy in /tmp/x509up_u1000.
Your proxy is valid until Sat Mar 16 03:54:38 CET 2024
```

Check the content of the proxy with

```
$ docker compose exec client voms-proxy-info -all
subject : /C=IT/O=IGI/CN=test0/CN=441572696
issuer : /C=IT/O=IGI/CN=test0
identity : /C=IT/O=IGI/CN=test0
type : RFC3820 compliant impersonation proxy
strength : 2048
path : /tmp/x509up_u1000
timeleft : 11:59:45
key usage : Digital Signature, Non Repudiation, Key Encipherment
=== VO indigo-dc extension information ===
VO : indigo-dc
subject : /C=IT/O=IGI/CN=test0
issuer : /C=IT/O=IGI/CN=*.test.example
attribute : /indigo-dc/Role=NULL/Capability=NULL
timeleft : 11:59:45
uri : voms-remote.test.example:8080
```
If you want to force the query to one voms-aa use one of the followings:
```
$ docker compose exec client voms-proxy-init -voms voms-primary
$ docker compose exec client voms-proxy-init -voms voms-replica
$ docker compose exec client voms-proxy-init -voms voms-remote
```

To run the testsuite:
```
$ docker compose exec testsuite bash run-testsuite.sh
```
Binary file added compose/voms-replica/VOMS-AA_replica.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8a7bb09

Please sign in to comment.