function CheckCyrusByDomains() { if (!is_file('/etc/artica-postfix/settings/Daemons/EnableVirtualDomainsInMailBoxes')) { return null; } $EnableVirtualDomainsInMailBoxes = trim(@file_get_contents('/etc/artica-postfix/settings/Daemons/EnableVirtualDomainsInMailBoxes')); if ($EnableVirtualDomainsInMailBoxes != 1) { return null; } $users = new usersMenus(); $cyrus_text_password = $users->cyrus_ldap_admin_password; $ldap = new clladp(); $locals_domains = $ldap->hash_get_all_local_domains(); writelogs("wants to set virtdomains, " . count($locals_domains) . " local domains", __FUNCTION__, __FILE__, __LINE__); if (!is_array($locals_domains)) { writelogs("wants to set virtdomains, but no domains set in ldap", __FUNCTION__, __FILE__, __LINE__); return null; } while (list($num, $ligne) = each($locals_domains)) { writelogs("check {$num} domains", __FUNCTION__, __FILE__, __LINE__); if ($num == null) { continue; } $cyr = "cyrus@{$num}"; $cyrus_accounts[$cyr] = $cyr; ChangeCyrusPassword($cyr, $cyrus_text_password); } $cyrus_accounts["cyrus"] = "cyrus"; $change = false; $local_admins = get_cyrus_admins(); while (list($num, $ligne) = each($cyrus_accounts)) { if (!$local_admins[$ligne]) { writelogs("Must add {$ligne} in cyrus configuration...", __FUNCTION__, __FILE__, __LINE__); $local_admins[$ligne] = true; $change = true; } } if ($change) { while (list($num, $ligne) = each($local_admins)) { if (trim($num) == null) { continue; } $admins = $admins . $num . " "; } set_cyrus_admins($admins); } else { writelogs("no admins to add in /etc/imapd.conf", __FUNCTION__, __FILE__, __LINE__); } reset($cyrus_accounts); while (list($num, $ligne) = each($cyrus_accounts)) { if (is_file("/usr/sbin/testsaslauthd")) { writelogs("Testing cyrus account {$num}", __FUNCTION__, __FILE__, __LINE__); system("/usr/sbin/testsaslauthd -u {$num} -p {$cyrus_text_password} >/dev/null 2>&1"); } } }
function build_conf(){ @unlink("/etc/spamassassin/sa-learn-cyrus.conf"); $users=new usersMenus(); if(!$users->cyrus_imapd_installed){return null;} if($users->ZARAFA_INSTALLED){return null;} if(!$users->spamassassin_installed){return null;} $usersList=ListUsers(); if(count($usersList)==0){return null;} $unix=new unix(); $salearn=$unix->find_program("sa-learn"); $ipurge=$unix->LOCATE_CYRUS_IPURGE(); $users_list=@implode(" ",$usersList); $sock=new sockets(); $EnableVirtualDomainsInMailBoxes=$sock->GET_INFO("EnableVirtualDomainsInMailBoxes"); if($EnableVirtualDomainsInMailBoxes==1){ $ldap=new clladp(); $domains=$ldap->hash_get_all_local_domains(); while (list ($num, $ligne) = each ($domains) ){ if(trim($ligne)==null){continue;} $doms[]=$ligne; } $domains_list=@implode(" ",$doms); } $l[]="# Configuration for sa-learn-cyrus"; $l[]="#"; $l[]="# hjb -- 2008-02-12"; $l[]="#"; $l[]="# -------------------------------------------------------"; $l[]="# global parameters"; $l[]="#"; $l[]="[global]"; $l[]=""; $l[]="# Directory to store output of sa-learn and ipurge temporarily "; $l[]="tmp_dir = /tmp"; $l[]=""; $l[]="# To avoid race conditions, we use a lock file."; $l[]="lock_file = /var/lock/sa-learn-cyrus.lock"; $l[]=""; $l[]="# level of verbosity (0 .. 3)?"; $l[]="verbose = 2"; $l[]=""; $l[]="# Don't excute commands, show only what would be executed,"; $l[]="# Change this to 'no' after testing."; $l[]="simulate = no"; $l[]=""; $l[]="# -------------------------------------------------------"; $l[]="# Mailbox"; $l[]="#"; $l[]="[mailbox]"; $l[]=""; $l[]="# List of mailboxes/users which will be considered."; $l[]="# If this list is empty all mailboxes will be searched."; $l[]="#"; $l[]="include_list = '$users_list'"; $l[]=""; $l[]="# If include_list is empty, only mailboxes matching this pattern will be considered"; $l[]="include_regexp = '.*'"; $l[]=""; $l[]="# List of mailboxes/users which will be ignored"; $l[]="exclude_list = ''"; $l[]=""; $l[]="# If exclude_list is empty, mailboxes matching this pattern will be ignored"; $l[]="exclude_regexp = ''"; $l[]=""; $l[]="# Spam folder relative to INBOX (cyrus nomenclature: e.g. 'junk.Spam')"; $l[]="spam_folder = 'Junk'"; $l[]=""; $l[]="# Ham folder relative to INBOX (cyrus nomenclature: e.g. 'junk.Ham')"; $l[]="ham_folder = 'Ham'"; $l[]=""; $l[]="# Remove spam after feeding it to SA"; $l[]="remove_spam = yes"; $l[]=""; $l[]="# Remove ham after feeding it to SA"; $l[]="remove_ham = no"; $l[]=""; $l[]="# -------------------------------------------------------"; $l[]="# Spamassassin"; $l[]="#"; $l[]="[sa]"; $l[]=""; $l[]="# Path with system-wide SA preferences"; $l[]="site_config_path = /etc/spamassassin"; $l[]=""; $l[]="# SA configuration file"; $l[]="prefs_file = /etc/spamassassin/local.cf"; $l[]=""; $l[]="# Path to sa-learn"; $l[]="learn_cmd = $salearn"; $l[]=""; $l[]="# SA user and group"; $l[]="user = root"; $l[]="group = root"; $l[]=""; $l[]="# run sa-learn in debug mode (useful to examine problems)"; $l[]="debug = no"; $l[]=""; $l[]="# -------------------------------------------------------"; $l[]="# IMAP"; $l[]="#"; $l[]="[imap]"; $l[]=""; $l[]="# Base directory of IMAP spool (below that mailboxes are located)"; $l[]="base_dir = $users->cyr_partition_default"; $l[]=""; $l[]="# If base_dir has subdivisions with initial letters of mailbox names"; $l[]="# set initial_letter = yes (default), otherwise choose no."; $l[]="# Example for joe's mailbox:"; $l[]="# yes: <base_dir>/j/user/joe/"; $l[]="# no: <base_dir>/user/joe/"; $l[]="initial_letter = yes"; $l[]=""; $l[]="# If your cyrus spool uses domain hierarchy give a list of domains"; $l[]="# Example for mailbox fritz@bar.org and joe@foo.com"; $l[]="# <base_dir>/domain/b/bar.org/f/fritz"; $l[]="# <base_dir>/domain/f/foo.com/j/joe"; $l[]="# domains = foo.com bar.org"; $l[]="#"; $l[]="# If you don't use Cyrus's domain support leave the entry empty."; $l[]="# The initial_letter option (see above) is applied to domains, too. "; $l[]="domains = '$domains_list'"; $l[]=""; $l[]="# Choose 'unixhierarchysep = yes' if Cyrus is configured to accept usernames"; $l[]="# like 'hans.mueller.somedomain.tld'"; $l[]="unixhierarchysep = yes"; $l[]=""; $l[]="# imap command to purge mail messages"; $l[]="purge_cmd = $ipurge"; $l[]=""; $l[]="# Cyrus-IMAPd user"; $l[]="user = cyrus"; @file_put_contents("/etc/spamassassin/sa-learn-cyrus.conf",@implode("\n",$l)); system(LOCATE_PHP5_BIN2()." ".dirname(__FILE__)."/exec.spamassassin.php"); }
function localdomain_search() { $users = new usersMenus(); $page = CurrentPageName(); $t = time(); $tpl = new templates(); $ldap = new clladp(); $are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}"); if ($users->AsPostfixAdministrator) { $hash = $ldap->hash_get_all_local_domains(); } else { $hash = $ldap->Hash_associated_domains($_SESSION["ou"]); } $search = string_to_flexregex("localdomain-search"); while (list($domain, $ligne) = each($hash)) { $id = md5($domain); $delete = imgsimple("delete-32.png", null, "DeleteLocalDomain{$t}('{$domain}','{$id}')"); if ($search != null) { if (!preg_match("#{$search}#", $domain)) { continue; } } $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t\t<td style='font-size:18px'><i class='icon-globe'></i> {$domain}</td>\n\t\t\t<td style='text-align:center'>{$delete}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th style='width:99%'>{domains}</th>\n\t\t\t\t\t<th> </th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>\n<script>\n\tvar xmem{$t}='';\n\tvar xDeleteLocalDomain{$t}= function (obj) {\t\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue); return;};\n\t\t\$('#'+xmem{$t}).remove();\n\t}\t\t\t\n\t\t\t\t\n\t\tfunction DeleteLocalDomain{$t}(domain,id){\n\t\t\txmem{$t}=id;\n\t\t\tif(confirm('{$are_you_sure_to_delete} '+domain)){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('localdomain-remove',domain);\n\t\t\t\tXHR.appendData('ou','{$_SESSION["ou"]}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',xDeleteLocalDomain{$t});\t\n\t\t\t}\n\t\t}\n\t\t\t\t\n</script>"; }
function BuildConfig() { $unix = new unix(); $sock = new sockets(); $php = $unix->LOCATE_PHP5_BIN(); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Checking cyrusadm ad\n"; } shell_exec("{$php} /usr/share/artica-postfix/exec.cyrus.php --cyrusadm-ad"); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Checking DB CONFIG\n"; } shell_exec("{$php} /usr/share/artica-postfix/exec.cyrus.php --DB_CONFIG"); $impadconf = explode("\n", @file_get_contents("/etc/artica-postfix/settings/Daemons/impadconf")); while (list($index, $ligne) = each($impadconf)) { if (!preg_match("#(.+?):(.+)#", $ligne, $re)) { continue; } $IMAPD_GET_ARTICA[trim($re[1])] = trim($re[2]); } $CyrusAdmPlus = trim(@file_get_contents('/etc/artica-postfix/CyrusAdmPlus')); $maxmessagesize = $IMAPD_GET_ARTICA['maxmessagesize']; $autocreateinboxfolders = $IMAPD_GET_ARTICA['autocreateinboxfolders']; $quotawarn = $IMAPD_GET_ARTICA['quotawarn']; $allowallsubscribe = $IMAPD_GET_ARTICA['allowallsubscribe']; $duplicatesuppression = $IMAPD_GET_ARTICA['duplicatesuppression']; $popminpoll = $IMAPD_GET_ARTICA['popminpoll']; $createonpost = $IMAPD_GET_ARTICA['createonpost']; $allowanonymouslogin = $IMAPD_GET_ARTICA['allowanonymouslogin']; $partition_default = trim($sock->GET_INFO('CyrusPartitionDefault')); if ($partition_default == null) { $partition_default = '/var/spool/cyrus/mail'; } if (!is_numeric($popminpoll)) { $popminpoll = 0; } if (!is_numeric($maxmessagesize)) { $maxmessagesize = 0; } if ($autocreateinboxfolders == null) { $autocreateinboxfolders = 'sent|drafts|spam|templates'; } if (!is_numeric($quotawarn)) { $quotawarn = 90; } if (!is_numeric($allowallsubscribe)) { $allowallsubscribe = 1; } if (!is_numeric($duplicatesuppression)) { $duplicatesuppression = 0; } if (!is_numeric($allowanonymouslogin)) { $allowanonymouslogin = 0; } if (!is_numeric($createonpost)) { $createonpost = 1; } $EnableMechCramMD5 = intval($sock->GET_INFO("EnableMechCramMD5")); $EnableMechDigestMD5 = intval($sock->GET_INFO("EnableMechDigestMD5")); $EnableMechLogin = $sock->GET_INFO("EnableMechLogin"); $EnableMechPlain = $sock->GET_INFO("EnableMechPlain"); if (!is_numeric($EnableMechLogin)) { $EnableMechLogin = 1; } if (!is_numeric($EnableMechPlain)) { $EnableMechPlain = 1; } $sasl_mech_listZ = array(); if ($EnableMechLogin == 1) { $sasl_mech_listZ[] = 'LOGIN'; } if ($EnableMechPlain == 1) { $sasl_mech_listZ[] = 'PLAIN'; } if ($EnableMechDigestMD5 == 1) { $sasl_mech_listZ[] = 'DIGEST-MD5'; } if ($EnableMechCramMD5 == 1) { $sasl_mech_listZ[] = "CRAM-MD5"; } if (count($sasl_mech_listZ) == 0) { $sasl_mech_listZ[] = 'LOGIN'; $sasl_mech_listZ[] = 'PLAIN'; } $sasl_mech_list = @implode(" ", $sasl_mech_listZ); $EnableCyrusMasterCluster = intval($sock->GET_INFO("EnableCyrusMasterCluster")); $CyrusImapDisableCluster = intval($sock->GET_INFO("CyrusImapDisableCluster")); $EnableCyrusReplicaCluster = intval($sock->GET_INFO("EnableCyrusReplicaCluster")); $cyrus_id = intval($sock->GET_INFO("cyrus_id")); $CyrusClusterPort = intval($sock->GET_INFO('CyrusClusterPort')); $CyrusReplicaClusterPort = intval($sock->GET_INFO('CyrusReplicaClusterPort')); $CyrusEnableBackendMurder = intval($sock->GET_INFO("CyrusEnableBackendMurder")); $CyrusEnableImapMurderedFrontEnd = intval($sock->GET_INFO("CyrusEnableImapMurderedFrontEnd")); $EnableVirtualDomainsInMailBoxes = intval($sock->GET_INFO("EnableVirtualDomainsInMailBoxes")); $chown = $unix->find_program("chown"); $configdirectory = '/var/lib/cyrus'; $srvtab = '/var/lib/cyrus/srvtab'; $POSTFIX_QUEUE_DIRECTORY = $unix->POSTCONF_GET("queue_directory"); $echo = $unix->find_program("echo"); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} sasl_mech_list...........: {$sasl_mech_list}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Partition Default........: {$partition_default}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Postfix Queue directory..: {$POSTFIX_QUEUE_DIRECTORY}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableVirtualDomainsInMailBoxes: {$EnableVirtualDomainsInMailBoxes}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableCyrusMasterCluster.: {$EnableCyrusMasterCluster}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableCyrusReplicaCluster: {$EnableCyrusReplicaCluster}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CyrusClusterPort.........: {$CyrusClusterPort}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CyrusEnableBackendMurder.: {$CyrusEnableBackendMurder}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CyrusEnableImapMurderedFrontEnd.: {$CyrusEnableImapMurderedFrontEnd}\n"; } if ($EnableCyrusMasterCluster == 1) { CHANGE_SERVICES_IP("csync", $CyrusClusterPort); } if ($EnableCyrusReplicaCluster == 1) { CHANGE_SERVICES_IP("csync", $CyrusReplicaClusterPort); } $ldap = new clladp(); $LDAP_PASSWORD = $ldap->ldap_password; $LDAP_SUFFIX = $ldap->suffix; $HOSTNAME = $unix->hostname_g(); $HOSTNAMES = explode(".", $HOSTNAME); unset($HOSTNAMES[0]); $DOMAIN = @implode(".", $HOSTNAMES); if ($CyrusEnableBackendMurder == 1) { $SS[] = "configdirectory: /var/lib/cyrus-murder"; $SS[] = "partition-default:{$partition_default}"; $SS[] = "ldap_uri: ldap://{$ldap->ldap_host}:{$ldap->ldap_port}"; $SS[] = "sasl_mech_list: {$sasl_mech_list}"; $SS[] = "admins: murder"; @file_put_contents("/etc/imap-murder.conf", @implode("\n", $SS)); @mkdir("/var/lib/cyrus-murder/socket", 0755, true); @mkdir("/var/lib/cyrus-murder/db", 0755, true); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} /etc/imap-murder.conf done\n"; } shell_exec("{$chown} -R cyrus:mail /var/lib/cyrus-murder"); shell_exec("{$echo} \"{$LDAP_PASSWORD}\"|/usr/sbin/saslpasswd2 -c murder"); } $partition_default_root = dirname($partition_default); $f = array(); $f[] = "configdirectory: {$configdirectory}"; $f[] = "defaultpartition: default"; $f[] = "partition-default: {$partition_default}"; $f[] = "partition-news: /var/spool/cyrus/news"; $f[] = "srvtab: {$srvtab}"; $f[] = "newsspool: {$partition_default_root}/news"; $f[] = "sievedir: {$partition_default_root}/sieve"; $f[] = "idlesocket: /var/run/cyrus/socket/idle"; $f[] = "notifysocket: /var/run/cyrus/socket/notify"; $f[] = "lmtpsocket: {$POSTFIX_QUEUE_DIRECTORY}/var/run/cyrus/socket/lmtp"; $f[] = "sasl_saslauthd_path:/var/run/saslauthd/mux"; $f[] = "altnamespace: no"; $f[] = "unixhierarchysep: yes"; $f[] = "lmtp_downcase_rcpt: yes"; $f[] = "umask: 077"; $f[] = "sieveusehomedir: false"; $f[] = "hashimapspool: true"; $f[] = "allowplaintext: yes"; $f[] = "sasl_pwcheck_method: saslauthd"; $f[] = "sasl_auto_transition: no"; $f[] = "sasl_minimum_layer: 0"; $f[] = "ldap_member_base:dc=organizations,{$LDAP_SUFFIX}"; $f[] = "idlemethod: poll"; $f[] = "syslog_prefix: cyrus"; $f[] = "servername: {$HOSTNAME}"; if ($CyrusEnableBackendMurder == 1) { $f[] = "mupdate_server: {$HOSTNAME}"; $f[] = "mupdate_port: 3905"; $f[] = "mupdate_authname: murder"; $f[] = "mupdate_username: murder"; $f[] = "mupdate_password: {$LDAP_PASSWORD}"; $f[] = "proxyservers: murder"; } if ($CyrusEnableImapMurderedFrontEnd == 1) { $ini = new Bs_IniHandler(); $ini->loadFile("/etc/artica-postfix/settings/Daemons/CyrusMurderBackendServer"); $MURDER_BACKEND = $ini->_params["MURDER_BACKEND"]["servername"]; $backend_server_name = str_replace(".", "_", $MURDER_BACKEND); $f[] = "mupdate_server: {$MURDER_BACKEND}"; $f[] = "mupdate_port: 3905"; $f[] = "mupdate_authname: murder"; $f[] = "mupdate_username: murder"; $f[] = "mupdate_password: {$LDAP_PASSWORD}"; $f[] = "#mupdate_config: standard"; $f[] = "allowusermoves: true"; $f[] = "{$backend_server_name}_authname: murder"; $f[] = "{$backend_server_name}_password: {$LDAP_PASSWORD}"; $f[] = "proxy_authname: murder"; } if ($EnableCyrusMasterCluster == 1) { $ini = new Bs_IniHandler(); $ini->loadFile("/etc/artica-postfix/settings/Daemons/CyrusClusterReplicaInfos"); $CyrusClusterID = intval($sock->GET_INFO("CyrusClusterID")); if ($CyrusClusterID == 0) { $CyrusClusterID = 1; } $f[] = "sync_host: {$ini->_params["REPLICA"]["servername"]}"; $f[] = "sync_authname: cyrus"; $f[] = "sync_password: {$ini->_params["REPLICA"]["password"]}"; $f[] = "guid_mode: sha1"; $f[] = "sync_log: yes"; $f[] = "sync_repeat_interval: 60"; $f[] = "sync_batch_size: 1000"; $f[] = "sync_machineid: {$CyrusClusterID}"; } $cur_email[] = "cyrus"; $cur_email[] = "cyrus@{$DOMAIN}"; if ($EnableVirtualDomainsInMailBoxes == 1) { $ldap = new clladp(); if ($ldap->ldapFailed) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed to connect to LDAP server, checking cache\n"; } $cur_email = unserialize(@file_get_contents("/etc/artica-postfix/CYRUS_ADMINS_CACHE")); } else { $domains = $ldap->hash_get_all_local_domains(); while (list($domain, $cyrusadm) = each($domains)) { $ldap->CyrusAdminOtherCreate("cyrus@{$domain}", null, true); $cur_email[] = "cyrus@{$domain}"; } @file_put_contents("/etc/artica-postfix/CYRUS_ADMINS_CACHE", serialize($cur_email)); } } if ($CyrusAdmPlus != null) { $cur_email[] = $CyrusAdmPlus; } while (list($index, $cyrusadm) = each($cur_email)) { $cyrusadm = trim($cyrusadm); if ($cyrusadm == null) { continue; } $_cyrusadms[$cyrusadm] = $cyrusadm; } while (list($cyrusadm, $xcyrusadm) = each($_cyrusadms)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Cyrus Admin..............: `{$cyrusadm}`\n"; } $_cyrusadms2[] = $cyrusadm; } if ($EnableVirtualDomainsInMailBoxes == 1) { $f[] = "virtdomains: userid"; $f[] = "defaultdomain: localhost.localdomain"; } else { $f[] = "virtdomains: no"; } $f[] = "sasl_mech_list: {$sasl_mech_list}"; if ($CyrusEnableBackendMurder == 1) { $cur_email[] = "murder"; } if ($CyrusEnableImapMurderedFrontEnd == 1) { $cur_email[] = "murder"; } $cur_emails = @implode(" ", $_cyrusadms2); $f[] = "admins: {$cur_emails}"; $f[] = "username_tolower: 1"; $f[] = "ldap_uri: ldap://{$ldap->ldap_host}:{$ldap->ldap_port}"; $f[] = ""; $f[] = ""; $f[] = "autocreatequota: 0"; $f[] = "popminpoll: {$popminpoll}"; $f[] = "maxmessagesize: {$maxmessagesize}"; $f[] = "autocreateinboxfolders: {$autocreateinboxfolders}"; $f[] = "quotawarn: {$quotawarn}"; $f[] = "allowallsubscribe: {$allowallsubscribe}"; $f[] = "duplicatesuppression: {$duplicatesuppression}"; $f[] = "allowanonymouslogin: {$allowanonymouslogin}"; $f[] = "createonpost: {$createonpost}"; $f[] = "sieve_maxscriptsize: 1024"; $f[] = ""; if (is_file("/etc/ssl/certs/cyrus.pem")) { $f[] = "tls_cert_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_imap_cert_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_imap_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_pop3_cert_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_pop3_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_lmtp_cert_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_lmtp_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "sieve_tls_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_sieve_cert_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_sieve_key_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_ca_file: /etc/ssl/certs/cyrus.pem"; $f[] = "tls_ca_path: /etc/ssl/certs"; $f[] = "tls_session_timeout: 1440"; $f[] = "tls_cipher_list: TLSv1+HIGH:!aNULL:@STRENGTH"; } $f[] = "tls_require_cert: false"; $f[] = "tls_imap_require_cert: false"; $f[] = "tls_pop3_require_cert: false"; $f[] = "tls_lmtp_require_cert: false"; $f[] = "tls_sieve_require_cert: false"; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} /etc/imapd.conf DONE\n"; } @file_put_contents("/etc/imapd.conf", @implode("\n", $f)); WRITE_CYRUS_CONF(); }