7 Commits

5 changed files with 74 additions and 6 deletions

1
.gitignore vendored
View File

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

View File

@@ -6,7 +6,14 @@ SMEServer Koozali developed git repo for smeserver-lib smeserver
<br />https://wiki.koozali.org/
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-lib&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-lib&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-lib&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-lib&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-lib&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-lib&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-lib&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-lib&classification=SME+Server&order=changeddate+DESC%2Ccomponent%2Cpriority%2Cbug_severity&query_format=advanced)
And a list of outstanding Legacy bugs: (e-smith-lib) [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-lib&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

54
root/sbin/e-smith/getmyip Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# List of services to query for the public IP
services=(
"ifconfig.me"
"ipinfo.io/ip"
"icanhazip.com"
"api.ipify.org"
"ident.me"
"ip.tyk.nu"
"checkip.amazonaws.com"
"ipecho.net/plain"
"myip.dnsomatic.com"
"ip.seeip.org"
"ipapi.co/ip"
"wtfismyip.com/text"
"openident.net/ip"
"ifconfig.co/ip"
)
# Function to shuffle the array of services
shuffle_services() {
local i
for ((i=${#services[@]} - 1; i > 0; i--)); do
local j=$((RANDOM % (i + 1)))
local temp="${services[i]}"
services[i]="${services[j]}"
services[j]="$temp"
done
}
# Function to fetch the public IP address
get_public_ip() {
shuffle_services
for service in "${services[@]}"; do
public_ip=$(curl -s --max-time 5 "$service")
# Check if the curl request was successful and there's a valid IP address
if [[ $? -eq 0 && $public_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
logger -t public_ip_script "Service used: $service, IP found: $public_ip"
echo "$public_ip"
return
fi
done
# If none of the services returned a valid IP, output an error message
echo "Failed to retrieve public IP using all services." >&2
logger -t public_ip_script "Error: Failed to retrieve public IP using all services."
exit 1
}
# Execute the function
get_public_ip

View File

@@ -160,11 +160,11 @@ sub ldapaddgroup {
);
if ($type eq "group") {
$attrs{'description'} = $self->stringToASCII($acct->prop('Description') || $acctName );
$attrs{'mail'} = $acct->prop("$acctName\@$domain");
$attrs{'mail'} = "$acctName\@$domain";
}
if ($type eq "ibay") {
$attrs{'description'} = $self->stringToASCII($acct->prop('Name') || $acctName );
#$attrs{'mail'} = $acct->prop("$acctName\@$domain");# we might want to set email for ibay there?
#$attrs{'mail'} = "$acctName\@$domain";# we might want to set email for ibay there?
$attrs{'objectClass'} = ['posixGroup'];
}
if ($type eq "machine") {
@@ -205,11 +205,11 @@ sub ldapmodgroup {
);
if ($type eq "group") {
$attrs{'description'} = [ $self->stringToASCII($acct->prop('Description') || $acctName ) ];
$attrs{'mail'} = [ $acct->prop("$acctName\@$domain") ];
$attrs{'mail'} = [ "$acctName\@$domain" ];
}
if ($type eq "ibay") {
$attrs{'description'} = [ $self->stringToASCII($acct->prop('Name') || $acctName ) ] ;
#$attrs{'mail'} = [ $acct->prop("$acctName\@$domain") ];
#$attrs{'mail'} = [ "$acctName\@$domain" ];
}
# if type user we add nothing
#get current content

View File

@@ -6,7 +6,7 @@ Summary: smeserver server and gateway - library module
%define name smeserver-lib
Name: %{name}
%define version 11.0.0
%define release 7
%define release 9
Version: %{version}
Release: %{release}%{?dist}
License: Artistic
@@ -33,6 +33,12 @@ Provides: e-smith-lib
smeserver server and gateway software - library module.
%changelog
* Thu Dec 12 2024 Brian Read <brianr@koozali.org> 11.0.0-9.sme
- add in getmyip [SME: 12810 ]
* Tue Nov 12 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-8.sme
- fix Use of uninitialized value [SME: 12760]
* Tue Aug 13 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-7.sme
- esmith::util:ldap initial commit [SME: 12719]