Compare commits

...
Author SHA1 Message Date
Alvin-Zilverstand 8cd8b57a3c Add Swedish (sv-SE) language support 2026-09-25 10:38:46 +02:00
Jamie Curnow 2cfd3395cf Adds integration tests for per path access lists, fixes ipv6 jsv,
and enforces host-wide access list when location access list is not set
2026-09-24 12:21:49 +10:00
23 changed files with 1311 additions and 117 deletions

No files matched your search

+29 -59
View File
@@ -42,9 +42,11 @@ const getProxyHostsUsingAccessListInLocations = async (accessListId) => {
[`%"access_list_id":${accessListId}%`], [`%"access_list_id":${accessListId}%`],
); );
} }
// knex raw() returns [rows, metadata] for MySQL // knex raw() returns [rows, metadata] for MySQL, { rows } for Postgres and rows for SQLite
const rows = Array.isArray(result) && Array.isArray(result[0]) ? result[0] : result; if (!Array.isArray(result)) {
return rows || []; return result?.rows || [];
}
return (Array.isArray(result[0]) ? result[0] : result) || [];
}; };
const internalAccessList = { const internalAccessList = {
@@ -233,26 +235,6 @@ const internalAccessList = {
.whereIn("id", locationHostIds) .whereIn("id", locationHostIds)
.allowGraph(proxyHostModel.defaultAllowGraph) .allowGraph(proxyHostModel.defaultAllowGraph)
.withGraphFetched("[owner, certificate, access_list.[clients,items]]"); .withGraphFetched("[owner, certificate, access_list.[clients,items]]");
for (const host of locationHosts) {
// Fetch access lists for locations
if (host.locations?.length) {
for (let i = 0; i < host.locations.length; i++) {
const loc = host.locations[i];
if (loc.access_list_id && loc.access_list_id > 0) {
const locAccessList = await accessListModel
.query()
.allowGraph("[clients,items]")
.where("is_deleted", 0)
.andWhere("id", loc.access_list_id)
.withGraphFetched("[clients,items]")
.first();
if (locAccessList) {
host.locations[i].access_list = locAccessList;
}
}
}
}
}
await internalNginx.bulkGenerateConfigs("proxy_host", locationHosts); await internalNginx.bulkGenerateConfigs("proxy_host", locationHosts);
} }
} }
@@ -338,50 +320,38 @@ const internalAccessList = {
}); });
// 2. update any proxy hosts that were using it (ignoring permissions) // 2. update any proxy hosts that were using it (ignoring permissions)
if (row.proxy_hosts) { const affectedHostIds = new Set((row.proxy_hosts || []).map((h) => h.id));
if (affectedHostIds.size) {
await proxyHostModel.query().where("access_list_id", "=", row.id).patch({ access_list_id: 0 }); await proxyHostModel.query().where("access_list_id", "=", row.id).patch({ access_list_id: 0 });
// 3. reconfigure those hosts, then reload nginx
// set the access_list_id to zero for these items
row.proxy_hosts.map((_val, idx) => {
row.proxy_hosts[idx].access_list_id = 0;
return true;
});
await internalNginx.bulkGenerateConfigs("proxy_host", row.proxy_hosts);
} }
// Also handle proxy hosts that reference this access list in their locations JSON // Also clear it from any proxy host locations using it, these will then inherit the host's access list
const locationHostRows = await getProxyHostsUsingAccessListInLocations(row.id); const locationHostRows = await getProxyHostsUsingAccessListInLocations(row.id);
if (locationHostRows?.length) { for (const { id: hostId } of locationHostRows) {
const locationHostIds = locationHostRows.map((r) => r.id).filter((id) => { const host = await proxyHostModel.query().where("id", hostId).first();
return !row.proxy_hosts?.find((h) => h.id === id); if (host?.locations?.some((loc) => loc.access_list_id === row.id)) {
}); const updatedLocations = host.locations.map((loc) => {
if (locationHostIds.length) { if (loc.access_list_id === row.id) {
// Clear the access_list_id in locations JSON for these hosts return { ...loc, access_list_id: 0 };
for (const hostId of locationHostIds) {
const host = await proxyHostModel.query().where("id", hostId).first();
if (host?.locations) {
const updatedLocations = host.locations.map((loc) => {
if (loc.access_list_id === row.id) {
return { ...loc, access_list_id: 0 };
}
return loc;
});
await proxyHostModel.query().where("id", hostId).patch({ locations: updatedLocations });
} }
} return loc;
});
// Re-fetch and regenerate configs await proxyHostModel.query().where("id", hostId).patch({ locations: updatedLocations });
const locationHosts = await proxyHostModel.query() affectedHostIds.add(hostId);
.where("is_deleted", 0)
.whereIn("id", locationHostIds)
.allowGraph(proxyHostModel.defaultExpand)
.withGraphFetched("[owner, certificate, access_list.[clients,items]]");
await internalNginx.bulkGenerateConfigs("proxy_host", locationHosts);
} }
} }
// 3. reconfigure those hosts from fresh rows, then reload nginx
if (affectedHostIds.size) {
const affectedHosts = await proxyHostModel
.query()
.where("is_deleted", 0)
.whereIn("id", [...affectedHostIds])
.allowGraph(proxyHostModel.defaultAllowGraph)
.withGraphFetched("[owner, certificate, access_list.[clients,items]]");
await internalNginx.bulkGenerateConfigs("proxy_host", affectedHosts);
}
await internalNginx.reload(); await internalNginx.reload();
// delete the htpasswd file // delete the htpasswd file
+25 -1
View File
@@ -6,6 +6,7 @@ import _ from "lodash";
import errs from "../lib/error.js"; import errs from "../lib/error.js";
import utils from "../lib/utils.js"; import utils from "../lib/utils.js";
import { debug, nginx as logger } from "../logger.js"; import { debug, nginx as logger } from "../logger.js";
import accessListModel from "../models/access_list.js";
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename); const __dirname = dirname(__filename);
@@ -168,6 +169,24 @@ const internalNginx = {
host.locations[i], host.locations[i],
); );
// A location with its own access list overrides the host's,
// otherwise it inherits the host's access list
let locationAccessList = null;
if (locationCopy.access_list_id > 0 && locationCopy.access_list_id !== host.access_list?.id) {
locationAccessList = await accessListModel
.query()
.where("is_deleted", 0)
.andWhere("id", locationCopy.access_list_id)
.withGraphFetched("[clients,items]")
.first();
}
if (locationAccessList) {
locationCopy.access_list = locationAccessList;
} else {
locationCopy.access_list_id = host.access_list_id;
locationCopy.access_list = host.access_list;
}
if (locationCopy.forward_host.indexOf("/") > -1) { if (locationCopy.forward_host.indexOf("/") > -1) {
const splitted = locationCopy.forward_host.split("/"); const splitted = locationCopy.forward_host.split("/");
@@ -179,7 +198,9 @@ const internalNginx = {
} }
}; };
locationRendering().then(() => resolve(renderedLocations)); locationRendering()
.then(() => resolve(renderedLocations))
.catch(reject);
}); });
}, },
@@ -271,6 +292,9 @@ const internalNginx = {
debug(logger, `Could not write ${filename}:`, err.message); debug(logger, `Could not write ${filename}:`, err.message);
reject(new errs.ConfigurationError(err.message)); reject(new errs.ConfigurationError(err.message));
}); });
}).catch((err) => {
debug(logger, `Could not render locations for ${filename}:`, err.message);
reject(new errs.ConfigurationError(err.message));
}); });
}); });
}, },
-32
View File
@@ -2,7 +2,6 @@ import _ from "lodash";
import errs from "../lib/error.js"; import errs from "../lib/error.js";
import { castJsonIfNeed } from "../lib/helpers.js"; import { castJsonIfNeed } from "../lib/helpers.js";
import utils from "../lib/utils.js"; import utils from "../lib/utils.js";
import accessListModel from "../models/access_list.js";
import proxyHostModel from "../models/proxy_host.js"; import proxyHostModel from "../models/proxy_host.js";
import internalAuditLog from "./audit-log.js"; import internalAuditLog from "./audit-log.js";
import internalCertificate from "./certificate.js"; import internalCertificate from "./certificate.js";
@@ -13,33 +12,6 @@ const omissions = () => {
return ["is_deleted", "owner.is_deleted"]; return ["is_deleted", "owner.is_deleted"];
}; };
/**
* Fetches access lists for each location that has its own access_list_id.
* Attaches the expanded access_list object (with clients and items) to each location.
*
* @param {Object} host
* @returns {Promise}
*/
const fetchLocationAccessLists = async (host) => {
if (!host.locations?.length) {
return;
}
for (let i = 0; i < host.locations.length; i++) {
const loc = host.locations[i];
if (loc.access_list_id && loc.access_list_id > 0) {
const accessList = await accessListModel
.query()
.where("is_deleted", 0)
.andWhere("id", loc.access_list_id)
.withGraphFetched("[clients,items]")
.first();
if (accessList) {
host.locations[i].access_list = accessList;
}
}
}
};
const internalProxyHost = { const internalProxyHost = {
/** /**
* @param {Access} access * @param {Access} access
@@ -112,7 +84,6 @@ const internalProxyHost = {
}); });
}) })
.then(async (row) => { .then(async (row) => {
await fetchLocationAccessLists(row);
// Configure nginx // Configure nginx
return internalNginx.configure(proxyHostModel, "proxy_host", row).then(() => { return internalNginx.configure(proxyHostModel, "proxy_host", row).then(() => {
return row; return row;
@@ -242,7 +213,6 @@ const internalProxyHost = {
// No need to add nginx config if host is disabled // No need to add nginx config if host is disabled
return row; return row;
} }
await fetchLocationAccessLists(row);
// Configure nginx // Configure nginx
return internalNginx.configure(proxyHostModel, "proxy_host", row).then((new_meta) => { return internalNginx.configure(proxyHostModel, "proxy_host", row).then((new_meta) => {
row.meta = new_meta; row.meta = new_meta;
@@ -373,8 +343,6 @@ const internalProxyHost = {
enabled: 1, enabled: 1,
}); });
await fetchLocationAccessLists(row);
// Configure nginx // Configure nginx
await internalNginx.configure(proxyHostModel, "proxy_host", row); await internalNginx.configure(proxyHostModel, "proxy_host", row);
+3
View File
@@ -1,3 +1,4 @@
import net from "node:net";
import Ajv from "ajv/dist/2020.js"; import Ajv from "ajv/dist/2020.js";
import errs from "../error.js"; import errs from "../error.js";
@@ -9,6 +10,8 @@ const ajv = new Ajv({
coerceTypes: true, coerceTypes: true,
}); });
ajv.addFormat("ipv6", { type: "string", validate: (value) => net.isIPv6(value) });
/** /**
* @param {Object} schema * @param {Object} schema
* @param {Object} payload * @param {Object} payload
+3
View File
@@ -1,3 +1,4 @@
import net from "node:net";
import Ajv from "ajv/dist/2020.js"; import Ajv from "ajv/dist/2020.js";
import _ from "lodash"; import _ from "lodash";
import commonDefinitions from "../../schema/common.json" with { type: "json" }; import commonDefinitions from "../../schema/common.json" with { type: "json" };
@@ -14,6 +15,8 @@ const ajv = new Ajv({
schemas: [commonDefinitions], schemas: [commonDefinitions],
}); });
ajv.addFormat("ipv6", { type: "string", validate: (value) => net.isIPv6(value) });
/** /**
* *
* @param {Object} schema * @param {Object} schema
+4
View File
@@ -31,6 +31,10 @@ class AccessList extends Model {
$parseDatabaseJson(json) { $parseDatabaseJson(json) {
const thisJson = super.$parseDatabaseJson(json); const thisJson = super.$parseDatabaseJson(json);
// Postgres returns COUNT() as a string
if (typeof thisJson.proxy_host_count === "string") {
thisJson.proxy_host_count = Number.parseInt(thisJson.proxy_host_count, 10);
}
return convertIntFieldsToBool(thisJson, boolFields); return convertIntFieldsToBool(thisJson, boolFields);
} }
+1 -1
View File
@@ -44,7 +44,7 @@
}, },
{ {
"type": "string", "type": "string",
"format": "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$" "pattern": "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"
}, },
{ {
"type": "string", "type": "string",
+10
View File
@@ -38,6 +38,16 @@ services:
- website2.example.com - website2.example.com
- website3.example.com - website3.example.com
examplesite:
image: "${IMAGE}-examplesite:ci-${BUILD_NUMBER}"
build:
context: ../test/docker
dockerfile: Dockerfile.website
expose:
- "80/tcp"
networks:
- fulltest
stepca: stepca:
image: nginxproxymanager/testca image: nginxproxymanager/testca
volumes: volumes:
+26 -9
View File
@@ -1,4 +1,4 @@
import { IconLock, IconLockOpen2 } from "@tabler/icons-react"; import { IconArrowBackUp, IconLock, IconLockOpen2 } from "@tabler/icons-react";
import { Field, useFormikContext } from "formik"; import { Field, useFormikContext } from "formik";
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import Select, { type ActionMeta, components, type OptionProps } from "react-select"; import Select, { type ActionMeta, components, type OptionProps } from "react-select";
@@ -32,8 +32,16 @@ interface Props {
name?: string; name?: string;
label?: string; label?: string;
onFormChange?: (value: number) => void; onFormChange?: (value: number) => void;
// When set, the 0 option inherits the host's access list instead of being public
inheritHost?: boolean;
} }
export function AccessField({ name = "accessListId", label = "access-list", id = "accessListId", onFormChange }: Props) { export function AccessField({
name = "accessListId",
label = "access-list",
id = "accessListId",
onFormChange,
inheritHost = false,
}: Props) {
const { locale } = useLocaleState(); const { locale } = useLocaleState();
const { isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]); const { isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]);
const { setFieldValue } = useFormikContext(); const { setFieldValue } = useFormikContext();
@@ -60,13 +68,22 @@ export function AccessField({ name = "accessListId", label = "access-list", id =
icon: <IconLock size={14} className="text-lime" />, icon: <IconLock size={14} className="text-lime" />,
})) || []; })) || [];
// Public option // Public or inherit option
options?.unshift({ options?.unshift(
value: 0, inheritHost
label: intl.formatMessage({ id: "access-list.public" }), ? {
subLabel: intl.formatMessage({ id: "access-list.public.subtitle" }), value: 0,
icon: <IconLockOpen2 size={14} className="text-red" />, label: intl.formatMessage({ id: "access-list.inherit" }),
}); subLabel: intl.formatMessage({ id: "access-list.inherit.subtitle" }),
icon: <IconArrowBackUp size={14} className="text-secondary" />,
}
: {
value: 0,
label: intl.formatMessage({ id: "access-list.public" }),
subLabel: intl.formatMessage({ id: "access-list.public.subtitle" }),
icon: <IconLockOpen2 size={14} className="text-red" />,
},
);
return ( return (
<Field name={name}> <Field name={name}>
@@ -312,6 +312,7 @@ export function LocationsFields({ initialValues, name = "locations" }: Props) {
label="access-list" label="access-list"
id={`locations-access-list-${row.id}`} id={`locations-access-list-${row.id}`}
onFormChange={(value) => handleAccessListChange(row.id, value)} onFormChange={(value) => handleAccessListChange(row.id, value)}
inheritHost
/> />
{advVisible.includes(row.id) && ( {advVisible.includes(row.id) && (
<div className=""> <div className="">
+6
View File
@@ -71,6 +71,12 @@
"access-list.help.rules-order": { "access-list.help.rules-order": {
"defaultMessage": "Note that the allow and deny directives will be applied in the order they are defined." "defaultMessage": "Note that the allow and deny directives will be applied in the order they are defined."
}, },
"access-list.inherit": {
"defaultMessage": "Inherit from Proxy Host"
},
"access-list.inherit.subtitle": {
"defaultMessage": "Uses the proxy host's access list"
},
"access-list.pass-auth": { "access-list.pass-auth": {
"defaultMessage": "Pass Auth to Upstream" "defaultMessage": "Pass Auth to Upstream"
}, },
+6
View File
@@ -71,6 +71,12 @@
"access-list.help.rules-order": { "access-list.help.rules-order": {
"defaultMessage": "Luba ja keela reeglid rakenduvad selles järjekorras, milles need on kirjas." "defaultMessage": "Luba ja keela reeglid rakenduvad selles järjekorras, milles need on kirjas."
}, },
"access-list.inherit": {
"defaultMessage": "Päri puhverserverilt"
},
"access-list.inherit.subtitle": {
"defaultMessage": "Kasutab puhverserveri juurdepääsuloendit"
},
"access-list.pass-auth": { "access-list.pass-auth": {
"defaultMessage": "Edasta autentimine sihtserverile" "defaultMessage": "Edasta autentimine sihtserverile"
}, },
+17 -14
View File
@@ -57,20 +57,23 @@
"defaultMessage": "Български" "defaultMessage": "Български"
}, },
"locale-tr-TR": { "locale-tr-TR": {
"defaultMessage": "Türkçe" "defaultMessage": "Türkçe"
}, },
"locale-hu-HU": { "locale-hu-HU": {
"defaultMessage": "Magyar" "defaultMessage": "Magyar"
}, },
"locale-no-NO": { "locale-no-NO": {
"defaultMessage": "Norsk" "defaultMessage": "Norsk"
}, },
"locale-uk-UA": { "locale-uk-UA": {
"defaultMessage": "Українська" "defaultMessage": "Українська"
}, },
"locale-az-AZ": { "locale-sv-SE": {
"defaultMessage": "Azərbaycanca" "defaultMessage": "Svenska"
}, },
"locale-az-AZ": {
"defaultMessage": "Azərbaycanca"
},
"locale-fa-IR": { "locale-fa-IR": {
"defaultMessage": "فارسی" "defaultMessage": "فارسی"
} }
+776
View File
@@ -0,0 +1,776 @@
{
"2fa.backup-codes-remaining": {
"defaultMessage": "Kvarvarande backup-koder: {count}"
},
"2fa.backup-warning": {
"defaultMessage": "Spara dessa backup-koder på en säker plats. Varje kod kan bara användas en gång."
},
"2fa.disable": {
"defaultMessage": "Inaktivera tvåfaktorsautentisering"
},
"2fa.disable-confirm": {
"defaultMessage": "Inaktivera 2FA"
},
"2fa.disable-warning": {
"defaultMessage": "Att inaktivera tvåfaktorsautentisering gör ditt konto mindre säkert."
},
"2fa.disabled": {
"defaultMessage": "Inaktiverad"
},
"2fa.done": {
"defaultMessage": "Jag har sparat mina backup-koder"
},
"2fa.enable": {
"defaultMessage": "Aktivera tvåfaktorsautentisering"
},
"2fa.enabled": {
"defaultMessage": "Aktiverad"
},
"2fa.enter-code": {
"defaultMessage": "Ange verifieringskod"
},
"2fa.enter-code-disable": {
"defaultMessage": "Ange verifieringskod för att inaktivera"
},
"2fa.regenerate": {
"defaultMessage": "Förnya"
},
"2fa.regenerate-backup": {
"defaultMessage": "Generera nya backup-koder"
},
"2fa.regenerate-instructions": {
"defaultMessage": "Ange en verifieringskod för att generera nya backup-koder. Dina gamla koder blir ogiltiga."
},
"2fa.secret-key": {
"defaultMessage": "Hemlig nyckel"
},
"2fa.setup-instructions": {
"defaultMessage": "Scanna den här QR-koden med din autenticator-app, eller skriv in nyckeln manuellt."
},
"2fa.status": {
"defaultMessage": "Status"
},
"2fa.title": {
"defaultMessage": "Tvåfaktorsautentisering"
},
"2fa.verify-enable": {
"defaultMessage": "Verifiera och aktivera"
},
"access-list": {
"defaultMessage": "Tillgangslista"
},
"access-list.access-count": {
"defaultMessage": "{count} {count, plural, one {regel} other {regler}}"
},
"access-list.auth-count": {
"defaultMessage": "{count} {count, plural, one {användare} other {användare}}"
},
"access-list.help-rules-last": {
"defaultMessage": "När minst en regel finns läggs den \"deny all\"-regeln till sist"
},
"access-list.help.rules-order": {
"defaultMessage": "Var tillåt- och nek-direktiv används i den ordning de är definierade."
},
"access-list.pass-auth": {
"defaultMessage": "Skicka autentisering till upstream"
},
"access-list.public": {
"defaultMessage": "Offentlig tillgänglig"
},
"access-list.public.subtitle": {
"defaultMessage": "Ingen grundläggande autentisering krävs"
},
"access-list.rule-source.placeholder": {
"defaultMessage": "192.168.1.100 eller 192.168.1.0/24 eller 2001:db8::/32"
},
"access-list.satisfy-any": {
"defaultMessage": "Uppfyll ett krav"
},
"access-list.subtitle": {
"defaultMessage": "{users} {users, plural, one {användare} other {användare}}, {rules} {rules, plural, one {regel} other {regler}} - Skapad: {date}"
},
"access-lists": {
"defaultMessage": "Tillgångslister"
},
"action.add": {
"defaultMessage": "Lägg till"
},
"action.add-location": {
"defaultMessage": "Lägg till plats"
},
"action.allow": {
"defaultMessage": "Tillåt"
},
"action.close": {
"defaultMessage": "Stäng"
},
"action.delete": {
"defaultMessage": "Ta bort"
},
"action.deny": {
"defaultMessage": "Neka"
},
"action.disable": {
"defaultMessage": "Inaktivera"
},
"action.download": {
"defaultMessage": "Ladda ner"
},
"action.edit": {
"defaultMessage": "Redigera"
},
"action.enable": {
"defaultMessage": "Aktivera"
},
"action.permissions": {
"defaultMessage": "Tillstånd"
},
"action.renew": {
"defaultMessage": "Förnya"
},
"action.view-details": {
"defaultMessage": "Visa detaljer"
},
"auditlogs": {
"defaultMessage": "Granskningslogg"
},
"auto": {
"defaultMessage": "Auto"
},
"cancel": {
"defaultMessage": "Avbryt"
},
"certificate": {
"defaultMessage": "Certifikat"
},
"certificate.custom-certificate": {
"defaultMessage": "Anpassat certifikat"
},
"certificate.custom-certificate-key": {
"defaultMessage": "Anpassad certifikatnyckel"
},
"certificate.custom-intermediate": {
"defaultMessage": "Anstandscertifikat"
},
"certificate.in-use": {
"defaultMessage": "Används"
},
"certificate.none.subtitle": {
"defaultMessage": "Ingt certifikat tilldelat"
},
"certificate.none.subtitle.for-http": {
"defaultMessage": "Denna värd kommer inte att använda HTTPS"
},
"certificate.none.title": {
"defaultMessage": "Ingen"
},
"certificate.not-in-use": {
"defaultMessage": "Inte i användning"
},
"certificate.renew": {
"defaultMessage": "Förnya certifikat"
},
"certificates": {
"defaultMessage": "Certifikat"
},
"certificates.custom": {
"defaultMessage": "Anpassat certifikat"
},
"certificates.custom.warning": {
"defaultMessage": "Nyckelfiler med lösenfras stöds inte."
},
"certificates.dns.credentials": {
"defaultMessage": "Innehåll i autentiseringsfil"
},
"certificates.dns.credentials-note": {
"defaultMessage": "Den här pluginen kräver en konfigurationsfil som innehåller en API-token eller andra äktestegenskaper för din leverantör"
},
"certificates.dns.credentials-warning": {
"defaultMessage": "Denna data kommer att lagras som ren text i databasen och i en fil!"
},
"certificates.dns.propagation-seconds": {
"defaultMessage": "DNS-propageringssekunder"
},
"certificates.dns.propagation-seconds-note": {
"defaultMessage": "Lämna tomt för att använda plugins standardvärde. Antal sekunder att vänta på DNS-propagering."
},
"certificates.dns.provider": {
"defaultMessage": "DNS-leverantör"
},
"certificates.dns.provider.placeholder": {
"defaultMessage": "Välj en leverantör..."
},
"certificates.dns.warning": {
"defaultMessage": "Denna sektion kräver kunskap om Certbot och dess DNS-plugin. Vänligen konsultera dokumentationen för respektive plugin."
},
"certificates.http.reachability-404": {
"defaultMessage": "Det finns en server på detta domän, men det ser inte ut att vara Nginx Proxy Manager. Se till att ditt domän pekar på IP-adressen där NPM-instansen körs."
},
"certificates.http.reachability-failed-to-check": {
"defaultMessage": "Kunde inte kontrollera tillgänglighet på grund av kommunikationsfel med site24x7.com."
},
"certificates.http.reachability-not-resolved": {
"defaultMessage": "Det finns ingen server tillgänglig på detta domän. Se till att ditt domän finns och pekar på IP-adressen där NPM-instansen körs, och om nödvändigt att port 80 är forwarding i din router."
},
"certificates.http.reachability-ok": {
"defaultMessage": "Din server är tillgänglig, och det bör vara möjligt att skapa certifikat."
},
"certificates.http.reachability-other": {
"defaultMessage": "Det finns en server på detta domän, men den returnerade en oväntad kod {code}. Är det NPM-servern? Se till att ditt domän pekar på IP-adressen där NPM-instansen körs."
},
"certificates.http.reachability-wrong-data": {
"defaultMessage": "Det finns en server på detta domän, men den returnerade oväntade data. Är det NPM-servern? Se till att ditt domän pekar på IP-adressen där NPM-instansen körs."
},
"certificates.http.test-results": {
"defaultMessage": "Testresultat"
},
"certificates.http.warning": {
"defaultMessage": " Dessa domänerna måste redan konfigureras att peka mot den här installationen."
},
"certificates.key-type": {
"defaultMessage": "Nyckeltyp"
},
"certificates.key-type-description": {
"defaultMessage": "RSA är bredt kompatibel, ECDSA är snabbare och mer säker, men kanske inte stöds av äldre system"
},
"certificates.key-type-ecdsa": {
"defaultMessage": "ECDSA 256"
},
"certificates.key-type-rsa": {
"defaultMessage": "RSA 2048"
},
"certificates.request.subtitle": {
"defaultMessage": "med Let's Encrypt"
},
"certificates.request.title": {
"defaultMessage": "Begär ett nytt certifikat"
},
"column.access": {
"defaultMessage": "Åtkomst"
},
"column.authorization": {
"defaultMessage": "Autorisering"
},
"column.authorizations": {
"defaultMessage": "Autoriseringar"
},
"column.custom-locations": {
"defaultMessage": "Anpassade platser"
},
"column.destination": {
"defaultMessage": "Destination"
},
"column.details": {
"defaultMessage": "Detaljer"
},
"column.email": {
"defaultMessage": "E-post"
},
"column.event": {
"defaultMessage": "Händelse"
},
"column.expires": {
"defaultMessage": "Utgår"
},
"column.http-code": {
"defaultMessage": "HTTP-kod"
},
"column.incoming-port": {
"defaultMessage": "Inkommande port"
},
"column.name": {
"defaultMessage": "Namn"
},
"column.protocol": {
"defaultMessage": "Protokoll"
},
"column.provider": {
"defaultMessage": "Leverantör"
},
"column.roles": {
"defaultMessage": "Roller"
},
"column.rules": {
"defaultMessage": "Regler"
},
"column.satisfy": {
"defaultMessage": "Uppfyll"
},
"column.satisfy-all": {
"defaultMessage": "Alla"
},
"column.satisfy-any": {
"defaultMessage": "Någon"
},
"column.scheme": {
"defaultMessage": "Schema"
},
"column.source": {
"defaultMessage": "Källa"
},
"column.ssl": {
"defaultMessage": "SSL"
},
"column.status": {
"defaultMessage": "Status"
},
"created-on": {
"defaultMessage": "Skapad: {date}"
},
"dashboard": {
"defaultMessage": "Instrumentpanel"
},
"dead-host": {
"defaultMessage": "404-tjänst inte funnen"
},
"dead-hosts": {
"defaultMessage": "404-tjänster inte funna"
},
"dead-hosts.count": {
"defaultMessage": "{count} {count, plural, one {404-tjänst} other {404-tjänster}}"
},
"disabled": {
"defaultMessage": "Inaktiverad"
},
"domain-names": {
"defaultMessage": "Domännamn"
},
"domain-names.max": {
"defaultMessage": "{count} domännamn maximalt"
},
"domain-names.placeholder": {
"defaultMessage": "Börja skriva för att lägga till domän..."
},
"domain-names.wildcards-not-permitted": {
"defaultMessage": "Wildcards tillåts inte för den här typen"
},
"domain-names.wildcards-not-supported": {
"defaultMessage": "Wildcards stöds inte för den här CA:n"
},
"domains.advanced": {
"defaultMessage": "Avancerad"
},
"domains.force-ssl": {
"defaultMessage": "Zwång SSL"
},
"domains.hsts-enabled": {
"defaultMessage": "HSTS aktiverat"
},
"domains.hsts-subdomains": {
"defaultMessage": "HSTS underdomäner"
},
"domains.http2-support": {
"defaultMessage": "HTTP/2-stöd"
},
"domains.trust-forwarded-proto": {
"defaultMessage": "Förtroende för upstream forwarded proto-huvuden"
},
"domains.use-dns": {
"defaultMessage": "Använd DNS-utmaning"
},
"email-address": {
"defaultMessage": "E-postadress"
},
"empty-search": {
"defaultMessage": "Inga resultat hittade"
},
"empty-subtitle": {
"defaultMessage": "Varför inte skapa en?"
},
"enabled": {
"defaultMessage": "Aktiv"
},
"error.access.at-least-one": {
"defaultMessage": "Antingen en autorisering eller en tillgångsregel krävs"
},
"error.access.duplicate-usernames": {
"defaultMessage": "Autentiseringsanvändarnamnen måste vara unika"
},
"error.invalid-auth": {
"defaultMessage": "Ogiltig e-post eller lösenord"
},
"error.invalid-domain": {
"defaultMessage": "Ogiltigt domän: {domain}"
},
"error.invalid-email": {
"defaultMessage": "Ogiltig e-postadress"
},
"error.max-character-length": {
"defaultMessage": "Maximal längd är {max} tecken"
},
"error.max-domains": {
"defaultMessage": "För många domännamn, max är {max}"
},
"error.maximum": {
"defaultMessage": "Maximum är {max}"
},
"error.min-character-length": {
"defaultMessage": "Minsta längd är {min} tecken"
},
"error.minimum": {
"defaultMessage": "Minimum är {min}"
},
"error.passwords-must-match": {
"defaultMessage": "Lösenorden måste matcha"
},
"error.required": {
"defaultMessage": "Detta krävs"
},
"expires.on": {
"defaultMessage": "Utgår: {date}"
},
"footer.github-fork": {
"defaultMessage": "Fork mig på GitHub"
},
"host.flags.block-exploits": {
"defaultMessage": "Blockera vanliga utnyttjanden"
},
"host.flags.cache-assets": {
"defaultMessage": "Cacha resurser"
},
"host.flags.preserve-path": {
"defaultMessage": "Bevara sökväg"
},
"host.flags.protocols": {
"defaultMessage": "Protokoll"
},
"host.flags.websockets-upgrade": {
"defaultMessage": "Websocket-stöd"
},
"host.forward-port": {
"defaultMessage": "Vidarekoppla port"
},
"host.forward-scheme": {
"defaultMessage": "Schema"
},
"hosts": {
"defaultMessage": "Värdar"
},
"http-only": {
"defaultMessage": "Endast HTTP"
},
"lets-encrypt": {
"defaultMessage": "Let's Encrypt"
},
"lets-encrypt-via-dns": {
"defaultMessage": "Let's Encrypt via DNS"
},
"lets-encrypt-via-http": {
"defaultMessage": "Let's Encrypt via HTTP"
},
"loading": {
"defaultMessage": "Laddar..."
},
"login.2fa-code": {
"defaultMessage": "Verifieringskod"
},
"login.2fa-code-placeholder": {
"defaultMessage": "Skriv in kod"
},
"login.2fa-description": {
"defaultMessage": "Skriv in koden från din autenticator-app"
},
"login.2fa-title": {
"defaultMessage": "Tvåfaktorsautentisering"
},
"login.2fa-verify": {
"defaultMessage": "Verifiera"
},
"login.title": {
"defaultMessage": "Logga in på ditt konto"
},
"nginx-config.label": {
"defaultMessage": "Anpassad Nginx-konfiguration"
},
"nginx-config.placeholder": {
"defaultMessage": "# Skriv in din anpassade Nginx-konfiguration här på egen risk!"
},
"no-permission-error": {
"defaultMessage": "Du har inte tillgång att se detta"
},
"notfound.action": {
"defaultMessage": "Tag mig hem"
},
"notfound.content": {
"defaultMessage": "Beklagar, sidan du sökte efter hittades inte"
},
"notfound.title": {
"defaultMessage": "Oops... du har precis hittat en fel-sida"
},
"notification.error": {
"defaultMessage": "Fel"
},
"notification.object-deleted": {
"defaultMessage": "{object} har tagits bort"
},
"notification.object-disabled": {
"defaultMessage": "{object} har inaktiverats"
},
"notification.object-enabled": {
"defaultMessage": "{object} har aktiverats"
},
"notification.object-renewed": {
"defaultMessage": "{object} har förnyats"
},
"notification.object-saved": {
"defaultMessage": "{object} har sparats"
},
"notification.success": {
"defaultMessage": "Lyckades"
},
"object.actions-title": {
"defaultMessage": "{object} #{id}"
},
"object.add": {
"defaultMessage": "Lägg till {object}"
},
"object.delete": {
"defaultMessage": "Ta bort {object}"
},
"object.delete.content": {
"defaultMessage": "Är du säker på att du vill ta bort den här {object}?"
},
"object.edit": {
"defaultMessage": "Redigera {object}"
},
"object.empty": {
"defaultMessage": "Ingen {objects}"
},
"object.event.created": {
"defaultMessage": "Skapad {object}"
},
"object.event.deleted": {
"defaultMessage": "Raderad {object}"
},
"object.event.disabled": {
"defaultMessage": "Inaktiverad {object}"
},
"object.event.enabled": {
"defaultMessage": "Aktiviterad {object}"
},
"object.event.renewed": {
"defaultMessage": "Förnyad {object}"
},
"object.event.updated": {
"defaultMessage": "Uppdaterad {object}"
},
"offline": {
"defaultMessage": "Offline"
},
"online": {
"defaultMessage": "Online"
},
"options": {
"defaultMessage": "Alternativ"
},
"password": {
"defaultMessage": "Lösenord"
},
"password.generate": {
"defaultMessage": "Generera slumpmässigt lösenord"
},
"password.hide": {
"defaultMessage": "Göm lösenord"
},
"password.show": {
"defaultMessage": "Visa lösenord"
},
"permissions.hidden": {
"defaultMessage": "Gölggt"
},
"permissions.manage": {
"defaultMessage": "Hantera"
},
"permissions.view": {
"defaultMessage": "Endast visa"
},
"permissions.visibility.all": {
"defaultMessage": "Alla poster"
},
"permissions.visibility.title": {
"defaultMessage": "Synlighet för poster"
},
"permissions.visibility.user": {
"defaultMessage": "Endast skapade poster"
},
"proxy-host": {
"defaultMessage": "Proxy-värd"
},
"proxy-host.forward-host": {
"defaultMessage": "Forward Hostname / IP"
},
"proxy-hosts": {
"defaultMessage": "Proxy-värdar"
},
"proxy-hosts.count": {
"defaultMessage": "{count} {count, plural, one {Proxy-värd} other {Proxy-värdar}}"
},
"public": {
"defaultMessage": "Offentlig"
},
"redirection-host": {
"defaultMessage": "Omdirigeringsvärd"
},
"redirection-host.forward-domain": {
"defaultMessage": "Forward domain"
},
"redirection-host.forward-http-code": {
"defaultMessage": "HTTP-kod"
},
"redirection-hosts": {
"defaultMessage": "Omdirigeringsvärdar"
},
"redirection-hosts.count": {
"defaultMessage": "{count} {count, plural, one {Omdirigeringsvärd} other {Omdirigeringsvärdar}}"
},
"redirection-hosts.http-code.300": {
"defaultMessage": "300 Flera val"
},
"redirection-hosts.http-code.301": {
"defaultMessage": "301 Permanent omdirigering"
},
"redirection-hosts.http-code.302": {
"defaultMessage": "302 Tillfällig omdirigering"
},
"redirection-hosts.http-code.303": {
"defaultMessage": "303 Se annan"
},
"redirection-hosts.http-code.307": {
"defaultMessage": "307 Tillfällig omdirigering"
},
"redirection-hosts.http-code.308": {
"defaultMessage": "308 Permanent omdirigering"
},
"role.admin": {
"defaultMessage": "Administratör"
},
"role.standard-user": {
"defaultMessage": "Standardanvändare"
},
"save": {
"defaultMessage": "Spara"
},
"setting": {
"defaultMessage": "Inställning"
},
"settings": {
"defaultMessage": "Inställningar"
},
"settings.default-site": {
"defaultMessage": "Standardplats"
},
"settings.default-site.404": {
"defaultMessage": "404-sida"
},
"settings.default-site.444": {
"defaultMessage": "Ingen respons (444)"
},
"settings.default-site.congratulations": {
"defaultMessage": "Grattis-sida"
},
"settings.default-site.description": {
"defaultMessage": "Vad som ska visas när Nginx träffar en okänd värd"
},
"settings.default-site.html": {
"defaultMessage": "Anpassad HTML"
},
"settings.default-site.html.placeholder": {
"defaultMessage": "<!-- Skriv in ditt anpassade HTML-innehåll här -->"
},
"settings.default-site.redirect": {
"defaultMessage": "Omdirigering"
},
"setup.preamble": {
"defaultMessage": "Kom igång genom att skapa din administratörskonto."
},
"setup.title": {
"defaultMessage": "Välkommen!"
},
"sign-in": {
"defaultMessage": "Logga in"
},
"ssl-certificate": {
"defaultMessage": "SSL-certifikat"
},
"stream": {
"defaultMessage": "Ström"
},
"stream.forward-host": {
"defaultMessage": "Forward värd"
},
"stream.forward-host.placeholder": {
"defaultMessage": "example.com eller 10.0.0.1 eller 2001:db8:3333:4444:5555:6666:7777:8888"
},
"stream.incoming-port": {
"defaultMessage": "Inkommande port"
},
"streams": {
"defaultMessage": "Strömmar"
},
"streams.count": {
"defaultMessage": "{count} {count, plural, one {Ström} other {Strömmar}}"
},
"streams.tcp": {
"defaultMessage": "TCP"
},
"streams.udp": {
"defaultMessage": "UDP"
},
"test": {
"defaultMessage": "Test"
},
"update-available": {
"defaultMessage": "Uppdatering tillgänglig: {latestVersion}"
},
"user": {
"defaultMessage": "Användare"
},
"user.change-password": {
"defaultMessage": "Ändra lösenord"
},
"user.confirm-password": {
"defaultMessage": "Bekräfta lösenord"
},
"user.current-password": {
"defaultMessage": "Nuvarande lösenord"
},
"user.edit-profile": {
"defaultMessage": "Redigera profil"
},
"user.full-name": {
"defaultMessage": "Fullständigt namn"
},
"user.login-as": {
"defaultMessage": "Logga in som {name}"
},
"user.logout": {
"defaultMessage": "Logga ut"
},
"user.new-password": {
"defaultMessage": "Nytt lösenord"
},
"user.nickname": {
"defaultMessage": "Nickname"
},
"user.set-password": {
"defaultMessage": "Ange lösenord"
},
"user.set-permissions": {
"defaultMessage": "Ange behörigheter för {name}"
},
"user.switch-dark": {
"defaultMessage": "Vänd till mörk läge"
},
"user.switch-light": {
"defaultMessage": "Vänd till ljust läge"
},
"user.two-factor": {
"defaultMessage": "Tvåfaktorsautentisering"
},
"username": {
"defaultMessage": "Användarnamn"
},
"users": {
"defaultMessage": "Användare"
}
}
+2 -1
View File
@@ -65,7 +65,8 @@ rm -rf "${LOCAL_RESOLVE}"
printf "nameserver %s\noptions ndots:0" "${DNSROUTER_IP}" > "${LOCAL_RESOLVE}" printf "nameserver %s\noptions ndots:0" "${DNSROUTER_IP}" > "${LOCAL_RESOLVE}"
# bring up all remaining containers, except cypress! # bring up all remaining containers, except cypress!
docker compose up -d --remove-orphans stepca squid docker compose build examplesite
docker compose up -d --remove-orphans --no-build stepca squid examplesite
docker compose pull db-mysql || true # ok to fail docker compose pull db-mysql || true # ok to fail
docker compose pull db-postgres || true # ok to fail docker compose pull db-postgres || true # ok to fail
docker compose pull authentik authentik-redis authentik-ldap || true # ok to fail docker compose pull authentik authentik-redis authentik-ldap || true # ok to fail
@@ -0,0 +1,301 @@
/// <reference types="cypress" />
describe('Per-path Access Lists', () => {
const domain = 'website3.example.com';
const alpha = {
name: 'Path Alpha',
username: 'alpha-user',
password: 'alpha-pass',
};
const beta = {
name: 'Path Beta',
username: 'beta-user',
password: 'beta-pass',
};
let token;
let alphaListId;
let betaListId;
let hostId;
/**
* Requests a path on the proxy host directly (bypassing squid)
* and yields the HTTP status code and response body
*
* @param {string} path
* @param {object} [creds]
* @param {string} creds.username
* @param {string} creds.password
*/
const request = (path, creds) => {
const auth = creds ? `-u '${creds.username}:${creds.password}'` : '';
return cy.exec(`curl --noproxy '*' -s -w '\n%{http_code}' ${auth} http://${domain}${path}`)
.then((result) => {
expect(result.exitCode).to.eq(0);
const lines = result.stdout.trim().split('\n');
const status = lines.pop();
return { status: status, body: lines.join('\n') };
});
};
// nginx reloads are signalled and return immediately, so the old
// config can still be served for a moment after an API change.
// Retry until the expected response is seen.
const waitForResponse = (path, creds, check, description) => {
// Copy now, the callback runs later and creds may have been changed by then
const credsCopy = creds ? { ...creds } : null;
let last = null;
cy.waitUntil(() => request(path, credsCopy).then((res) => {
last = res;
return check(res);
}), {
timeout: 15000,
interval: 500,
errorMsg: () => `${path} did not return ${description}, last status: ${last?.status}`,
});
};
const expectStatus = (path, creds, status) => {
waitForResponse(path, creds, (res) => res.status === status, status);
};
// Also checks the body so we know the page came from examplesite
// and not the NPM default site
const expectPage = (path, creds, text) => {
waitForResponse(path, creds, (res) => res.status === '200' && res.body.includes(text), `200 with "${text}"`);
};
const createAccessList = (list) => {
return cy.task('backendApiPost', {
token: token,
path: '/api/nginx/access-lists',
data: {
name: list.name,
satisfy_any: false,
pass_auth: false,
items: [
{
username: list.username,
password: list.password,
}
],
clients: [],
}
}).then((data) => {
cy.validateSwaggerSchema('post', 201, '/nginx/access-lists', data);
expect(data).to.have.property('id');
expect(data.id).to.be.greaterThan(0);
return cy.wrap(data.id);
});
};
const location = (path, accessListId) => {
return {
path: path,
forward_scheme: 'http',
forward_host: 'examplesite',
forward_port: 80,
access_list_id: accessListId,
};
};
before(() => {
cy.resetUsers();
cy.getToken().then((tok) => {
token = tok;
});
});
it('Should be able to create multiple access lists with credentials', () => {
createAccessList(alpha).then((id) => {
alphaListId = id;
});
createAccessList(beta).then((id) => {
betaListId = id;
expect(betaListId).to.not.equal(alphaListId);
});
});
it('Should be able to create a proxy host with a different access list per location', () => {
cy.task('backendApiPost', {
token: token,
path: '/api/nginx/proxy-hosts',
data: {
domain_names: [domain],
forward_scheme: 'http',
forward_host: 'examplesite',
forward_port: 80,
access_list_id: 0,
certificate_id: 0,
meta: {
dns_challenge: false
},
advanced_config: '',
locations: [
location('/dashboard', alphaListId),
location('/profile', betaListId),
],
block_exploits: false,
caching_enabled: false,
allow_websocket_upgrade: false,
http2_support: false,
hsts_enabled: false,
hsts_subdomains: false,
ssl_forced: false
}
}).then((data) => {
cy.validateSwaggerSchema('post', 201, '/nginx/proxy-hosts', data);
expect(data).to.have.property('id');
expect(data.id).to.be.greaterThan(0);
hostId = data.id;
expect(data).to.have.property('enabled', true);
expect(data).to.have.property('access_list_id', 0);
expect(data.locations).to.have.length(2);
expect(data.locations[0]).to.have.property('access_list_id', alphaListId);
expect(data.locations[1]).to.have.property('access_list_id', betaListId);
});
});
it('Should persist the location access lists on the proxy host', () => {
cy.task('backendApiGet', {
token: token,
path: `/api/nginx/proxy-hosts/${hostId}`,
}).then((data) => {
cy.validateSwaggerSchema('get', 200, '/nginx/proxy-hosts/{hostID}', data);
expect(data.locations[0]).to.have.property('path', '/dashboard');
expect(data.locations[0]).to.have.property('access_list_id', alphaListId);
expect(data.locations[1]).to.have.property('path', '/profile');
expect(data.locations[1]).to.have.property('access_list_id', betaListId);
});
});
it('Should not require auth for the host root', () => {
expectPage('/', null, 'this is the index page');
});
it('Should only accept the alpha credentials on /dashboard', () => {
expectStatus('/dashboard', null, '401');
expectStatus('/dashboard', beta, '401');
expectPage('/dashboard', alpha, 'this is the dashboard page');
});
it('Should only accept the beta credentials on /profile', () => {
expectStatus('/profile', null, '401');
expectStatus('/profile', alpha, '401');
expectPage('/profile', beta, 'this is the profile page');
});
it('Should apply access list credential changes to locations using it', () => {
const newPassword = 'alpha-pass-changed';
cy.task('backendApiPut', {
token: token,
path: `/api/nginx/access-lists/${alphaListId}`,
data: {
name: alpha.name,
satisfy_any: false,
pass_auth: false,
items: [
{
username: alpha.username,
password: newPassword,
}
],
clients: [],
}
}).then((data) => {
cy.validateSwaggerSchema('put', 200, '/nginx/access-lists/{listID}', data);
expect(data).to.have.property('id', alphaListId);
});
expectStatus('/dashboard', alpha, '401');
expectPage('/dashboard', { username: alpha.username, password: newPassword }, 'this is the dashboard page');
alpha.password = newPassword;
// Other locations are unaffected
expectStatus('/profile', null, '401');
expectPage('/profile', beta, 'this is the profile page');
});
it('Should inherit the host access list on locations without their own', () => {
// Host uses beta, /dashboard overrides with alpha, /missing has none and should inherit beta
cy.task('backendApiPut', {
token: token,
path: `/api/nginx/proxy-hosts/${hostId}`,
data: {
access_list_id: betaListId,
locations: [
location('/dashboard', alphaListId),
location('/profile', betaListId),
location('/missing', 0),
],
}
}).then((data) => {
// No swagger validation here: with a host access list set, the expanded
// access_list in the response has no proxy_host_count, which the schema requires
expect(data).to.have.property('access_list_id', betaListId);
expect(data.locations[2]).to.have.property('access_list_id', 0);
});
expectStatus('/', null, '401');
expectStatus('/', alpha, '401');
expectPage('/', beta, 'this is the index page');
// examplesite returns 404 for this path, once past the access list
expectStatus('/missing', null, '401');
expectStatus('/missing', alpha, '401');
expectStatus('/missing', beta, '404');
expectStatus('/dashboard', beta, '401');
expectPage('/dashboard', alpha, 'this is the dashboard page');
});
it('Should remove a deleted access list from the host and locations using it', () => {
cy.task('backendApiDelete', {
token: token,
path: `/api/nginx/access-lists/${betaListId}`,
}).then((data) => {
cy.validateSwaggerSchema('delete', 200, '/nginx/access-lists/{listID}', data);
expect(data).to.be.equal(true);
});
cy.task('backendApiGet', {
token: token,
path: `/api/nginx/proxy-hosts/${hostId}`,
}).then((data) => {
expect(data).to.have.property('access_list_id', 0);
expect(data.locations[0]).to.have.property('access_list_id', alphaListId);
expect(data.locations[1]).to.have.property('access_list_id', 0);
expect(data.locations[2]).to.have.property('access_list_id', 0);
});
expectPage('/', null, 'this is the index page');
expectPage('/profile', null, 'this is the profile page');
expectStatus('/missing', null, '404');
// Remaining location access list must still be enforced
expectStatus('/dashboard', null, '401');
expectPage('/dashboard', alpha, 'this is the dashboard page');
});
it('Should be able to delete the proxy host and remaining access list', () => {
cy.task('backendApiDelete', {
token: token,
path: `/api/nginx/proxy-hosts/${hostId}`,
}).then((data) => {
cy.validateSwaggerSchema('delete', 200, '/nginx/proxy-hosts/{hostID}', data);
expect(data).to.be.equal(true);
});
cy.task('backendApiDelete', {
token: token,
path: `/api/nginx/access-lists/${alphaListId}`,
}).then((data) => {
cy.validateSwaggerSchema('delete', 200, '/nginx/access-lists/{listID}', data);
expect(data).to.be.equal(true);
});
});
});
+6
View File
@@ -0,0 +1,6 @@
FROM nginx:stable
RUN rm -rf /etc/nginx/conf.d
COPY nginx /etc/nginx
COPY www /www
RUN chown -R nginx:nginx /www
+29
View File
@@ -0,0 +1,29 @@
server {
listen 80;
server_name website1.example.com website2.example.com website3.example.com;
root /www;
index index.html;
# redirect requests for .html URLs to their extensionless form
if ($request_uri ~ ^/index\.html(\?.*)?$) {
return 301 /$1;
}
if ($request_uri ~ ^/(.+)\.html(\?.*)?$) {
return 301 /$1$2;
}
location / {
try_files $uri $uri.html $uri/ =404;
}
error_page 404 /404.html;
location = /404.html {
internal;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
}
+30
View File
@@ -0,0 +1,30 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format custom_combined '$remote_addr - $remote_user [$time_local] "$host" "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log custom_combined;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12; # Includes Docker subnet
set_real_ip_from 192.168.0.0/16;
include include/*.conf;
include conf.d/*.conf;
include /sites/*/nginx.conf;
}
+9
View File
@@ -0,0 +1,9 @@
<html>
<head>
<title>404</title>
</head>
<body>
404 not found
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<html>
<head>
<title>Dashboard</title>
</head>
<body>
this is the dashboard page
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<html>
<head>
<title>Index</title>
</head>
<body>
this is the index page
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<html>
<head>
<title>Profile</title>
</head>
<body>
this is the profile page
</body>
</html>