Compare commits
7 Commits
11_0_0-7_e
...
master
Author | SHA1 | Date | |
---|---|---|---|
7b8363f96b | |||
980b444bbd | |||
3e818d32b7 | |||
a409c24859 | |||
4177f9666a | |||
f99cce8bae | |||
e61e1a8096 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
||||
*.bak
|
||||
|
@@ -6,7 +6,14 @@ SMEServer Koozali developed git repo for smeserver-ibays smeserver
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-ibays&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)\
|
||||
Show list of outstanding bugs:
|
||||
[All](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=NEEDINFO&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&cf_package=smeserver-ibays&classification=SME+Server&list_id=105756&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=CONFIRMED&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=UNCONFIRMED&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Need info](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=NEEDINFO&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[In progress](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=IN_PROGRESS&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=RESOLVED&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap&bug_status=VERIFIED&cf_package=smeserver-ibays&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
|
||||
And a list of outstanding Legacy bugs: (e-smith-ibays) [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-ibays&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
@@ -33,7 +33,6 @@ foreach my $event (qw(ibay-create ibay-modify ibay-modify-files))
|
||||
foreach my $event (qw(post-install post-upgrade smeserver-ibays-update))
|
||||
{
|
||||
event_link("init-ibays", $event, "15");
|
||||
event_link('store-ldap-smbpasswd', $event, "06");
|
||||
}
|
||||
|
||||
my $event = "smeserver-ibays-update";
|
||||
@@ -44,3 +43,4 @@ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/nmbd");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||
event_link("systemd-reload", $event, "89");
|
||||
event_link("systemd-default", $event, "88");
|
||||
event_link("store-ldap-smbpasswd",$event, "06");
|
||||
|
@@ -28,8 +28,9 @@ use strict;
|
||||
use Errno;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::util;
|
||||
use Net::LDAP;
|
||||
use esmith::AccountsDB;
|
||||
use utf8;
|
||||
use esmith::util::ldap;
|
||||
|
||||
my $adb = esmith::AccountsDB->open_ro();
|
||||
|
||||
@@ -41,22 +42,8 @@ unless ($conf->get('ldap')->prop('status') eq "enabled" )
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $domain = $conf->get('DomainName')
|
||||
|| die("Couldn't determine domain name");
|
||||
$domain = $domain->value;
|
||||
|
||||
# prepare LDAP bind
|
||||
my $pw = esmith::util::LdapPassword();
|
||||
my $base = esmith::util::ldapBase ($domain);
|
||||
|
||||
my $ldap = Net::LDAP->new('localhost')
|
||||
or die "$@";
|
||||
|
||||
$ldap->bind(
|
||||
dn => "cn=root,$base",
|
||||
password => $pw
|
||||
);
|
||||
|
||||
my $ldap=esmith::util::ldap->new();
|
||||
|
||||
my $event = $ARGV [0];
|
||||
my $ibay = $ARGV [1];
|
||||
@@ -88,10 +75,10 @@ if ( "$ldapauth" ne "enabled" )
|
||||
}
|
||||
}
|
||||
|
||||
my $result = $ldap->delete("uid=$ibay,ou=Users,$base");
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) ibay account $ibay.\n" );
|
||||
my $result = $ldap->ldapdeluser($ibay);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) ibay account $ibay.\n" );
|
||||
|
||||
$result = $ldap->delete("cn=$ibay,ou=Groups,$base");
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group account $ibay.\n" );
|
||||
$result = $ldap->ldapdelgroup($ibay);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group account $ibay.\n" );
|
||||
|
||||
exit $x
|
||||
|
@@ -28,30 +28,18 @@ use esmith::util;
|
||||
use esmith::templates;
|
||||
use esmith::AccountsDB;
|
||||
use esmith::ConfigDB;
|
||||
use Net::LDAP;
|
||||
use utf8;
|
||||
use esmith::util::ldap;
|
||||
|
||||
my $conf = esmith::ConfigDB->open_ro
|
||||
or die "Could not open Config DB";
|
||||
|
||||
my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
|
||||
my $x = 0; # exit value
|
||||
|
||||
my $domain = $conf->get('DomainName')
|
||||
|| die("Couldn't determine domain name");
|
||||
$domain = $domain->value;
|
||||
my $result;
|
||||
|
||||
# prepare LDAP bind
|
||||
my $pw = esmith::util::LdapPassword();
|
||||
my $base = esmith::util::ldapBase ($domain);
|
||||
|
||||
my $ldap = Net::LDAP->new('localhost')
|
||||
or die "$@";
|
||||
|
||||
$ldap->bind(
|
||||
dn => "cn=root,$base",
|
||||
password => $pw
|
||||
);
|
||||
my $ldap=esmith::util::ldap->new();
|
||||
|
||||
$ENV{'PATH'} = "/bin";
|
||||
|
||||
@@ -108,45 +96,23 @@ if ($event eq 'ibay-create')
|
||||
#------------------------------------------------------------
|
||||
# add new ibay group to ldap
|
||||
#------------------------------------------------------------
|
||||
$result = $ldap->add("cn=$ibayName,ou=Groups,$base",
|
||||
attrs => [
|
||||
"cn"=> $ibayName,
|
||||
"gidNumber"=> $ibay->prop("Gid"),
|
||||
"objectClass" => [ 'posixGroup', 'mailboxRelatedObject']
|
||||
]);
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
|
||||
$result = $ldap->ldapgroup($ibay);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
|
||||
|
||||
#------------------------------------------------------------
|
||||
# add new ibay user to ldap
|
||||
# add new ibay user to ldap and lock password
|
||||
#------------------------------------------------------------
|
||||
$result = $ldap->add("uid=$ibayName,ou=Users,$base",
|
||||
attrs => [
|
||||
"uidNumber" => $ibay->prop("Uid"),
|
||||
"gidNumber" => $ibay->prop("Gid"),
|
||||
"cn" => $ibay->prop("Name"),
|
||||
"objectClass" => [ 'account', 'posixAccount', 'shadowAccount'],
|
||||
"homeDirectory" => "/home/e-smith/files/ibays/$ibayName",
|
||||
"loginShell" => "/bin/false",
|
||||
"shadowExpire" => -1,
|
||||
"shadowFlag" => 134538308,
|
||||
"shadowInactive" => -1,
|
||||
"shadowLastChange" => 15997,
|
||||
"shadowMax" => 99999,
|
||||
"shadowMin" => -1,
|
||||
"shadowWarning"=> 7,
|
||||
]
|
||||
);
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
|
||||
$result = $ldap->ldapuser($ibay);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Loop to add new user to groups "shared,". $ibay->prop("Group")
|
||||
#------------------------------------------------------------
|
||||
foreach my $grp ( 'shared', $ibay->prop("Group") ) {
|
||||
$result = $ldap->modify("cn=$grp,ou=Groups,$base",
|
||||
add => {
|
||||
"memberUid"=> [ $ibay->prop("Uid")]
|
||||
});
|
||||
my @groupMembers = ($ibayName);
|
||||
$result = $ldap->ldapaddgroupmembers($grp,\@groupMembers);
|
||||
# error code 20 is entry already exits.
|
||||
$result->code && ( $result->code != 20 ) && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to add (ldap) account $ibayName to supplementary group $grp.\n" );
|
||||
$result && ( $result != 20 ) && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to add (ldap) account $ibayName to supplementary group $grp.\n" );
|
||||
}
|
||||
#------------------------------------------------------------
|
||||
# Create the ibay files and set the password.
|
||||
@@ -168,12 +134,6 @@ if ($event eq 'ibay-create')
|
||||
or ( $x = 255, warn "Error locking (unix) account $ibayName" );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------
|
||||
# lock password in ldap
|
||||
#------------------------------------------------------------
|
||||
$result = $ldap->modify("uid=$ibayName,ou=Users,$base",
|
||||
replace => { 'userPassword' => "{crypt}!*"});
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Error locking (ldap) account $ibayName.\n" );
|
||||
}
|
||||
elsif ($event eq 'ibay-modify' and $ibayName ne 'Primary')
|
||||
{
|
||||
@@ -190,23 +150,17 @@ elsif ($event eq 'ibay-modify' and $ibayName ne 'Primary')
|
||||
#------------------------------------------------------------
|
||||
# Modify ibay description in ldap"
|
||||
#------------------------------------------------------------
|
||||
$result = $ldap->modify("uid=$ibayName,ou=Users,$base",
|
||||
replace => {
|
||||
"cn" => $ibay->prop("Name"),
|
||||
}
|
||||
);
|
||||
$result->code && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify email of (ldap) account $ibayName.\n" );
|
||||
$result = $ldap->ldapuser($ibay);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Loop to add new user to groups "shared,". $ibay->prop("Group")
|
||||
#------------------------------------------------------------
|
||||
foreach my $grp ( 'shared', $ibay->prop("Group") ) {
|
||||
$result = $ldap->modify("cn=$grp,ou=Groups,$base",
|
||||
add=> {
|
||||
"memberUid"=> [ $ibay->prop("Uid")]
|
||||
} );
|
||||
foreach my $grp ( 'shared', $ibay->prop("Group") ) {
|
||||
my @groupMembers = ($ibayName);
|
||||
$result = $ldap->ldapaddgroupmembers($grp,\@groupMembers);
|
||||
# error code 20 is entry already exits.
|
||||
$result->code && ( $result->code != 20 ) && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to add (ldap) account $ibayName to supplementary group $grp.\n" );
|
||||
$result && ( $result != 20 ) && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to add (ldap) account $ibayName to supplementary group $grp.\n" );
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ Summary: smeserver server and gateway - ibays module
|
||||
%define name smeserver-ibays
|
||||
Name: %{name}
|
||||
%define version 11.0.0
|
||||
%define release 7
|
||||
%define release 10
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
@@ -13,6 +13,7 @@ Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
BuildArchitectures: noarch
|
||||
Requires: smeserver-lib >= 11.0.0-7
|
||||
Requires: smeserver-base
|
||||
Requires: perl(CGI::FormMagick)
|
||||
Requires: smeserver-formmagick
|
||||
@@ -27,7 +28,13 @@ Provides: e-smith-ibays
|
||||
smeserver server and gateway software - ibays module.
|
||||
|
||||
%changelog
|
||||
* Sat May 18 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
|
||||
* Sat Jan 18 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
|
||||
- cleanup MULTIPLE_RPM_OWNERS on S06store-ldap-smbpasswd [SME: 12860]
|
||||
|
||||
* Tue Aug 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-9.sme
|
||||
- use esmith::util:ldap to manipulate ldap entries [SME: 12687]
|
||||
|
||||
* Sat May 18 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
|
||||
- edit LDAP entries using Net::LDAP rather than cpu [SME: 12687]
|
||||
|
||||
* Sat Apr 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
|
||||
|
Reference in New Issue
Block a user