Commit Graph

138 Commits

Author SHA1 Message Date
Rob Crittenden
bd619adb5c Use a new mechanism for delegating certificate issuance.
Using the client IP address was a rather poor mechanism for controlling
who could request certificates for whom. Instead the client machine will
bind using the host service principal and request the certificate.

In order to do this:
* the service will need to exist
* the machine needs to be in the certadmin rolegroup
* the host needs to be in the managedBy attribute of the service

It might look something like:

admin

ipa host-add client.example.com --password=secret123
ipa service-add HTTP/client.example.com
ipa service-add-host --hosts=client.example.com HTTP/client.example.com
ipa rolegroup-add-member --hosts=client.example.com certadmin

client

ipa-client-install
ipa-join -w secret123
kinit -kt /etc/krb5.keytab host/client.example.com
ipa -d cert-request file://web.csr --principal=HTTP/client.example.com
2009-11-03 09:04:05 -07:00
Jason Gerard DeRose
c4b7b70636 Add mod_python adapter and some UI tuning 2009-10-27 21:38:13 -06:00
Rob Crittenden
725656119c Remove a bunch of unused imports, general cleanup 2009-10-25 22:54:55 -06:00
Rob Crittenden
453a19fcac First pass at enforcing certificates be requested from same host
We want to only allow a machine to request a certificate for itself, not for
other machines. I've added a new taksgroup which will allow this.

The requesting IP is resolved and compared to the subject of the CSR to
determine if they are the same host. The same is done with the service
principal. Subject alt names are not queried yet.

This does not yet grant machines actual permission to request certificates
yet, that is still limited to the taskgroup request_certs.
2009-10-21 03:22:44 -06:00
Rob Crittenden
aa2183578c Add can_add() and can_delete() GER helpers 2009-10-21 03:11:45 -06:00
Jason Gerard DeRose
ce8be42c56 Fixed compatability break in rpcserver.py 2009-10-17 17:59:38 -06:00
Rob Crittenden
5ad91a0781 Add a sleep() prior to calling tasks to ensure postop writes are done
We were seeing a rare deadlock of DS when creating the memberOf task because
one thread was adding memberOf in a postop while another was trying to
create an index and this was causing a PRLock deadlock.
2009-10-16 14:57:53 -04:00
Rob Crittenden
0573389370 Be more forgiving when trying to replace older DS schema.
We have to replace 05rfc2247.ldif because it contains some conflicting
attributes with DNS in some older versions of 389-DS/RHDS. This fails on
some newer versions of 389-DS/RHDS so this lets it continue installing
if the new file is not needed.
2009-10-16 14:56:49 -04:00
Jason Gerard DeRose
4a350213b7 Fixed 'import json' for simplejson compatability 2009-10-16 12:38:22 -06:00
Rob Crittenden
b8cadd90bd parse_qs is in cgi on Python < 2.6, use that instead
Python 2.6's cgi module calls the parse_qs in urlparse for backwards
compatibility
2009-10-16 09:12:17 -04:00
Jason Gerard DeRose
5fad455ff4 Fixed try/except/finally for Python 2.4 compatability 2009-10-15 15:00:57 -06:00
Jason Gerard DeRose
f58ff2921d Giant webui patch take 2 2009-10-13 11:28:00 -06:00
Rob Crittenden
48785a5af1 Loosen the ACI for the KDC to allow adds/deletes
Password policy entries must be a child of the entry protected by this
ACI.

Also change the format of this because in DS it was stored as:
\n(target)\n so was base64-encoded when it was retrieved.
2009-10-05 13:27:34 -06:00
Rob Crittenden
8de6dc00dc Robustness fix for updater, in case updates['updates'] is not set yet. 2009-10-05 13:26:41 -06:00
Rob Crittenden
e62bbab37a Let the updater delete entries and add small test harness
In order to run the tests you must put your DM password into
~/.ipa/.dmpw

Some tests are expected to generate errors. Don't let any ERROR
messages from the updater fool you, watch the pass/fail of the nosetests.
2009-10-05 13:25:42 -06:00
Rob Crittenden
aa7792a000 Add option to not normalize a DN when adding/updating a record.
The KDC ldap plugin is very picky about the format of DNs. It does
not allow spacing between elements so we can't normalize it.
2009-10-05 12:57:31 -06:00
Rob Crittenden
0d70c68395 Fix aci plugin, enhance aci parsing capabilities, add user group support
- The aci plugin didn't quite work with the new ldap2 backend.
- We already walk through the target part of the ACI syntax so skip that
  in the regex altogether. This now lets us handle all current ACIs in IPA
  (some used to be ignored/skipped)
- Add support for user groups so one can do v1-style delegation (group A
  can write attributes x,y,z in group B). It is actually quite a lot more
  flexible than that but you get the idea)
- Improve error messages in the aci library
- Add a bit of documentation to the aci plugin
2009-09-28 22:27:42 -06:00
Rob Crittenden
e4877c946f Only initialize the API once in the installer
Make the ldap2 plugin schema loader ignore SERVER_DOWN errors

525303
2009-09-28 22:17:01 -06:00
Rob Crittenden
d0587cbdd5 Enrollment for a host in an IPA domain
This will create a host service principal and may create a host entry (for
admins).  A keytab will be generated, by default in /etc/krb5.keytab
If no kerberos credentails are available then enrollment over LDAPS is used
if a password is provided.

This change requires that openldap be used as our C LDAP client. It is much
easier to do SSL using openldap than mozldap (no certdb required). Otherwise
we'd have to write a slew of extra code to create a temporary cert database,
import the CA cert, ...
2009-09-24 17:45:49 -06:00
Rob Crittenden
4f4d57cd30 Use the same variable name in the response as the dogtag plugin 2009-09-24 17:42:26 -04:00
Rob Crittenden
49b36583a5 Add external CA signing and abstract out the RA backend
External CA signing is a 2-step process. You first have to run the IPA
installer which will generate a CSR. You pass this CSR to your external
CA and get back a cert. You then pass this cert and the CA cert and
re-run the installer. The CSR is always written to /root/ipa.csr.

A run would look like:

 # ipa-server-install --ca --external-ca -p password -a password -r EXAMPLE.COM -u dirsrv -n example.com --hostname=ipa.example.com -U
[ sign cert request ]
 # ipa-server-install --ca --external-ca -p password -a password --external_cert_file=/tmp/rob.crt --external_ca_file=/tmp/cacert.crt  -U -p password -a password -r EXAMPLE.COM -u dirsrv -n example.com --hostname=ipa.example.com

This also abstracts out the RA backend plugin so the self-signed CA we
create can be used in a running server. This means that the cert plugin
can request certs (and nothing else). This should let us do online replica
creation.

To handle the self-signed CA the simple ca_serialno file now contains
additional data so we don't have overlapping serial numbers in replicas.
This isn't used yet. Currently the cert plugin will not work on self-signed
replicas.

One very important change for self-signed CAs is that the CA is no longer
held in the DS database. It is now in the Apache database.

Lots of general fixes were also made in ipaserver.install.certs including:
 - better handling when multiple CA certificates are in a single file
 - A temporary directory for request certs is not always created when the
   class is instantiated (you have to call setup_cert_request())
2009-09-15 10:01:08 -04:00
Rob Crittenden
eca7cdc94a Raise more specific error when an Objectclass Violation occurs Fix the virtual plugin to work with the new backend 2009-09-14 09:46:39 -04:00
Rob Crittenden
2c3bca7e74 Remove deprecated comment on plugin naming conventions 2009-09-14 09:46:35 -04:00
Pavel Zuna
356375ef18 Make ldap2.add_entry proof to None values, because python-ldap hate'em. 2009-09-08 13:38:25 -04:00
Martin Nagy
205a41205b Add A and PTR records of ourselves during installation
If the DNS zones already exist but don't contain our own records, add
them. This patch introduces the ipalib.api into the installers. For now,
the code is still little messy. Later patches will abandon the way we
create zones now and use ipalib.api exclusively.
2009-09-02 22:04:25 +02:00
Martin Nagy
4e5a68397a Use DNS forwarders in /etc/named.conf
This patch adds options --forwarder and --no-forwarders. At least one of
them must be used if you are doing a setup with DNS server. They are
also mutually exclusive. The --forwarder option can be used more than
once to specify more servers. If the installer runs in interactive mode,
it will prompt the user if none of these option was given at the command
line.
2009-09-02 19:09:28 +02:00
Pavel Zuna
91d01a532a Introduce a list of attributes for which only MOD_REPLACE operations are generated. 2009-08-28 13:18:21 -04:00
Rob Crittenden
38ae093c7b Add the CA constraint to the self-signed CA we generate
514027
2009-08-27 16:49:09 -04:00
Rob Crittenden
559c76f761 Add option to the installer for uid/gid starting numbers.
This also adds a new option to the template system. If you include
eval(string) in a file that goes through the templater then the
string in the eval will be evaluated by the Python interpreter. This is
used so one can do $UIDSTART+1. If any errors occur during the evaluation
the original string is is returned, eval() and all so it is up to the
developer to make sure the evaluation passes.

The default value for uid and gid is now a random value between
1,000,000 and (2^31 - 1,000,000)
2009-08-27 14:15:26 -04:00
Rob Crittenden
cab5525076 Enable ldapi connections in the management framework.
If you don't want to use ldapi then you can remove the ldap_uri setting
in /etc/ipa/default.conf. The default for the framework is to use
ldap://localhost:389/
2009-08-27 13:36:58 -04:00
Rob Crittenden
08fc563212 Generate CRLs and make them available from the IPA web server 2009-08-26 09:51:19 -04:00
Rob Crittenden
d9c54cd83e Clean up additional issues discovered with pylint and pychecker 2009-08-20 09:20:56 -04:00
Rob Crittenden
8780751330 Clean up some problems discovered with pylint and pychecker
Much of this is formatting to make pylint happy but it also fixes some
real bugs.
2009-08-12 13:18:15 -04:00
Pavel Zuna
b4d173d844 Fix bug in _get_syntax (it was always returning None).
Also prevent a few cases of double processing of arguments.
2009-08-03 23:01:44 -06:00
Jason Gerard DeRose
03a80f512c Fixed whitespace indentation error in certs.py 2009-07-27 19:23:31 -06:00
Rob Crittenden
5bbe1108d5 Identify CAs to trust from an imported PKCS#12 file
We used to use certutil -O to determine the cert chain to trust. This
behavior changed in F-11 such that untrusted CAs are not displayed.
This is only used when we import PKCS#12 files so use pk12util -l to
display the list of certs and keys in the file to determine the nickname(s)
of the CAs to trust.

509111
2009-07-27 16:04:53 -06:00
Rob Crittenden
5767c6b37d Fix deprecation warning for the sha library on Python 2.6
sha has been replaced by hashlib. We need to support Python 2.4 - 2.6 so
this will use hashlib if available but fall back onto sha if not.
Fortunately they use the same API for the function we need.

509042

Signed-off-by: Jason Gerard DeRose <jderose@redhat.com>
2009-07-23 20:03:01 -06:00
Rob Crittenden
b382755fee No need to trust NSS built-in CA's, more specific regex for finding CA nickname
- Add some logging so we have a better idea of what happened if things fail
- Default to self-signed CA to trust if one is not found. This will fix
  the self-signed CA case where certutil doesn't return untrusted CA's in
  -O output.
- Remove unused httplib import

Signed-off-by: Jason Gerard DeRose <jderose@redhat.com>
2009-07-23 13:45:45 -06:00
Martin Nagy
de53d0a26e Make --setup-dns work on replica installation
The ipa-replica-install script will setup the DNS if user specifies the
--setup-dns option. It will only add the zone into LDAP if the
cn=dns,$SUFFIX container doesn't exist. For now, however, we do not add
the records.
2009-07-22 18:02:22 +02:00
Martin Nagy
a09d2c3498 Add a reverse zone with server's PTR record
Also, small cosmetic change in dns.ldif.
2009-07-22 18:02:22 +02:00
Rob Crittenden
8d164569d0 Allow replicas of an IPA server using an internal dogtag server as the CA
This involves creating a new CA instance on the replica and using pkisilent
to create a clone of the master CA.

Also generally fixes IPA to work with the latest dogtag SVN tip. A lot of
changes to ports and configuration have been done recently.
2009-07-15 09:00:01 -04:00
Simo Sorce
9fe707a3f2 Basic changes to get a default principal for DNS
Also moves delagation layout installation in dsinstance.
This is needed to allow us to set default membership in
other modules like bindinstance.

Signed-off-by: Martin Nagy <mnagy@redhat.com>
2009-07-10 09:42:22 -04:00
Pavel Zuna
3b613091bb Import explode_dn from ldap.functions for backward compatibility with older version of python-ldap. Fix bug in add_entry_to_group.
Resolves 510149
2009-07-08 12:15:58 -04:00
Rob Crittenden
45a40635bb Add class variable to indicate whether SSL is required or not.
Older python-ldap versions will crash if you call ldap.get_option()
on a value that has not been set.
2009-07-07 22:57:23 -04:00
Pavel Zuna
f59cab1ccd Fix bug in ldap2.modify_password and make adding/removing members slightly more efficient. 2009-07-07 22:56:56 -04:00
Pavel Zuna
79ac9c6c78 Add conversion of attribute name synonyms when generating modlists. 2009-06-15 13:11:44 -04:00
Pavel Zuna
ad54fc3399 Add support for incomplete (truncated) search results.
ldap2.find_entries now returns a tuple containing 2 values. First,
a list of entries (dn, entry_attrs), Second, the truncated flag. If
the truncated flag is True, search results hit a server limitation
and are incomplete.

This patch also removes decoding of non-string scalar python types into
unicode (they are left unchanged).
2009-06-15 11:18:55 -04:00
Pavel Zuna
6e84f08143 Fix bugs in ldap2. 2009-06-12 15:10:57 -04:00
Pavel Zuna
87bfd6b21a Fix bug in ldap2.normalize_dn.
DN was always returned as lower-case, sometimes resulting in 2 RDN values with different cases when creating entries.
2009-06-10 11:51:15 -04:00
Martin Nagy
1bc786e379 Use LDAP instead of flat file for zone storage 2009-06-02 12:32:01 +02:00