-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5bbdad
commit e3a4f6c
Showing
4 changed files
with
247 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
services: | ||
sonarqube: | ||
image: sonarqube:lts-community | ||
ports: | ||
- 9000:9000 | ||
healthcheck: | ||
test: 'grep -Fq "SonarQube is operational" /opt/sonarqube/logs/sonar.log' | ||
interval: 10s | ||
timeout: 5s | ||
retries: 20 | ||
start_period: 2m | ||
|
||
https-proxy: | ||
image: nginx | ||
ports: | ||
- 4443:4443 | ||
volumes: | ||
- $GITHUB_WORKSPACE/.github/qa-sq-behind-ngix/nginx.conf:/etc/nginx/nginx.conf:ro | ||
- $GITHUB_WORKSPACE/.github/qa-sq-behind-ngix/ca.crt:/etc/nginx/client_certs/ca.crt:ro | ||
- $GITHUB_WORKSPACE/.github/qa-sq-behind-ngix/server.crt:/etc/nginx/server.crt:ro | ||
- $GITHUB_WORKSPACE/.github/qa-sq-behind-ngix/server.key:/etc/nginx/server.key:ro | ||
healthcheck: | ||
test: 'true' | ||
interval: 10s | ||
timeout: 5s | ||
retries: 20 | ||
start_period: 2m |
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,69 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
|
||
echo Generating server certificate... | ||
|
||
openssl req \ | ||
-newkey rsa:4096 \ | ||
-x509 \ | ||
-sha256 \ | ||
-addext "subjectAltName = DNS:localhost" \ | ||
-days 3650 \ | ||
-nodes \ | ||
-out server.crt \ | ||
-subj "/C=CH/ST=Geneva/L=Geneva/O=Server/OU=Dept" \ | ||
-keyout server.key | ||
|
||
echo Generating client certificate... | ||
|
||
# Generate Certificate Authority key | ||
openssl genrsa \ | ||
-passout pass:test42 \ | ||
-des3 \ | ||
-out ca.key 4096 \ | ||
|
||
# Generate Certificate Authority certificate | ||
openssl req \ | ||
-passin pass:test42 \ | ||
-new \ | ||
-x509 \ | ||
-days 365 \ | ||
-key ca.key \ | ||
-out ca.crt \ | ||
-subj "/C=CH/ST=Geneva/L=Geneva/O=CertificateAuthority/OU=ExpertDepartment" | ||
|
||
# Generating Client certificate key | ||
openssl genrsa \ | ||
-passout pass:test42 \ | ||
-des3 \ | ||
-out user.key 4096 | ||
|
||
# Generating Client certificate certificate | ||
openssl req \ | ||
-passin pass:test42 \ | ||
-new \ | ||
-key user.key \ | ||
-out user.csr \ | ||
-subj "/C=CH/ST=Geneva/L=Geneva/O=UserOrg/OU=UserDepartment" | ||
|
||
# Sign the certificate | ||
openssl x509 \ | ||
-passin pass:test42 \ | ||
-req \ | ||
-days 365 \ | ||
-in user.csr \ | ||
-CA ca.crt \ | ||
-CAkey ca.key \ | ||
-set_serial 01 \ | ||
-out user.crt | ||
|
||
# Generate a PKCS12 format certificate | ||
openssl pkcs12 \ | ||
-passin pass:test42 \ | ||
-passout pass:test42 \ | ||
-export \ | ||
-out user.p12 \ | ||
-inkey user.key \ | ||
-in user.crt \ | ||
-certfile ca.crt |
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,52 @@ | ||
user nginx; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log notice; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
|
||
server { | ||
# port to listen on. Can also be set to an IP:PORT | ||
listen 4443 ssl; | ||
#server_name localhost; | ||
|
||
ssl_protocols TLSv1.1 TLSv1.2; | ||
|
||
ssl_certificate /etc/nginx/server.crt; | ||
ssl_certificate_key /etc/nginx/server.key; | ||
|
||
access_log /var/log/nginx/localhost; | ||
error_log /var/log/nginx/localhost.error debug; | ||
|
||
location / { | ||
proxy_pass http://sonarqube:9000; # To update if necessary | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
proxy_set_header X-Forwarded-Proto https; | ||
} | ||
} | ||
} |
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