Skip to content

Commit 4f813e0

Browse files
committed
Updated and improved identity source Cmdlets
1 parent 98e4d4c commit 4f813e0

1 file changed

Lines changed: 115 additions & 34 deletions

File tree

src/StorageGRID-Webscale.psm1

Lines changed: 115 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11794,25 +11794,42 @@ function Global:Get-SgwTopologyHealth {
1179411794

1179511795
## identity-source ##
1179611796

11797-
# complete as of API 2.1
11797+
# complete as of API 2.2
1179811798

1179911799
<#
1180011800
.SYNOPSIS
1180111801
Retrieve identity sources
1180211802
.DESCRIPTION
1180311803
Retrieve identity sources
11804+
.PARAMETER Server
11805+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
11806+
.PARAMETER ProfileName
11807+
StorageGRID Profile to use for connection.
1180411808
#>
1180511809
function Global:Get-SgwIdentitySources {
1180611810
[CmdletBinding()]
1180711811

1180811812
PARAM (
11809-
[parameter(
11810-
Mandatory = $False,
11813+
[parameter(Mandatory = $False,
1181111814
Position = 0,
11812-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
11815+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
11816+
[parameter(Mandatory = $False,
11817+
Position = 1,
11818+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName
1181311819
)
1181411820

1181511821
Begin {
11822+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
11823+
$ProfileName = "default"
11824+
}
11825+
if ($ProfileName) {
11826+
$Profile = Get-SgwProfile -ProfileName $ProfileName
11827+
if (!$Profile.Name) {
11828+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
11829+
}
11830+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
11831+
}
11832+
1181611833
if (!$Server) {
1181711834
$Server = $Global:CurrentSgwServer
1181811835
}
@@ -11843,81 +11860,132 @@ function Global:Get-SgwIdentitySources {
1184311860
}
1184411861
}
1184511862

11863+
Set-Alias -Name Update-SgwIdentitySource -Value Set-SgwIdentitySource
1184611864
<#
1184711865
.SYNOPSIS
11848-
Retrieve identity sources
11866+
Set or update identity source
1184911867
.DESCRIPTION
11850-
Retrieve identity sources
11851-
#>
11852-
function Global:Update-SgwIdentitySources {
11868+
Set or update identity source
11869+
.PARAMETER Server
11870+
StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.
11871+
.PARAMETER ProfileName
11872+
StorageGRID Profile to use for connection.
11873+
.PARAMETER Id
11874+
A unique identifier for the identity source (automatically assigned when the identity source is configured)
11875+
.PARAMETER Disable
11876+
Disable Identity Source ID
11877+
.PARAMETER Hostname
11878+
Server hostname or IP address of the identity source
11879+
.PARAMETER Port
11880+
Port to use to connect to the identity source
11881+
.PARAMETER Credential
11882+
Username and password to use to access the identity source
11883+
.PARAMETER BaseGroupDN
11884+
Fully qualified Distinguished Name (DN) of an LDAP subtree to be used to search for groups
11885+
.PARAMETER BaseUserDN
11886+
Fully qualified Distinguished Name (DN) of an LDAP subtree to be used to search for users
11887+
.PARAMETER LdapServiceType
11888+
Identity Source LDAP Service Type
11889+
.PARAMETER Type
11890+
Identity Source Type
11891+
.PARAMETER LDAPUserIDAttribute
11892+
LDAP attribute that identifies the LDAP user who attempts authentication with unique name/login (only required when ldapServiceType is 'Other')
11893+
.PARAMETER LDAPUserUUIDAttribute
11894+
LDAP attribute that identifies the LDAP user’s permanent unique identity (only required when ldapServiceType is 'Other')
11895+
.PARAMETER LDAPGroupIDAttribute
11896+
LDAP attribute that identifies the LDAP group of the user who attempts authentication (only required when ldapServiceType is 'Other')
11897+
.PARAMETER LDAPGroupUUIDAttribute
11898+
LDAP attribute that identifies the LDAP group’s permanent unique identity (only required when ldapServiceType is 'Other')
11899+
.PARAMETER DisableTLS
11900+
Disable Transport Layer Security (TLS) when connecting to the identity source server
11901+
.PARAMETER CACertificate
11902+
Custom CA certificate to use to connect to the identity source server (if no custom certificate is supplied and TLS is enabled, the Operating System CA certificate will be used)
11903+
#>
11904+
function Global:Set-SgwIdentitySource {
1185311905
[CmdletBinding()]
1185411906

1185511907
PARAM (
11856-
[parameter(
11857-
Mandatory = $True,
11908+
[parameter(Mandatory = $False,
1185811909
Position = 0,
11859-
HelpMessage = "Identity Source ID",
11860-
ValueFromPipeline = $True,
11861-
ValueFromPipelineByPropertyName = $True)][String]$Id,
11862-
[parameter(
11863-
Mandatory = $False,
11910+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
11911+
[parameter(Mandatory = $False,
1186411912
Position = 1,
11865-
HelpMessage = "Disable Identity Source ID")][Switch]$Disable,
11913+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName,
1186611914
[parameter(
1186711915
Mandatory = $False,
1186811916
Position = 2,
11869-
HelpMessage = "Identity Source Hostname")][String]$Hostname,
11917+
HelpMessage = "A unique identifier for the identity source (automatically assigned when the identity source is configured)",
11918+
ValueFromPipelineByPropertyName = $True)][String]$Id,
1187011919
[parameter(
1187111920
Mandatory = $False,
1187211921
Position = 3,
11873-
HelpMessage = "Identity Source Port")][Int]$Port,
11922+
HelpMessage = "Disable Identity Source ID")][Switch]$Disable,
1187411923
[parameter(
1187511924
Mandatory = $False,
1187611925
Position = 4,
11877-
HelpMessage = "Identity Source Username and password")][PSCredential]$Credential,
11926+
HelpMessage = "Server hostname or IP address of the identity source")][String]$Hostname,
11927+
[parameter(
11928+
Mandatory = $False,
11929+
Position = 5,
11930+
HelpMessage = "Port to use to connect to the identity source")][Int]$Port,
1187811931
[parameter(
1187911932
Mandatory = $False,
1188011933
Position = 6,
11881-
HelpMessage = "Identity Source Base Group DN")][String]$BaseGroupDN,
11934+
HelpMessage = "Username and password to use to access the identity source")][PSCredential]$Credential,
1188211935
[parameter(
1188311936
Mandatory = $False,
1188411937
Position = 7,
11885-
HelpMessage = "Identity Source Base User DN")][String]$BaseUserDN,
11938+
HelpMessage = "Fully qualified Distinguished Name (DN) of an LDAP subtree to be used to search for groups")][String]$BaseGroupDN,
1188611939
[parameter(
1188711940
Mandatory = $False,
1188811941
Position = 8,
11889-
HelpMessage = "Identity Source LDAP Service Type")][String]$LdapServiceType,
11942+
HelpMessage = "Fully qualified Distinguished Name (DN) of an LDAP subtree to be used to search for users")][String]$BaseUserDN,
1189011943
[parameter(
1189111944
Mandatory = $False,
1189211945
Position = 9,
11893-
HelpMessage = "Identity Source Type")][String]$Type,
11946+
HelpMessage = "Identity Source LDAP Service Type")][ValidateSet("OpenLDAP","Active Directory","Other")][String]$LdapServiceType,
1189411947
[parameter(
1189511948
Mandatory = $False,
1189611949
Position = 10,
11897-
HelpMessage = "Identity Source LDAP User ID Attribute")][String]$LDAPUserIDAttribute,
11950+
HelpMessage = "Identity Source Type")][ValidateSet("ldap")][String]$Type,
1189811951
[parameter(
1189911952
Mandatory = $False,
1190011953
Position = 11,
11901-
HelpMessage = "Identity Source LDAP User UUID Attribute")][String]$LDAPUserUUIDAttribute,
11954+
HelpMessage = "LDAP attribute that identifies the LDAP user who attempts authentication with unique name/login (only required when ldapServiceType is 'Other')")][String]$LDAPUserIDAttribute,
1190211955
[parameter(
1190311956
Mandatory = $False,
1190411957
Position = 12,
11905-
HelpMessage = "Identity Source LDAP Group ID Attribute")][String]$LDAPGroupIDAttribute,
11958+
HelpMessage = "LDAP attribute that identifies the LDAP user’s permanent unique identity (only required when ldapServiceType is 'Other')")][String]$LDAPUserUUIDAttribute,
1190611959
[parameter(
1190711960
Mandatory = $False,
1190811961
Position = 13,
11909-
HelpMessage = "Identity Source Disable TLS")][Switch]$DisableTLS,
11962+
HelpMessage = "LDAP attribute that identifies the LDAP group of the user who attempts authentication (only required when ldapServiceType is 'Other')")][String]$LDAPGroupIDAttribute,
1191011963
[parameter(
1191111964
Mandatory = $False,
1191211965
Position = 14,
11913-
HelpMessage = "Identity Source CA Certificate")][String]$CACertificate,
11966+
HelpMessage = "LDAP attribute that identifies the LDAP group’s permanent unique identity (only required when ldapServiceType is 'Other')")][String]$LDAPGroupUUIDAttribute,
1191411967
[parameter(
1191511968
Mandatory = $False,
1191611969
Position = 15,
11917-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
11970+
HelpMessage = "Disable Transport Layer Security (TLS) when connecting to the identity source server")][Switch]$DisableTLS,
11971+
[parameter(
11972+
Mandatory = $False,
11973+
Position = 16,
11974+
HelpMessage = "Custom CA certificate to use to connect to the identity source server (if no custom certificate is supplied and TLS is enabled, the Operating System CA certificate will be used)")][String]$CACertificate
1191811975
)
1191911976

1192011977
Begin {
11978+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
11979+
$ProfileName = "default"
11980+
}
11981+
if ($ProfileName) {
11982+
$Profile = Get-SgwProfile -ProfileName $ProfileName
11983+
if (!$Profile.Name) {
11984+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
11985+
}
11986+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
11987+
}
11988+
1192111989
if (!$Server) {
1192211990
$Server = $Global:CurrentSgwServer
1192311991
}
@@ -11974,21 +12042,34 @@ function Global:Update-SgwIdentitySources {
1197412042

1197512043
<#
1197612044
.SYNOPSIS
11977-
Retrieve identity sources
12045+
Request that users and groups from the identity source be synchronized as soon as possible
1197812046
.DESCRIPTION
11979-
Retrieve identity sources
12047+
Request that users and groups from the identity source be synchronized as soon as possible
1198012048
#>
1198112049
function Global:Sync-SgwIdentitySources {
1198212050
[CmdletBinding()]
1198312051

1198412052
PARAM (
11985-
[parameter(
11986-
Mandatory = $False,
12053+
[parameter(Mandatory = $False,
1198712054
Position = 0,
11988-
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server
12055+
HelpMessage = "StorageGRID Webscale Management Server object. If not specified, global CurrentSgwServer object will be used.")][PSCustomObject]$Server,
12056+
[parameter(Mandatory = $False,
12057+
Position = 1,
12058+
HelpMessage = "StorageGRID Profile to use for connection.")][Alias("Profile")][String]$ProfileName
1198912059
)
1199012060

1199112061
Begin {
12062+
if (!$ProfileName -and !$Server -and !$CurrentSgwServer.Name) {
12063+
$ProfileName = "default"
12064+
}
12065+
if ($ProfileName) {
12066+
$Profile = Get-SgwProfile -ProfileName $ProfileName
12067+
if (!$Profile.Name) {
12068+
Throw "Profile $ProfileName not found. Create a profile using New-SgwProfile or connect to a StorageGRID Server using Connect-SgwServer"
12069+
}
12070+
$Server = Connect-SgwServer -Name $Profile.Name -Credential $Profile.Credential -AccountId $Profile.AccountId -SkipCertificateCheck:$Profile.SkipCertificateCheck -DisableAutomaticAccessKeyGeneration:$Profile.disalble_automatic_access_key_generation -TemporaryAccessKeyExpirationTime $Profile.temporary_access_key_expiration_time -S3EndpointUrl $Profile.S3EndpointUrl -SwiftEndpointUrl $Profile.SwiftEndpointUrl -Transient
12071+
}
12072+
1199212073
if (!$Server) {
1199312074
$Server = $Global:CurrentSgwServer
1199412075
}

0 commit comments

Comments
 (0)