@@ -2615,21 +2615,23 @@ public function configure_bastille_firewall() {
26152615
26162616 $ row = $ this ->db ->queryOneRecord ('SELECT * FROM ?? WHERE server_id = ? ' , $ conf ["mysql " ]["database " ] . '.firewall ' , $ conf ['server_id ' ]);
26172617
2618- if (trim ($ row ['tcp_port ' ]) != '' || trim ($ row ['udp_port ' ]) != '' ) {
2619- $ tcp_public_services = trim (str_replace (', ' , ' ' , $ row ['tcp_port ' ]));
2620- $ udp_public_services = trim (str_replace (', ' , ' ' , $ row ['udp_port ' ]));
2621- } else {
2622- $ tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000 ' ;
2623- $ udp_public_services = '53 ' ;
2624- }
2618+ if (!empty ($ row )) {
2619+ if (trim ($ row ['tcp_port ' ]) != '' || trim ($ row ['udp_port ' ]) != '' ) {
2620+ $ tcp_public_services = trim (str_replace (', ' , ' ' , $ row ['tcp_port ' ]));
2621+ $ udp_public_services = trim (str_replace (', ' , ' ' , $ row ['udp_port ' ]));
2622+ } else {
2623+ $ tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000 ' ;
2624+ $ udp_public_services = '53 ' ;
2625+ }
26252626
2626- if (!stristr ($ tcp_public_services , $ conf ['apache ' ]['vhost_port ' ])) {
2627- $ tcp_public_services .= ' ' .intval ($ conf ['apache ' ]['vhost_port ' ]);
2628- if ($ row ['tcp_port ' ] != '' ) $ this ->db ->query ("UPDATE firewall SET tcp_port = tcp_port + ? WHERE server_id = ? " , ', ' . intval ($ conf ['apache ' ]['vhost_port ' ]), $ conf ['server_id ' ]);
2629- }
2627+ if (!stristr ($ tcp_public_services , $ conf ['apache ' ]['vhost_port ' ])) {
2628+ $ tcp_public_services .= ' ' .intval ($ conf ['apache ' ]['vhost_port ' ]);
2629+ if ($ row ['tcp_port ' ] != '' ) $ this ->db ->query ("UPDATE firewall SET tcp_port = tcp_port + ? WHERE server_id = ? " , ', ' . intval ($ conf ['apache ' ]['vhost_port ' ]), $ conf ['server_id ' ]);
2630+ }
26302631
2631- $ content = str_replace ('{TCP_PUBLIC_SERVICES} ' , $ tcp_public_services , $ content );
2632- $ content = str_replace ('{UDP_PUBLIC_SERVICES} ' , $ udp_public_services , $ content );
2632+ $ content = str_replace ('{TCP_PUBLIC_SERVICES} ' , $ tcp_public_services , $ content );
2633+ $ content = str_replace ('{UDP_PUBLIC_SERVICES} ' , $ udp_public_services , $ content );
2634+ }
26332635
26342636 wf ('/etc/Bastille/bastille-firewall.cfg ' , $ content );
26352637
0 commit comments