9 Commits

Author SHA1 Message Date
7b8363f96b * 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]
2025-01-18 16:24:55 -05:00
980b444bbd Add *.bak to .gitignore 2024-11-12 19:19:58 +00:00
3e818d32b7 Deleting spurious *.spec.bak files 2024-11-12 19:19:56 +00:00
a409c24859 Update README with specific Bugzilla links with status options 2024-10-27 14:28:46 +00:00
4177f9666a Update readme bugzilla link to show all outstanding bugs 2024-10-27 12:12:05 +00:00
f99cce8bae * 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]
2024-08-13 17:42:52 -04:00
e61e1a8096 * 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]
2024-05-18 15:21:54 -04:00
1d67d9bd64 * Sat May 18 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- edit LDAP entries using Net::LDAP rather than cpu [SME: 12687]
2024-05-18 14:07:19 -04:00
0e72a182b7 * Sat Apr 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-6.sme
- fix path for store-ldap-smbpasswd  [SME: 12614]
2024-04-13 04:31:44 -04:00
6 changed files with 127 additions and 62 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
*.log *.log
*spec-20* *spec-20*
*.tar.xz *.tar.xz
*.bak

View File

@@ -6,7 +6,14 @@ SMEServer Koozali developed git repo for smeserver-ibays smeserver
<br />https://wiki.koozali.org/ <br />https://wiki.koozali.org/
## Bugzilla ## 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) 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 ## Description

View File

@@ -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)) foreach my $event (qw(post-install post-upgrade smeserver-ibays-update))
{ {
event_link("init-ibays", $event, "15"); event_link("init-ibays", $event, "15");
event_link('store-ldap-smbpasswd', $event, "06");
} }
my $event = "smeserver-ibays-update"; my $event = "smeserver-ibays-update";
@@ -42,6 +41,6 @@ templates2events("/samba/smb.conf", $event);
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smbd"); safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smbd");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/nmbd"); safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/nmbd");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
event_link('store-ldap-smbpasswd', $event, "06");
event_link("systemd-reload", $event, "89"); event_link("systemd-reload", $event, "89");
event_link("systemd-default", $event, "88"); event_link("systemd-default", $event, "88");
event_link("store-ldap-smbpasswd",$event, "06");

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/usr/bin/perl
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# copyright (C) 1999-2005 Mitel Networks Corporation # copyright (C) 2024 Koozali foundation inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -22,28 +22,63 @@
#------------------------------------------------------------ #------------------------------------------------------------
# Delete the Unix account and files for the ibay. # Delete the Unix account and files for the ibay.
#------------------------------------------------------------ #------------------------------------------------------------
package esmith;
event=$1 use strict;
ibay=$2 use Errno;
use esmith::ConfigDB;
use esmith::util;
use esmith::AccountsDB;
use utf8;
use esmith::util::ldap;
if [ -z "$ibay" ] my $adb = esmith::AccountsDB->open_ro();
then
echo ibayName argument missing
exit 1
fi
ldapauth=$(/sbin/e-smith/config getprop ldap Authentication || echo disabled) my $conf = esmith::ConfigDB->open_ro or die "Could not open config db";
x=0 # exit value
/bin/rm -rf /home/e-smith/files/ibays/$ibay unless ($conf->get('ldap')->prop('status') eq "enabled" )
if [ "$ldapauth" != "enabled" ] {
then warn "Not running action script $0, LDAP service not enabled!\n";
/usr/sbin/userdel "$ibay" || x=1 exit(0);
/usr/sbin/cpu -C/etc/cpu-system.conf userdel "$ibay" }
/usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay"
else # prepare LDAP bind
/usr/sbin/cpu userdel "$ibay" || x=1 my $ldap=esmith::util::ldap->new();
/usr/sbin/cpu -C/etc/cpu-system.conf groupdel "$ibay" || x=1
fi my $event = $ARGV [0];
my $ibay = $ARGV [1];
die "Username argument missing." unless defined ($ibay);
$a = $adb->get($ibay) || undef;
unless ( defined $a && $a->prop('type') eq "ibay-deleted" )
{
warn "$ibay is not an Ibay account\n";
exit (0);
}
my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
my $x = 0; # exit value
my $discard = `/bin/rm -rf /home/e-smith/files/ibays/$ibay`;
if ($? != 0)
{
( $x = 255, warn "Failed to delete content of ibay $ibay.\n" );
}
if ( "$ldapauth" ne "enabled" )
{
$discard = `/usr/sbin/userdel "$ibay"`;
if ($? != 0)
{
( $x = 255, warn "Failed to delete (unix) 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->ldapdelgroup($ibay);
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group account $ibay.\n" );
exit $x exit $x

View File

@@ -2,6 +2,7 @@
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# copyright (C) 1999-2005 Mitel Networks Corporation # copyright (C) 1999-2005 Mitel Networks Corporation
# copyright (C) 2024 Koozali foundation inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -27,12 +28,18 @@ use esmith::util;
use esmith::templates; use esmith::templates;
use esmith::AccountsDB; use esmith::AccountsDB;
use esmith::ConfigDB; use esmith::ConfigDB;
use utf8;
use esmith::util::ldap;
my $conf = esmith::ConfigDB->open_ro my $conf = esmith::ConfigDB->open_ro
or die "Could not open Config DB"; or die "Could not open Config DB";
my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
my $x = 0; # exit value my $x = 0; # exit value
my $result;
# prepare LDAP bind
my $ldap=esmith::util::ldap->new();
$ENV{'PATH'} = "/bin"; $ENV{'PATH'} = "/bin";
@@ -54,8 +61,9 @@ if ($event eq 'ibay-create')
# Check the Unix account. # Check the Unix account.
#------------------------------------------------------------ #------------------------------------------------------------
# Create the ibay's unique group first #------------------------------------------------------------
# create unix user and group account, unless we switch to ldap authentication
#------------------------------------------------------------
if ($ldapauth ne 'enabled') if ($ldapauth ne 'enabled')
{ {
system( system(
@@ -85,31 +93,27 @@ if ($event eq 'ibay-create')
) == 0 or ( $x = 255, warn "Failed to create (unix) account $ibayName.\n" ); ) == 0 or ( $x = 255, warn "Failed to create (unix) account $ibayName.\n" );
} }
system( #------------------------------------------------------------
"/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupadd", # add new ibay group to ldap
"-g", #------------------------------------------------------------
$ibay->prop("Gid"), $result = $ldap->ldapgroup($ibay);
$ibayName $result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $ibayName.\n" );
system( #------------------------------------------------------------
"/usr/sbin/cpu", "-C/etc/cpu-system.conf", "useradd", # add new ibay user to ldap and lock password
"-u", #------------------------------------------------------------
$ibay->prop("Uid"), $result = $ldap->ldapuser($ibay);
"-g", $result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $ibayName.\n" );
$ibay->prop("Gid"),
"-c",
$ibay->prop("Name"),
"-d",
"/home/e-smith/files/ibays/$ibayName/files",
"-G",
"shared,"
. $ibay->prop("Group"),
"-s",
"/bin/false",
"$ibayName"
) == 0 or ( $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") ) {
my @groupMembers = ($ibayName);
$result = $ldap->ldapaddgroupmembers($grp,\@groupMembers);
# error code 20 is entry already exits.
$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. # Create the ibay files and set the password.
#------------------------------------------------------------ #------------------------------------------------------------
@@ -130,15 +134,12 @@ if ($event eq 'ibay-create')
or ( $x = 255, warn "Error locking (unix) account $ibayName" ); or ( $x = 255, warn "Error locking (unix) account $ibayName" );
} }
system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-L", $ibayName) == 0
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Error locking (ldap) account $ibayName" );
} }
elsif ($event eq 'ibay-modify' and $ibayName ne 'Primary') elsif ($event eq 'ibay-modify' and $ibayName ne 'Primary')
{ {
#------------------------------------------------------------ #------------------------------------------------------------
# Modify ibay description in /etc/passwd using "usermod" # Modify ibay description in /etc/passwd using "usermod"
#------------------------------------------------------------ #------------------------------------------------------------
if ($ldapauth ne 'enabled') if ($ldapauth ne 'enabled')
{ {
system("/usr/sbin/usermod", "-c", $ibay->prop("Name"), system("/usr/sbin/usermod", "-c", $ibay->prop("Name"),
@@ -146,9 +147,22 @@ elsif ($event eq 'ibay-modify' and $ibayName ne 'Primary')
or ( $x = 255, warn "Failed to modify (unix) account $ibayName.\n" ); or ( $x = 255, warn "Failed to modify (unix) account $ibayName.\n" );
} }
system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", $ibay->prop("Name"), #------------------------------------------------------------
"-G", "shared," . $ibay->prop("Group"), "$ibayName") == 0 # Modify ibay description in ldap"
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (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") ) {
my @groupMembers = ($ibayName);
$result = $ldap->ldapaddgroupmembers($grp,\@groupMembers);
# error code 20 is entry already exits.
$result && ( $result != 20 ) && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to add (ldap) account $ibayName to supplementary group $grp.\n" );
}
} }
#------------------------------------------------------------ #------------------------------------------------------------

View File

@@ -4,7 +4,7 @@ Summary: smeserver server and gateway - ibays module
%define name smeserver-ibays %define name smeserver-ibays
Name: %{name} Name: %{name}
%define version 11.0.0 %define version 11.0.0
%define release 5 %define release 10
Version: %{version} Version: %{version}
Release: %{release}%{?dist} Release: %{release}%{?dist}
License: GPL License: GPL
@@ -13,13 +13,13 @@ Source: %{name}-%{version}.tar.xz
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
BuildArchitectures: noarch BuildArchitectures: noarch
Requires: smeserver-base >= 4.13.15-76 Requires: smeserver-lib >= 11.0.0-7
Requires: smeserver-base
Requires: perl(CGI::FormMagick) Requires: perl(CGI::FormMagick)
Requires: smeserver-formmagick >= 1.4.0-12 Requires: smeserver-formmagick
#Conflicts: e-smith-apache < 0.1.1 Requires: smeserver-apache
Requires: smeserver-apache >= 2.6.0-19
BuildRequires: perl, perl(Test::Inline) BuildRequires: perl, perl(Test::Inline)
BuildRequires: smeserver-devtools >= 1.11.0-03 BuildRequires: smeserver-devtools
AutoReqProv: no AutoReqProv: no
@@ -28,7 +28,16 @@ Provides: e-smith-ibays
smeserver server and gateway software - ibays module. smeserver server and gateway software - ibays module.
%changelog %changelog
* Sat Apr 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-5.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
- fix path for store-ldap-smbpasswd [SME: 12614] - fix path for store-ldap-smbpasswd [SME: 12614]
* Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-4.sme * Thu Apr 04 2024 Brian Read <brianr@koozali.org> 11.0.0-4.sme