mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 19:16:40 +07:00
security: TLS, проверка Host, шифрованное запоминание входа и аудит-лог
- TLS через подключаемый overlay docker-compose.tls.yml + Caddyfile: Caddy сам получает и продлевает сертификат Let's Encrypt, HSTS добавляется на уровне прокси — намеренно там, а не в nginx.conf, иначе установки без TLS заперли бы сами себя; - проверка заголовка Host против DNS rebinding: AURUM_ALLOWED_HOSTS, по умолчанию localhost и 127.0.0.1, чужой Host получает 421 с подсказкой, какую переменную поправить; - «запомнить меня на 7 дней» вернулось в безопасном виде: пароль шифруется AES-GCM ключом с extractable: false в IndexedDB, вместо прежнего base64 в localStorage, который разворачивался обратно в пароль одним atob. Требует secure context, поэтому по обычному HTTP к LAN-адресу чекбокс не показывается, а не притворяется рабочим; - аудит-лог необратимых операций (восстановление бэкапа, массовое создание транзакций, удаление счёта) в лог контейнера. Не в БД сознательно: таблица аудита исчезла бы ровно в том событии, которое должна объяснять; - README: раздел про TLS и таблица двух переменных, решающих, кто может достучаться до инстанса.
This commit is contained in:
@@ -12,13 +12,16 @@ RUN apk add --no-cache openssl
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY docker-entrypoint.d/20-basic-auth.sh /docker-entrypoint.d/20-basic-auth.sh
|
||||
COPY docker-entrypoint.d/25-allowed-hosts.sh /docker-entrypoint.d/25-allowed-hosts.sh
|
||||
# sed strips any stray CR: cloned on Windows with core.autocrlf=true the
|
||||
# script arrives as CRLF, the kernel reads the shebang as "/bin/sh\r", and
|
||||
# scripts arrive as CRLF, the kernel reads the shebang as "/bin/sh\r", and
|
||||
# nginx dies on boot with "not found" (exit 127). .gitattributes fixes this
|
||||
# at the repository level; this line covers checkouts that predate it.
|
||||
RUN sed -i 's/\r$//' /docker-entrypoint.d/20-basic-auth.sh \
|
||||
&& chmod +x /docker-entrypoint.d/20-basic-auth.sh \
|
||||
&& touch /etc/nginx/basic-auth.conf
|
||||
# The empty .conf files matter: nginx.conf includes both unconditionally, and
|
||||
# an include of a missing file is a startup error.
|
||||
RUN sed -i 's/\r$//' /docker-entrypoint.d/20-basic-auth.sh /docker-entrypoint.d/25-allowed-hosts.sh \
|
||||
&& chmod +x /docker-entrypoint.d/20-basic-auth.sh /docker-entrypoint.d/25-allowed-hosts.sh \
|
||||
&& touch /etc/nginx/basic-auth.conf /etc/nginx/allowed-hosts.conf
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
Reference in New Issue
Block a user