Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 3b075b4

Browse files
Merge branch 'development' of https://github.com/hzi-braunschweig/SORMAS-Project into feature-3054-Remove-invalid-imports
� Conflicts: � sormas-e2e-ui-tests/Object Repository/Login/MainView/menu_Settings.rs � sormas-e2e-ui-tests/Scripts/Events/CreateNewEvent/Script1587017521693.groovy � sormas-e2e-ui-tests/Scripts/Login/partials/ChangeLanguageToEnglish/Script1585891866369.groovy
2 parents 40c97ff + fd39b02 commit 3b075b4

846 files changed

Lines changed: 23907 additions & 6473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ If you've never submitted an issue to the SORMAS repository before or this is yo
2424
* Device:
2525
* SORMAS version:
2626
* Android version/Browser:
27+
* Server URL:
28+
* User Role:
2729

2830
### Additional Information

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ deploy
2323
/sormas-app/java_pid21052.hprof
2424
bin
2525
/sormas-base/setup/setup.log
26+
27+
# Exclude maven wrapper
28+
!/.mvn/wrapper/maven-wrapper.jar
29+
2630
/sormas-cargoserver/.env
2731
/sormas-cargoserver/custom.env
2832
/sormas-cargoserver/custom.properties

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

GUIDE_SORMAS2SORMAS_CERTIFICATE.md

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This guide explains how to:
55
* set up the server address list file
66
* add certificates of other SORMAS instances to the local truststore
77
* add other servers to the local server list
8+
* handling self-signed ssl certificates on test systems
89

910
### Prerequisites
1011

@@ -13,32 +14,41 @@ See [Installing Java](SERVER_SETUP.md#java-11)
1314

1415
### Using the certificate generation script
1516

16-
1. Run ``bash ./generate-cert.sh``
17-
2. If the ``sormas2sormas`` directory is not found, you will be prompted to provide its path.
18-
3. If the ``SORMAS_PROPERTIES`` environment variable is not available, the script will search for the ``sormas.properties``
19-
file in ``/opt/domains/sormas/sormas.properties`` by default. If it is not found there, you will be prompted to provide
20-
the path to the ``sormas.properties`` file.
21-
4. For the generation of the certificate, the following data is needed: a password, a *Common Name* (CN)
22-
and an *Organization* (O). These may be set in environment variables (recommended), or provided
23-
manually as the script executes.
24-
* The password environment variable should be named ``SORMAS_S2S_CERT_PASS``. Please note that the password has to be
25-
at least 6 characters, or you will be prompted for a new one.
26-
* the *Common Name* environment variable should be named ``SORMAS_S2S_CERT_CN``.<br/>
27-
**Important**: for Germany, this value should be the SurvNet Code Site. <br/>
28-
E.g. *2.03.1.01.*
29-
* the *Organization* (O) environment variable should be named ``SORMAS_S2S_CERT_ORG``.<br/>
17+
1. Run ``bash ./s2s-generate-cert.sh``
18+
2. If the ``SORMAS2SORMAS_DIR`` environment variable is not available, the script will search for ``/opt/sormas2sormas`` by default.
19+
If it is not found there, you will be prompted to provide the pat to the *sormas2sormas* directory.
20+
3. If the ``SORMAS_DOMAIN_DIR`` environment variable is not available, the script will search for ``/opt/domains/sormas`` by default.<br>
21+
If it is not found there, you will be prompted to provide the path to the *sormas domain directory*.
22+
>If you don't have a local sormas installation, for example you are using the docker environment,
23+
>you can specify any existing directory and after the script finishes you will find a ``sormas.properties`` file there
24+
>that contains the necessary configuration that must be added to the ``sormas.properties`` file of your installation
25+
4. For the generation of the certificate, the following data is needed:
26+
an identifier of the *Organization*, the name of the *Organization*, the host name of the SORMAS server, the **https** port of the server,
27+
a password for the certificate keystore and a password for the REST user to be used when sharing data through the REST api.
28+
These may be set in environment variables (recommended), or provided manually as the script executes.
29+
30+
* the identifier of the *Organization* environment variable should be named ``SORMAS_ORG_ID``.
31+
This variable is also used as *Common Name* (CN) of the certificate<br/>
32+
**Important**: for Germany, this value should be the SORMAS SurvNet Code Site (e.g. 2.99.1.01. if the regular Code Site was 1.99.1.01.). <br/>
33+
* the name of the organization *Organization* (O) environment variable should be named ``SORMAS_ORG_NAME``.<br/>
3034
**Important**: for Germany, this value should be the name of the Health Department (Gesundheitsamt)
3135
to which the SORMAS instance will be assigned. <br/>
32-
E.g. *GA Braunschweig*
36+
E.g. *GA Musterhausen*
37+
* the host name variable should be named ``SORMAS_HOST_NAME``. <br/>
38+
E.g. *sormas.gesundheitsamt-musterhausen.de*
39+
* the https port environment variable should be named ``SORMAS_HTTPS_PORT``. If it is not found, you will be prompted to provide it.
40+
If you press enter without typing a port number the default 443 will be used.
41+
* The password environment variable should be named ``SORMAS_S2S_CERT_PASS``. Please note that the password has to be
42+
at least 6 characters, or you will be prompted for a new one.
43+
* the REST user password environment variable should be named ``SORMAS_S2S_REST_PASSWORD``.
44+
Please note that the password has to be at least 12 characters, or you will be prompted for a new one.
45+
3346
5. After providing the requested data, the certificate files will be generated. <br/>
3447
The generated certificate has a validity of 3 years.
3548
The certificate files will be available in the root SORMAS directory, in the folder ``/sormas2sormas``.
3649
6. A CSV file containing the access data for this instance will also be generated in the folder ``/sormas2sormas``.
37-
It will be named ``server-access-data.csv``.
38-
The file will contain on the first two columns of the first row the Common Name and the Organization, as provided
39-
when creating the certificate. <br/>
40-
**Please fill in on the third column the full URL of the server.** <br/>
41-
You will also have to set up a user for communicating with other SORMAS instances.
50+
It will be named ``{host name}-server-access-data.csv``.
51+
The file will contain the organization identifier, organization name, host name and the REST user password.<br/>
4252
7. The generated ``.p12`` file should not be shared with third parties. <br/>
4353
The generated ``.crt`` file will be verified and shared with other SORMAS instances, from which this instance
4454
will be able to request data. Conversely, in order to enable other SORMAS instances to request data from this
@@ -52,24 +62,43 @@ the path to the ``sormas.properties`` file.
5262
To enable other SORMAS instances to send and receive data from this instance, their certificate must be added to the
5363
truststore of this instance. Furthermore, the access data of other instances must be added to the local server
5464
list. To complete this setup, please follow the next steps:
55-
1. Run ``bash ./import-to-truststore.sh``
56-
2. If the ``sormas2sormas`` directory is not found, you will be prompted to provide its path.
57-
3. If the ``SORMAS_PROPERTIES`` environment variable is not available, the script will search for the ``sormas.properties``
58-
file in ``/opt/domains/sormas/sormas.properties`` by default. If it is not found there, you will be prompted to provide
59-
the path to the ``sormas.properties`` file.
65+
1. Run ``bash ./s2s-import-to-truststore.sh``
66+
2. If the ``SORMAS2SORMAS_DIR`` environment variable is not available, the script will search for ``/opt/sormas2sormas`` by default.
67+
If it is not found there, you will be prompted to provide the path to the *sormas2sormas* directory.
68+
3. If the ``SORMAS_DOMAIN_DIR`` environment variable is not available, the script will search for ``/opt/domains/sormas`` by default.
69+
If it is not found there, you will be prompted to provide the path to the *sormas domain directory*.
70+
>If you don't have a local sormas installation, for example you are using the docker environment,
71+
>you can specify any existing directory and after the script finishes you will find a ``sormas.properties`` file there
72+
>that contains the necessary configuration that must be added to the ``sormas.properties`` file of your installation
73+
6074
4. If ``sormas2sormas.truststore.p12`` is not found in the folder ``/sormas2sormas``, it will be created.
6175
The truststore password may be provided in an environment variable ``SORMAS_S2S_TRUSTSTORE_PASS``.
6276
* If the aforementioned environment variable is not available, the truststore password will be searched in the
6377
``sormas.properties`` file.
6478
* If it is not found there, you will be prompted to provide the truststore password.
6579
* The relevant properties will be automatically set by the script in the ``sormas.properties`` file.
6680
5. If the server address list file ``server-list.csv`` is not found in the folder ``/sormas2sormas``, it will also be created.
67-
6. You will be prompted to provide the file name of the certificate to be imported. This certificate should be located
68-
in the ``/sormas2sormas`` folder. Please provide the name including the extension. E.g ``mycert.crt``
81+
6. You will be prompted to provide the *host name* of the organization that's certificate is being imported.
82+
If the certificate was generated with the `s2s-generate-cert.sh` script, the identifier can be found at the beginning of the file.
83+
This certificate should be located in the ``/sormas2sormas`` folder.
6984
7. After providing the requested data, the certificate will be imported to the truststore.
70-
8. You should have also received a CSV file with the server access data. From this file, copy the line corresponding to the
71-
instance you would like to communicate with and add it to the local server address list file. This file is named
72-
``server-list.csv`` and is located in the ``/sormas2sormas`` folder. <br/>
73-
*Note*: You may check that the Common Name and the Organization of the certificate match the ones corresponding to
74-
the server in the CSV file.
75-
9. You may now delete the ``.crt`` file.
85+
8. The content of the ``server-access-data.csv`` provided together with the certificate will be copied to the ``server-list.csv`` file.
86+
9. You may now delete the ``.crt`` and ``server-access-data.csv`` files.
87+
88+
10. *Optional for test systems and other systems with self-signed ssl certificates* <br>
89+
You must import the SSL certificate of the other server into the ``cacerts.jks`` of your sormas domain.
90+
* For getting the SSL certificate you can use ``openssl`` <br>
91+
e.g.
92+
```shell script
93+
openssl s_client -showcerts -servername sormas.gesundheitsamt-musterhausen.de -connect sormas.gesundheitsamt-musterhausen.de:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certificate.cer
94+
```
95+
* To import the SSL certificate you can use ``keytool`` <br>
96+
e.g.
97+
```shell script
98+
keytool -importcert -trustcacerts -noprompt -keystore /opt/domains/sormas/config/cacerts.jks -alias sormas_dev -storepass changeit -file certificate.cer
99+
```
100+
Note that the alias can be used only once.
101+
102+
After the certificate is generated and at least one other certificate is imported,
103+
on some pages of the application you will see a new box with a *Share* button and information about sharing.
104+

SERVER_DEV_SETUP.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Other steps :
4444
* Adjust the logging configuration in ``${HOME}/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
4545
* Build and deploy applications (ear and war) with you IDE.
4646

47+
## Keycloak
48+
49+
See [Keycloak](SERVER_SETUP.md#keycloak-server) for how to install Docker locally.
50+
51+
If you are doing active development on Keycloak (themes, authentication mechanisms, translations, etc.) it's recommended to install the standalone variant.
52+
4753

4854
## Other components
4955

SERVER_SETUP.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Java 11](#java-11)
99
* [Postgres Database](#postgres-database)
1010
* [SORMAS Server](#sormas-server)
11+
* [Keycloak Server](#keycloak-server)
1112
* [Web Server Setup](#web-server-setup)
1213
* [Apache Web Server](#apache-web-server)
1314
* [Firewall](#firewall)
@@ -18,6 +19,7 @@
1819

1920
## Related
2021
* [Creating an App for a Demo Server](DEMO_APP.md)
22+
* [SORMAS Docker Repository](https://github.com/hzi-braunschweig/SORMAS-Docker)
2123

2224
## Prerequisites
2325

@@ -71,6 +73,62 @@
7173
* Adjust the logging configuration in ``/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
7274
* Linux: [Update the SORMAS domain](SERVER_UPDATE.md)
7375

76+
## Keycloak Server
77+
78+
By default Keycloak is run as a Docker container, which can be set up in two ways:
79+
* As a Docker container
80+
* As a Standalone installation
81+
82+
### Keycloak as a Docker container
83+
*To be done only in the situation when SORMAS is already installed on the machine as a standalone installation.*
84+
85+
*For complete Docker setup see the [SORMAS-Docker](https://github.com/hzi-braunschweig/SORMAS-Docker/tree/keycloak-integration) repository.*
86+
87+
**Prerequisites**
88+
* SORMAS Server is installed
89+
* PostgreSQL is installed
90+
* Docker is installed
91+
* Open and edit [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh) with your system's actual values
92+
93+
**Setup**
94+
* Run [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh)
95+
* Update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK`
96+
97+
98+
### Keycloak as a standalone installation
99+
100+
**Prerequisites**
101+
* SORMAS Server is installed
102+
* PostgreSQL is installed
103+
104+
**Setup**
105+
106+
Setting Keycloak up as a standalone installation [Server Installation and Configuration Guide](https://www.keycloak.org/docs/11.0/server_installation/#installation)
107+
* Make sure to configure Keycloak with PostgreSQL Database [Relational Database Setup](https://www.keycloak.org/docs/11.0/server_installation/#_database)
108+
* Setup an Admin User
109+
* Copy the `themes` folder content to `${KEYCLOAK_HOME}/themes` [Deploying Themes](https://www.keycloak.org/docs/11.0/server_development/#deploying-themes)
110+
* Create the SORMAS Realm by importing [SORMAS.json](sormas-base/setup/keycloak/SORMAS.json) see [Create a New Realm](https://www.keycloak.org/docs/11.0/server_admin/#_create-realm)
111+
* Update the `sormas-*` clients by generating new secrets for them
112+
* Update the realm's email settings to allow sending emails to users
113+
114+
To update the SORMAS Server run the following commands
115+
```shell script
116+
${ASADMIN} set-config-property --propertyName=payara.security.openid.clientSecret --propertyValue=${KEYCLOAK_SORMAS_UI_SECRET} --source=domain
117+
${ASADMIN} set-config-property --propertyName=payara.security.openid.clientId --propertyValue=sormas-ui --source=domain
118+
${ASADMIN} set-config-property --propertyName=payara.security.openid.scope --propertyValue=openid --source=domain
119+
${ASADMIN} set-config-property --propertyName=payara.security.openid.providerURI --propertyValue=http://localhost:${KEYCLOAK_PORT}/keycloak/auth/realms/SORMAS --source=domain
120+
${ASADMIN} set-config-property --propertyName=sormas.rest.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth\",\"ssl-required\":\"external\",\"resource\":\"sormas-rest\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_REST_SECRET}\"},\"confidential-port\":0,\"principal-attribute\":\"preferred_username\",\"enable-basic-auth\":true}" --source=domain
121+
${ASADMIN} set-config-property --propertyName=sormas.backend.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth/\",\"ssl-required\":\"external\",\"resource\":\"sormas-backend\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_BACKEND_SECRET}\"},\"confidential-port\":0}" --source=domain
122+
```
123+
where:
124+
* `${ASADMIN}` - represents the location to `${PAYARA_HOME}\bin\asadmin`
125+
* `${KEYCLOAK_PORT}` - the port on which keycloak will run
126+
* `${KEYCLOAK_SORMAS_UI_SECRET}` - is the secret generated in Keycloak for the `sormas-ui` client
127+
* `${KEYCLOAK_SORMAS_REST_SECRET}` - is the secret generated in Keycloack for the `sormas-rest` client
128+
* `${KEYCLOAK_SORMAS_BACKEND_SECRET}` - is the secret generated in Keycloack for the `sormas-backend` client
129+
130+
Then update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK`
131+
74132
## Web Server Setup
75133

76134
### Apache Web Server

0 commit comments

Comments
 (0)