Wiki-Quellcode von LDAP extern freigeben
Version 2.1 von michaelecer@sbede am 2021/08/28 16:16
Zeige letzte Bearbeiter
author | version | line-number | content |
---|---|---|---|
1 | (% style="color:#2980b9" %)ldhost | ||
2 | |||
3 | (% class="box" %) | ||
4 | ((( | ||
5 | (% style="color:#000000" %)##nano /etc/shorewall/rules | ||
6 | DNAT ext dmz:172.28.29.2:1636 tcp 636## | ||
7 | ))) | ||
8 | |||
9 | (% class="box" %) | ||
10 | ((( | ||
11 | (% style="color:#000000" %)##shorewall restart## | ||
12 | ))) | ||
13 | |||
14 | |||
15 | (% style="color:#2980b9" %)logosrv | ||
16 | |||
17 | (% class="box" %) | ||
18 | ((( | ||
19 | (% style="color:#000000" %)##nano /usr/sbin/ldfirewall.custom## | ||
20 | ))) | ||
21 | |||
22 | (% style="color:#000000" %)folgenden Text pasten und bearbeiten: | ||
23 | |||
24 | (% class="box" %) | ||
25 | ((( | ||
26 | (% style="color:#000000" %)###!/bin/bash | ||
27 | \\DRYRUN=no | ||
28 | VERBOSE=no | ||
29 | ipt=do_iptables | ||
30 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/bin:/usr/local/bin/support" | ||
31 | \\do_iptables() | ||
32 | { | ||
33 | run iptables "$@" | ||
34 | } | ||
35 | run() | ||
36 | { | ||
37 | if [ "$VERBOSE" = "yes" ]; then | ||
38 | echo "$@" | ||
39 | fi | ||
40 | if [ "$DRYRUN" = "no" ]; then | ||
41 | "$@" | ||
42 | fi | ||
43 | } | ||
44 | \\case "$1" in | ||
45 | start|restart) | ||
46 | # Zugelassene externe IP-Adressen | ||
47 | # (falls mehrere IP-Adressen nötig, diese per Leerzeichen trennen) | ||
48 | # ~-~-~-~-~-~-- | ||
49 | # - BelWue-Moodle-Server IPs: 129.143.69.1 129.143.232.18 129.143.255.2 | ||
50 | # - Webuntis Server in Österreich IP: 213.208.138.146 | ||
51 | SOURCEIP="213.23.76.144 213.23.76.123 195.34.83.83 87.130.28.26" | ||
52 | IP_LOGOSRV_DMZ=172.28.29.2 | ||
53 | IP_SAMBA4_SERVERNET=172.28.28.30 | ||
54 | \\ for ipaddr in $SOURCEIP | ||
55 | do | ||
56 | echo -n "Adding custom rules to allow ldaps connections (tcp/1636) from host '${ipaddr}' and redirect to 'samba4-ad:636'... " | ||
57 | $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 | ||
58 | $ipt -t mangle -I mark_from_internet_check_ports -p tcp -s ${ipaddr} -d ${IP_LOGOSRV_DMZ} ~-~-dport 1636 -g mark_from_internet_allowed | ||
59 | echo "OK" | ||
60 | done | ||
61 | ;; | ||
62 | stop) | ||
63 | ;; | ||
64 | *) | ||
65 | echo "Benutzung: $0 {start|restart}" | ||
66 | exit 1 | ||
67 | ;; | ||
68 | esac## | ||
69 | ))) | ||
70 | |||
71 | (% style="color:#000000" %)folgendes muss hier angepasst werden: | ||
72 | |||
73 | (% class="box" %) | ||
74 | ((( | ||
75 | (% style="color:#000000" %)##SOURCEIP=" 87.130.28.26" <- SBE IP, da wird eine zusätzliche gewhitelistet, die öffentliche ip der moodle Instanz | ||
76 | IP_LOGOSRV_DMZ=172.28.29.2 <- (ifconfig in logosrv und Eintrag "DMZ" anschauen | ||
77 | IP_SAMBA4_SERVERNET=172.28.28.30 <- ifconfig in Sambacontainer und Eintrag "servernet" anschauen## | ||
78 | ))) | ||
79 | |||
80 | (% style="color:#000000" %)Das Skript muss für den Cronjob ausführbar gemacht werden und einmalig ausgeführt werden | ||
81 | |||
82 | (% class="box" %) | ||
83 | ((( | ||
84 | (% style="color:#000000" %)##chmod +x ldfirewall.custom | ||
85 | bash ldfirewall.custom## | ||
86 | ))) | ||
87 | |||
88 | (% class="box" %) | ||
89 | ((( | ||
90 | (% style="color:#000000" %)##nano /etc/logodidact/internet.conf## | ||
91 | ))) | ||
92 | |||
93 | (% style="color:#000000" %)FromInternetAllowTCP 636 als Port freigeben in der Internet.conf | ||
94 | |||
95 | (% class="box" %) | ||
96 | ((( | ||
97 | (% style="color:#000000" %)##ldfirewall restart## | ||
98 | ))) | ||
99 | |||
100 | (% style="color:#000000" %)Portfreischalten auf dem Router nicht vergessen! | ||
101 | |||
102 | (% style="color:#000000" %)[[image:1597240262579-305.png]] |