première version du script de génération de conf pour Thunderbird

sessionscripts
Daniel Berteaud 13 years ago
parent 39849419a3
commit a94c3fad43
  1. 5
      createlinks
  2. 13
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/99MozMcdThunderbird
  3. 17
      root/etc/e-smith/templates/usr/share/mozilla-mcd/thunderbird.conf.php/10All
  4. 109
      root/usr/share/mozilla-mcd/thunderbird.php

@ -11,4 +11,9 @@ templates2events("/home/e-smith/files/shares/wpkg/files/config.xml", qw(wpkg-upd
templates2events("/home/e-smith/files/shares/wpkg/files/profiles/variables.xml", qw(wpkg-update bootstrap-console-save)); templates2events("/home/e-smith/files/shares/wpkg/files/profiles/variables.xml", qw(wpkg-update bootstrap-console-save));
templates2events("/home/e-smith/files/samba/netlogon/netlogon.bat", qw(workgroup-update bootstrap-consolesave)); templates2events("/home/e-smith/files/samba/netlogon/netlogon.bat", qw(workgroup-update bootstrap-consolesave));
templates2events("/usr/share/mozilla-mcd/thunderbird.conf.php", qw(wpkg-update webapps-update bootstrap-consolesave));
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/usr/share/mozilla-mcd/thunderbird.conf.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/usr/share/mozilla-mcd/thunderbird.conf.php/template-end");
panel_link('logonscript','manager'); panel_link('logonscript','manager');

@ -0,0 +1,13 @@
Alias /thunderbird.cfg /usr/share/mozilla-mcd/thunderbird.php
<Directory /usr/share/mozilla-mcd/>
AddType application/x-httpd-php .php .php3
php_admin_value open_basedir /usr/share/mozilla-mcd
Order deny,allow
Deny from all
Allow from {"$localAccess $externalSSLAccess";}
<FilesMatch "\.conf\.php$">
order deny,allow
Deny from all
</FilesMatch>
</Directory>

@ -0,0 +1,17 @@
{
use esmith::util;
my $ldapbase = esmith::util::ldapBase ($DomainName);
$OUT .=<<"EOF";
define('DOMAIN', '$DomainName');
define('USER_BASE', 'ou=Users,$ldapbase');
define('IMAP_SERVER', '$SystemName.$DomainName');
define('SMTP_SERVER', '$SystemName.$DomainName');
define('LDAP_SERVER', 'localhost');
EOF
}

@ -0,0 +1,109 @@
<?php
ini_set('log_errors', 1);
ini_set('display_errors', 0);
require('thunderbird.conf.php');
if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERVER['QUERY_STRING'])) {
$temp = explode('@', $_SERVER['QUERY_STRING']);
$uid = $temp[0];
//Connexion a l'annuaire LDAP
$link = @ldap_connect(LDAP_SERVER) or die ('connexion echouee');
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_bind($link) or die ('identification echouee');
// Recherche de l'utilisateur demandé
$result = ldap_search($link, USER_BASE, "uid=" . $uid);
$user = ldap_get_entries($link, $result);
if($user['count'] == 0) {
// user not found
exit;
}
}
else {
exit;
}
?>
// Compte local
lockPref("mail.account.account1.server", "server1");
lockPref("mail.accountmanager.localfoldersserver", "server1");
lockPref("mail.server.server1.directory-rel", "[ProfD]Mail/Local Folders");
lockPref("mail.server.server1.hostname", "Local Folders");
lockPref("mail.server.server1.name", "Dossiers locaux");
lockPref("mail.server.server1.type", "none");
lockPref("mail.server.server1.userName", "nobody");
// SMTP
lockPref("mail.smtp.defaultserver", "smtp1");
lockPref("mail.smtpservers", "smtp1");
lockPref("mail.smtpserver.smtp1.try_ssl", 3);
lockPref("mail.smtpserver.smtp1.port", 465);
lockPref("mail.smtpserver.smtp1.hostname", "<?php echo SMTP_SERVER; ?>");
lockPref("mail.smtpserver.smtp1.username", "<?php echo $uid; ?>");
// Compte par défaut
lockPref("mail.accountmanager.defaultaccount", "account2");
<?php
$mail = explode('@', $user[0]['mail'][0]);
$account = 2;
$id = 1;
$server = 2;
$accountlist = 'account1';
$identities = ''
?>
// Compte personnel
lockPref("mail.account.account2.server", "server<?php echo $server?>");
lockPref("mail.server.server2.hostname", "<?php echo IMAP_SERVER; ?>");
lockPref("mail.server.server2.name", "<?php echo $user[0]['mail'][0]; ?>");
lockPref("mail.server.server2.port", 993);
lockPref("mail.server.server2.socketType", 3);
lockPref("mail.server.server2.type", "imap");
lockPref("mail.server.server2.userName", "<?php echo $uid; ?>");
<?php
for ($i=0; $i < count($user[0]['mail'])-1; $i++){
?>
lockPref("mail.identity.id<?php echo $id; ?>.fullName", "<?php echo $user[0]['cn'][0]; ?>");
lockPref("mail.identity.id<?php echo $id; ?>.organization", "<?php echo $user[0]['o'][0]; ?>");
lockPref("mail.identity.id<?php echo $id; ?>.smtpServer", "smtp1");
lockPref("mail.identity.id<?php echo $id; ?>.useremail", "<?php echo $user[0]['mail'][$i]; ?>");
lockPref("mail.identity.id<?php echo $id; ?>.valid", true);
<?php
//$accountlist .= ',account' . $account;
$identities .= ',id' . $id;
$account++;
$id++;
}
?>
lockPref("mail.account.account2.identities", "<?php echo $identities;?>");
lockPref("mail.accountmanager.accounts", "account1,account2");
// Mise a jour
lockPref("app.update.enabled", false);
lockPref("app.update.auto", false);
// Extension
lockPref("extensions.installDistroAddons", true);
lockPref("extensions.enabledScopes", 13);
lockPref("extensions.autoDisableScopes", 2);
// Spam
lockPref("mail.adaptivefilters.junk_threshold", 500);
// Checks
defaultPref("mail.check_all_imap_folders_for_new", true);
// Composition
defaultPref("mail.default_html_action", 3);
// Pièces jointes
defaultPref("mail.content_disposition_type ", 1);
// Expunge
defaultPref("mail.imap.expunge_option", 3);
defaultPref("mail.imap.expunge_threshold_number", 100);
Loading…
Cancel
Save