LDAPContext: take a root_password argument or generate one
This commit is contained in:
parent
86bb16d07b
commit
e13d80f5cf
|
@ -12,9 +12,15 @@ use Hydra::Helper::Exec;
|
||||||
# It creates a top level organization and structure, and provides
|
# It creates a top level organization and structure, and provides
|
||||||
# add_user and add_group.
|
# add_user and add_group.
|
||||||
#
|
#
|
||||||
|
# Hash Parameters:
|
||||||
|
#
|
||||||
|
# * root_password: The clear text password required for connecting to the LDAP server
|
||||||
|
#
|
||||||
# The server is automatically terminated when the class is dropped.
|
# The server is automatically terminated when the class is dropped.
|
||||||
sub new {
|
sub new {
|
||||||
my ($class) = @_;
|
my ($class, %opts) = @_;
|
||||||
|
|
||||||
|
my $rootPassword = $opts{'root_password'} // rand_chars();
|
||||||
|
|
||||||
my $root = File::Temp->newdir();
|
my $root = File::Temp->newdir();
|
||||||
mkdir $root;
|
mkdir $root;
|
||||||
|
@ -36,6 +42,7 @@ sub new {
|
||||||
_slapd_dir => $slapd_dir,
|
_slapd_dir => $slapd_dir,
|
||||||
_socket => $socket,
|
_socket => $socket,
|
||||||
_tmpdir => $root,
|
_tmpdir => $root,
|
||||||
|
root_password => $rootPassword,
|
||||||
};
|
};
|
||||||
|
|
||||||
my $blessed = bless $self, $class;
|
my $blessed = bless $self, $class;
|
||||||
|
@ -128,7 +135,7 @@ objectClass: olcMdbConfig
|
||||||
olcDatabase: {1}mdb
|
olcDatabase: {1}mdb
|
||||||
olcDbDirectory: ${\$self->{"_db_dir"}}
|
olcDbDirectory: ${\$self->{"_db_dir"}}
|
||||||
olcRootDN: cn=root,dc=example
|
olcRootDN: cn=root,dc=example
|
||||||
olcRootPW: notapassword
|
olcRootPW: ${\$self->{"root_password"}}
|
||||||
olcSuffix: dc=example
|
olcSuffix: dc=example
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue