Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option "dir_generic_ldap_enabled" to function mod_dir_config() #205

Open
MuesliMjamjam opened this issue Sep 18, 2018 · 1 comment
Open

Comments

@MuesliMjamjam
Copy link

function mod_dir_config should contain an (bool) argument "dir_generic_ldap_enabled" which, according to HP Ilo 5 1.20 User Guide, has to be set to true in order to use Ilo with openldap authentication. See
https://support.hpe.com/hpsc/doc/public/display?docId=a00039434en_us
on page 264. Point Number 4.

Try:
myilo = hpilo.Ilo('myilohost',login='user',password='pass',ssl_context=my_ssl_context);
myilo.get_dir_config();
{'dir_kerberos_kdc_port': 88, 'dir_enable_grp_acct': True, 'dir_kerberos_enabled': False, 'dir_authentication_enabled': True, 'dir_user_context_10': '', 'dir_user_context_11': '', 'dir_user_context_12': '', 'dir_user_context_13': '', 'dir_user_context_14': '', 'dir_user_context_15': '', 'dir_server_port': 636, 'dir_kerberos_kdc_address': '', 'dir_local_user_acct': True, 'dir_object_dn': '', 'dir_grpacct1_sid': '', 'dir_user_context_2': '', 'dir_user_context_3': '', 'dir_user_context_1': 'ou=myusergroup,dc=myserv,dc=com', 'dir_user_context_6': '', 'dir_user_context_7': '', 'dir_user_context_4': '', 'dir_user_context_5': '', 'dir_grpacct1_name': 'cn=CommonNameGroup,ou=OUnit,dc=myserv,dc=com', 'dir_user_context_8': '', 'dir_user_context_9': '', 'dir_server_address': '', 'dir_grpacct1_priv': '1,2,3,4', 'dir_generic_ldap_enabled': True, 'dir_kerberos_realm': ''}

but

myilo.mod_dir_config(dir_generic_ldap_enabled=True)
Traceback (most recent call last):
File "", line 1, in
TypeError: mod_dir_config() got an unexpected keyword argument 'dir_generic_ldap_enabled'

The respective argument is missing in function declaration.
With this, constallations where Ilo shall be used with authentication via openldap will not work. At least it did not in my configuration.

i suggest to slightly change method mod_dir_config like this:

In file hpilo.py:

...

def mod_dir_config(self, dir_authentication_enabled=None,
        dir_local_user_acct=None,dir_server_address=None,
        dir_server_port=None,dir_object_dn=None,dir_object_password=None,
        dir_user_context_1=None,dir_user_context_2=None,
        dir_user_context_3=None,dir_user_context_4=None,
        dir_user_context_5=None,dir_user_context_6=None,
        dir_user_context_7=None,dir_user_context_8=None,
        dir_user_context_9=None,dir_user_context_10=None,
        dir_user_context_11=None,dir_user_context_12=None,
        dir_user_context_13=None,dir_user_context_14=None,
        dir_user_context_15=None,dir_enable_grp_acct=None,
        dir_kerberos_enabled=None,dir_kerberos_realm=None,
        dir_kerberos_kdc_address=None,dir_kerberos_kdc_port=None,
        dir_kerberos_keytab=None,
        dir_grpacct1_name=None,dir_grpacct1_sid=None,
        dir_grpacct1_priv=None,dir_grpacct2_name=None,
        dir_grpacct2_sid=None,dir_grpacct2_priv=None,
        dir_grpacct3_name=None,dir_grpacct3_sid=None,
        dir_grpacct3_priv=None,dir_grpacct4_name=None,
        dir_grpacct4_sid=None,dir_grpacct4_priv=None,
        dir_grpacct5_name=None,dir_grpacct5_sid=None,
        dir_grpacct5_priv=None,dir_grpacct6_name=None,
        dir_grpacct6_sid=None,dir_grpacct6_priv=None,
        dir_generic_ldap_enabled=None):
    """Modify iLO directory configuration, only values that are specified
         will be changed."""
    vars = dict(locals())
    del vars['self']

    # The _priv thing is a comma-separated list of numbers, but other
    # functions use names, and the iLO ssh interface shows different names.
    # Support them all.
    privmap = {
        'login':         1,
        'rc':            2,
        'remote_cons':   2,
        'vm':            3,
        'virtual_media': 3,
        'power':         4,
        'reset_server':  4,
        'config':        5,
        'config_ilo':    5,
        'admin':         6,
    }

    # create special case for element with text inside
    if dir_kerberos_keytab:
        keytab_el = etree.Element('DIR_KERBEROS_KEYTAB')
        keytab_el.text = dir_kerberos_keytab
        del vars['dir_kerberos_keytab']

    elements = []
    for key, val in vars.items():
        if val is None:
            continue
        if key.endswith('_priv'):
            if isinstance(val, basestring):
                val = val.replace('oemhp_', '').replace('_priv', '').split(',')
            val = ','.join([str(privmap.get(x,x)) for x in val])
        else:
            val = str({True: 'Yes', False: 'No'}.get(val, val))
        elements.append(etree.Element(key.upper(), VALUE=val))

    if dir_kerberos_keytab:
        elements.append(keytab_el)
    return self._control_tag('DIR_INFO','MOD_DIR_CONFIG',elements=elements)

...

EOF

So just add argument "dir_generic_ldap_enabled=None" to function declaration.

@flaviotorres
Copy link
Contributor

I also noticed the same missing param for iLO4.

>>> ilo.mod_dir_config(dir_generic_ldap_enabled="True") Traceback (most recent call last): File "<input>", line 1, in <module> ilo.mod_dir_config(dir_generic_ldap_enabled="True") TypeError: mod_dir_config() got an unexpected keyword argument 'dir_generic_ldap_enabled'

flaviotorres pushed a commit to flaviotorres/python-hpilo that referenced this issue Mar 5, 2019
flaviotorres added a commit to flaviotorres/python-hpilo that referenced this issue Mar 5, 2019
adding missing field to get generic ldap enabled seveas#205
seveas pushed a commit that referenced this issue May 27, 2019
adding missing field to get generic ldap enabled #205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants