Wiki-Quellcode von OpenLDAP direkt im Internet freigeben (ohne Stream im rev-proxy)
Version 5.1 von aku@sbede am 2022/05/16 15:00
Zeige letzte Bearbeiter
author | version | line-number | content |
---|---|---|---|
1 | (% style="color:#000000" %)Wenn Sie den OpenLDAP direkt und nicht über den rev-proxy im Internet freigeben wollen, folgen Sie bitte dieser Anleitung. | ||
2 | |||
3 | |||
4 | === (% style="color:#000000" %)Schritte im Container (% style="color:#2980b9" %)ldhost(%%) === | ||
5 | |||
6 | |||
7 | (% style="color:#000000" %)Öffnen Sie die die Datei /etc/nano/shorewall/rules mit einem Editor Ihrer Wahl und fügen Sie(%%) am Anfang folgende Zeile hinzu | ||
8 | |||
9 | (% class="box" %) | ||
10 | ((( | ||
11 | (% style="color:#000000" %)##DNAT ext dmz:172.28.29.2:1636 tcp 636## | ||
12 | ))) | ||
13 | |||
14 | (% style="color:#000000" %)Im Anschluß daran starten Sie mit folgendem Befehl die Shorewall neu | ||
15 | |||
16 | (% class="box" %) | ||
17 | ((( | ||
18 | (% style="color:#000000" %)##shorewall restart## | ||
19 | ))) | ||
20 | |||
21 | |||
22 | === (% style="color:#000000" %)Schritte im Container (% style="color:#2980b9" %)logosrv(%%) === | ||
23 | |||
24 | |||
25 | (% style="color:#000000" %)Erstellem Sie die Datei /usr/sbin/ldfirewall.custom mit einem Editor Ihrer Wahl. | ||
26 | Sollte die Datei schin exitieren öffnen Sie sie. | ||
27 | |||
28 | (% class="box" %) | ||
29 | ((( | ||
30 | (% style="color:#000000" %)##nano /usr/sbin/ldfirewall.custom## | ||
31 | ))) | ||
32 | |||
33 | |||
34 | (% style="color:#000000" %)Kopieren Sie nun folgenden Text in die Datei. Wichtig sollte sich schon Inhalt in der Datei befinden fügen sie folgenden Text hinzu: | ||
35 | |||
36 | (% class="box" %) | ||
37 | ((( | ||
38 | (% style="color:#000000" %)###!/bin/bash | ||
39 | \\DRYRUN=no | ||
40 | VERBOSE=no | ||
41 | ipt=do_iptables | ||
42 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/bin:/usr/local/bin/support" | ||
43 | \\do_iptables() | ||
44 | { | ||
45 | run iptables "$@" | ||
46 | } | ||
47 | run() | ||
48 | { | ||
49 | if [ "$VERBOSE" = "yes" ]; then | ||
50 | echo "$@" | ||
51 | fi | ||
52 | if [ "$DRYRUN" = "no" ]; then | ||
53 | "$@" | ||
54 | fi | ||
55 | } | ||
56 | \\case "$1" in | ||
57 | start|restart) | ||
58 | # Zugelassene externe IP-Adressen | ||
59 | # (falls mehrere IP-Adressen nötig, diese per Leerzeichen trennen) | ||
60 | # ~-~-~-~-~-~-- | ||
61 | # - BelWue-Moodle-Server IPs: 129.143.69.1 129.143.232.18 129.143.255.2 | ||
62 | # - Webuntis Server in Österreich IP: 213.208.138.146 | ||
63 | ##(% style="color:#e74c3c" %)## SOURCEIP="213.23.76.144 213.23.76.123 195.34.83.83 87.130.28.26" | ||
64 | IP_LOGOSRV_DMZ=172.28.29.2 | ||
65 | IP_SAMBA4_SERVERNET=172.28.28.30##(%%) | ||
66 | \\(% style="color:#000000" %)## for ipaddr in $SOURCEIP | ||
67 | do | ||
68 | echo -n "Adding custom rules to allow ldaps connections (tcp/1636) from host '${ipaddr}' and redirect to 'samba4-ad:636'... " | ||
69 | $ipt -t nat -I PREROUTING -i dmz -p tcp -s ${ipaddr} -d ${IP_LOGOSRV_DMZ} ~-~-dport 1636 -j DNAT ~-~-to-destination ${IP_SAMBA4_SERVERNET}:636 | ||
70 | $ipt -t mangle -I mark_from_internet_check_ports -p tcp -s ${ipaddr} -d ${IP_LOGOSRV_DMZ} ~-~-dport 1636 -g mark_from_internet_allowed | ||
71 | echo "OK" | ||
72 | done | ||
73 | ;; | ||
74 | stop) | ||
75 | ;; | ||
76 | *) | ||
77 | echo "Benutzung: $0 {start|restart}" | ||
78 | exit 1 | ||
79 | ;; | ||
80 | esac## | ||
81 | ))) | ||
82 | |||
83 | |||
84 | (% style="color:#000000" %)Hier müssen nun folgende Werte angepasst werden: | ||
85 | |||
86 | (% class="box" %) | ||
87 | ((( | ||
88 | (% style="color:#000000" %)##SOURCEIP=" 87.130.28.26" ##(% style="color:#e74c3c" %)## <- SBE IP, da wird eine zusätzliche gewhitelistet, die öffentliche ip der moodle Instanz##(%%) | ||
89 | (% style="color:#000000" %)##IP_LOGOSRV_DMZ=172.28.29.2 ##(% style="color:#e74c3c" %)##<- (ifconfig in logosrv und Eintrag "DMZ" anschauen##(%%)## | ||
90 | (% style="color:#000000" %)IP_SAMBA4_SERVERNET=172.28.28.30 (% style="color:#e74c3c" %) <- ifconfig in Sambacontainer und Eintrag "servernet" anschauen(%%)## | ||
91 | ))) | ||
92 | |||
93 | |||
94 | (% style="color:#000000" %)Danach müssen Sie die Datei als Skript für den Cronjob ausführbar gemacht werden und auch e ausfürhbar machen Skript muss für den Cronjob ausführbar gemacht werden und einmalig ausgeführt werden | ||
95 | |||
96 | (% class="box" %) | ||
97 | ((( | ||
98 | (% style="color:#000000" %)##chmod +x ldfirewall.custom## | ||
99 | ))) | ||
100 | |||
101 | |||
102 | (% style="color:#000000" %)Führen Sie nun das Skript einmal aus | ||
103 | |||
104 | (% class="box" %) | ||
105 | ((( | ||
106 | (% style="color:#000000" %)##bash ldfirewall.custom## | ||
107 | ))) | ||
108 | |||
109 | |||
110 | (% style="color:#000000" %)Im nächsten Schritt öffnen Sie mit einem Editor Ihrer Wahl die //internet.conf// | ||
111 | |||
112 | (% class="box" %) | ||
113 | ((( | ||
114 | (% style="color:#000000" %)##nano /etc/logodidact/internet.conf## | ||
115 | ))) | ||
116 | |||
117 | |||
118 | (% style="color:#000000" %)Hier fügen Sie nun den Port 636 im Abschnitt //FromInternetAllowTCP// hinzu | ||
119 | |||
120 | (% class="box" %) | ||
121 | ((( | ||
122 | (% style="color:#000000" %)FromInternetAllowTCP 636 | ||
123 | ))) | ||
124 | |||
125 | |||
126 | (% style="color:#000000" %)Im Anschluß daran starten Sie die Firewall neu | ||
127 | |||
128 | (% class="box" %) | ||
129 | ((( | ||
130 | (% style="color:#000000" %)##ldfirewall restart## | ||
131 | ))) | ||
132 | |||
133 | |||
134 | (% style="color:#000000" %)Damit die Freigabe des OpenLDAP funktioniert ist es wichtig die Portfreigabe (Port 636) im Router nichtzu vergessen: | ||
135 | |||
136 | (% style="color:#000000" %)[[image:1597240262579-305.png]] |