2009-06-24 08:12:27 -05:00
|
|
|
# Authors:
|
|
|
|
# Rob Crittenden <rcritten@redhat.com>
|
|
|
|
# Pavel Zuna <pzuna@redhat.com>
|
|
|
|
#
|
|
|
|
# Copyright (C) 2008 Red Hat
|
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2009-06-24 08:12:27 -05:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-06-24 08:12:27 -05:00
|
|
|
"""
|
|
|
|
Test the `ipalib/plugins/service.py` module.
|
|
|
|
"""
|
|
|
|
|
2011-04-26 15:45:19 -05:00
|
|
|
from ipalib import api, errors, x509
|
|
|
|
from tests.test_xmlrpc.xmlrpc_test import Declarative, fuzzy_uuid, fuzzy_hash
|
2011-07-27 04:02:00 -05:00
|
|
|
from tests.test_xmlrpc.xmlrpc_test import fuzzy_digits, fuzzy_date, fuzzy_issuer
|
2012-03-06 14:53:07 -06:00
|
|
|
from tests.test_xmlrpc.xmlrpc_test import fuzzy_hex
|
2010-08-05 21:41:32 -05:00
|
|
|
from tests.test_xmlrpc import objectclasses
|
2010-10-08 12:15:03 -05:00
|
|
|
import base64
|
2011-08-09 20:21:56 -05:00
|
|
|
from ipalib.dn import *
|
2010-08-05 21:41:32 -05:00
|
|
|
|
|
|
|
fqdn1 = u'testhost1.%s' % api.env.domain
|
|
|
|
fqdn2 = u'testhost2.%s' % api.env.domain
|
2011-02-11 09:54:13 -06:00
|
|
|
fqdn3 = u'TestHost3.%s' % api.env.domain
|
2010-08-05 21:41:32 -05:00
|
|
|
service1 = u'HTTP/%s@%s' % (fqdn1, api.env.realm)
|
|
|
|
hostprincipal1 = u'host/%s@%s' % (fqdn1, api.env.realm)
|
2011-08-09 20:21:56 -05:00
|
|
|
service1dn = DN(('krbprincipalname',service1),('cn','services'),('cn','accounts'),api.env.basedn)
|
|
|
|
host1dn = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),api.env.basedn)
|
|
|
|
host2dn = DN(('fqdn',fqdn2),('cn','computers'),('cn','accounts'),api.env.basedn)
|
|
|
|
host3dn = DN(('fqdn',fqdn3),('cn','computers'),('cn','accounts'),api.env.basedn)
|
2010-08-05 21:41:32 -05:00
|
|
|
|
2011-04-26 15:45:19 -05:00
|
|
|
fd = open('tests/test_xmlrpc/service.crt', 'r')
|
|
|
|
servercert = fd.readlines()
|
|
|
|
servercert = ''.join(servercert)
|
|
|
|
servercert = x509.strip_header(servercert)
|
|
|
|
fd.close()
|
|
|
|
|
|
|
|
badservercert = 'MIICbzCCAdigAwIBAgICA/4wDQYJKoZIhvcNAQEFBQAwKTEnMCUGA1UEAxMeSVBBIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTEwMDgwOTE1MDIyN1oXDTIwMDgwOTE1MDIyN1owKTEMMAoGA1UEChMDSVBBMRkwFwYDVQQDExBwdW1hLmdyZXlvYWsuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwYbfEOQPgGenPn9vt1JFKvWm/Je3y2tawGWA3LXDuqfFJyYtZ8ib3TcBUOnLk9WK5g2qCwHaNlei7bj8ggIfr5hegAVe10cun+wYErjnYo7hsHYd+57VZezeipWrXu+7NoNd4+c4A5lk4A/xJay9j3bYx2oOM8BEox4xWYoWge1ljPrc5JK46f0X7AGW4F2VhnKPnf8rwSuzI1U8VGjutyM9TWNy3m9KMWeScjyG/ggIpOjUDMV7HkJL0Di61lznR9jXubpiEC7gWGbTp84eGl/Nn9bgK1AwHfJ2lHwfoY4uiL7ge1gyP6EvuUlHoBzdb7pekiX28iePjW3iEG9IawIDAQABoyIwIDARBglghkgBhvhCAQEEBAMCBkAwCwYDVR0PBAQDAgUgMA0GCSqGSIb3DQEBBQUAA4GBACRESLemRV9BPxfEgbALuxH5oE8jQm8WZ3pm2pALbpDlAd9wQc3yVf6RtkfVthyDnM18bg7IhxKpd77/p3H8eCnS8w5MLVRda6ktUC6tGhFTS4QKAf0WyDGTcIgkXbeDw0OPAoNHivoXbIXIIRxlw/XgaSaMzJQDBG8iROsN4kCv'
|
2010-10-08 12:15:03 -05:00
|
|
|
|
2010-08-05 21:41:32 -05:00
|
|
|
|
2011-08-22 15:24:07 -05:00
|
|
|
class test_service(Declarative):
|
2010-08-05 21:41:32 -05:00
|
|
|
|
|
|
|
cleanup_commands = [
|
|
|
|
('host_del', [fqdn1], {}),
|
|
|
|
('host_del', [fqdn2], {}),
|
2011-02-11 09:54:13 -06:00
|
|
|
('host_del', [fqdn3], {}),
|
2010-08-05 21:41:32 -05:00
|
|
|
('service_del', [service1], {}),
|
|
|
|
]
|
|
|
|
|
|
|
|
tests = [
|
|
|
|
dict(
|
|
|
|
desc='Try to retrieve non-existent %r' % service1,
|
|
|
|
command=('service_show', [service1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: service not found' % service1),
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to update non-existent %r' % service1,
|
2010-10-08 12:15:03 -05:00
|
|
|
command=('service_mod', [service1], dict(usercertificate=servercert)),
|
2010-08-05 21:41:32 -05:00
|
|
|
expected=errors.NotFound(reason='no such entry'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to delete non-existent %r' % service1,
|
|
|
|
command=('service_del', [service1], {}),
|
|
|
|
expected=errors.NotFound(reason='no such entry'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % fqdn1,
|
|
|
|
command=('host_add', [fqdn1],
|
|
|
|
dict(
|
|
|
|
description=u'Test host 1',
|
|
|
|
l=u'Undisclosed location 1',
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=fqdn1,
|
|
|
|
summary=u'Added host "%s"' % fqdn1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == host1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
fqdn=[fqdn1],
|
|
|
|
description=[u'Test host 1'],
|
|
|
|
l=[u'Undisclosed location 1'],
|
|
|
|
krbprincipalname=[u'host/%s@%s' % (fqdn1, api.env.realm)],
|
|
|
|
objectclass=objectclasses.host,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
2010-11-10 15:47:29 -06:00
|
|
|
managedby_host=[u'%s' % fqdn1],
|
2011-08-22 15:24:07 -05:00
|
|
|
has_keytab=False,
|
|
|
|
has_password=False,
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % fqdn2,
|
|
|
|
command=('host_add', [fqdn2],
|
|
|
|
dict(
|
|
|
|
description=u'Test host 2',
|
|
|
|
l=u'Undisclosed location 2',
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=fqdn2,
|
|
|
|
summary=u'Added host "%s"' % fqdn2,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == host2dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
fqdn=[fqdn2],
|
|
|
|
description=[u'Test host 2'],
|
|
|
|
l=[u'Undisclosed location 2'],
|
|
|
|
krbprincipalname=[u'host/%s@%s' % (fqdn2, api.env.realm)],
|
|
|
|
objectclass=objectclasses.host,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
2010-11-10 15:47:29 -06:00
|
|
|
managedby_host=[u'%s' % fqdn2],
|
2011-08-22 15:24:07 -05:00
|
|
|
has_keytab=False,
|
|
|
|
has_password=False,
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-02-11 09:54:13 -06:00
|
|
|
dict(
|
|
|
|
desc='Create %r' % fqdn3,
|
|
|
|
command=('host_add', [fqdn3],
|
|
|
|
dict(
|
|
|
|
description=u'Test host 3',
|
|
|
|
l=u'Undisclosed location 3',
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=fqdn3.lower(),
|
|
|
|
summary=u'Added host "%s"' % fqdn3.lower(),
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == host3dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
fqdn=[fqdn3.lower()],
|
|
|
|
description=[u'Test host 3'],
|
|
|
|
l=[u'Undisclosed location 3'],
|
|
|
|
krbprincipalname=[u'host/%s@%s' % (fqdn3.lower(), api.env.realm)],
|
|
|
|
objectclass=objectclasses.host,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
managedby_host=[u'%s' % fqdn3.lower()],
|
2011-08-22 15:24:07 -05:00
|
|
|
has_keytab=False,
|
|
|
|
has_password=False,
|
2011-02-11 09:54:13 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-08-05 21:41:32 -05:00
|
|
|
dict(
|
|
|
|
desc='Create %r' % service1,
|
|
|
|
command=('service_add', [service1],
|
|
|
|
dict(
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=u'Added service "%s"' % service1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
objectclass=objectclasses.service,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to create duplicate %r' % service1,
|
|
|
|
command=('service_add', [service1],
|
|
|
|
dict(
|
|
|
|
force=True,
|
|
|
|
),
|
|
|
|
),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.DuplicateEntry(
|
|
|
|
message=u'service with name "%s" already exists' % service1),
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve %r' % service1,
|
|
|
|
command=('service_show', [service1], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=None,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
has_keytab=False,
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve %r with all=True' % service1,
|
|
|
|
command=('service_show', [service1], dict(all=True)),
|
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=None,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
objectclass=objectclasses.service,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
has_keytab=False
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Search for %r' % service1,
|
|
|
|
command=('service_find', [service1], {}),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'1 service matched',
|
|
|
|
result=[
|
|
|
|
dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
has_keytab=False,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Search for %r with all=True' % service1,
|
|
|
|
command=('service_find', [service1], dict(all=True)),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'1 service matched',
|
|
|
|
result=[
|
|
|
|
dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
objectclass=objectclasses.service,
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
has_keytab=False,
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-02-11 09:54:13 -06:00
|
|
|
dict(
|
|
|
|
desc='Add non-existent host to %r' % service1,
|
2012-03-23 14:09:54 -05:00
|
|
|
command=('service_add_host', [service1], dict(host=u'notfound')),
|
2011-02-11 09:54:13 -06:00
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[(u'notfound', u'no such entry')])),
|
|
|
|
completed=0,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove non-existent host from %r' % service1,
|
2012-03-23 14:09:54 -05:00
|
|
|
command=('service_remove_host', [service1], dict(host=u'notfound')),
|
2011-02-11 09:54:13 -06:00
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[(u'notfound', u'This entry is not a member')])),
|
|
|
|
completed=0,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add host to %r' % service1,
|
|
|
|
command=('service_add_host', [service1], dict(host=fqdn2)),
|
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[])),
|
|
|
|
completed=1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1, fqdn2],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove host from %r' % service1,
|
|
|
|
command=('service_remove_host', [service1], dict(host=fqdn2)),
|
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[])),
|
|
|
|
completed=1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add mixed-case host to %r' % service1,
|
|
|
|
command=('service_add_host', [service1], dict(host=fqdn3)),
|
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[])),
|
|
|
|
completed=1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1, fqdn3.lower()],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Remove mixed-case host from %r' % service1,
|
|
|
|
command=('service_remove_host', [service1], dict(host=fqdn3)),
|
|
|
|
expected=dict(
|
|
|
|
failed=dict(managedby=dict(host=[])),
|
|
|
|
completed=1,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2011-02-11 09:54:13 -06:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-04-26 15:45:19 -05:00
|
|
|
dict(
|
|
|
|
desc='Update %r with a bad certificate' % service1,
|
|
|
|
command=('service_mod', [service1], dict(usercertificate=badservercert)),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.CertificateOperationError(
|
|
|
|
error=u'Issuer "CN=IPA Test Certificate Authority" does not ' +
|
|
|
|
u'match the expected issuer'),
|
2011-04-26 15:45:19 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-08-05 21:41:32 -05:00
|
|
|
dict(
|
|
|
|
desc='Update %r' % service1,
|
2010-10-08 12:15:03 -05:00
|
|
|
command=('service_mod', [service1], dict(usercertificate=servercert)),
|
2010-08-05 21:41:32 -05:00
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=u'Modified service "%s"' % service1,
|
|
|
|
result=dict(
|
2010-10-08 12:15:03 -05:00
|
|
|
usercertificate=[base64.b64decode(servercert)],
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
managedby_host=[fqdn1],
|
2011-04-26 15:45:19 -05:00
|
|
|
valid_not_before=fuzzy_date,
|
|
|
|
valid_not_after=fuzzy_date,
|
2011-08-09 20:21:56 -05:00
|
|
|
subject=lambda x: DN(x) == \
|
2012-03-26 06:11:41 -05:00
|
|
|
DN(('CN',api.env.host),x509.subject_base()),
|
2011-04-26 15:45:19 -05:00
|
|
|
serial_number=fuzzy_digits,
|
2012-03-06 14:53:07 -06:00
|
|
|
serial_number_hex=fuzzy_hex,
|
2011-04-26 15:45:19 -05:00
|
|
|
md5_fingerprint=fuzzy_hash,
|
|
|
|
sha1_fingerprint=fuzzy_hash,
|
2011-07-27 04:02:00 -05:00
|
|
|
issuer=fuzzy_issuer,
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve %r to verify update' % service1,
|
|
|
|
command=('service_show', [service1], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=None,
|
|
|
|
result=dict(
|
2011-08-09 20:21:56 -05:00
|
|
|
dn=lambda x: DN(x) == service1dn,
|
2010-10-08 12:15:03 -05:00
|
|
|
usercertificate=[base64.b64decode(servercert)],
|
2010-08-05 21:41:32 -05:00
|
|
|
krbprincipalname=[service1],
|
|
|
|
has_keytab=False,
|
|
|
|
managedby_host=[fqdn1],
|
2010-10-20 12:14:22 -05:00
|
|
|
# These values come from the servercert that is in this
|
|
|
|
# test case.
|
2011-04-26 15:45:19 -05:00
|
|
|
valid_not_before=fuzzy_date,
|
|
|
|
valid_not_after=fuzzy_date,
|
2011-08-09 20:21:56 -05:00
|
|
|
subject=lambda x: DN(x) == \
|
2012-03-26 06:11:41 -05:00
|
|
|
DN(('CN',api.env.host),x509.subject_base()),
|
2011-04-26 15:45:19 -05:00
|
|
|
serial_number=fuzzy_digits,
|
2012-03-06 14:53:07 -06:00
|
|
|
serial_number_hex=fuzzy_hex,
|
2011-04-26 15:45:19 -05:00
|
|
|
md5_fingerprint=fuzzy_hash,
|
|
|
|
sha1_fingerprint=fuzzy_hash,
|
2011-07-27 04:02:00 -05:00
|
|
|
issuer=fuzzy_issuer,
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete %r' % service1,
|
|
|
|
command=('service_del', [service1], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=service1,
|
|
|
|
summary=u'Deleted service "%s"' % service1,
|
2011-01-07 10:17:55 -06:00
|
|
|
result=dict(failed=u''),
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to retrieve non-existent %r' % service1,
|
|
|
|
command=('service_show', [service1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: service not found' % service1),
|
2010-08-05 21:41:32 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to update non-existent %r' % service1,
|
2010-10-08 12:15:03 -05:00
|
|
|
command=('service_mod', [service1], dict(usercertificate=servercert)),
|
2010-08-05 21:41:32 -05:00
|
|
|
expected=errors.NotFound(reason='no such entry'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to delete non-existent %r' % service1,
|
|
|
|
command=('service_del', [service1], {}),
|
|
|
|
expected=errors.NotFound(reason='no such entry'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create service with malformed principal "foo"',
|
|
|
|
command=('service_add', [u'foo'], {}),
|
|
|
|
expected=errors.MalformedServicePrincipal(reason='missing service')
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create service with bad realm "HTTP/foo@FOO.NET"',
|
|
|
|
command=('service_add', [u'HTTP/foo@FOO.NET'], {}),
|
|
|
|
expected=errors.RealmMismatch(),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create a host service %r' % hostprincipal1,
|
|
|
|
command=('service_add', [hostprincipal1], {}),
|
|
|
|
expected=errors.HostService()
|
|
|
|
),
|
|
|
|
|
2012-02-22 16:42:38 -06:00
|
|
|
|
|
|
|
# These tests will only succeed when running against lite-server.py
|
|
|
|
# on same box as IPA install.
|
|
|
|
dict(
|
|
|
|
desc='Delete the current host (master?) %s HTTP service, should be caught' % api.env.host,
|
|
|
|
command=('service_del', ['HTTP/%s' % api.env.host], {}),
|
|
|
|
expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete the current host (master?) %s ldap service, should be caught' % api.env.host,
|
|
|
|
command=('service_del', ['ldap/%s' % api.env.host], {}),
|
|
|
|
expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-03-19 09:16:49 -05:00
|
|
|
dict(
|
|
|
|
desc='Disable the current host (master?) %s HTTP service, should be caught' % api.env.host,
|
|
|
|
command=('service_disable', ['HTTP/%s' % api.env.host], {}),
|
|
|
|
expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Disable the current host (master?) %s ldap service, should be caught' % api.env.host,
|
|
|
|
command=('service_disable', ['ldap/%s' % api.env.host], {}),
|
|
|
|
expected=errors.ValidationError(name='principal', error='This principal is required by the IPA master'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-08-05 21:41:32 -05:00
|
|
|
]
|