Esempio n. 1
0
 /**
  * Auto configures PPTP.
  *
  * @return void
  * @throws Engine_Exception
  */
 public function auto_configure()
 {
     clearos_profile(__METHOD__, __LINE__);
     if (!$this->get_auto_configure_state()) {
         return;
     }
     $ifaces = new Iface_Manager();
     // Local / Remote IP configuration
     //--------------------------------
     $lans = $ifaces->get_most_trusted_networks();
     if (!empty($lans[0])) {
         list($ip, $netmask) = preg_split('/\\//', $lans[0]);
         $base_ip = preg_replace('/\\.[0-9]+$/', '', $ip);
         if (!Network_Utils::is_private_ip($base_ip . '.1')) {
             $base_ip = '192.168.222';
             $local_range = '1-99';
             $remote_range = '100-199';
         } else {
             $local_range = '80-89';
             $remote_range = '90-99';
         }
         $this->set_local_ip($base_ip . '.' . $local_range);
         $this->set_remote_ip($base_ip . '.' . $remote_range);
     }
     // DNS server configuration
     //-------------------------
     $ips = $ifaces->get_most_trusted_ips();
     if (!empty($ips[0]) && clearos_app_installed('dns')) {
         $this->set_dns_server($ips[0]);
     } else {
         $this->set_dns_server('');
     }
     // WINS server configuration
     //--------------------------
     $samba = new Samba();
     $is_wins = $samba->get_wins_support();
     $wins_server = $samba->get_wins_server();
     if ($is_wins && !empty($ips[0])) {
         $this->set_wins_server($ips[0]);
     } else {
         if (!empty($wins_server)) {
             $this->set_wins_server($wins_server);
         } else {
             $this->set_wins_server('');
         }
     }
     // Restart
     //--------
     $this->reset();
 }
Esempio n. 2
0
 /**
  * Returns tuning level.
  *
  * @return string tuning level
  * @throws Engine_Exception
  */
 public function get_tuning()
 {
     clearos_profile(__METHOD__, __LINE__);
     if (clearos_app_installed('performance_tuning')) {
         clearos_load_library('performance_tuning/Performance_Tuning');
         $performance = new \clearos\apps\performance_tuning\Performance_Tuning();
         $tuning = $performance->get_web_proxy_tuning();
     } else {
         $tuning['level'] = Tuning::LEVEL_HOME_NETWORK;
         $tuning['children'] = self::DEFAULT_CHILDREN;
     }
     return $tuning;
 }