Skip to content
  1. May 25, 2021
  2. May 18, 2021
    • Thomas Woerner's avatar
      New server management module · 16795b8b
      Thomas Woerner authored
      There is a new server management module placed in the plugins folder:
      
          plugins/modules/ipaserver.py
      
      The server module allows to ensure presence and absence of servers. The
      module requires an existing server, the deployment of a new server can
      not be done with the module.
      
      DNSName has been added to ansible_freeipa_module in plugins/module_utils
      as this is used for locations.
      
      Here is the documentation for the module:
      
          README-server.md
      
      New example playbooks have been added:
      
          playbooks/server/server-absent-continue.yml
          playbooks/server/server-absent-force.yml
          playbooks/server/server-absent-ignore_last_of_role.yml
          playbooks/server/server-absent-ignore_topology_disconnect.yml
          playbooks/server/server-absent.yml
          playbooks/server/server-hidden.yml
          playbooks/server/server-location.yml
          playbooks/server/server-no-location.yml
          playbooks/server/server-no-service-weight.yml
          playbooks/server/server-not-hidden.yml
          playbooks/server/server-present.yml
          playbooks/server/server-service-weight.yml
      
      New tests for the module:
      
          tests/server/test_server.yml
      
      Change in module_utils/ansible_freeipa_module:
      
          DNSName is imported from ipapython.dnsutil and also added to __all__
      16795b8b
  3. May 11, 2021
  4. May 05, 2021
    • Rafael Guterres Jeffman's avatar
      Fix compare_args_ipa when passing None as parameter. · c17e9fe2
      Rafael Guterres Jeffman authored
      There were no test for the arguments of compare_args_ipa() to check
      if they were `None`, and they were used in contexts where `None`
      would raise exceptions.
      
      A test was added to return `False` if only one of the parameters is
      `None`, and `True` if both are None.
      c17e9fe2
  5. May 04, 2021
    • Rafael Guterres Jeffman's avatar
      Force plugins to execute using LANGUAGE='C'. · 09942c3d
      Rafael Guterres Jeffman authored
      IPA translates exception messages and Ansible uses controller's
      language to execute plugins on target hosts, and since ansible-freeipa
      uses Exceptions messages to detect some errors and/or states, using any
      language that has a translation for the required messages may cause the
      plugin to misbehave.
      
      This patch modifies ansible_freeipa_module in plugin/module_utils to
      force the use of "C" as the language by setting the environment variable
      LANGUAGE.
      
      Tests were added to verify the correct behavior:
      
          tests/environment/test_locale.yml
      
      The first test will fail, if ansible_freeipa_module is not patched, with
      the message:
      
         host_show failed: nonexistent: host nicht gefunden
      
      This issue is not present if the language selected does not provide
      a translation for the eror message.
      
      This patch does not fix encoding issues that might occur in certain
      releases (e.g.: CentOS 8.3).
      
      Fix #516
      09942c3d
  6. Feb 16, 2021
  7. Dec 29, 2020
  8. Nov 16, 2020
    • Rafael Guterres Jeffman's avatar
      Add FreeIPA version check to module_utils.ansible_freeipa_module. · 2aaabc77
      Rafael Guterres Jeffman authored
      Some attribute values are only accepted for specific FreeIPA versions,
      for example `self` for permission's `bindtype`. Although there are
      options to check for command and parameter availability, there is no
      check for verifying if a value should be accepted.
      
      This patch add a function to evaluate the target FreeIPA host version,
      by comparing a giver version to the current installed one.
      
      The version evaluation uses Python packaging's version comparision,
      which is compatible with PEP 440, if available. If not available, it
      falls back to a string split, that will work for the most common cases,
      but might fail for versions including strings with `rc` or `dev`, for
      example.
      2aaabc77
  9. Nov 13, 2020
    • Rafael Guterres Jeffman's avatar
      Bypass Ansible filtering on data returned by the module. · 88f84cef
      Rafael Guterres Jeffman authored
      Due to Ansible filtering out values in the output that might be match
      values in sensible attributes that have `no_log` set, if a module need
      to return data to the controller, it cannot rely on
      `ansible_module.exit_json` if there is a chance that a partial match
      may occur.
      
      See: https://github.com/ansible/ansible/issues/71789
      
      The change provided here uses the same implementation that is used on
      Ansible's `AnsibleModule.exit_json`, without the data filtering layer,
      so every attribute with be printed and, therefore, logged by Ansible.
      
      This is needed for the Vault module, as we need to return values that
      are explicit requested by the user and that might, at least partially,
      match the values in attributes with `no_log` set.
      
      Tests that reproduced the issue, and show it was fixed were provided
      for all Vault types.
      88f84cef
  10. Aug 17, 2020
    • Rafael Guterres Jeffman's avatar
      Added support for client defined result data in FReeIPABaseModule · 531e544b
      Rafael Guterres Jeffman authored
      Modified support for processing result of IPA API commands so that
      client code can define its own processing and add return values to
      self.exit_args based on command result.
      
      If a subclass need to process the result of IPA API commands it should
      override the method `process_command_result`. The default implementation
      will simply evaluate if `changed` should be true.
      531e544b
  11. Aug 06, 2020
    • Sergio Oliveira Campos's avatar
      Allow multiple dns zones to be absent. · 75d16c2d
      Sergio Oliveira Campos authored
      This PR allow ipadnszone module to ensure that multiple dns zones
      are absent at once, to be consistent with other ansible-freeipa
      modules.
      
      To fix this issue, it was required that custom arguents must be
      passed using keyword arguments so that `get_ipa_command_args()`
      is kept generic.
      75d16c2d
  12. Aug 03, 2020
    • Sergio Oliveira Campos's avatar
      Fixed error msgs on FreeIPABaseModule subclasses · 563a03d9
      Sergio Oliveira Campos authored
      When a fail_json is called a SystemExit exeception is raised.
      Since the FreeIPABaseModule has an internal context manager to deal
      with exceptions this ContextManager captures the SystemExit. After
      dealing destroying the kinit session the SystemExit must be raised again
      to allow the fail_json to work properly.
      563a03d9
  13. May 12, 2020
    • Thomas Woerner's avatar
      ansible_freeipa_module: New function api_check_command · fdcdad2c
      Thomas Woerner authored
      This function can be used to check if a command is available in the API.
      
      This is used in ipauser module to check if user_add_certmapdata is available
      in the API.
      fdcdad2c
    • Thomas Woerner's avatar
      ansible_freeipa_module: New function DN_x500_text · 6a69bbea
      Thomas Woerner authored
      This function is needed to properly convert issuer and subject from a
      certificate or the issuer and subject parameters in ipauser for certmapdata
      to the data representation where the items in DN are reversed.
      
      The function additionally provides a fallback solution for IPA < 4.5.
      Certmapdata is not supported for IPA < 4.5, but the conversion is done
      before the API version can be checked.
      6a69bbea
    • Thomas Woerner's avatar
      ansible_freeipa_module: New function load_cert_from_str · 571cc210
      Thomas Woerner authored
      For certmapdata processing in ipauser it is needed to be able to load a cert
      from a string given in the task to be able to get the issuer and subject of
      the certificate. The format of the certifiacte here is lacking the markers
      for the begin and end of the certificate. Therefore load_pem_x509_certificate
      can not be used directly. Also in IPA < 4.5 it is needed to load the
      certificate with load_certificate instead of load_pem_x509_certificate. The
      function is implementing this properly.
      571cc210
  14. May 06, 2020
    • Thomas Woerner's avatar
      Do not remove member attributes while updating others · 457050c6
      Thomas Woerner authored
      Because of a missing check member attributes (for use with action: member)
      are cleared when a non-member attribute is changed. The fix simply adds a
      check for None (parameter not set) to gen_add_del_lists in
      ansible_freeipa_module to make sure that the parameter is only changed if
      it should be changed.
      
      All places where the add and removal lists have been generated manually
      have been changed to also use gen_add_del_lists.
      
      Resolves: #252 (The "Manager" attribute is removed when updating any user
                      attribute)
      457050c6
  15. Apr 26, 2020
  16. Apr 16, 2020
    • Thomas Woerner's avatar
      ansible_freeipa_module: Set KRB5CCNAME for api_connect (non root) · 871cce52
      Thomas Woerner authored
      In the case that the admin password has been set and become was not set
      the call to backend.connect in api_connect failed. The solution is simply
      to set os.environ["KRB5CCNAME"] in temp_kinit after kinit_password has
      been called using the temporary ccache. os.environ["KRB5CCNAME"] is not
      used automatically by api.Backend.[ldap2,rpcclient].connect. Afterwards
      os.environ["KRB5CCNAME"] is unset in temp_kdestroy if ccache_name is not
      None.
      
      Fixes: #249 (Kerberos errors while using the modules with a non-sudoer user)
      871cce52
  17. Mar 26, 2020
    • Sergio Oliveira Campos's avatar
      Fixed a bug in AnsibleFreeIPAParams · 22059072
      Sergio Oliveira Campos authored
      When accessing an instance of AnsibleFreeIPAParams with .get the obj was
      by-passing the call to _afm_convert which was the primaty reason why it
      was created.
      
      Also the class now extends Mapping instead of dict.
      22059072
  18. Mar 24, 2020
  19. Feb 20, 2020
  20. Feb 13, 2020
    • Rafael Guterres Jeffman's avatar
      Properly handle base64 enconding of certificates stored as bytes. · 1a3c9114
      Rafael Guterres Jeffman authored
      This change is needed to properly handle base64 encoding of certificates
      stored as bytes, under Python 3, as used by IPA service. It does not
      affect Python 2.7 as bytes are identical to str in this version of the
      language.
      
      When retireving certificates stored by FreeIPA service data is returned
      as bytes, under Python 3, and encoding then breaks, as there is no
      bytes.public_bytes method. In Python 3, encoding with base64 will be the
      same for strings and bytes.
      1a3c9114
    • Thomas Woerner's avatar
      ipahost: Add support for several IP addresses and also to change them · 167c7631
      Thomas Woerner authored
      ipahost was so far ignoring IP addresses when the host already existed.
      This happened because host_mod is not providing functionality to do this.
      Now ipaddress is a list and it is possible to ensure a host with several
      IP addresses (these can be IPv4 and IPv6). Also it is possible to ensure
      presence and absence of IP addresses for an exising host using action
      member.
      
      There are no IP address conclict checks as this would lead into issues with
      updating an existing host that already is using a duplicate IP address for
      example for round-robin (RR). Also this might lead into issues with ensuring
      a new host with several IP addresses in this case. Also to ensure a list of
      hosts with changing the IP address of one host to another in the list would
      result in issues here.
      
      New example playbooks have been added:
      
          playbooks/host/host-present-with-several-ip-addresses.yml
          playbooks/host/host-member-ipaddresses-absent.yml
          playbooks/host/host-member-ipaddresses-present.yml
      
      A new test has been added for verification:
      
          tests/host/test_host_ipaddresses.yml
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1783976
             https://bugzilla.redhat.com/show_bug.cgi?id=1783979
      167c7631
  21. Feb 11, 2020
  22. Dec 11, 2019
    • Rafael Guterres Jeffman's avatar
      Allow execution of API commands that do not require a name. · 0210899e
      Rafael Guterres Jeffman authored
      There are some commands in the IPA API that do not require
      arguments, and current implementation does not allow these
      commands to be execute.
      
      This patch adds api_command_no_name to allow the execution
      of such commands, which is required, for example, to create
      a vaultcontainer management module.
      0210899e
  23. Dec 02, 2019
    • Thomas Woerner's avatar
      ipahost: Extension to be able handle several hosts and all settings · 94b1f25b
      Thomas Woerner authored
      The ipahost management module was not able to add several hosts at once.
      Addtionally there have been settings missing.
      
      ansible_freeipa_module has been extended to provide two additional functions
      that are needed to simplify the extension of the ipahost module:
      
          gen_add_del_lists(user_list, res_list)
          encode_certificate(cert)
      
      gen_add_del_lists will generate the lists for the addition and removal of
      members using the provided user and ipa settings.
      
      encode_certificate will encode a certificate using base64 with also taking
      FreeIPA and Python versions into account.
      
      The missing settings in ipahost have been:
      
          certificate
          managedby_host
          principal
          create_keytab_[user,group,host,hostgroup]
          retrieve_keytab_[user,group,host,hostgroup]
          sshpubkey
          userclass
          auth_ind
          requires_pre_auth
          ok_as_delegate
          ok_to_auth_as_delegate
      
      The README-host.md file has been updated to provide information about the
      new settings and also the members. Also examples for the new things have
      been added.
      
      New example playbooks have been added:
      
          playbooks/host/add-host.yml
          playbooks/host/host-member-allow_create_keytab-absent.yml
          playbooks/host/host-member-allow_create_keytab-present.yml
          playbooks/host/host-member-allow_retrieve_keytab-absent.yml
          playbooks/host/host-member-allow_retrieve_keytab-present.yml
          playbooks/host/host-member-certificate-absent.yml
          playbooks/host/host-member-certificate-present.yml
          playbooks/host/host-member-managedby_host-absent.yml
          playbooks/host/host-member-managedby_host-present.yml
          playbooks/host/host-member-principal-absent.yml
          playbooks/host/host-member-principal-present.yml
          playbooks/host/host-present-with-allow_create_keytab.yml
          playbooks/host/host-present-with-allow_retrieve_keytab.yml
          playbooks/host/host-present-with-certificate.yml
          playbooks/host/host-present-with-managedby_host.yml
          playbooks/host/host-present-with-principal.yml
          playbooks/host/host-present-with-randompassword.yml
          playbooks/host/host-present.yml
          playbooks/host/hosts-member-certificate-absent.yml
          playbooks/host/hosts-member-certificate-present.yml
          playbooks/host/hosts-member-managedby_host-absent.yml
          playbooks/host/hosts-member-managedby_host-present.yml
          playbooks/host/hosts-member-principal-absent.yml
          playbooks/host/hosts-member-principal-present.yml
          playbooks/host/hosts-present-with-certificate.yml
          playbooks/host/hosts-present-with-managedby_host.yml
          playbooks/host/hosts-present-with-randompasswords.yml
      
      New tests have been added for the module:
      
          tests/host/certificate/cert1.der
          tests/host/certificate/cert1.pem
          tests/host/certificate/cert2.der
          tests/host/certificate/cert2.pem
          tests/host/certificate/cert3.der
          tests/host/certificate/cert3.pem
          tests/host/certificate/private1.key
          tests/host/certificate/private2.key
          tests/host/certificate/private3.key
          tests/host/certificate/test_host_certificate.yml
          tests/host/certificate/test_hosts_certificate.yml
          tests/host/test_host.yml
          tests/host/test_host_allow_create_keytab.yml
          tests/host/test_host_allow_retrieve_keytab.yml
          tests/host/test_host_managedby_host.yml
          tests/host/test_host_principal.yml
          tests/host/test_host_random.yml
          tests/host/test_hosts.yml
          tests/host/test_hosts_managedby_host.yml
          tests/host/test_hosts_principal.yml
      94b1f25b
    • Thomas Woerner's avatar
      ansible_freeipa_module: Better support for KRB5CCNAME environment variable · e77f4daa
      Thomas Woerner authored
      The use of gssapi.creds.Credentials is not good if krb5 ticket forwarding
      is used. It will fail. gssapi.Credentials with usage and store is the proper
      way to do this.
      e77f4daa
  24. Nov 29, 2019
  25. Oct 22, 2019
  26. Oct 21, 2019
  27. Oct 18, 2019
  28. Oct 09, 2019
Loading