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