Beispiel #1
0
function stunnel_save(){
	$stunnel=new stunnel4();
	$sock=new sockets();
	$sock->SET_INFO('sTunnel4enabled',$_GET["enable_stunnel"]);
	
	$stunnel->main_array["postfix_relayhost"]["accept"]=$_GET["localport"];
	$stunnel->SaveConf();
	$stunnel->SaveToserver();
	
}
function save_step_stunnel_server()
{
    $stunnel = new stunnel4();
    $datas = $stunnel->SaveToserver();
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body(save_step_infos(true, $datas));
}
Beispiel #3
0
function build()
{
    $stunnel = new stunnel4();
    if ($GLOBALS["OUTPUT"]) {
        echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} building settings\n";
    }
    $stunnel->SaveConf();
    if (!is_file("/opt/artica/ssl/certs/lighttpd.pem")) {
        shell_exec("/usr/share/artica-postfix/bin/artica-install -lighttpd-cert 2>&1");
    }
    @copy("/opt/artica/ssl/certs/lighttpd.pem", "/etc/stunnel/stunnel.pem");
    @chmod("/etc/stunnel/stunnel.pem", 0600);
    @mkdir("/etc/stunnel", 0755, true);
    @file_put_contents("/etc/stunnel/stunnel.conf", $stunnel->ConfBuilded);
}
Beispiel #4
0
function relayhost_save()
{
    $main = new main_cf();
    $tpl = new templates();
    $stunnel = new stunnel4();
    $continue = true;
    $main->smtp_sasl_password_maps_enable_2();
    $localport = $stunnel->main_array["postfix_relayhost"]["accept"];
    $stunnel->main_array["postfix_relayhost"]["connect"] = $_GET["server"];
    $stunnel->main_array["postfix_relayhost"]["port"] = $_GET["port"];
    $stunnel->SaveConf();
    $stunnel->SaveToserver();
    writelogs("Saving [127.0.0.1]:{$localport} -> {$_GET["username"]}", __FUNCTION__, __FILE__, __LINE__);
    $main->main_array["relayhost"] = "[127.0.0.1]:{$localport}";
    $main->save_conf();
    $sock = new sockets();
    $sock->SET_INFO("PostfixRelayHost", "[127.0.0.1]:{$localport}");
    $sock->getFrameWork("cmd.php?postfix-relayhost=yes");
    if ($_GET["username"] == null) {
        $continue = false;
    }
    if ($_GET["password"] == null) {
        $continue = false;
    }
    $saslpswd = new smtp_sasl_password_maps();
    if ($continue) {
        writelogs("UPDATE [127.0.0.1]:{$localport}", __FUNCTION__, __FILE__, __LINE__);
        if (!$saslpswd->add("[127.0.0.1]:{$localport}", $_GET["username"], $_GET["password"])) {
            echo $tpl->javascript_parse_text("{err_sasl_saveldap}<br>{$saslpswd->ldap_infos}");
            return;
        }
        $sock->SET_INFO("smtp_sender_dependent_authentication", 1);
        $sock->getFrameWork("cmd.php?postfix-hash-senderdependent=yes");
        $sock->getFrameWork("cmd.php?postfix-smtp-sasl=yes");
    } else {
        writelogs("Delete [127.0.0.1]:{$localport}", __FUNCTION__, __FILE__, __LINE__);
        $saslpswd->delete("[127.0.0.1]:{$localport}");
    }
}