dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
606 stars 279 forks source link

User Creation #105

Closed kgrvamsi closed 4 years ago

kgrvamsi commented 4 years ago

Hi @texroemer how can i enable the other options when i create user with administrator role?

image

this is the call i'm using to create the user

PATCH https://{{DELL_SERVER}}/redfish/v1/Managers/iDRAC.Embedded.1/Accounts/7

Body

{
        "UserName": "testing",
        "Password": "testing",
        "Enabled":  true,
        "RoleId":   "Administrator"
    }
texroemer commented 4 years ago

Hi @kgrvamsi

Accounts URI is based off DMTF standard which doesn't have OEM attribute settings but we are looking into adding these in future iDRAC release. For now you'll have to use Server Configuration Profile feature to configure these iDRAC user settings.

Example of the payload passing in for POST command:

payload = {"ShareParameters":{"Target":"ALL"},"ImportBuffer":"<SystemConfiguration><Component FQDD=\"iDRAC.Embedded.1\"><Attribute Name=\"Users.3#UserName\">user3</Attribute><Attribute Name=\"Users.3#Password\">P@ssw0rd</Attribute><Attribute Name=\"Users.3#Privilege\">511</Attribute><Attribute Name=\"Users.3#IpmiLanPrivilege\">Administrator</Attribute><Attribute Name=\"Users.3#IpmiSerialPrivilege\">Administrator</Attribute><Attribute Name=\"Users.3#Enable\">Enabled</Attribute><Attribute Name=\"Users.3#SolEnable\">Enabled</Attribute><Attribute Name=\"Users.3#ProtocolEnable\">Enabled</Attribute><Attribute Name=\"Users.3#AuthenticationProtocol\">MD5</Attribute><Attribute Name=\"Users.3#PrivacyProtocol\">DES</Attribute></Component></SystemConfiguration>"}

Example of executing script using this payload.

C:\Python38-32>ImportSystemConfigurationLocalREDFISH.py -ip 192.168.0.120 -u root -p calvin

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin User Name ErrCode: 0 Name: Users.3#UserName NewValue: user3 Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin Password ErrCode: 0 Name: Users.3#Password NewValue: ** OldValue: ** Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin Privilege ErrCode: 0 Name: Users.3#Privilege NewValue: 511 OldValue: 0 Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin IPMI LAN Privilege ErrCode: 0 Name: Users.3#IpmiLanPrivilege NewValue: Administrator OldValue: No Access Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin IPMI Serial Privilege ErrCode: 0 Name: Users.3#IpmiSerialPrivilege NewValue: Administrator OldValue: No Access Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin Enable ErrCode: 0 Name: Users.3#Enable NewValue: Enabled OldValue: Disabled Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: User Admin SOL Enable ErrCode: 0 Name: Users.3#SolEnable NewValue: Enabled OldValue: Disabled Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: SNMP V3 Protocol Enable ErrCode: 0 Name: Users.3#ProtocolEnable NewValue: Enabled OldValue: Disabled Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: SNMP V3 Authentication Protocol ErrCode: 0 Name: Users.3#AuthenticationProtocol NewValue: MD5 OldValue: SHA Severity: OK

@odata.type: #DellManager.v1_0_0.ServerConfigurationProfileResults DisplayValue: SNMP V3 Privacy Protocol ErrCode: 0 Name: Users.3#PrivacyProtocol NewValue: DES OldValue: AES Severity: OK

Message: Successfully imported and applied Server Configuration Profile. MessageArgs: [] MessageArgs@odata.count: 0 MessageId: SYS053

texroemer commented 4 years ago

You can also use PATCH on OEM URI "redfish/v1/Managers/iDRAC.Embedded.1/Attributes" to configure iDRAC user.

Example:

C:\Python38-32>SetIdracLcSystemAttributesREDFISH.py -ip 192.168.0.120 -u root -p calvin -s idrac -an Users.3.Enable,Users.3.UserName,Users.3.Password,Users.3.Privilege,Users.3.IpmiLanPrivilege,Users.3.IpmiSerialPrivilege,Users.3.ProtocolEnable,Users.3.SolEnable -av Enabled,user3,P@ssw0rd,511,Administrator,Administrator,Enabled,Enabled

kgrvamsi commented 4 years ago

Hi @texroemer thanks for responding and sorry for my delayed response and for the second approach is that aligned to any version of idrac or does it work for 3.21.26.21 as well?

texroemer commented 4 years ago

Hi @kgrvamsi

For the second approach i mentioned, this is supported on any version of iDRAC 9. For iDRAC 7/8, this is not supported and will have to use the first approach for the workflow.

Thanks