-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added vault * Update ci-main.yml * Update ci-main.yml * fix vault name * Add Upload Script * Update ci-main.yml * Update ci-main.yml * Update ci-main.yml * Update ci-main.yml * Downgraded cloud version * fix db driver * added info state * Update Sign-And-Upload Script * Delete ci-sonar.yml * added vault properties * added vault properties * added cors * fix test * checkstyle Co-authored-by: Felix Dittrich <[email protected]> Co-authored-by: Felix Dittrich <[email protected]>
- Loading branch information
1 parent
d56a59d
commit 76fb5a5
Showing
13 changed files
with
206 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# DCC Rules Upload Script | ||
|
||
This Batch script allows to upload multiple DCC-Validation Rules with one CMD command. | ||
|
||
## Preparation | ||
|
||
Install DGC-CLI on your computer. Follow all the steps described in Readme file. | ||
https://github.com/eu-digital-green-certificates/dgc-cli | ||
|
||
Copy your DCC-Validation Rules in a directory next to the Batch-File. | ||
The Rules can be placed within a directory structure. | ||
A rule file MUST have the filename ```rule.json```. All other files will be ignored. | ||
|
||
Copy you Upload- and MTLS-Certificate into the directory. | ||
|
||
Open the Batch-File with a Text-Editor of your choice and set the following Values | ||
|
||
| Variable | Value | | ||
| --- | --- | | ||
| DGCG_ENDPOINT | URL of rules upload endpoint (should end with /rules) | | ||
| SIGNING_KEY | Path to PrivateKeyFile of your Upload Certificate | | ||
| SIGNING_CERT | Path to PEM-File of your Upload Certificate | | ||
| TLS_KEY | Path to PrivateKeyFile of your TLS Certificate | | ||
| TLS_CERT | Path to PEM-File of your TLS Certificate | | ||
|
||
## Upload Rules | ||
|
||
Just execute the Batch Script and all Rules will be uploaded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@echo off | ||
REM Change this values according to your needs | ||
SET DGCG_ENDPOINT="https://example.org/rules" | ||
SET SIGNING_KEY="upload_key.pem" | ||
SET SIGNING_CERT="upload.pem" | ||
SET TLS_KEY="auth_key.pem" | ||
SET TLS_CERT="auth.pem" | ||
|
||
|
||
REM DO NOT CHANGE ANYTHING BELOW THIS! | ||
|
||
echo Search rule files and sign with Upload Certificate and Upload to DGCG | ||
|
||
for /f "usebackq delims=|" %%f in (`dir /s/b rule.json`) do (call :upload %%f) | ||
|
||
echo deleting temporary file | ||
del -f tmp.cms | ||
|
||
goto :eof | ||
|
||
:upload | ||
echo Processing JSON file %1 | ||
call dgc signing sign-string -c %SIGNING_CERT% -k %SIGNING_KEY% -i "%1" -o tmp.cms | ||
call curl --no-progress-bar --request POST "%DGCG_ENDPOINT%" --header "Content-Type: application/cms-text" --header "Accept: application/json" --data-binary @tmp.cms --cert %TLS_CERT% --key %TLS_KEY% | ||
echo. | ||
echo. |
24 changes: 24 additions & 0 deletions
24
src/main/java/eu/europa/ec/dgc/businessrule/config/CorsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package eu.europa.ec.dgc.businessrule.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.web.cors.CorsConfiguration; | ||
import org.springframework.web.cors.CorsConfigurationSource; | ||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@Configuration | ||
@EnableWebSecurity | ||
public class CorsConfig implements WebMvcConfigurer { | ||
|
||
@Bean | ||
CorsConfigurationSource corsConfigurationSource(DgcConfigProperties dgcConfigProperties) { | ||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | ||
CorsConfiguration corsConfiguration = new CorsConfiguration().applyPermitDefaultValues(); | ||
corsConfiguration.addAllowedOrigin(dgcConfigProperties.getCorsUrl()); | ||
source.registerCorsConfiguration("/**",corsConfiguration); | ||
return source; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/eu/europa/ec/dgc/businessrule/config/WebSecurityConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package eu.europa.ec.dgc.businessrule.config; | ||
|
||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
|
||
@EnableWebSecurity | ||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
http.cors(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
spring: | ||
h2: | ||
console: | ||
enabled: false | ||
datasource: | ||
driver-class-name: org.postgresql.Driver | ||
url: jdbc:postgresql://localhost:5432/postgres | ||
username: postgres | ||
password: postgres | ||
url: jdbc:postgresql://${POSTGRESQL_SERVICE_HOST}:${POSTGRESQL_SERVICE_PORT}/${POSTGRESQL_DATABASE} | ||
username: ${POSTGRESQL_USER} | ||
password: ${POSTGRESQL_PASSWORD} | ||
jpa: | ||
database-platform: org.hibernate.dialect.PostgreSQLDialect | ||
springdoc: | ||
api-docs: | ||
enabled: false | ||
dgc: | ||
corsUrl: ${DGC_CORS_ENABLED_URL} | ||
gateway: | ||
connector: | ||
enabled: true | ||
endpoint: ${DGC_GATEWAY_CONNECTOR_ENDPOINT} | ||
proxy: | ||
enabled: false | ||
tls-trust-store: | ||
password: ${DGC_GATEWAY_CONNECTOR_TLSTRUSTSTORE_PASSWORD} | ||
path: ${DGC_GATEWAY_CONNECTOR_TLSTRUSTSTORE_PATH} | ||
tls-key-store: | ||
alias: ${DGC_GATEWAY_CONNECTOR_TLSKEYSTORE_ALIAS} | ||
password: ${DGC_GATEWAY_CONNECTOR_TLSKEYSTORE_PASSWORD} | ||
path: ${DGC_GATEWAY_CONNECTOR_TLSKEYSTORE_PATH} | ||
trust-anchor: | ||
alias: ${DGC_GATEWAY_CONNECTOR_TRUSTANCHOR_ALIAS} | ||
password: ${DGC_GATEWAY_CONNECTOR_TRUSTANCHOR_PASSWORD} | ||
path: ${DGC_GATEWAY_CONNECTOR_TRUSTANCHOR_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
spring: | ||
application: | ||
name: cwa-dcc-rules | ||
cloud: | ||
vault: | ||
ssl: | ||
trust-store: file:${SSL_VAULT_TRUSTSTORE_PATH} | ||
trust-store-password: ${SSL_VAULT_TRUSTSTORE_PASSWORD} | ||
enabled: true | ||
generic: | ||
enabled: false | ||
kv: | ||
enabled: true | ||
backend: ${VAULT_BACKEND} | ||
profile-separator: '/' | ||
application-name: 'cwa-dcc-rules' | ||
default-context: '' | ||
profiles: cloud | ||
fail-fast: true | ||
authentication: KUBERNETES | ||
kubernetes: | ||
role: ${VAULT_ROLE} | ||
kubernetes-path: kubernetes | ||
service-account-token-file: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
uri: ${VAULT_URI} | ||
connection-timeout: 5000 | ||
read-timeout: 15000 | ||
config: | ||
order: -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
spring: | ||
cloud: | ||
vault: | ||
enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters