diff options
Diffstat (limited to 'samba_wizard/Samba.pm')
-rwxr-xr-x | samba_wizard/Samba.pm | 122 |
1 files changed, 68 insertions, 54 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm index 6f6b50d1..a1974549 100755 --- a/samba_wizard/Samba.pm +++ b/samba_wizard/Samba.pm @@ -56,7 +56,6 @@ my $o = { wiz_domain_master => '', wiz_password_server => '', wiz_passdb_backend => '', wiz_passdb_backend_yn => '', - wiz_domain => '', wiz_ldap_admin_dn => '', wiz_ldap_suffix => '', wiz_ldap_root_pw => '', wiz_ldap_root_pw_2 => '', wiz_sambatype => '', }, @@ -82,7 +81,7 @@ my %type = ( ); my @yesorno = qw(yes no); push @yesorno, ""; -my @loglevel = qw(0 1 2 3 4 5 6 7 8 9 10); +my @loglevel = qw(0 1 2 3 4 5 6 7 8 9); push @loglevel, "10"; $o->{pages} = { welcome => { @@ -119,15 +118,11 @@ $o->{pages} = { $o->{var}{wiz_security} = "user"; $o->{var}{wiz_domain_logons} = "yes"; $o->{var}{wiz_wins_support} ||= $samba->{global}{'wins support'}; - if ($samba->{global}{'os level'}) { - $o->{var}{wiz_oslevel} = $samba->{global}{'os level'}; - } else { - $o->{var}{wiz_oslevel} = "64"; - } + $o->{var}{wiz_oslevel} = "128"; if ($samba->{global}{'passdb backend'}) { - $o->{var}{wiz_passdb_backend_yn} = "yes" + $o->{var}{wiz_passdb_backend_yn} = "yes"; } else { - $o->{var}{wiz_passdb_backend_yn} = "no" + $o->{var}{wiz_passdb_backend_yn} = "no"; } }, post => sub { @@ -154,22 +149,28 @@ $o->{pages} = { pre => sub { $o->{var}{wiz_domain_master} = "no"; $o->{var}{wiz_security} = "user"; - if ($samba->{global}{'os level'}) { - $o->{var}{wiz_oslevel} = $samba->{global}{'os level'}; - } else { - $o->{var}{wiz_oslevel} = "64"; - } + $o->{var}{wiz_wins_support} = "no"; + $o->{var}{wiz_oslevel} = "70"; + $o->{var}{wiz_local_master} = "yes"; + $o->{var}{wiz_domain_master} = "no"; + $o->{var}{wiz_preferred_master} = "yes"; + $o->{var}{wiz_domain_logons} = "yes"; + $o->{var}{wiz_wins_server} = "192.168.10.107"; + $o->{var}{wiz_name_resolve_order} = "wins lmhosts bcast"; + $o->{var}{wiz_dns_proxy} = "no"; }, data => [ { label => N('Security:'), fixed_val => \$o->{var}{wiz_security} }, { label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} }, + { label => N('Wins support:'), val => \$o->{var}{wiz_wins_support}, fixed_val => \@yesorno }, + { label => N('Wins server:'), val => \$o->{var}{wiz_wins_server} }, ], complete => sub { - if (!$o->{var}{wiz_domain_master}) { - $::in->ask_warn(N("Error"), N("The domain is wrong.")); - return 1 - } else { return 0 }; - }, + if (!$o->{var}{wiz_wins_support} =~ /no/ and !$o->{var}{wiz_wins_server} ) { + $::in->ask_warn(N("Error"), N("Your server doesn't support Wins. Please provide a Wins server, or leave blank Wins Support entry.")); + return 1 + } else { return 0 }; + }, next => 'ask_workgroup', }, member => { @@ -178,7 +179,6 @@ $o->{pages} = { $o->{var}{wiz_security} = "domain"; $o->{var}{wiz_domain_master} = "no"; $o->{var}{wiz_password_server} ||= $samba->{global}{'password server'}; - $o->{var}{wiz_domain} ||= $samba->{global}{domain}; if ($samba->{global}{'passdb backend'}) { $o->{var}{wiz_passdb_backend_yn} = "yes" } else { @@ -189,15 +189,15 @@ $o->{pages} = { $o->{var}{wiz_passdb_backend_yn} =~ /yes/ and return 'ldap_conf'; }, data => [ - { label => N('Password server'), val => \$o->{var}{wiz_password_server} }, - { label => N('Domain:'), val => \$o->{var}{wiz_domain} }, + { label => N('Password server'), hidden => 1, val => \$o->{var}{wiz_password_server} }, { label => N('Use LDAP Passdb backend'), val => \$o->{var}{wiz_passdb_backend_yn}, fixed_list => \@yesorno }, { label => N('Security:'), fixed_val => \$o->{var}{wiz_security} }, { label => N('Domain master:'), fixed_val => \$o->{var}{wiz_domain_master} }, + ], complete => sub { - if (!$o->{var}{wiz_domain}) { - $::in->ask_warn(N("Error"), N("The domain is wrong.")); + if (!$o->{var}{wiz_password_server}) { + $::in->ask_warn(N("Error"), N("Please provide the password server.")); return 1 } else { return 0 }; }, @@ -206,35 +206,36 @@ $o->{pages} = { ldap_conf => { name => N('LDAP configuration for Domain Controlling') . "\n\n" . N('The account (dn) that samba uses to access the LDAP server. This account needs to have write access to the LDAP tree. You will need to give samba the password for this dn.'), pre => sub { -# ldap machine suffix = ou=Computers -# ldap user suffix = ou=Users -# ldap group suffix = ou=Groups -# admin users = - -# global -# testparm + $o->{var}{wiz_ldap_passwd_sync} = "yes"; if ($samba->{global}{'ldap suffix'}) { $o->{var}{wiz_ldap_suffix} = $samba->{global}{'ldap suffix'}; - } else { - $o->{var}{wiz_ldap_suffix} = "dc=mydomain, dc=com"; - } - if ($samba->{global}{'ldap admin dn'}) - { $o->{var}{wiz_ldap_admin_dn} ||= $samba->{global}{'ldap admin dn'} - } else { - $o->{var}{wiz_ldap_admin_dn} = "cn=Manager,dc=mydomain,dc=com"; - } + } else { $o->{var}{wiz_ldap_suffix} = "dc=mydomain, dc=com" } + if ($samba->{global}{'ldap admin dn'}) { + $o->{var}{wiz_ldap_admin_dn} ||= $samba->{global}{'ldap admin dn'} + } else { $o->{var}{wiz_ldap_admin_dn} = "cn=Manager,dc=mydomain,dc=com" } if ($samba->{global}{'passdb backend'}) { $o->{var}{wiz_passdb_backend} = $samba->{global}{'passdb backend'} - } else { - $o->{var}{wiz_passdb_backend} = "ldapsam:ldap://localhost"; - } + } else { $o->{var}{wiz_passdb_backend} = "ldapsam:ldap://localhost" } + if($samba->{global}{'ldap machine suffix'}) { + $o->{var}{wiz_ldap_machine_suffix} = $samba->{global}{'ldap machine suffix'} } + else { $o->{var}{wiz_ldap_machine_suffix} = "ou=Computers" } + if($samba->{global}{'ldap group suffix'}) { + $o->{var}{wiz_ldap_group_suffix} = $samba->{global}{'ldap group suffix'} } + else { $o->{var}{wiz_ldap_group_suffix} = "ou=Groups" } + if($samba->{global}{'ldap user suffix'}) { + $o->{var}{wiz_ldap_user_suffix} = $samba->{global}{'ldap user suffix'} } + else { $o->{var}{wiz_ldap_user_suffix} = "ou=Users" } }, data => [ { label => N('Passdb backend'), val => \$o->{var}{wiz_passdb_backend}, help => "ldapsam:ldap://<ldap server name>" }, - { label => N('LDAP administrator'), val => \$o->{var}{wiz_ldap_admin_dn}, help => "root" }, - { label => N('LDAP suffix'), val => \$o->{var}{wiz_ldap_suffix}, help => "dc=$DOMAINNAME,dc=com" }, + { label => N('LDAP administrator'), val => \$o->{var}{wiz_ldap_admin_dn}, help => N(' The ldap admin dn defines the Distinguished Name (DN) name used by Samba to contact the ldap server when retreiving user account information. ie: cn=Manager,dc=mydomain,dc=com') }, + { label => N('LDAP suffix'), val => \$o->{var}{wiz_ldap_suffix}, help => N('Specifies where user and machine accounts are added to the tree. Can be overriden by ldap user suffix and ldap machine suffix. It also used as the base dn for all ldap searches. ie: dc=$DOMAINNAME,dc=com') }, { label => N('LDAP password'), hidden => 1, val => \$o->{var}{wiz_ldap_root_pw} }, { label => N('LDAP password check:'), hidden => 1, val => \$o->{var}{wiz_ldap_root_pw_2} }, + { label => N('LDAP machine suffix:'), val => \$o->{var}{wiz_ldap_machine_suffix}, help => N('It specifies where machines should be added to the ldap tree. ie: ou=Computers') }, + { label => N('LDAP user suffix:'), val => \$o->{var}{wiz_ldap_user_suffix}, help => N('This parameter specifies where users are added to the tree. If this parameter is not specified, the value from ldap suffix.') }, + { label => N('LDAP group suffix:'), val => \$o->{var}{wiz_ldap_group_suffix}, help => N('This parameters specifies the suffix that is used for groups when these are added to the LDAP directory. ie: ou=Groups') }, + { label => N('admin users:'), val => \$o->{var}{wiz_admin_users}, help => N('root @adm') }, ], complete => sub { if (!($o->{var}{wiz_ldap_suffix})) { @@ -304,7 +305,7 @@ $o->{pages} = { next => 'summary', }, summary => { - name => N('Configuring Samba') . "\n\n" . N('The wizard collected the following parameters to configure Samba.') . "\n\n" . N('To accept these values, and configure your server, click the Next button or use the Back button to correct them.') . "\n\n" . N('If you have previously create some shares, they will appear in this configuration. Re-run wizard and choose: Manage share to remove/add/modify them.'), + name => N('Configuring Samba') . "\n\n" . N('The wizard collected the following parameters to configure Samba.') . "\n\n" . N('To accept these values, and configure your server, click the Next button or use the Back button to correct them.') . "\n\n" . N('If you have previously create some shares, they will appear in this configuration. Run "drakwizard sambashare" to manage your share.'), pre => sub { $o->{var}{wiz_sambatype} = $type{$o->{var}{wiz_type}}; }, @@ -349,18 +350,24 @@ sub check() { } sub global_special_options() { -# dos charset = 850 -# unix charset = ISO8859-1 + # set charset + $samba->{global}{'dos charset'} ||= "850"; + $samba->{global}{'unix charset'} ||= "ISO8859-1"; # detect Samba type 3 is standalone if ($o->{var}{wiz_type} == "3") { - exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'}; $samba->{global}{'security'} = "share"; + exists $samba->{global}{'domain_master'} and delete $samba->{global}{'domain_master'}; exists $samba->{global}{'domain logons'} and delete $samba->{global}{'domain logons'}; exists $samba->{global}{'wins support'} and delete $samba->{global}{'wins support'}; exists $samba->{global}{'os level'} and delete $samba->{global}{'os level'}; } else { # so pdc, bdc or member + $o->{var}{wiz_local_master} and $samba->{global}{'local master'} = $o->{var}{wiz_local_master}; + $o->{var}{wiz_preferred_master} and $samba->{global}{'preferred master'} = $o->{var}{wiz_preferred_master}; + $o->{var}{wiz_wins_server} and $samba->{global}{'wins server'} = $o->{var}{wiz_wins_server}; + $o->{var}{wiz_name_resolve_order} and $samba->{global}{'name resolve ordrer'} = $o->{var}{wiz_name_resolve_order}; + $o->{var}{wiz_dns_proxy} and $samba->{global}{'dns proxy'} = $o->{var}{wiz_dns_proxy}; $o->{var}{wiz_domain_master} and $samba->{global}{'domain master'} = $o->{var}{wiz_domain_master}; $o->{var}{wiz_security} and $samba->{global}{security} = $o->{var}{wiz_security}; $o->{var}{wiz_domain_logons} and $samba->{global}{'domain logons'} = $o->{var}{wiz_domain_logons}; @@ -368,17 +375,24 @@ sub global_special_options() { $o->{var}{wiz_passdb_backend} and $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; $o->{var}{wiz_wins_support} and $samba->{global}{'wins support'} = $o->{var}{wiz_wins_support}; $o->{var}{wiz_password_server} and $samba->{global}{'password server'} = $o->{var}{wiz_password_server}; - $o->{var}{wiz_domain} and $samba->{global}{domain} = $o->{var}{wiz_domain}; # ldap options if needed - if ($o->{var}{wiz_passdb_backend_yn} == "yes" ) { - $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; - $samba->{global}{'ldap admin_dn'} = $o->{var}{wiz_ldap_admin_dn}; - $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix}; + if ($o->{var}{wiz_passdb_backend_yn} =~ /yes/) { + $samba->{global}{'ldap passwd sync'} = "yes"; + $o->{var}{wiz_ldap_suffix} and $samba->{global}{'ldap suffix'} = $o->{var}{wiz_ldap_suffix}; + $o->{var}{wiz_ldap_admin_dn} and $samba->{global}{'ldap admin dn'} = $o->{var}{wiz_ldap_admin_dn}; + $o->{var}{wiz_passdb_backend} and $samba->{global}{'passdb backend'} = $o->{var}{wiz_passdb_backend}; + $o->{var}{wiz_ldap_machine_suffix} and $samba->{global}{'ldap machine suffix'} = $o->{var}{wiz_ldap_machine_suffix}; + $o->{var}{wiz_ldap_group_suffix} and $samba->{global}{'ldap group suffix'} = $o->{var}{wiz_ldap_group_suffix}; + $o->{var}{wiz_ldap_user_suffix} and $samba->{global}{'ldap user suffix'} = $o->{var}{wiz_ldap_user_suffix}; } else { # delete ldap options if exist exists $samba->{global}{'passdb backend'} and delete $samba->{global}{'passdb backend'}; - exists $samba->{global}{'ldap admin_dn'} and delete $samba->{global}{'ldap admin_dn'}; + exists $samba->{global}{'ldap admin dn'} and delete $samba->{global}{'ldap admin_dn'}; exists $samba->{global}{'ldap suffix'} and delete $samba->{global}{'ldap suffix'}; + exists $samba->{global}{'ldap passwd sync'} and delete$samba->{global}{'ldap passwd sync'}; + exists $samba->{global}{'ldap machine suffix'} and delete $samba->{global}{'ldap machine suffix'}; + exists $samba->{global}{'ldap group suffix'} and delete $samba->{global}{'ldap group suffix'}; + exists $samba->{global}{'ldap user suffix'} and delete $samba->{global}{'ldap user suffix'}; } } } |