changes for Univention install

This commit is contained in:
Ralf Becker 2014-11-07 13:16:30 +00:00
parent dd7daa8dad
commit b721ae1afc
3 changed files with 21 additions and 15 deletions

View File

@ -36,6 +36,7 @@ $config = array(
'backup' => '', 'backup' => '',
'admin_user' => 'sysop', 'admin_user' => 'sysop',
'admin_passwd'=> randomstring(), 'admin_passwd'=> randomstring(),
'admin_email' => '',
'lang' => 'en', // languages for admin user and extra lang to install 'lang' => 'en', // languages for admin user and extra lang to install
'charset' => 'utf-8', 'charset' => 'utf-8',
'start_db' => '/sbin/service mysqld', 'start_db' => '/sbin/service mysqld',
@ -347,7 +348,7 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
} }
// create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error) // create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error)
$setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']); $setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']);
foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve') as $name) foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name)
{ {
if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]);
} }
@ -355,7 +356,7 @@ if (!file_exists($config['header']) || filesize($config['header']) < 200) // def
// create first user // create first user
$setup_admin = $setup_cli.' --admin '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd'].','. $setup_admin = $setup_cli.' --admin '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd'].','.
$config['admin_user'].','.$config['admin_passwd'].',,,,'.$config['lang']); $config['admin_user'].','.$config['admin_passwd'].',,,'.$config['admin_email'].','.$config['lang']);
run_cmd($setup_admin); run_cmd($setup_admin);
// check if webserver is started and start it (permanent) if not // check if webserver is started and start it (permanent) if not
@ -754,7 +755,8 @@ function set_univention_defaults()
{ {
// ldap settings, see http://docs.univention.de/developer-reference-3.2.html#join:secret // ldap settings, see http://docs.univention.de/developer-reference-3.2.html#join:secret
$config['ldap_suffix'] = $config['ldap_base'] = _ucr_get('ldap/base'); $config['ldap_suffix'] = $config['ldap_base'] = _ucr_get('ldap/base');
$config['ldap_host'] = 'tls://'._ucr_get('ldap/server/ip').':'._ucr_get('ldap/server/port'); // port is ldap allowing starttls, but regular php/ldap config does not allow own certificate!
$config['ldap_host'] = 'ldap://'._ucr_get('ldap/server/ip').':'._ucr_get('ldap/server/port');
$config['ldap_admin'] = $config['ldap_root'] = 'cn=admin,$suffix'; $config['ldap_admin'] = $config['ldap_root'] = 'cn=admin,$suffix';
$config['ldap_admin_pw'] = $config['ldap_root_pw'] = _ucr_secret('ldap'); $config['ldap_admin_pw'] = $config['ldap_root_pw'] = _ucr_secret('ldap');
$config['ldap_context'] = 'cn=users,$base'; $config['ldap_context'] = 'cn=users,$base';
@ -777,15 +779,19 @@ function set_univention_defaults()
{ {
if (!is_array($domains)) $domains = explode("\n", $domains); if (!is_array($domains)) $domains = explode("\n", $domains);
$domain = array_shift($domains); $domain = array_shift($domains);
$config['smtpserver'] = "$mailserver,465,,,yes,tls"; // set "use auth with session credentials",tls,"not user editable","further identities"
$config['smtpserver'] = "$mailserver,465,,,yes,tls,no,yes";
$config['smtp'] = ',emailadmin_smtp_univention'; $config['smtp'] = ',emailadmin_smtp_univention';
$config['mailserver'] = "$mailserver,993,$domain,email,tls"; $config['mailserver'] = "$mailserver,993,$domain,email,tls";
$config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',emailadmin_imap_cyrus'; $config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',emailadmin_imap_cyrus';
// set folders so mail creates them on first login, UCS does not automatic
$config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,INBOX/Spam'; $config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,INBOX/Spam';
if (($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) if (($sieve_port = _ucr_get('mail/cyrus/sieve/port')))
{ {
$config['sieve'] = "$mailserver,$sieve_port,starttls"; $config['sieve'] = "$mailserver,$sieve_port,starttls";
} }
// set an email address for sysop user so mail works right away
$config['admin_email'] = '$admin_user@'.$domain;
} }
} }
} }

View File

@ -24,10 +24,10 @@ class setup_cmd_config extends setup_cmd
* Constructor * Constructor
* *
* @param string $domain string with domain-name or array with all arguments * @param string $domain string with domain-name or array with all arguments
* @param string $config_user=null user to config the domain (or header_admin_user) * @param string $config_user =null user to config the domain (or header_admin_user)
* @param string $config_passwd=null pw of above user * @param string $config_passwd =null pw of above user
* @param string $arguments=null array with command line argruments * @param string $arguments =null array with command line argruments
* @param boolean $verbose=false if true, echos out some status information during the run * @param boolean $verbose =false if true, echos out some status information during the run
*/ */
function __construct($domain,$config_user=null,$config_passwd=null,$arguments=null,$verbose=false) function __construct($domain,$config_user=null,$config_passwd=null,$arguments=null,$verbose=false)
{ {
@ -48,7 +48,7 @@ class setup_cmd_config extends setup_cmd
/** /**
* run the command: write the configuration to the database * run the command: write the configuration to the database
* *
* @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself * @param boolean $check_only =false only run the checks (and throw the exceptions), but not the command itself
* @return string success message * @return string success message
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
* @throws Exception('header.inc.php not found!'); * @throws Exception('header.inc.php not found!');
@ -113,7 +113,7 @@ class setup_cmd_config extends setup_cmd
/** /**
* Return or echo the most common config options * Return or echo the most common config options
* *
* @param boolean $echoit=false if true the config is additionally echo'ed out * @param boolean $echoit =false if true the config is additionally echo'ed out
* @return array with name => value pairs * @return array with name => value pairs
*/ */
static function get_config($echoit=false) static function get_config($echoit=false)
@ -183,8 +183,8 @@ class setup_cmd_config extends setup_cmd
array('name' => 'editforwardingaddress','allowed' => array('yes',null)), array('name' => 'editforwardingaddress','allowed' => array('yes',null)),
'acc_smtp_type', 'acc_smtp_type',
), ),
'--smtpserver' => array( //smtp server,[smtp port],[smtp user],[smtp password],[no|starttls|ssl|tls],[user editable],[further identities] '--smtpserver' => array( //smtp server,[smtp port],[smtp user],[smtp password],[auth session user/pw],[no|starttls|ssl|tls],[user editable],[further identities]
'acc_smtp_host','acc_smtp_port','acc_smtp_username','acc_smtp_passwd', 'acc_smtp_host','acc_smtp_port','acc_smtp_username','acc_smtp_passwd','acc_smtp_auth_session',
array('name' => 'acc_smtp_ssl','allowed' => array(0,'no',1,'starttls',3,'ssl',2,'tls')), array('name' => 'acc_smtp_ssl','allowed' => array(0,'no',1,'starttls',3,'ssl',2,'tls')),
'acc_user_editable','acc_further_identities', 'acc_user_editable','acc_further_identities',
), ),

View File

@ -182,7 +182,7 @@ function do_config($args)
/** /**
* Register all hooks * Register all hooks
* *
* @param array $args domain(default),[config user(admin)],password * @param array $arg domain(default),[config user(admin)],password
*/ */
function do_hooks($arg) function do_hooks($arg)
{ {
@ -335,7 +335,7 @@ function do_update($arg)
* *
* @param string $arg [domain(default)],[user(admin)],password * @param string $arg [domain(default)],[user(admin)],password
* @param int $stop see setup_cmd::check_installed * @param int $stop see setup_cmd::check_installed
* @param boolean $set_lang=true set our charset, overwriting the charset of the eGW installation, default true * @param boolean $set_lang =true set our charset, overwriting the charset of the eGW installation, default true
* @return array with unprocessed arguments from $arg * @return array with unprocessed arguments from $arg
*/ */
function _check_auth_config($arg,$stop,$set_lang=true) function _check_auth_config($arg,$stop,$set_lang=true)
@ -480,7 +480,7 @@ function do_usage($what='')
echo ' --files-dir, --backup-dir, --temp-dir '.lang('path to various directories: have to exist and be writeable by the webserver')."\n"; echo ' --files-dir, --backup-dir, --temp-dir '.lang('path to various directories: have to exist and be writeable by the webserver')."\n";
echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1',str_replace('/setup/setup-cli.php','',$_SERVER['PHP_SELF']))."\n"; echo ' --webserver-url '.lang('eg. /egroupware or http://domain.com/egroupware, default: %1',str_replace('/setup/setup-cli.php','',$_SERVER['PHP_SELF']))."\n";
echo ' --mailserver '.lang('host,port(143),[domain],[{standard(default)|vmailmgr = add domain for mailserver login}]').',[starttls|ssl|tls]'."\n"; echo ' --mailserver '.lang('host,port(143),[domain],[{standard(default)|vmailmgr = add domain for mailserver login}]').',[starttls|ssl|tls]'."\n";
echo ' --smtpserver '.lang('host,[smtp port],[smtp user],[smtp password],[auth=no|yes|ann]').',[starttls|ssl|tls]'."\n"; echo ' --smtpserver '.lang('host,[smtp port],[smtp user],[smtp password],[auth session user/pw=yes|no],[starttls|ssl|tls],[account user editable=yes|no],[further identities=yes|no]')."\n";
echo ' --smtp '.lang('MTA (with LDAP): [yes(user edit forwarding)],emailadmin_smtp(|_sql|_ldap|_ads|_qmail|_mandriva|_dbmailuser|_suse)')."\n"; echo ' --smtp '.lang('MTA (with LDAP): [yes(user edit forwarding)],emailadmin_smtp(|_sql|_ldap|_ads|_qmail|_mandriva|_dbmailuser|_suse)')."\n";
echo ' --imap '.lang('IMAP: Admin user,Password,emailadmin_imap(|_cyrus|_dovecot)')."\n"; echo ' --imap '.lang('IMAP: Admin user,Password,emailadmin_imap(|_cyrus|_dovecot)')."\n";
echo ' --sieve '.lang('Sieve: Host[,Port(4190)]').',[starttls|ssl|tls]'."\n"; echo ' --sieve '.lang('Sieve: Host[,Port(4190)]').',[starttls|ssl|tls]'."\n";