Commit Graph

10369 Commits

Author SHA1 Message Date
Martin Basti
33537f5556 client: make statestore and fstore consistent with server
There should not be mixed statestore as global variable and as local
function parameter. This commit fixes usage of sysrestore and statestore
as local variables only. In future we may need to change default
statestore and fstore depending on where the functions are called and
this change makes it easier and less error prone.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
19912796ed fix incorrect invocation of ipa-getkeytab during DL0 host enrollment
https://fedorahosted.org/freeipa/ticket/6434

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
a6ec372554 do partial host enrollment in domain level 0 replica install
In order to unify domain-level specific replica installers to a single
workflow some kind of host enrollment must be done also in domain level 0
replica installation.

Here the enrollment is done by directory manager using
one-time password and only krb5.conf is configured to point to master KDC.

Since host keytab is fetched during enrollment KDC installer no longer needs
to request it during replica install.

https://fedorahosted.org/freeipa/ticket/6434

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
3d5161d7e9 Separate function to purge IPA host principals from keytab
This functionality will be reused in the DL0 host enrollment

https://fedorahosted.org/freeipa/ticket/6434

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
8e36e03091 certs: do not re-create NSS database when requesting service cert
`CertDB.request_service_cert` could re-create NSSDB files if the supplied CA
certificate was not found in database. This could cause subtle bugs since the
files were recreated with wrong permissions. This behavior was removed so that
there are no destructive operations performed by the method.

https://fedorahosted.org/freeipa/ticket/6429

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
89bb5ed1eb replica install: merge KRA agent cert export into KRA install
Merge all KRA agent cert export code paths into a single code path in KRA
install.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
822e1bc82a replica install: merge RA cert import into CA install
Merge all RA cert import code paths into a single code path in CA install.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Stanislav Laznicka
bddd4fac46 Replaced EMPTY_LINE constant with a function call
https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Basti <mbasti@redhat.com>
2016-11-11 12:13:56 +01:00
Stanislav Laznicka
cf1c4e84e7 client: Making the configure functions more readable
https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Basti <mbasti@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
2dedfe5d33 server install: do not restart httpd during CA install
At this point, httpd is not configured and the restart fails.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
31a9ef4f8b IPAChangeConf: use constant for empty line
Instead of copy&paste is better to use constant. It makes code shorter
and improves readability, saves resources.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
1c9267803c client: import IPAChangeConf directly instead the module
We should use as specific import as possible, better for python memory
consumption and speed, and looks better in code.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
c30b45ab15 client: remove extra return from hardcode_ldap_server
https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
cc6efb9798 client: install function: return constant not hardcoded number
https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
49f201e2b2 client: remove unneded return from configure_ipa_conf
Function always returns return code 0, and this code is even not used
elsewehere.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
5c16608a0d client: remove unneded return configure_krb5_conf
Function configure_krb5_conf always returns 0 as return state. Remove
the 'return' statement and let exceptions work

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Basti
f98faec478 ipa-client-install: move client install to module
This commit only moves the code from ipa-client-install to module
ipaclient/install/client.py and fixes PEP8.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
0933e080aa install: merge all KRA install code paths into one
Merge KRA install code paths use in ipa-replica-install in either domain
level and ipa-kra-install into one.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
dc38d53de1 install: merge all CA install code paths into one
Merge CA install code paths use in ipa-server-install, ipa-replica-install
in either domain level and ipa-ca-install into one.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
0e232b5f52 replica install: use one remote KRA host name everywhere
Remote master and KRA host names may differ. Always use the remote KRA host
name and never the remote master host name in KRA replica install.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Jan Cholasta
8a7e79a7a6 replica install: use one remote CA host name everywhere
Remote master and CA host names may differ. Always use the remote CA host
name and never the remote master host name in CA replica install.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
b1283c1e56 initialize empty /etc/http/alias during server/replica install
In order to reduce coupling between httpinstance and other service installers,
the HTTP installer is now tasked with initialization of /etc/httpd/alias (RA
agent database) in the beginning of server/replica installation

Part of https://fedorahosted.org/freeipa/ticket/6429

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Martin Babinsky
2fdc2d0cb7 CertDB: add API for non-destructive initialization from PKCS#12 bundle
`create_from_pkcs12` method of CertDB was re-creating NSS database files
during PKCS#12 bundle import. This may cause bugs because the file permissions
could be re-set to wrong values causing subtle bugs. Modify the class API so
that the server cert chain can be imported while preserving existing FS
attributes.

https://fedorahosted.org/freeipa/ticket/6429

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Stanislav Laznicka
7279ef1d0f Moved update of DNA plugin among update plugins
To make the code more general, moved the update_dna_shared_config
among other update plugins.

Bugfix: DNA shared config connection protocol was compared to a
method string which would result in a try to always update it
even if there was no need to.

https://fedorahosted.org/389/ticket/48373 causes that two
shared DNA config entries are created instead of one.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Stanislav Laznicka
83e72d7046 Move ds.replica_populate to an update plugin
Replica populate can be applied with other update plugins.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Stanislav Laznicka
eac6f52957 Remove redundant dsinstance restart
Removed a redundant restart in server install which was there
only so other methods of dsinstance would not fail as they would
use the wrong connection mentioned above.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2016-11-11 12:13:56 +01:00
Petr Spacek
961773bd04 Build: pass down %{release} from SPEC to configure
This is required in order to bake-in precise vendor version to
version.py.

https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
8c81c6c5b8 Build: update IPA_VERSION_IS_GIT_SNAPSHOT to comply with PEP440
Python setuptools started to warn about forward incompatibility.
Now we are following PEP440 so it should not cause any problems
with future versions of setuptools.

https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
0023fb5924 Build: add make srpms target
https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
a691b7d183 Build: IPA_VERSION_IS_GIT_SNAPSHOT re-generates version number on RPM build
This is a huge hack. rpms target will touch VERSION.m4 file. This change
is then detected by automake Makefiles which subsequently re-execute configure
and make.

We have to workaround fact that variables in new make targets
(executed after new configure) are different than original ones.

Also, we have to 'bake-in' precise snapshot version from Git to
VERSION.m4 inside of RPM tarball so the RPM does not depend on git
anymore.

All this magic slows build down a bit.
Do not enable IPA_VERSION_IS_GIT_SNAPSHOT if you want fastest possible builds.

The option IPA_VERSION_IS_GIT_SNAPSHOT is now enabled by default as it
was before we started the build system refactoring effort.

https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
3dc5d2c6f9 Build: use POSIX 1003.1-1988 (ustar) file format for tar archives
Default format used by Autotools limits length of paths to
99 characters. This is not enough for tarballs with Git snapshots.

https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
f6f5708a5a Build: IPA_VERSION_IS_GIT_SNAPSHOT checks if source directory is Git repo
https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Petr Spacek
394edf5f05 Build: remove unused and redundant code from configure.ac and po/Makefile.in
https://fedorahosted.org/freeipa/ticket/6418

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 10:41:38 +01:00
Fraser Tweedale
cdd41e06e6 Ensure correct IPA CA nickname in DS and HTTP NSSDBs
During replica installation, if the IPA deployment has a custom
subject_base, the routines that create the DS and HTTP NSSDBs
erroneously compare the subject of CA certs to the *default* subject
base. This causes the IPA CA cert to be added to the NSSDBs with a
nickname derived from the subject name, instead of "{REALM} IPA CA".

At a later stage of installation, the `upload_cacrt` plugin reads
certs from the HTTP NSSDB in order to update the cn=certificates
LDAP certstore.  The NSSDB nickname of the cert is used as the CN
for the entry.  Because the IPA CA cert was not installed in the
HTTP NSSDB with the "{REALM} IPA CA", this causes a spurious entry
for the IPA CA to be added to the certstore.

To avoid this scenario, use the deployment's actual subject base
when deciding if a cert is the IPA CA cert.

Fixes: https://fedorahosted.org/freeipa/ticket/6415
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
2016-11-11 07:05:14 +01:00
Pavel Vomacka
2644c95548 Coverity - null pointer dereference
Add check which protect from calling method of null.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
aa8a904c4a Coverity - accessing attribute of variable which can point to null
Added check whether variable is pointing to null or not.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
cd74f78ed7 Coverity - opens dialog which might not be created
Check whether dialog object is created before opening it.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
4af31c70c5 Coverity - iterating over variable which could be null
Change condition to check also variable which could be null.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
cad9f9b682 Coverity - null pointer dereference
The 'obj' variable could be null, so there could be error when it is used.
A new check that 'obj' is not false is added.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
d94a2aa185 Coverity - true branch can't be executed
The 'result' variable is always false because of previous condition.
Therefore there is direct assignment.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
7be585dbb2 Coverity - true branch can't be executed
The 'data' variable is always false because of previous condition.
Therefore there is direct assignment.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
ed74e14ab4 Coverity - removed dead code
There cannot be string value because of previous checks.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
4b63ce26eb Coverity - Accesing attribute of null
There is a possibility that widget is null and then there could be an error.
Therefore there is new check of widget variable.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
de8cb7585b Coverity - identical code for different branches
In both cases when the condition is true or false ut is set the same value.
Changed to assign the value directly.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
fa3982c7c8 Coverity - not initialized variable
The variable hasn't been initialized, now it is set to null by default.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
d4ad0ca04c Coverity - null pointer exception
Variable 'row' could be null in some cases. And set css to variable which is pointing to null
causes error. Therefore there is new check.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Pavel Vomacka
a2525ff645 Coverity - null pointer exception
Variable 'option' can be null and there will be error of reading property of null.

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2016-11-10 18:58:38 +01:00
Tomas Krizek
a68c95d116 ipaldap: remove do_bind from LDAPClient
Remove do_bind() method that was a relict used in IPAdmin. Replace
its uses with simple / external binds.

https://fedorahosted.org/freeipa/ticket/6461

Reviewed-By: Martin Basti <mbasti@redhat.com>
2016-11-10 17:40:49 +01:00
Florence Blanc-Renaud
808b1436b4 Refactor installer code requesting certificates
- Temporary modify certmonger dogtag-ipa-ca-renew helper to request the IPA RA
agent cert, using the temp cert created during pkispawn. The cert request
is now processed through certmonger, and the helper arguments are restored
once the agent cert is obtained.

- Modify the installer code creating HTTP and LDAP certificates to use
certmonger's IPA helper with temporary parameters (calling dogtag-submit
instead of ipa-submit)

- Clean-up for the integration tests: sometimes ipa renewal.lock is not
released during ipa-server-uninstall. Make sure that the file is removed
to allow future installations.

https://fedorahosted.org/freeipa/ticket/6433

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
2016-11-10 14:15:57 +01:00
Florence Blanc-Renaud
7462adec13 Use autobind instead of host keytab authentication in dogtag-ipa-ca-renew-agent
This commit makes sure that dogtag-ipa-ca-renew-agent CA helper can be used
before Kerberos is configured.

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
2016-11-10 14:15:57 +01:00