Skip to content

Commit 5ed6f3d

Browse files
committed
SSL_CERTS_PATH needs a default - small fixes
1 parent 0de3769 commit 5ed6f3d

File tree

6 files changed

+183
-71
lines changed

6 files changed

+183
-71
lines changed

README.md

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ I won't go in to too much detail here but here are the basics for someone new to
6868
version: '3'
6969
services:
7070
app:
71-
image: 'jc21/nginx-proxy-manager:latest'
71+
image: 'baudneo/nginx-proxy-manager:latest'
7272
restart: unless-stopped
7373
ports:
7474
- '80:80'
@@ -100,6 +100,127 @@ Password: changeme
100100

101101
Immediately after logging in with this default user you will be asked to modify your details and change your password.
102102

103+
# Timezone
104+
## Environment Variables
105+
- `TZ` - Set to your timezone. Example: `TZ=America/Chicago`
106+
107+
## Configuration
108+
- Instead of setting `TZ` you can mount `/etc/localtime` into the docker container
109+
-------
110+
# CrowdSec OpenResty Bouncer
111+
112+
## NOTE
113+
- If you don't see the bouncer hitting your local API, send a request to one of the proxied hosts in NPM. I have noticed the bouncer does not start until NPM gets a request once it is all loaded up.
114+
- To check if the bouncer is running, use `docker logs --follow [name of your NPM container]`. There will be a log line like -> `nginx: [alert] [lua] init_by_lua:8: [Crowdsec] Initialisation done`
115+
116+
## Environment Variables
117+
- `CROWDSEC_BOUNCER=1` - Enable CrowdSec OpenResty bouncer, still needs to be configured.
118+
- `CROWDSEC_LAPI=[URL]` - configure CrowdSec local API URL
119+
- `CROWDSEC_KEY=[API KEY]` - configure CrowdSec API key
120+
- `$CROWDSEC_RECAP_SECRET=[SECRET KEY]` - configure reCAPTCHA
121+
- `$CROWDSEC_RECAP_SITE=[SITE KEY]` - configure reCAPTCHA
122+
- `SSL_CERTS_PATH` - CA certificate used to communicate with Google for reCAPTCHA validation
123+
## Configuration
124+
- Config file located at `data/crowdsec/crowdsec-openresty-bouncer.conf`
125+
- HTML templates are located at `/crowdsec/templates/` inside the container
126+
- The first time the container is run, a crowdsec config file is created with ENV vars substituted out. User is responsible for config after first creation of the file.
127+
- Set the URL and API key at a minimum. reCAPTCHA's vars if wanted.
128+
-------
129+
# Admin dashboard logging / OpenResty DEBUG level logging
130+
131+
## Environment Variables
132+
- `ADMIN_DASHBOARD_LOG=1` - Enable admin (Port 81) dashboard logging
133+
- `OPENRESTY_DEBUG=1` - Enable DEBUG level logging for the default OpenResty `ERROR` log
134+
135+
## Configuration
136+
- Admin panel logs are located at `data/logs/admin-panel_access.log` and `data/logs/admin-panel_error.log`
137+
- OpenResty default logs `fallback_access.log` and `fallback_error.log`. `DEBUG` level will be set on the error log, it is set to `WARN` by default.
138+
-------
139+
# ModSecurity
140+
_ModSecurity WAF is installed and loaded by default, OWASP-CoreRuleSet is installed and used as the default rule set. The user is responsible for configuring modsecurity via config/CLI._
141+
142+
## Environment Variables
143+
- `MODSEC_CREATE=1` - Force recreating the default modsecurity config, _This should never be needed_
144+
- `MODSEC_ADMIN_PANEL=1` - Enable ModSec for the admin panel
145+
- `MODSEC_ENABLE=1` - Enable ModSec for the default.conf server block
146+
147+
## Tips to enable
148+
### The minimum directives that need to be added to enable modsec.
149+
- See all directives -> https://github.com/SpiderLabs/ModSecurity-nginx#usage
150+
```
151+
modsecurity on;
152+
modsecurity_rules_file /etc/nginx/modsec/main.conf;
153+
```
154+
- To enable modsec for **ALL HTTP** hosts, add the directives to `data/nginx/custom/http_top.conf`
155+
- To enable for only **certain HTTP** hosts, add the directives to the `Advanced` tab configuration at the root level (not inside a `___location` block)
156+
- To enable only for **certain locations** on _certain HTTP_ hosts, place the directives into a `___location` block inside the `Advanced` tab
157+
- **Stream hosts are untested and, as far as I know, unsupported**. ModSec directives go in server and HTTP blocks.
158+
159+
## Configuration
160+
- By default, the audit log is enabled and is located at `data/logs/modsec_audit.log`
161+
- The config and rule set are located at `data/modsec` and `data/modsec/ruleset`
162+
- `data/modsec/modsecurity.conf` is the main modsec config file.
163+
- `data/modsec/main.conf` is the main rules file, it has `Include` directives that load the actual rules
164+
- `data/modsec` is symbolically linked to `/etc/nginx/modsec`
165+
-------
166+
# docker-compose.yaml
167+
```
168+
version: "3"
169+
services:
170+
npm:
171+
#image: 'jc21/nginx-proxy-manager:latest'
172+
image: 'baudneo/nginx-proxy-manager:latest'
173+
restart: always
174+
container_name: npm-crowdsec
175+
ports:
176+
# Public HTTP Port:
177+
- '80:80'
178+
# Public HTTPS Port:
179+
- '443:443'
180+
# Admin Web Port:
181+
- '81:81'
182+
environment:
183+
# This is the default cert used to validate reCAPTCHA
184+
SSL_CERTS_PATH: "/etc/ssl/certs/GTS_Root_R1.pem"
185+
TZ: "America/Chicago"
186+
ADMIN_PANEL_LOG: "1"
187+
CROWDSEC_BOUNCER: "1"
188+
OPENRESTY_DEBUG: "0"
189+
190+
CROWDSEC_LAPI: "http://IP TO CROWDSEC LOCAL API:8080"
191+
CROWDSEC_KEY: "xxxxxxxxxxxxxxxxxxxxxxxx"
192+
CROWDSEC_RECAP_SECRET: "XXXX"
193+
CROWDSEC_RECAP_SITE: "XXXX"
194+
# These are the settings to access your db
195+
DB_MYSQL_HOST: "db"
196+
DB_MYSQL_PORT: 3306
197+
DB_MYSQL_USER: "npm-user"
198+
DB_MYSQL_PASSWORD: "db user password"
199+
DB_MYSQL_NAME: "npm"
200+
# If you would rather use Sqlite uncomment this
201+
# and remove all DB_MYSQL_* lines above
202+
# DB_SQLITE_FILE: "/data/database.sqlite"
203+
# Uncomment this if IPv6 is not enabled on your host
204+
# DISABLE_IPV6: 'true'
205+
volumes:
206+
- ./data:/data
207+
- ./letsencrypt:/etc/letsencrypt
208+
depends_on:
209+
- db
210+
db:
211+
image: 'jc21/mariadb-aria:latest'
212+
restart: always
213+
container_name: npm_db
214+
environment:
215+
MYSQL_ROOT_PASSWORD: 'xxXXxxXXXxxxXXX'
216+
MYSQL_DATABASE: 'npm'
217+
MYSQL_USER: 'npm-user'
218+
MYSQL_PASSWORD: "db user password"
219+
volumes:
220+
- ./data/mysql:/var/lib/mysql
221+
```
222+
223+
103224

104225
## Contributors
105226

backend/package-lock.json

Lines changed: 39 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ARG BUILD_VERSION
1010
ARG BUILD_COMMIT
1111
ARG BUILD_DATE
1212
ARG BASE_TAG
13+
ARG SSL_CERTS_PATH
1314

1415
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
1516
S6_FIX_ATTRS_HIDDEN=1 \
@@ -21,7 +22,12 @@ ENV SUPPRESS_NO_CONFIG_WARNING=1 \
2122
OPENRESTY_DEBUG="0" \
2223
MODSEC_CREATE="0" \
2324
MODSEC_ENABLE="0" \
24-
MODSEC_ADMIN_PANEL="0"
25+
MODSEC_ADMIN_PANEL="0" \
26+
CROWDSEC_UPDATE_DIR='/cs-update' \
27+
GEOLITE_DB_GRAB="0" \
28+
GEOLITE2_DB_GRAB="0" \
29+
GEOIP_DIR="/geoip_db" \
30+
SSL_CERTS_PATH="${SSL_CERTS_PATH:-'/etc/ssl/certs/GTS_Root_R1.pem'}"
2531

2632
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
2733
&& apt-get update \

docker/rootfs/etc/cont-init.d/90_mmdb.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ log() {
88
if [[ -n "${GEOLITE2_DB_GRAB}" ]]; then
99
if [[ "${GEOLITE2_DB_GRAB}" == "1" ]] || [[ "${GEOLITE2_DB_GRAB}" -eq 1 ]]; then
1010
log "GeoLite2 DB Grab configured, installing/updating GeoLite2 Database's"
11-
geo2="${GEOIP_DIR:-/geoip}/2"
11+
geo2="${GEOIP_DIR:/geoip_db}/2"
1212
mkdir -p "$geo2/tmp"
13-
GEOIP2_DB_URLS=(
14-
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb"
15-
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb"
16-
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb"
17-
)
13+
if [ -z "$GEOIP2_DB_URLS" ]; then
14+
GEOIP2_DB_URLS=(
15+
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb"
16+
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb"
17+
"https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb"
18+
)
19+
fi
1820
# download new dbs and diff them, update if different
1921
for db in "${GEOIP2_DB_URLS[@]}"; do
2022
log "Downloading ${db##*/} from ${db%/*}..."
@@ -46,7 +48,7 @@ if [[ -n "${GEOLITE_DB_GRAB}" ]]; then
4648
if [ "${GEOLITE_DB_GRAB}" == "1" ] || [ "${GEOLITE2_DB_GRAB}" -eq 1 ]; then
4749
log "GeoLite LEGACY DB Grab configured, downloading GeoLite LEGACY Database's"
4850

49-
geo1="${GEOIP_DIR:-/geoip}/1"
51+
geo1="${GEOIP_DIR:/geoip_db}/1"
5052
mkdir -p "$geo1"
5153

5254

0 commit comments

Comments
 (0)