Wiki-Quellcode von OpenLDAP direkt im Internet freigeben (ohne Stream im rev-proxy)
Version 4.1 von aku@sbede am 2022/05/16 14:59
Verstecke letzte Bearbeiter
author | version | line-number | content |
---|---|---|---|
![]() |
4.1 | 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.1 | 2 | |
![]() |
4.1 | 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 | |||
![]() |
2.1 | 9 | (% class="box" %) |
10 | ((( | ||
![]() |
4.1 | 11 | (% style="color:#000000" %)##DNAT ext dmz:172.28.29.2:1636 tcp 636## |
![]() |
2.1 | 12 | ))) |
13 | |||
![]() |
4.1 | 14 | (% style="color:#000000" %)Im Anschluß daran starten Sie mit folgendem Befehl die Firewall neu |
15 | |||
![]() |
2.1 | 16 | (% class="box" %) |
17 | ((( | ||
18 | (% style="color:#000000" %)##shorewall restart## | ||
19 | ))) | ||
20 | |||
21 | |||
![]() |
4.1 | 22 | === (% style="color:#000000" %)Schritte im Container (% style="color:#2980b9" %)logosrv(%%) === |
![]() |
2.1 | 23 | |
![]() |
4.1 | 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 | |||
![]() |
2.1 | 28 | (% class="box" %) |
29 | ((( | ||
30 | (% style="color:#000000" %)##nano /usr/sbin/ldfirewall.custom## | ||
31 | ))) | ||
32 | |||
33 | |||
![]() |
4.1 | 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 | |||
![]() |
2.1 | 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 | ||
![]() |
4.1 | 63 | ##(% style="color:#e74c3c" %)## SOURCEIP="213.23.76.144 213.23.76.123 195.34.83.83 87.130.28.26" |
![]() |
2.1 | 64 | IP_LOGOSRV_DMZ=172.28.29.2 |
![]() |
4.1 | 65 | IP_SAMBA4_SERVERNET=172.28.28.30##(%%)## |
66 | \\(% style="color:#000000" %) for ipaddr in $SOURCEIP | ||
![]() |
2.1 | 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 | ;; | ||
![]() |
4.1 | 80 | esac(%%)## |
![]() |
2.1 | 81 | ))) |
82 | |||
83 | |||
![]() |
4.1 | 84 | (% style="color:#000000" %)Hier müssen nun folgende Werte angepasst werden: |
85 | |||
![]() |
2.1 | 86 | (% class="box" %) |
87 | ((( | ||
![]() |
4.1 | 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(%%)## | ||
![]() |
2.1 | 91 | ))) |
92 | |||
93 | |||
![]() |
4.1 | 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 | |||
![]() |
2.1 | 96 | (% class="box" %) |
97 | ((( | ||
![]() |
4.1 | 98 | (% style="color:#000000" %)##chmod +x ldfirewall.custom## |
![]() |
2.1 | 99 | ))) |
100 | |||
![]() |
4.1 | 101 | |
102 | (% style="color:#000000" %)Führen Sie nun das Skript einmal aus | ||
103 | |||
![]() |
2.1 | 104 | (% class="box" %) |
105 | ((( | ||
![]() |
4.1 | 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 | ((( | ||
![]() |
2.1 | 114 | (% style="color:#000000" %)##nano /etc/logodidact/internet.conf## |
115 | ))) | ||
116 | |||
117 | |||
![]() |
4.1 | 118 | (% style="color:#000000" %)Hier fügen Sie nun den Port 636 im Abschnitt //FromInternetAllowTCP// hinzu |
119 | |||
![]() |
2.1 | 120 | (% class="box" %) |
121 | ((( | ||
![]() |
4.1 | 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 | ((( | ||
![]() |
2.1 | 130 | (% style="color:#000000" %)##ldfirewall restart## |
131 | ))) | ||
132 | |||
133 | |||
![]() |
4.1 | 134 | (% style="color:#000000" %)Damit die Freigabe des OpenLDAP funktioniert ist es wichtig die Portfreigabe (Port 636) im Router nichtzu vergessen: |
135 | |||
![]() |
2.1 | 136 | (% style="color:#000000" %)[[image:1597240262579-305.png]] |