@@ -108,15 +108,15 @@ INET_GW_org=$INET_GW
108
108
RESET='0'
109
109
110
110
echo
111
- read -p 'Would you Reset the Configuration: [y/N] ' -s -n 1 RESET_ANSWER
111
+ read -p 'Would you Reset the Configuration: [y/N] ' -s -n 1 qRESET_ANSWER
112
112
echo
113
- if [ "$RESET_ANSWER " = "y" ]
113
+ if [ "$qRESET_ANSWER " = "y" ]
114
114
then
115
115
RESET='1'
116
116
wget https://github.com/CyberAndi/CyberSecurity-Box/raw/CyberSecurity-Box/Firmware/backup-OpenWrt-2024-08-29.tar.gz
117
117
sysupgrade -r backup-OpenWrt-2024-08-29.tar.gz
118
118
uci set unbound.ub_main.dhcp_link='dnsmasq'
119
- uci set unbound.ub_main.listen_port='5353'
119
+ uci set unbound.ub_main.listen_port=$DNS_UNBOUND_port
120
120
set_unbound_reset
121
121
processes=$(uci commit && reload_config)
122
122
wait $processes
@@ -130,11 +130,13 @@ if [ "$RESET_ANSWER" = "y" ]
130
130
fi
131
131
132
132
echo
133
- read -p 'Please give me the WAN-IP (Gateway/Router): ['$INET_GW'] ' INET_GW
133
+ read -p 'Please give me the WAN-IP (Gateway/Router): ['$INET_GW'] ' qINET_GW
134
134
echo
135
- if [ "$INET_GW " = "" ]
135
+ if [ "$qINET_GW " = "" ]
136
136
then
137
137
INET_GW=$INET_GW_org
138
+ else
139
+ INET_GW=$qINET_GW
138
140
fi
139
141
140
142
WAN_ip=$(echo $INET_GW | cut -f1 -d '.')
194
196
195
197
LAN_org=$LAN
196
198
197
- read -p 'Type the LAN-IP (Internal Network): ['$( echo $LAN )'] ' LAN
198
- if [ "$LAN " = "" ]
199
+ read -p 'Type the LAN-IP (Internal Network): ['$( echo $LAN )'] ' qLAN
200
+ if [ "$qLAN " = "" ]
199
201
then
200
202
LAN=$LAN_org
203
+ else
204
+ LAN=$qLAN
201
205
fi
202
206
203
207
if [ ! -z "$3" ]
@@ -208,10 +212,12 @@ if [ ! -z "$3" ]
208
212
fi
209
213
210
214
echo
211
- read -p 'Your local Domain of your LAN? [CyberSecBox.local] ' LOCAL_DOMAIN
212
- if [ "$LOCAL_DOMAIN " = "" ]
215
+ read -p 'Your local Domain of your LAN? [CyberSecBox.local] ' qLOCAL_DOMAIN
216
+ if [ "$qLOCAL_DOMAIN " = "" ]
213
217
then
214
218
LOCAL_DOMAIN=$LOCAL_DOMAIN_org
219
+ else
220
+ LOCAL_DOMAIN=$qLOCAL_DOMAIN
215
221
fi
216
222
217
223
if [ ! -z "$4" ]
@@ -225,10 +231,12 @@ WIFI_SSID_org=$WIFI_SSID
225
231
226
232
echo
227
233
228
- read -p 'The Main-WiFi-SSID? ['$(echo $WIFI_SSID)'] ' WIFI_SSID
229
- if [ "$WIFI_SSID " = "" ]
234
+ read -p 'The Main-WiFi-SSID? ['$(echo $WIFI_SSID)'] ' qWIFI_SSID
235
+ if [ "$qWIFI_SSID " = "" ]
230
236
then
231
237
WIFI_SSID=$WIFI_SSID_org
238
+ else
239
+ WIFI_SSID=$qWIFI_SSID
232
240
fi
233
241
234
242
if [ ! -z "$5" ]
@@ -242,18 +250,20 @@ WIFI_PASS_org=$WIFI_PASS
242
250
243
251
echo
244
252
245
- read -p 'And the WiFi-Key? [Cyber,Sec9ox] ' WIFI_PASS
246
- if [ "$WIFI_PASS " = "" ]
253
+ read -p 'And the WiFi-Key? [Cyber,Sec9ox] ' qWIFI_PASS
254
+ if [ "$qWIFI_PASS " = "" ]
247
255
then
248
256
WIFI_PASS=$WIFI_PASS_org
257
+ else
258
+ WIFI_PASS=$qWIFI_PASS
249
259
fi
250
260
251
- USERNAME ='root'
261
+ qUSERNAME ='root'
252
262
echo
253
- read -p 'Enter the user for the login: [root] ' -s USERNAME
263
+ read -p 'Enter the user for the login: [root] ' -s qUSERNAME
254
264
echo
255
265
echo
256
- passwd $USERNAME
266
+ passwd $qUSERNAME
257
267
258
268
if [ ! -z "$6" ]
259
269
then
286
296
287
297
AD_GUARD='0'
288
298
echo
289
- read -p 'Install AdGuard-Blocker? Need external USB-Device [y/N] ' -s -n 1 ADGUARD_ACTIVE
299
+ read -p 'Install AdGuard-Blocker? Need external USB-Device [y/N] ' -s -n 1 qADGUARD_ACTIVE
290
300
291
- if [ "$ADGUARD_ACTIVE " = "" ]
301
+ if [ "$qADGUARD_ACTIVE " = "" ]
292
302
then
293
303
AD_GUARD='0'
294
- elif [ "$ADGUARD_ACTIVE " = "y" ]
304
+ elif [ "$qADGUARD_ACTIVE " = "y" ]
295
305
then
296
306
AD_GUARD='1'
297
307
else
301
311
echo
302
312
TOR_ONION='0'
303
313
echo
304
- read -p 'Use TOR(Onion)-Network? [Y/n] ' -s -n 1 TOR_ACTIVE
305
- if [ "$TOR_ACTIVE " = "" ]
314
+ read -p 'Use TOR(Onion)-Network? [Y/n] ' -s -n 1 qTOR_ACTIVE
315
+ if [ "$qTOR_ACTIVE " = "" ]
306
316
then
307
317
TOR_ONION='1'
308
- elif [ "$TOR_ACTIVE " = "y" ]
318
+ elif [ "$qTOR_ACTIVE " = "y" ]
309
319
then
310
320
TOR_ONION='1'
311
321
else
314
324
315
325
echo
316
326
317
- SDNS_PORT ='y'
327
+ qSDNS_PORT ='y'
318
328
DNSMASQ_Relay_port='53'
319
329
echo
320
330
321
331
STUBBY='1'
322
332
DNS_IP='127.0.0.1'
323
- read -p 'DNS-Relay to STUBBY [Y/n] ' -s -n 1 SDNS_PORT
333
+ read -p 'DNS-Relay to STUBBY [Y/n] ' -s -n 1 qSDNS_PORT
324
334
325
335
326
- if [ "$SDNS_PORT " = "" ]
336
+ if [ "$qSDNS_PORT " = "" ]
327
337
then
328
338
STUBBY='1'
329
339
elif [ "$SNDS_PORT" = "y" ]
330
340
then
331
341
STUBBY='1'
332
342
else
333
343
STUBBY='0'
334
- DNSMASQ_relay_port='53'
344
+ DNSMASQ_relay_port=$DNS_port
345
+ DNS_PORT=$qDNS_PORT
335
346
DNS_IP=$INET_GW
336
347
fi
337
348
echo $DNS_IP
338
349
echo
339
- DNS_PORT ='y'
340
- read -p 'DNS-Relay to UNBOUND-DNS? [Y/n] ' -s -n 1 DNS_PORT
350
+ qDNS_PORT ='y'
351
+ read -p 'DNS-Relay to UNBOUND-DNS? [Y/n] ' -s -n 1 qDNS_PORT
341
352
UNBOUND='1'
342
- if [ "$DNS_PORT " = "" ]
353
+ if [ "$qDNS_PORT " = "" ]
343
354
then
344
355
UNBOUND='1'
345
- DNSMASQ_Relay_port='5353'
356
+ DNSMASQ_Relay_port=$DNSMASQ_port
346
357
if [ "$TOR_ONION" = "1" ]
347
358
then
348
- UNBOUND_Relay_port='9053'
359
+ UNBOUND_Relay_port=$DNS_TOR_port
349
360
elif [ "$STUBBY" = "0" ]
350
361
then
351
- UNBOUND_Relay_port='53'
362
+ UNBOUND_Relay_port=$DNS_port
352
363
else
353
- UNBOUND_Relay_port='5453'
364
+ UNBOUND_Relay_port=$DNS_STUBBY_port
354
365
fi
355
- elif [ "$DNS_PORT " = "y" ]
366
+ elif [ "$qDNS_PORT " = "y" ]
356
367
then
357
368
UNBOUND='1'
358
- DNSMASQ_Relay_port='5353'
369
+ DNSMASQ_Relay_port=$DNSMASQ_port
359
370
if [ "$TOR_ONION" = "1" ]
360
371
then
361
- UNBOUND_Relay_port='9053'
372
+ UNBOUND_Relay_port=$DNS_TOR_port
362
373
elif [ "$STUBBY" = "0" ]
363
374
then
364
- UNBOUND_Relay_port='53'
375
+ UNBOUND_Relay_port=$DNS_port
365
376
else
366
- UNBOUND_Relay_port='5453'
377
+ UNBOUND_Relay_port=$DNS_STUBBY_port
367
378
fi
368
379
elif [ "$TOR_ONION" = "1" ]
369
380
then
370
- DNSMASQ_Relay_port='9053'
371
- UNBOUND_Relay_port='9053'
381
+ DNSMASQ_Relay_port=$DNS_TOR_port
382
+ UNBOUND_Relay_port=$DNS_TOR_port
372
383
UNBOUND='0'
373
384
elif [ "$STUBBY" = "0" ]
374
385
then
375
- DNSMASQ_Relay_port='53'
376
- UNBOUND_Relay_port='53'
386
+ DNSMASQ_Relay_port=$DNS_port
387
+ UNBOUND_Relay_port=$DNS_port
377
388
UNBOUND='0'
378
389
else
379
- DNSMASQ_Relay_port='5453'
380
- UNBOUND_Relay_port='5453'
390
+ DNSMASQ_Relay_port=$DNS_STUBBY_port
391
+ UNBOUND_Relay_port=$DNS_STUBBY_port
381
392
UNBOUND='0'
382
393
fi
383
394
VLAN_ENABLE='0'
384
395
echo
385
396
echo
386
- read -p 'Would you like separate Networks for each Device-Category? [Y/n] ' -s -n 1 VLAN_ACTIVE
387
- if [ "$VLAN_ACTIVE " = "" ]
397
+ read -p 'Would you like separate Networks for each Device-Category? [Y/n] ' -s -n 1 qVLAN_ACTIVE
398
+ if [ "$qVLAN_ACTIVE " = "" ]
388
399
then
389
400
VLAN_ENABLE='1'
390
- elif [ "$VLAN_ACTIVE " = "y" ]
401
+ elif [ "$qVLAN_ACTIVE " = "y" ]
391
402
then
392
403
VLAN_ENABLE='1'
393
404
else
@@ -399,19 +410,19 @@ echo
399
410
400
411
if [ ! -z "$7" ]
401
412
then
402
- SECURE_RULESW =$7
413
+ qSECURE_RULES =$7
403
414
else
404
- SECURE_RULES ='y'
415
+ qSECURE_RULES ='y'
405
416
fi
406
417
407
418
echo
408
- read -p 'Activate HighSecure-Firewall? [Y/n] ' -s -n 1 SECURE_RULES
419
+ read -p 'Activate HighSecure-Firewall? [Y/n] ' -s -n 1 qSECURE_RULES
409
420
410
- if [ "$SECURE_RULES " = "" ]
421
+ if [ "$qSECURE_RULES " = "" ]
411
422
then
412
423
FW_HSactive='1'
413
424
# set_HS_Firewall
414
- elif [ "$SECURE_RULES " = "y" ]
425
+ elif [ "$qSECURE_RULES " = "y" ]
415
426
then
416
427
FW_HSactive='1'
417
428
#set_HS_Firewall
@@ -753,6 +764,8 @@ all_other_CONTROLER_port="1-8042 8044-65535"
753
764
mDNS_port="5353"
754
765
all_other_mDNS_port="1-5352 5354-65535"
755
766
767
+
768
+
756
769
#Link Local Multicast Name Resolution (LLMNR)
757
770
#5357
758
771
LLMNR_port="5357"
@@ -947,6 +960,8 @@ ACCESS_HTTPS_port="8443"
947
960
#TOR Onion Services
948
961
TOR_SOCKS_port="9050"
949
962
TOR_SOCKS2_port="9150"
963
+ TOR_SOCKS3_port="9100"
964
+ TOR_SOCKS4_port="9200"
950
965
TOR_TRANS_port="9040"
951
966
TOR_DIR_port="9030"
952
967
TOR_OR_port="9049"
@@ -1256,6 +1271,8 @@ iptab_ACCESS_HTTPS_port="8443"
1256
1271
#TOR Onion Services
1257
1272
iptab_TOR_SOCKS_port="9050"
1258
1273
iptab_TOR_SOCKS2_port="9150"
1274
+ iptab_TOR_SOCKS3_port="9100"
1275
+ iptab_TOR_SOCKS4_port="9200"
1259
1276
iptab_TOR_TRANS_port="9040"
1260
1277
iptab_TOR_DIR_port="9030"
1261
1278
iptab_TOR_OR_port="9049"
@@ -3082,23 +3099,23 @@ VirtualAddrNetworkIPv6 fc00::/7
3082
3099
3083
3100
ControlPort 9051
3084
3101
CookieAuthentication 1
3085
- DNSPort 127.0.0.1:9053
3086
- DNSPort 127.0.0.1:9153
3087
- DNSPort 0.0.0.0:9053
3088
- DNSPort [::]:9053
3102
+ DNSPort 127.0.0.1:$(echo $DNS_TOR_port)
3103
+ DNSPort [0::1]:$(echo $DNS_TOR_port)
3104
+ DNSPort 0.0.0.0:$(echo $DNS_TOR_port)
3105
+ DNSPort [::]:$(echo $DNS_TOR_port)
3089
3106
3090
- TransPort 0.0.0.0:9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3091
- TransPort [::]:9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3092
- #TransPort 9040 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3093
- SocksPort 9050 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3094
- SocksPort 9150 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3095
- SocksPort 9100 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3096
- SocksPort 9200 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3107
+ TransPort 0.0.0.0:$(echo $TOR_TRANS_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3108
+ TransPort [::]:$(echo $TOR_TRANS_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3109
+ #TransPort $(echo $TOR_TRANS_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3110
+ SocksPort $(echo $TOR_SOCKS_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3111
+ SocksPort $(echo $TOR_SOCKS2_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3112
+ SocksPort $(echo $TOR_SOCKS3_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3113
+ SocksPort $(echo $TOR_SOCKS4_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3097
3114
3098
- #ORPort 127.0.0.1:9049
3099
- #DirPort 9030
3115
+ #ORPort 127.0.0.1:$(echo $TOR_OR_port) NoListen
3116
+ #DirPort $(echo $TOR_DIR_port) NoListen
3100
3117
3101
- HTTPTunnelPort 9060 IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3118
+ HTTPTunnelPort $(echo $TOR_THTTP_port) IsolateClientAddr IsolateClientProtocol IsolateDestAddr IsolateDestPort
3102
3119
3103
3120
DisableDebuggerAttachment 1
3104
3121
DisableAllSwap 1
@@ -3415,9 +3432,10 @@ uci set unbound.ub_main.verbosity='1'
3415
3432
3416
3433
uci add_list unbound.ub_main.outgoing_port_permit=$SDNS_port
3417
3434
uci add_list unbound.ub_main.outgoing_port_permit=$TOR_SOCKS_port
3418
- uci add_list unbound.ub_main.outgoing_port_permit='9150'
3435
+ uci add_list unbound.ub_main.outgoing_port_permit=$TOR_SOCKS2_port
3419
3436
uci add_list unbound.ub_main.outgoing_port_permit=$DNS_TOR_port
3420
- uci add_list unbound.ub_main.outgoing_port_permit='9153'
3437
+ uci add_list unbound.ub_main.outgoing_port_permit=$TOR_SOCKS3_port
3438
+ uci add_list unbound.ub_main.outgoing_port_permit=$TOR_SOCKS4_port
3421
3439
uci add_list unbound.ub_main.outgoing_port_avoid='1-9029'
3422
3440
uci add_list unbound.ub_main.outgoing_port_avoid='9061-65335'
3423
3441
@@ -32165,8 +32183,6 @@ echo 'set Tor intercept' >> /root/install.log
32165
32183
uci set firewall.ssh_int.enabled='1'
32166
32184
uci set firewall.http_int.enabled='1'
32167
32185
uci set firewall.https_int.enabled='1'
32168
- uci set firewall.tcp_tor1_int.enabled='1'
32169
- uci set firewall.tcp_tor2_int.enabled='1'
32170
32186
processes=$(uci commit && reload_config)
32171
32187
wait $processes >> /root/install.log
32172
32188
@@ -32306,6 +32322,19 @@ uci set firewall.homematic1.extra='--syn'
32306
32322
uci set firewall.homematic1.enabled='0'
32307
32323
}
32308
32324
32325
+ test_tor_dns_intercept() {
32326
+ uci -q del firewall.dns_int
32327
+ uci set firewall.dns_int="redirect"
32328
+ uci set firewall.dns_int.name="Intercept-DNS"
32329
+ uci set firewall.dns_int.family="any"
32330
+ uci set firewall.dns_int.proto="tcp udp"
32331
+ uci set firewall.dns_int.src="lan"
32332
+ uci set firewall.dns_int.src_dport=$DNSPort
32333
+ uci set firewall.dns_int.target="DNAT"
32334
+ uci commit firewall
32335
+ service firewall restart
32336
+ }
32337
+
32309
32338
setup_tor_routing() {
32310
32339
iptables -t nat -A PREROUTING -i inet -p tcp --syn -j REDIRECT --to-ports $TOR_TRANS_port
32311
32340
iptables -A FORWARD -i inet -o wan -j ACCEPT
0 commit comments