Node-RED kann nun nur von einer Liste von Benutzern benutzt werden.
Build and Publish Site / docker (push) Successful in 16s
Build and Publish Site / docker (push) Successful in 16s
Diese Liste in docker_compose.yml unter ALLOWED_USERS abgelegt. Arbeit an der Dokumentation.
This commit is contained in:
1 parent
926c06b0b0
commit
9f7030ab35
8 files changed
+221
-18
No files matched your search
@@ -13,3 +13,4 @@ site/
|
||||
*.backup
|
||||
logic/node-red-data/size_by_ownergroup_and_number_of_copies_*
|
||||
*.no_use
|
||||
logic/node-red-data/.sessions.json
|
||||
@@ -15,6 +15,7 @@ services:
|
||||
- JSON_CACHE_WITH_PATH=/data/results/json_cache.json
|
||||
- NON_SPECIFIED_GROUPS=/data/non_specified_groups.csv
|
||||
- ERROR_LOGFILE=/data/logs/get_new_groupinfo_error.log
|
||||
- ALLOWED_USERS=huesser,kallmeier_m,bumbak_b,rebmann_m,bugmann_r,scheffler,fiehn_m
|
||||
- AD_SERVER=d.psi.ch
|
||||
- AD_SEARCH_BASE=DC=d,DC=psi,DC=ch
|
||||
- AD_USER=${AD_USER}
|
||||
|
||||
+16
-7
@@ -4,11 +4,20 @@ Die Applikation teilt sich in eine Datenerfassungs- und eine Visualisierungsschi
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
User([PSI User]) -->|HTTPS:443| Nginx[Zentraler NGINX Proxy]
|
||||
Nginx -->|Port 8501| Streamlit[Analytics App: Streamlit]
|
||||
Nginx -->|Port 1880 /logic| NodeRed[Logic App: Node-RED]
|
||||
NodeRed -->|LDAP:389| AD[PSI Active Directory]
|
||||
NodeRed -->|Cron Job| Script[Python-Skripte /opt/python-packages]
|
||||
Script -->|Daten| Shared[(shared_data / json_cache.json)]
|
||||
Streamlit -->|Liest| Shared
|
||||
subgraph "Datenerfassung (Backend)"
|
||||
AD[PSI Active Directory] -->|Liest a-/p-Gruppen Infos| NodeRed[Logic App: Node-RED]
|
||||
Metabase[metabase.psi.ch] -->|Saugt a-/p-Gruppen Infos ab| NodeRed
|
||||
NodeRed -->|Schreibt| SharedData[shared_data/json_cache.json]
|
||||
end
|
||||
|
||||
subgraph "Datenvisualisierung (Frontend)"
|
||||
SharedData -->|Liest| Streamlit[Analytics App: Streamlit]
|
||||
Streamlit -->|Zeigt Webseite| User([Benutzer])
|
||||
end
|
||||
|
||||
subgraph "Netzwerk & Zugriff"
|
||||
User -->|HTTPS:443| Nginx[Zentraler NGINX Proxy]
|
||||
Nginx -->|Port 8501| Streamlit
|
||||
Nginx -->|Port 1880 /logic| NodeRed
|
||||
end
|
||||
```
|
||||
+11
-9
@@ -29,19 +29,21 @@ COPY --from=builder /opt/python-packages /opt/python-packages
|
||||
# Den neuen Paket-Ordner zum PYTHONPATH hinzufügen
|
||||
ENV PYTHONPATH="/opt/python-packages"
|
||||
|
||||
# Zurück zum sicheren Standard-User von Node-RED
|
||||
USER node-red
|
||||
# Für globale npm-Installationen im Container bleiben wir kurz root,
|
||||
# übergeben aber das Node-RED-Verzeichnis als Zielpfad
|
||||
WORKDIR /usr/src/node-red
|
||||
RUN npm install --no-update-notifier \
|
||||
node-red-contrib-moment \
|
||||
node-red-contrib-cron-plus \
|
||||
passport-ldapauth
|
||||
|
||||
# Node-RED Module installieren
|
||||
RUN npm install node-red-contrib-moment node-red-contrib-cron-plus
|
||||
|
||||
# Wechsel zu root, um das Entrypoint-Skript zu kopieren und die Rechte zu setzen
|
||||
USER root
|
||||
|
||||
# Kopiere unser neues Entrypoint-Skript
|
||||
# Kopiere unser neues Entrypoint-Skript und setze Rechte
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Zurück zum sicheren Standard-User von Node-RED für den laufenden Betrieb
|
||||
USER node-red
|
||||
|
||||
# Setze unser Skript als den neuen Entrypoint
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
|
||||
|
||||
@@ -69,5 +69,152 @@
|
||||
}
|
||||
},
|
||||
"menu-menu-item-left-sidebar": true
|
||||
},
|
||||
"peter.huesser@psi.ch": {
|
||||
"editor": {
|
||||
"view": {
|
||||
"view-store-zoom": false,
|
||||
"view-store-position": false,
|
||||
"view-show-grid": true,
|
||||
"view-snap-grid": true,
|
||||
"view-grid-size": 20,
|
||||
"view-node-status": true,
|
||||
"view-node-info-icon": true,
|
||||
"view-node-show-label": true,
|
||||
"view-show-tips": true,
|
||||
"view-show-welcome-tours": true
|
||||
},
|
||||
"sidebar": {
|
||||
"state": {
|
||||
"v": 4,
|
||||
"tabs": [],
|
||||
"primary": {
|
||||
"width": 300,
|
||||
"top": {
|
||||
"tabs": [
|
||||
"info",
|
||||
"help",
|
||||
"config",
|
||||
"context"
|
||||
],
|
||||
"height": 302,
|
||||
"hidden": false,
|
||||
"active": "info"
|
||||
},
|
||||
"bottom": {
|
||||
"tabs": [
|
||||
"debug"
|
||||
],
|
||||
"hidden": false,
|
||||
"active": "debug"
|
||||
}
|
||||
},
|
||||
"secondary": {
|
||||
"width": 210,
|
||||
"top": {
|
||||
"tabs": [
|
||||
"explorer"
|
||||
],
|
||||
"height": 302,
|
||||
"hidden": false,
|
||||
"active": "explorer"
|
||||
},
|
||||
"bottom": {
|
||||
"tabs": [
|
||||
"palette"
|
||||
],
|
||||
"hidden": false,
|
||||
"active": "palette"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tours": {
|
||||
"welcome": "5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"huesser@d.psi.ch": {
|
||||
"editor": {
|
||||
"view": {
|
||||
"view-store-zoom": false,
|
||||
"view-store-position": false,
|
||||
"view-show-grid": true,
|
||||
"view-snap-grid": true,
|
||||
"view-grid-size": 20,
|
||||
"view-node-status": true,
|
||||
"view-node-info-icon": true,
|
||||
"view-node-show-label": true,
|
||||
"view-show-tips": true,
|
||||
"view-show-welcome-tours": true
|
||||
},
|
||||
"tours": {
|
||||
"welcome": "5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"huesser": {
|
||||
"editor": {
|
||||
"view": {
|
||||
"view-store-zoom": false,
|
||||
"view-store-position": false,
|
||||
"view-show-grid": true,
|
||||
"view-snap-grid": true,
|
||||
"view-grid-size": 20,
|
||||
"view-node-status": true,
|
||||
"view-node-info-icon": true,
|
||||
"view-node-show-label": true,
|
||||
"view-show-tips": true,
|
||||
"view-show-welcome-tours": true
|
||||
},
|
||||
"sidebar": {
|
||||
"state": {
|
||||
"v": 4,
|
||||
"tabs": [],
|
||||
"primary": {
|
||||
"width": 300,
|
||||
"top": {
|
||||
"tabs": [
|
||||
"info",
|
||||
"help",
|
||||
"config",
|
||||
"context"
|
||||
],
|
||||
"height": 302,
|
||||
"hidden": false,
|
||||
"active": "info"
|
||||
},
|
||||
"bottom": {
|
||||
"tabs": [
|
||||
"debug"
|
||||
],
|
||||
"hidden": false,
|
||||
"active": "debug"
|
||||
}
|
||||
},
|
||||
"secondary": {
|
||||
"width": 210,
|
||||
"top": {
|
||||
"tabs": [
|
||||
"explorer"
|
||||
],
|
||||
"height": 302,
|
||||
"hidden": false,
|
||||
"active": "explorer"
|
||||
},
|
||||
"bottom": {
|
||||
"tabs": [
|
||||
"palette"
|
||||
],
|
||||
"hidden": false,
|
||||
"active": "palette"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tours": {
|
||||
"welcome": "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
size_by_ownergroup_and_number_of_copies_2026-07-01T14_24_54.json
|
||||
size_by_ownergroup_and_number_of_copies_2026-07-02T12_59_59.json
|
||||
@@ -81,7 +81,50 @@ module.exports = {
|
||||
// permissions: "*"
|
||||
// }]
|
||||
//},
|
||||
adminAuth: {
|
||||
type: "credentials",
|
||||
users: function(username) {
|
||||
return Promise.resolve({ username: username, permissions: "*" });
|
||||
},
|
||||
authenticate: function(username, password) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// 1. Die Liste aus der Docker-Umgebungsvariable auslesen und aufsplitten
|
||||
const envUsers = process.env.ALLOWED_USERS || "";
|
||||
const allowedUsers = envUsers.split(',').map(u => u.trim().toLowerCase());
|
||||
|
||||
// Sicherstellen, dass Groß-/Kleinschreibung beim Tippen keine Rolle spielt
|
||||
const normalizedUsername = username.toLowerCase().trim();
|
||||
|
||||
// 2. Prüfen, ob der User auf der Liste steht (und die Variable nicht leer ist)
|
||||
if (allowedUsers.length === 0 || !allowedUsers.includes(normalizedUsername) || envUsers === "") {
|
||||
console.log(`Login-Abgewiesen: Benutzer '${username}' steht nicht auf der Docker-Whitelist.`);
|
||||
return resolve(null); // Direkt abweisen, ohne das AD zu belasten
|
||||
}
|
||||
|
||||
// 3. Wenn er auf der Liste steht -> Normal gegen das AD prüfen
|
||||
const ldap = require('ldapjs');
|
||||
const client = ldap.createClient({
|
||||
url: 'ldaps://d.psi.ch', // Umgestellt auf verschlüsseltes LDAPS
|
||||
tlsOptions: { rejectUnauthorized: false }
|
||||
});
|
||||
|
||||
// Deine funktionierende Domain-Struktur
|
||||
const userPrincipalName = username + '@d.psi.ch';
|
||||
|
||||
client.bind(userPrincipalName, password, function(err) {
|
||||
client.destroy();
|
||||
|
||||
if (err) {
|
||||
// Protokolliert den exakten AD-Fehler im Docker-Log für dich
|
||||
console.log("PSI-AD-Fehlerdetails:", err.message);
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
return resolve({ username: username, permissions: "*" });
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
/** The following property can be used to enable HTTPS
|
||||
* This property can be either an object, containing both a (private) key
|
||||
* and a (public) certificate, or a function that returns such an object.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
[{"ownerGroup": "p14733", "copies": "twoCopiesBig", "size": "4.42545020965E11", "packedSize": "4.4254487552E11", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p17960", "copies": "oneCopySmall", "size": "702539", "packedSize": "757760", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p18868", "copies": "oneCopyBig", "size": "1.857731772671E12", "packedSize": "1.85781331968E12", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p19082", "copies": "oneCopyBig", "size": "783180972", "packedSize": "783554560", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p20429", "copies": "oneCopyBig", "size": "9.1027056898E11", "packedSize": "9.1046001664E11", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p22475", "copies": "oneCopyBig", "size": "14906972436", "packedSize": "14908293120", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p22421", "copies": "oneCopyBig", "size": "894601183", "packedSize": "895569920", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p13399", "copies": "twoCopiesBig", "size": "2.842736852168E12", "packedSize": "2.84273588224E12", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p16722", "copies": "oneCopyBig", "size": "6.19961942213E11", "packedSize": "6.1998555136E11", "beamline": "X04DB", "department": "6000"}, {"ownerGroup": "p11455", "copies": "twoCopiesBig", "size": "6.78628731086E12", "packedSize": "6.78627745792E12", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p22634", "copies": "oneCopyBig", "size": "91777429", "packedSize": "91965440", "beamline": "CAMEA", "department": "3000"}, {"ownerGroup": "p10159", "copies": "twoCopiesBig", "size": "6.8733755661E10", "packedSize": "6.873368576E10", "beamline": "X04SA", "department": "6000"}, {"ownerGroup": "p21087", "copies": "oneCopyBig", "size": "14606258607", "packedSize": "14607390720", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p20053", "copies": "oneCopyBig", "size": "1.410823256112E12", "packedSize": "1.41090864128E12", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p16656", "copies": "twoCopiesBig", "size": "1.715284066467E12", "packedSize": "1.71528485888E12", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p16617", "copies": "twoCopiesBig", "size": "9.503073029366E12", "packedSize": "9.50307144704E12", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p20431", "copies": "oneCopyBig", "size": "3.91453234515E12", "packedSize": "3.91459446784E12", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p19581", "copies": "oneCopyBig", "size": "3.9618130914E10", "packedSize": "3.9627008E10", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p21001", "copies": "oneCopyBig", "size": "3.63128297719E11", "packedSize": "3.6315440128E11", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p22828", "copies": "oneCopySmall", "size": "878634", "packedSize": "1034240", "beamline": "ZEBRA", "department": "3000"}, {"ownerGroup": "p20132", "copies": "oneCopyBig", "size": "45350523155", "packedSize": "45428213760", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p19422", "copies": "oneCopyBig", "size": "14004021417", "packedSize": "14011105280", "beamline": "hal-9500", "department": "3000"}, {"ownerGroup": "p22024", "copies": "oneCopyBig", "size": "1793024560", "packedSize": "1794508800", "beamline": "flame", "department": "3000"}, {"ownerGroup": "p18594", "copies": "oneCopySmall", "size": "691628", "packedSize": "778240", "beamline": "SARESA", "department": "6000"}, {"ownerGroup": "p18552", "copies": "oneCopyBig", "size": "4.037656323E9", "packedSize": "4.03802112E9", "beamline": "X09LA", "department": "6000"}, {"ownerGroup": "p18820", "copies": "oneCopySmall", "size": "411737", "packedSize": "430080", "beamline": "X09LA", "department": "6000"}, {"ownerGroup": "p21045", "copies": "oneCopyBig", "size": "2186093137", "packedSize": "2187663360", "beamline": "gps", "department": "3000"}, {"ownerGroup": "p22486", "copies": "oneCopyBig", "size": "11773143", "packedSize": "16998400", "beamline": "ORION", "department": "3000"}, {"ownerGroup": "p18119", "copies": "oneCopyBig", "size": "4.650940788928E12", "packedSize": "4.6511261184E12", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p19002", "copies": "oneCopySmall", "size": "1864832", "packedSize": "1894400", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p21763", "copies": "oneCopyBig", "size": "201089761", "packedSize": "201594880", "beamline": "CAMEA", "department": "3000"}, {"ownerGroup": "p19544", "copies": "oneCopyBig", "size": "3.3026029881992E13", "packedSize": "3.30260307456E13", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p21150", "copies": "twoCopiesBig", "size": "4.789939778942E13", "packedSize": "4.789941563392E13", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p21607", "copies": "oneCopyBig", "size": "1.0740514148358E13", "packedSize": "1.074098649088ELine truncated
|
||||
[{"ownerGroup": "p20757", "copies": "oneCopyBig", "size": "2.9300065006979E13", "packedSize": "2.93008545792E13", "beamline": "X06SA", "department": "6000"}, {"ownerGroup": "p21899", "copies": "oneCopySmall", "size": "345855", "packedSize": "471040", "beamline": "TASP", "department": "3000"}, {"ownerGroup": "p23068", "copies": "oneCopySmall", "size": "556366", "packedSize": "747520", "beamline": "ZEBRA", "department": "3000"}, {"ownerGroup": "p22525", "copies": "oneCopyBig", "size": "1016154", "packedSize": "1034240", "beamline": "ZEBRA", "department": "3000"}, {"ownerGroup": "p17165", "copies": "oneCopyBig", "size": "3.142338874E9", "packedSize": "3.14295296E9", "beamline": "X09LA", "department": "6000"}, {"ownerGroup": "p18140", "copies": "oneCopyBig", "size": "1.00863586108854E14", "packedSize": "1.0086366583808E14", "beamline": "X06SA", "department": "6000"}, {"ownerGroup": "p19147", "copies": "oneCopyBig", "size": "1.05096560162E11", "packedSize": "1.0510595072E11", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p21788", "copies": "oneCopyBig", "size": "121109154", "packedSize": "121221120", "beamline": "DMC", "department": "3000"}, {"ownerGroup": "p19067", "copies": "oneCopyBig", "size": "16449795798", "packedSize": "16450611200", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p20596", "copies": "oneCopyBig", "size": "1.6240531114429E13", "packedSize": "1.624053282816E13", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p21228", "copies": "oneCopySmall", "size": "394", "packedSize": "10240", "beamline": "SARESC", "department": "6000"}, {"ownerGroup": "p12380", "copies": "twoCopiesBig", "size": "1.11313203588E11", "packedSize": "1.1131301888E11", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p20572", "copies": "oneCopyBig", "size": "4.149634617024E12", "packedSize": "4.14976841728E12", "beamline": "SARESA", "department": "6000"}, {"ownerGroup": "p21128", "copies": "twoCopiesBig", "size": "1.42383813462E11", "packedSize": "1.423840768E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p21125", "copies": "oneCopySmall", "size": "530947", "packedSize": "573440", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p21713", "copies": "oneCopyBig", "size": "2868837291", "packedSize": "2872524800", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p19860", "copies": "oneCopyBig", "size": "556745515", "packedSize": "557168640", "beamline": "dolly", "department": "3000"}, {"ownerGroup": "p21911", "copies": "oneCopyBig", "size": "3507197349", "packedSize": "3508418560", "beamline": "FOCUS", "department": "3000"}, {"ownerGroup": "p15084", "copies": "oneCopySmall", "size": "450370", "packedSize": "460800", "beamline": "X05LA", "department": "6000"}, {"ownerGroup": "a-35647", "copies": "twoCopiesBig", "size": "2.559831848885E12", "packedSize": "2.55983239168E12", "department": "3000"}, {"ownerGroup": "p15418", "copies": "oneCopySmall", "size": "870", "packedSize": "10240", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p23072", "copies": "oneCopyBig", "size": "1.187593658686E13", "packedSize": "1.187597609984E13", "beamline": "SARESC", "department": "6000"}, {"ownerGroup": "p19743", "copies": "oneCopyBig", "size": "2.38144181607E11", "packedSize": "2.3815064576E11", "beamline": "SATESE", "department": "6000"}, {"ownerGroup": "p16794", "copies": "oneCopyBig", "size": "2.984614530639E12", "packedSize": "2.9846417408E12", "beamline": "X08SA", "department": "6000"}, {"ownerGroup": "p18239", "copies": "oneCopyBig", "size": "3.615780039521E12", "packedSize": "3.61601907712E12", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p20556", "copies": "oneCopyBig", "size": "672450104", "packedSize": "675276800", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p19189", "copies": "twoCopiesBig", "size": "1.8189053728967E13", "packedSize": "1.818905554944E13", "beamline": "X02DA", "department": "6000"}, {"ownerGroup": "p16403", "copies": "twoCopiesBig", "size": "5.04022279847E11", "packedSize": "5.040223232E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p14820", "copies": "oneCopyBig", "size": "1014442", "packedSize": "1034240", "beamline": "X05LA", "department": "6000"}, {"ownerGroup": "p22158", "copies": "oneCopySmall", "size": "661465", "packedSize": "675840", "beamline": "SANS-I", "department": "3000"}, {"ownerGroup": "p21661", "copies": "oneCopyBig", "size": "1708876060", "packedSize": "1709834240", "beamline": "flame", "department": "3000"}, {"ownerGroup": "p20130", "copies": "oneCopyBig", "size": "6.755421615E11", "packedSize": "6.756544E11", "beamline": "X12SA", "department": "6000"}, {"ownerGroup": "p19897", "copies": "oneCopySmall", "size": "12816656", "packedSize": "12933120", "beamline": "lem", "department": "3000"}, {"ownerGroup": "p16064", "copies": "oneCopyBig", "size": "76972657", "packedSize": "77557760", "beamline": "X09LA", "department": "6000"}, {"ownerGroup": "p22032", "copies"Line truncated
|
||||
|
||||
Reference in new issue
Block a user