Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scabrero/users ad external script #1115

Merged
merged 3 commits into from
Mar 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/users/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
HEAD
+ Add script to update the credentials when mode is external AD
+ Added and used checkMailNotInUse method
3.3.3
+ Updated cloud sync to ignore any change done in cloud to internal users
or groups
+ Fixed EBox::CloudSync::Slave to sync uid and gid numbers on user update
Expand Down
3 changes: 2 additions & 1 deletion main/users/src/EBox/Users/Model/Mode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ sub validateTypedRow
if ($mode eq EBox::Users->STANDALONE_MODE) {
$self->_validateNormalMode($allFields);
} elsif ($mode eq EBox::Users->EXTERNAL_AD_MODE) {
if ($self->parentModule->configured()) {
if (exists $changedFields->{mode} and
$self->parentModule->configured()) {
throw EBox::Exceptions::External(__('External AD mode cannot be set once the users module has been configured.'));
}
$self->_validateExternalADMode($allFields);
Expand Down
63 changes: 63 additions & 0 deletions main/users/src/scripts/update-ad-credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/perl
# Copyright (C) 2013 Zentyal S.L.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

use strict;
use warnings;

use EBox;
use EBox::Global;

EBox::init();

my $global = EBox::Global->getInstance(1);
my $users = $global->modInstance('users');
if ($users->mode() ne $users->EXTERNAL_AD_MODE) {
die 'Users module not using external Active Directory';
}

my $mode = $users->model('Mode');
my $row = $mode->row();
my $currentDc = $row->valueByName('dcHostname');
my $currentUser = $row->valueByName('dcUser');

print "Domain controller FQDN (Full Qualified Domain Name) [$currentDc]: ";
my $newDc = <STDIN>;
chomp $newDc;
$newDc = $currentDc unless length $newDc;

print "User name [$currentUser]: ";
my $newUser = <STDIN>;
chomp $newUser;
$newUser = $currentUser unless length $newUser;

print "User password: ";
my $newPwd1 = <STDIN>;
chomp $newPwd1;

print "Repeat user password: ";
my $newPwd2 = <STDIN>;
chomp $newPwd2;

$row->elementByName('dcHostname')->setValue($newDc);
$row->elementByName('dcUser')->setValue($newUser);
$row->elementByName('dcPassword')->setValue($newPwd1);
$row->elementByName('dcPassword2')->setValue($newPwd2);
$row->store();

my $webadmin = $global->modInstance('webadmin');
$webadmin->restartService();

print "Done. You should restart all services now.\n";