Example #1
0
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// B O O T S T R A P
///////////////////////////////////////////////////////////////////////////////
$bootstrap = getenv('CLEAROS_BOOTSTRAP') ? getenv('CLEAROS_BOOTSTRAP') : '/usr/clearos/framework/shared';
require_once $bootstrap . '/bootstrap.php';
///////////////////////////////////////////////////////////////////////////////
// T R A N S L A T I O N S
///////////////////////////////////////////////////////////////////////////////
clearos_load_language('web_proxy');
///////////////////////////////////////////////////////////////////////////////
// D E P E N D E N C I E S
///////////////////////////////////////////////////////////////////////////////
use clearos\apps\web_proxy\Squid;
clearos_load_library('web_proxy/Squid');
///////////////////////////////////////////////////////////////////////////////
// M A I N
///////////////////////////////////////////////////////////////////////////////
$squid = new Squid();
$code = isset($_REQUEST['code']) ? $_REQUEST['code'] : '';
$url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
$ip = isset($_REQUEST['ip']) ? $_REQUEST['ip'] : '';
$ftp_reply = isset($_REQUEST['ftpreply1']) ? $_REQUEST['ftpreply1'] : '';
// Validate
//---------
// TODO
$encoded_ip = strtr(base64_encode($ip), '+/=', '-_.');
$encoded_url = strtr(base64_encode($url), '+/=', '-_.');
$encoded_ftp_reply = strtr(base64_encode($ftp_reply), '+/=', '-_.');
// Redirect back to framework
Example #2
0
 /**
  * Sets basic authentication default values.
  *
  * @return void
  * @throws Engine_Exception
  */
 public function set_basic_authentication_info_default()
 {
     clearos_profile(__METHOD__, __LINE__);
     $product = new Product();
     $name = $product->get_name();
     $realm = $name . ' - ' . lang('web_proxy_web_proxy');
     $tuning = $this->get_tuning();
     // TODO: deal with custom tuning
     if ($tuning['level'] == Tuning::LEVEL_CUSTOM) {
         $children = 60;
     } else {
         $children = $tuning['children'];
     }
     // Basic authentication
     //---------------------
     $file = new File(self::FILE_AUTH_CONFIG);
     $lines = "# This file is managed by the ClearOS API.  Use squid.conf for customization.\n";
     $lines .= "auth_param basic children {$children}\n";
     $lines .= "auth_param basic realm {$realm}\n";
     $lines .= "auth_param basic credentialsttl 2 hours\n";
     $lines .= "auth_param basic program {$this->file_pam_auth}\n";
     // TODO - IPv4 hack below
     $lines .= "external_acl_type system_group ipv4 %LOGIN {$this->file_squid_unix_group} -p\n";
     // Add NTLM if desired and possible
     //---------------------------------
     if ($this->get_ntlm_state() && clearos_library_installed('samba_common/Samba')) {
         clearos_load_library('samba_common/Samba');
         $samba = new \clearos\apps\samba_common\Samba();
         if ($samba->is_initialized()) {
             $domain = $samba->get_workgroup();
             // TODO: hard coded web_proxy_plugin below
             $lines .= "# NTLM\n";
             $lines .= "auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp " . "--require-membership-of={$domain}+web_proxy_plugin\n";
             $lines .= "auth_param ntlm children {$children}\n";
             $lines .= "auth_param ntlm keep_alive on\n";
         }
     }
     if ($file->exists()) {
         $file->delete();
     }
     $file->create('root', 'root', '0644');
     $file->add_lines($lines);
 }
Example #3
0
clearos_load_library('base/File');
clearos_load_library('network/Iface');
clearos_load_library('network/Iface_Manager');
clearos_load_library('network/Network_Utils');
clearos_load_library('samba_common/Samba');
// Exceptions
//-----------
use Exception;
use clearos\apps\base\Engine_Exception;
use clearos\apps\base\File_No_Match_Exception;
use clearos\apps\base\File_Not_Found_Exception;
use clearos\apps\base\Validation_Exception;
clearos_load_library('base/Engine_Exception');
clearos_load_library('base/File_No_Match_Exception');
clearos_load_library('base/File_Not_Found_Exception');
clearos_load_library('base/Validation_Exception');
///////////////////////////////////////////////////////////////////////////////
// C L A S S
///////////////////////////////////////////////////////////////////////////////
/**
 * PPTP VPN server class.
 *
 * @category   apps
 * @package    pptpd
 * @subpackage libraries
 * @author     ClearFoundation <*****@*****.**>
 * @copyright  2003-2013 ClearFoundation
 * @license    http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License version 3 or later
 * @link       http://www.clearfoundation.com/docs/developer/apps/pptpd/
 */
class PPTPd extends Daemon
 /**
  * Returns the state of the proxy filter.
  *
  * @return boolean TRUE if proxy filter is enabled
  * @throws Engine_Exception
  */
 public function get_proxy_filter_state()
 {
     clearos_profile(__METHOD__, __LINE__);
     $state = FALSE;
     if (clearos_library_installed('content_filter/DansGuardian')) {
         clearos_load_library('content_filter/DansGuardian');
         $dansguardian = new \clearos\apps\content_filter\DansGuardian();
         $state = $dansguardian->get_running_state();
     }
     return $state;
 }