]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/tor.cgi
core186: Ship ovpnmain.cgi
[ipfire-2.x.git] / html / cgi-bin / tor.cgi
index f39c0d8da0677110f2de3ab974e63974d911051a..9aa2bc95a1985e2f0e3b23311f0e34a26a10a2ec 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -730,6 +730,9 @@ sub BuildConfiguration() {
        open(FILE, ">$torrc");
 
        # Global settings.
+       print FILE "Sandbox 1\n";
+       print FILE "HardwareAccel 1\n";
+       print FILE "ClientUseIPv6 0\n";
        print FILE "ControlPort $TOR_CONTROL_PORT\n";
 
        if ($settings{'TOR_ENABLED'} eq 'on') {
@@ -787,23 +790,25 @@ sub BuildConfiguration() {
 
                        my @nodes = split(",", $settings{'TOR_USE_EXIT_NODES'});
                        foreach (@nodes) {
-                               print FILE "ExitNode $_\n";
+                               print FILE "ExitNodes $_\n";
                        }
                }
 
                if ($strict_nodes > 0) {
                        print FILE "StrictNodes 1\n";
                }
-       }
+        } else {
+               print FILE "SocksPort 0\n";
+        }
 
        if ($settings{'TOR_RELAY_ENABLED'} eq 'on') {
                # Reject access to private networks.
                print FILE "ExitPolicyRejectPrivate 1\n";
 
-               print FILE "ORPort $settings{'TOR_RELAY_PORT'}\n";
+               print FILE "ORPort $settings{'TOR_RELAY_PORT'} IPv4Only\n";
 
                if ($settings{'TOR_RELAY_DIRPORT'} ne '0') {
-                       print FILE "DirPort $settings{'TOR_RELAY_DIRPORT'}\n";
+                       print FILE "DirPort $settings{'TOR_RELAY_DIRPORT'} IPv4Only\n";
                }
 
                if ($settings{'TOR_RELAY_ADDRESS'} ne '') {
@@ -873,9 +878,9 @@ sub BuildConfiguration() {
 
        # Restart the service.
        if (($settings{'TOR_ENABLED'} eq 'on') || ($settings{'TOR_RELAY_ENABLED'} eq 'on')) {
-               system("/usr/local/bin/torctrl restart &>/dev/null");
+               &General::system("/usr/local/bin/torctrl", "restart");
        } else {
-               system("/usr/local/bin/torctrl stop &>/dev/null");
+               &General::system("/usr/local/bin/torctrl", "stop");
        }
        # Update pid and memory
        daemonstats();