Compare commits
21 Commits
feature/re
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ada0928b0 | ||
|
|
92cc200af6 | ||
|
|
6b8b8cb502 | ||
|
|
2f681931ba | ||
|
|
3c1a186c31 | ||
|
|
784ee606cc | ||
|
|
f95cea4540 | ||
|
|
87bcead3c7 | ||
|
|
742bead105 | ||
|
|
f1f241bc7d | ||
|
|
f533098276 | ||
|
|
1406a95ed0 | ||
|
|
7ca6fe3eac | ||
|
|
eb63185daa | ||
|
|
a067039351 | ||
|
|
7f20ab3bee | ||
|
|
2005544190 | ||
|
|
6273a11b6d | ||
|
|
92b7526700 | ||
|
|
15894b6043 | ||
|
|
89bbe26e55 |
1
.env
1
.env
@ -7,3 +7,4 @@ WEB_HOST=
|
|||||||
APPLICATION=
|
APPLICATION=
|
||||||
AUTH_MODE=ldap
|
AUTH_MODE=ldap
|
||||||
# AUTH_MODE=account
|
# AUTH_MODE=account
|
||||||
|
REFRESH_TOKEN=0
|
||||||
48
config/http/nginx.conf
Normal file
48
config/http/nginx.conf
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
use epoll;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 off;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 60s;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
# Compression
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 1000;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_comp_level 1;
|
||||||
|
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
|
||||||
|
|
||||||
|
resolver 127.0.0.11 ipv6=off;
|
||||||
|
|
||||||
|
client_body_timeout 20s;
|
||||||
|
client_header_timeout 20s;
|
||||||
|
|
||||||
|
}
|
||||||
10
config/include/csp.conf
Normal file
10
config/include/csp.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set $CSP_UPGRADE_INSECURE_REQUESTS "upgrade-insecure-requests;";
|
||||||
|
set $CSP_DEFAULT_SRC "default-src https: wss: data: blob: 'self';";
|
||||||
|
set $CSP_BASE_URI "base-uri 'self';";
|
||||||
|
set $CSP_CONNECT_SRC "connect-src 'self' *.evoleasing.ru wss:;";
|
||||||
|
set $CSP_WORKER_SRC "worker-src 'self' blob:;";
|
||||||
|
set $CSP_FONT_SRC "font-src 'self' fonts.gstatic.com fonts.googleapis.com;";
|
||||||
|
set $CSP_SCRIPT_SRC "script-src 'self';";
|
||||||
|
set $CSP_STYLE_SRC "style-src 'self' 'unsafe-inline' fonts.googleapis.com;";
|
||||||
|
set $CSP_OBJECT_SRC "object-src 'none';";
|
||||||
|
set $CSP_FRAME_ANCESTORS "frame-ancestors 'none';";
|
||||||
5
config/include/headers.conf
Normal file
5
config/include/headers.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
4
config/include/robots.conf
Normal file
4
config/include/robots.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
location /robots.txt {
|
||||||
|
default_type text/plain;
|
||||||
|
return 200 "User-agent: *\nDisallow: /";
|
||||||
|
}
|
||||||
5
config/include/security-headers.conf
Normal file
5
config/include/security-headers.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
add_header Content-Security-Policy "$CSP_UPGRADE_INSECURE_REQUESTS $CSP_DEFAULT_SRC $CSP_BASE_URI $CSP_CONNECT_SRC $CSP_WORKER_SRC $CSP_FONT_SRC $CSP_SCRIPT_SRC $CSP_STYLE_SRC $CSP_OBJECT_SRC $CSP_FRAME_ANCESTORS";
|
||||||
|
add_header X-Frame-Options SAMEORIGIN;
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header Referrer-Policy no-referrer-when-downgrade;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";
|
||||||
@ -21,17 +21,11 @@ upstream app {
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
|
include /etc/nginx/include/csp.conf;
|
||||||
|
proxy_set_header auth-mode $AUTH_MODE;
|
||||||
|
proxy_set_header refresh-token $REFRESH_TOKEN;
|
||||||
|
|
||||||
gzip on;
|
error_page 401 /login/$AUTH_MODE;
|
||||||
gzip_min_length 1000;
|
|
||||||
gzip_proxied any;
|
|
||||||
gzip_comp_level 1;
|
|
||||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
|
||||||
gzip_vary on;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
|
|
||||||
|
|
||||||
error_page 401 /login;
|
|
||||||
|
|
||||||
|
|
||||||
location = /auth {
|
location = /auth {
|
||||||
@ -41,28 +35,39 @@ server {
|
|||||||
|
|
||||||
proxy_pass_request_body off;
|
proxy_pass_request_body off;
|
||||||
proxy_set_header Content-Length "";
|
proxy_set_header Content-Length "";
|
||||||
|
proxy_set_header X-Original-URI $request_uri;
|
||||||
proxy_intercept_errors on;
|
proxy_intercept_errors on;
|
||||||
|
|
||||||
|
proxy_set_header auth-mode $AUTH_MODE;
|
||||||
|
proxy_set_header refresh-token $REFRESH_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /login {
|
location /login {
|
||||||
proxy_pass $login_proxy;
|
proxy_pass $login_proxy;
|
||||||
|
|
||||||
|
include /etc/nginx/include/security-headers.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/(logout|get-user)$ {
|
location ~ ^/(logout|get-user|login-telegram|login-confirm|refresh-token)$ {
|
||||||
proxy_pass http://auth_api/$AUTH_MODE/$1;
|
proxy_pass http://auth_api/$AUTH_MODE/$1;
|
||||||
|
proxy_set_header auth-mode $AUTH_MODE;
|
||||||
|
proxy_set_header refresh-token $REFRESH_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://app;
|
proxy_pass http://app;
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
include /etc/nginx/include/headers.conf;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
include /etc/nginx/include/auth.conf;
|
||||||
proxy_set_header Connection 'upgrade';
|
include /etc/nginx/include/security-headers.conf;
|
||||||
proxy_set_header Host $host;
|
}
|
||||||
proxy_cache_bypass $http_upgrade;
|
|
||||||
|
|
||||||
include /etc/nginx/include/auth.conf;
|
location /socket.io/ {
|
||||||
|
proxy_pass http://auth_api/socket.io/;
|
||||||
|
|
||||||
|
include /etc/nginx/include/headers.conf;
|
||||||
|
include /etc/nginx/include/auth.conf;
|
||||||
|
include /etc/nginx/include/security-headers.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /health {
|
location = /health {
|
||||||
|
|||||||
26
config/nginx.exposed.conf
Normal file
26
config/nginx.exposed.conf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
include /etc/nginx/include/upstream.conf;
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass $APPLICATION;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /health {
|
||||||
|
access_log off;
|
||||||
|
add_header 'Content-Type' 'application/json';
|
||||||
|
return 200 'UP';
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/include/location.conf;
|
||||||
|
include /etc/nginx/include/robots.conf;
|
||||||
|
}
|
||||||
@ -8,15 +8,7 @@ upstream app {
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
|
include /etc/nginx/include/csp.conf;
|
||||||
gzip on;
|
|
||||||
gzip_min_length 1000;
|
|
||||||
gzip_proxied any;
|
|
||||||
gzip_comp_level 1;
|
|
||||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
|
||||||
gzip_vary on;
|
|
||||||
gzip_disable "msie6";
|
|
||||||
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://app;
|
proxy_pass http://app;
|
||||||
@ -26,6 +18,8 @@ server {
|
|||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
|
||||||
|
include /etc/nginx/include/security-headers.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /health {
|
location = /health {
|
||||||
|
|||||||
27
docker-compose.auth.expose.yml
Normal file
27
docker-compose.auth.expose.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
server:
|
||||||
|
ports:
|
||||||
|
- '${PORT_EXPOSE}:80'
|
||||||
|
image: nginx:alpine
|
||||||
|
environment:
|
||||||
|
- APPLICATION=${APPLICATION}
|
||||||
|
- AUTH_MODE=${AUTH_MODE}
|
||||||
|
- REFRESH_TOKEN=${REFRESH_TOKEN}
|
||||||
|
volumes:
|
||||||
|
- ./config/nginx.auth.conf:/etc/nginx/templates/default.conf.template
|
||||||
|
- ./config/include:/etc/nginx/include
|
||||||
|
- ./config/http/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- auth_network
|
||||||
|
- app_network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
auth_network:
|
||||||
|
external:
|
||||||
|
name: auth_network
|
||||||
|
app_network:
|
||||||
|
external:
|
||||||
|
name: ${NETWORK_NAME}
|
||||||
@ -9,9 +9,11 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- APPLICATION=${APPLICATION}
|
- APPLICATION=${APPLICATION}
|
||||||
- AUTH_MODE=${AUTH_MODE}
|
- AUTH_MODE=${AUTH_MODE}
|
||||||
|
- REFRESH_TOKEN=${REFRESH_TOKEN}
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/nginx.auth.conf:/etc/nginx/templates/default.conf.template
|
- ./config/nginx.auth.conf:/etc/nginx/templates/default.conf.template
|
||||||
- ./config/include:/etc/nginx/include
|
- ./config/include:/etc/nginx/include
|
||||||
|
- ./config/http/nginx.conf:/etc/nginx/nginx.conf
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- auth_network
|
- auth_network
|
||||||
@ -22,7 +24,7 @@ networks:
|
|||||||
external:
|
external:
|
||||||
name: auth_network
|
name: auth_network
|
||||||
app_network:
|
app_network:
|
||||||
external: true
|
external:
|
||||||
name: ${NETWORK_NAME}
|
name: ${NETWORK_NAME}
|
||||||
web:
|
web:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
19
docker-compose.exposed.yml
Normal file
19
docker-compose.exposed.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
server:
|
||||||
|
extends:
|
||||||
|
file: docker-compose.traefik.yml
|
||||||
|
service: server
|
||||||
|
image: nginx:alpine
|
||||||
|
environment:
|
||||||
|
- APPLICATION=${APPLICATION}
|
||||||
|
volumes:
|
||||||
|
- ./config/nginx.exposed.conf:/etc/nginx/templates/default.conf.template
|
||||||
|
- ./config/include:/etc/nginx/include
|
||||||
|
- ./config/http/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
web:
|
||||||
|
external: true
|
||||||
@ -11,6 +11,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./config/nginx.off.conf:/etc/nginx/templates/default.conf.template
|
- ./config/nginx.off.conf:/etc/nginx/templates/default.conf.template
|
||||||
- ./config/include:/etc/nginx/include
|
- ./config/include:/etc/nginx/include
|
||||||
|
- ./config/http/nginx.conf:/etc/nginx/nginx.conf
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- app_network
|
- app_network
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user