Commit Graph

72 Commits

Author SHA1 Message Date
Thomas Woerner
71ec4d4e2a Incorporate "Use os.path.isfile() and isdir()" from freeipa upstream
b29db07c3b3d8937f53684fdbba985fec525d69d by Christian Heimes

    Replace custom file_exists() and dir_exists() functions with proper
    functions from Python's stdlib.

    The change also gets rid of pylint's invalid bad-python3-import error,
    https://github.com/PyCQA/pylint/issues/1565
2018-04-04 15:11:34 +02:00
Thomas Woerner
9beb31bf5c Client: Added version checks for save_state and configure_nisdomain calls
With FreeIPA 4.5 the functions save_state and configure_nisdomain have gotten
new options. A version check has been added to ipaextras and ipanss to make
sure that the modules are also working with FreeIPA 4.4.
2018-02-09 16:38:15 +01:00
Thomas Woerner
747ec87588 library/ipahost.py: Fix ipahost to work with Python3 2018-01-31 23:46:22 +01:00
Thomas Woerner
d009b80621 library/ipadiscovery: Add time synchronization calls
Attempt to sync time if on_master is not set and no_ntp is not set: At
first with given or dicovered time servers. If no ntp servers have been
given or discovered, then with the ipa server.

New parameters:
  on_master:
    description: IPA client installation on IPA server
    required: false
    default: false
    type: bool
    default: no
  ntp_servers:
    description: List of NTP servers to use
    required: false
    type: list
    default: []
  no_ntp:
    description: Do not sync time and do not detect time servers
    required: false
    default: false
    type: bool
    default: no

The ntp_servers output parameter is now always an empty list if on_master
or no_ntp is set.
2017-12-06 12:53:19 +01:00
Thomas Woerner
120786672e library/ipadiscovery: Drop unused check parameter 2017-12-06 12:52:46 +01:00
Thomas Woerner
fb8075c1ad library/ipadiscovery.py: Fix domain error message 2017-11-09 13:17:04 +01:00
Thomas Woerner
d8ba096eb9 New global ansible_ipa_client utils module
With ansible 2.3.1 it is possible to have one place as an additional utils
module to do all the needed steps to be able to generate the environment for
new and older ipa versions.

The library modules are now a lot smaller.

The minimal ansible version has been increased to 2.3.1.

In the future it might now also be possible to have a special
ansible_ipa_client version for ipa < 4.4 in this utils module.
2017-11-09 13:16:28 +01:00
Thomas Woerner
9259899db5 Merge pull request #6 from flo-renaud/fixipahost_44
ipahost module: fix the module for IPA 4.4 server
2017-10-18 11:36:53 +02:00
Florence Blanc-Renaud
5b57c8b792 ipahost module: fix the module for IPA 4.4 server
The module had unused imports preventing execution with an IPA 4.4 server.
The commit removes unneeded imports, and adds documentation details.
2017-10-17 17:06:14 +02:00
Thomas Woerner
fb047d7e4e Merge pull request #4 from flo-renaud/simplify_uninstall
Simplify ipaclient uninstall
2017-10-16 14:21:53 +02:00
Thomas Woerner
46b5d0f533 library/ipanss.py: Add standard_logging_setup call to fix logger.error behaviour
If the client name is not resolvable, the call of client_dns will internally
result in a logger.error call for the failed update of the DNS records.

The call to standard_logging_setup is fixing the behaviour to bremore like
a debug call.
2017-10-13 16:32:52 +02:00
Florence Blanc-Renaud
a0b8bd39e0 Simplify ipaclient uninstall
Currently ipaclient role is using the module ipaclient only for uninstallation,
and this module contains a lot of unused code.
It is simpler to directly call the command-line
   ipa-client-install --uninstall -U
and remove the ipaclient module.
2017-10-12 09:47:03 +02:00
Florence Blanc-Renaud
4bb1e84530 Fix modules documentation and remove unused variables 2017-10-11 16:14:36 +02:00
Thomas Woerner
d99dcbbffb library/ipajoin.py: Fixed comment for missing keytab 2017-10-05 10:42:57 +02:00
Thomas Woerner
99c0891880 library/ipajoin.py: Fixed white spaces for comments and imports 2017-10-05 10:42:35 +02:00
Thomas Woerner
ea77aa2820 library/ipatest.py: Fixed example descriptions 2017-10-05 10:41:48 +02:00
Thomas Woerner
6482a0d1c3 library/ipatest.py: Drop unused prinipal from module parameters
The principal is not used and needed in the module, therefore it got removed.
2017-10-05 10:39:43 +02:00
Thomas Woerner
c696ea3ebf New module ipafixca to fix a missing ca.crt file.
This is done right ipanss is used as this is failing without the ca.crt file.
2017-10-04 17:40:13 +02:00
Thomas Woerner
c78507409c library/ipatest.py: New validation tests: krb5.conf and ipa ping
The first validation test of the krb5.keytab is now done using the system
krb5.conf file. If this test failed, then the validation will be done with
the temporary krb5.conf file.

An additionally IPA test has been added. For now this is "ipa ping" as there
seems not to be a more comprehensive validation test for proper IPA
configuration.
2017-10-04 17:13:19 +02:00
Thomas Woerner
36f941b5f5 library/ipafstore.py: Fix example to user proper module name 2017-10-04 16:54:09 +02:00
Thomas Woerner
161fd027ab library/ipaapi.py: Fixed create_db version check
create_db is requiring an additional argument for IPA version 4.4.4 still.
2017-10-04 16:52:27 +02:00
Thomas Woerner
e908ee4b52 library/ipatest.py: Additional ccache removal 2017-10-02 19:03:18 +02:00
Thomas Woerner
afcc72807c library/ipatest.py: New return value ca_crt_exists
This will provide information if the ca.crt file exists. This will be needed
to be able to decide what needs to be fixed later on.
2017-10-02 19:01:50 +02:00
Thomas Woerner
0611704cb5 library/ipatest.py: Fix krb5_keytab_ok detection to work always 2017-10-02 19:00:25 +02:00
Thomas Woerner
e797410e62 library/ipaclient.py: Fix mixture of tabs and spaces for Python3 2017-10-02 17:04:23 +02:00
Thomas Woerner
354039321e Fix raise call for Python3 support 2017-10-02 17:03:44 +02:00
Thomas Woerner
95811b0287 library/ipajoin.py: Drop unused subject base gathering from certificate
ipajoin is not called always and therefore we can no depend on the subject
base gathered from the certificate output of the join call.
2017-09-25 15:57:59 +02:00
Thomas Woerner
7ee3cead85 library/ipadiscovery.py: Drop subject base guessing
The subject base generated in discovery is only a guess and might have been
changed by the admin at installation process. Therefore it is needed to
get this from the server - done in ipaapi as we are authenticaed there already
to use the api.
2017-09-25 15:55:49 +02:00
Thomas Woerner
6dc469fdb8 library/ipaapi.py: Add call to api to get subject base form server
The subject base generated in discovery is only a guess and might have been
changed by the admin at installation process. Therefore it is needed to
get this from the server.

subject_base has been added as a new return value.

Use subject base form ipaapi in roles/ipaclient/tasks/install.yml instead of
guessed value from ipadiscovery.
2017-09-25 15:54:21 +02:00
Thomas Woerner
860794232e library/ipajoin.py: Fail for already joined hosts if krb5.keytab is missing
It is not possible to restore a missing krb5.keytab using the admin
credential. Therefore the only way is to fail in this case.
2017-09-21 12:16:02 +02:00
Thomas Woerner
2ca4200141 library/ipanss.py: mkhomedir is a bool, added missing type 2017-09-19 15:30:43 +02:00
Thomas Woerner
1f2d397588 library/ipajoin.py: Return changed state and new parameter already_joined
The choined tag is only set if changes have been done with the join.

already_joined is set if the ipa-join command is filing with error 13
(already joined). The module is not calling fail_json in this case anymore.
2017-09-18 17:44:23 +02:00
Thomas Woerner
9fa0419ddf library/ipanss.py: Check if principal is an empty string 2017-09-18 17:36:11 +02:00
Thomas Woerner
0a8672fcb5 library/ipajoin.py: Enhanced tests for password and keytab
mutually_exclusive and required_one_of are only able to check if the parameters
are defined, but not if they are set to "".
2017-09-18 17:33:08 +02:00
Thomas Woerner
bf64c0bb8f library/ipatest.py: New ipa test module
Test if the krb5.keytab on the machine is valid and can be used.

options:
  servers:
    description: The FQDN of the IPA servers to connect to.
    required: true
  domain:
    description: The primary DNS domain of an existing IPA deployment.
    required: true
  realm:
    description: The Kerberos realm of an existing IPA deployment.
    required: true
  hostname:
    description: The hostname of the machine to join (FQDN).
    required: true
  kdc:
    description: The name or address of the host running the KDC.
    required: true
  principal:
    description: The authorized kerberos principal used to join the IPA realm.
    required: false
  kinit_attempts:
    description: Repeat the request for host Kerberos ticket X times.
    required: false
    default: 5

returns:
  krb5_keytab_ok:
    description: The flag describes if krb5.keytab on the host is usable.
    returned: always
    type: bool
2017-09-18 17:29:24 +02:00
Thomas Woerner
945da71207 Merge remote-tracking branch 'upstream/master' 2017-09-15 14:12:12 +02:00
Thomas Woerner
db12c0959a library/ipajoin.py: Fix principal usage with otp
With otp usage the user supplied principal may not be used for join.
2017-09-15 14:06:39 +02:00
Florence Blanc-Renaud
c824cf6745 Fix logic trying to obtain a keytab
When ipahost is run to generate an OTP and the host is already existing,
the OTP is properly generated but ipa-join will fail if the host is
already enrolled (ie when it has a keytab).
Add a step calling ipa host-disable to erase OTP and keytab before
requesting an OTP.
2017-09-15 13:49:09 +02:00
Thomas Woerner
c088e3f9a6 library/ipajoin.py: Add kinit_attempts default value
Also: Add ipaclient_kinit_attempts default value to
roles/ipaclient/defaults/main.yml
2017-09-15 12:26:03 +02:00
Thomas Woerner
3cd878d10b library/ipajoin.py: Fix required_one_of, add mutually_exclusive
The one_of check was using a tuple instead of a list, the check for principal
or keytab has been removed, a new mutually exclusive check for password
xor keytab has been added.
2017-09-15 12:22:34 +02:00
Thomas Woerner
fa1eeb042c library/ipa{api,discovery,extras,nss,sssd}.py: Drop unused required_one_of 2017-09-15 12:20:46 +02:00
Thomas Woerner
fcea9c2b6c library/ipaclient.py: Compatibility to ipa 4.4 and later 2017-09-15 10:08:36 +02:00
Thomas Woerner
d1a36f4342 library/ipaextras.py: Compatibility to ipa 4.4 and later, new version check 2017-09-15 09:40:09 +02:00
Thomas Woerner
71b19d3f07 library/ipanss.py: Compatibilty to ipa 4.4 and later, new version check 2017-09-15 09:40:08 +02:00
Thomas Woerner
2c2ae77bed library/ipaapi.py: Compatibilty to ipa 4.4 and later, new version check 2017-09-15 09:40:08 +02:00
Thomas Woerner
a5fb29566f library/ipasssd.py: Compatibilty to ipa 4.4 and later, new version check
For ipa versions prior to 4.5 it is needed to use ipa-client-install script
as a source for functions. But the script contains a global finally clause
in which the generated ccache file gets removed. Threfore the script is
temporarily copied to ipa_client_install.py and the global finally clause
gets removed from the copy. All this is done in a temporary directory, which
gets removed right after the import has been done.
2017-09-15 09:40:08 +02:00
Thomas Woerner
a572dfb69e library/sssd.py: Renamed to ipasssd 2017-09-15 09:40:08 +02:00
Thomas Woerner
218d77e9c6 library/ipajoin.py: Compatibilty to ipa 4.4 and later, new version check
For ipa versions prior to 4.5 it is needed to use ipa-client-install script
as a source for functions. But the script contains a global finally clause
in which the generated ccache file gets removed. Threfore the script is
temporarily copied to ipa_client_install.py and the global finally clause
gets removed from the copy. All this is done in a temporary directory, which
gets removed right after the import has been done.

A Object called options is generated as ipa-client-install and also
ipaclient/install/client.py functions are using this object.

inspect.argspec is used on configure_krb5_conf to find out if the function
requires configure_sssd as an optional argument or in the options object.
2017-09-15 09:40:08 +02:00
Thomas Woerner
6e3f133aee library/ipafstore.py: Compatibilty to ipa 4.4 and later, new version check 2017-09-15 09:40:08 +02:00
Thomas Woerner
56063ae373 library/ipadiscovery.py: Compatibilty to ipa 4.4 and later, new version check
freeipa 4.4 is the first version that supports all needed functions.
Therefore a check has been added to make sure that ipadiscovery fails for
versions before 4.4.

The python bindings of ipa versions before 4.6 are having a different
structure.
2017-09-15 09:40:08 +02:00