On (26/02/16 11:53), Jakub Hrozek wrote:
On Thu, Feb 25, 2016 at 05:18:09PM -0500, Dan Lavu wrote:
> Here is a patch for
https://fedorahosted.org/sssd/ticket/2820
>
> First real patch... criticisms to for what I need to improve on are welcome,
> including concepts that I should learn, thanks.
Thanks a lot for the patch!
See my comments inline:
> From 529adb3e0d763a8ee9ba9b4c5b13f933d723e8de Mon Sep 17 00:00:00 2001
> From: Dan Lavu <dlavu(a)redhat.com>
> Date: Fri, 5 Feb 2016 08:51:07 -0500
> Subject: [PATCH] Adding SSL encryption to integration tests.
>
> ---
> src/tests/intg/ca.py | 166 ++++++++++++++++++++++++++++++++++++++++++
> src/tests/intg/ds_openldap.py | 14 ++++
> 2 files changed, 180 insertions(+)
> create mode 100644 src/tests/intg/ca.py
>
> diff --git a/src/tests/intg/ca.py b/src/tests/intg/ca.py
> new file mode 100644
> index
0000000000000000000000000000000000000000..a44a92e5d5053338dabd7d8d82d2b1d50ec7594e
> --- /dev/null
> +++ b/src/tests/intg/ca.py
> @@ -0,0 +1,166 @@
> +#
> +# SSSD LOCAL domain tests
> +#
> +# Copyright (c) 2016 Red Hat, Inc.
> +# Author: Dan Lavu <dan(a)redhat.com>
> +#
> +# This 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; version 2 only
> +#
> +# 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
> +# along with this program. If not, see <
http://www.gnu.org/licenses/>.
> +#
> +
> +from OpenSSL import crypto
> +from os.path import exists, join
> +
> +import socket
> +import os
> +import fnmatch
> +
> +
> +class CA:
It would be nice to use the new-style classes, so class CA(object)
> + """CA Class"""
> +
> + def __init__(self, subject=None, country=None, state=None,
> + city=None, organization=None, unit=None, config_dir=None):
> + if subject is None:
> + self.subject = socket.gethostname()
> + if country is None:
> + self.country = 'US'
I'm nt python expert but might use
default arguments
http://www.tutorialspoint.com/python/python_functions.htm
-> Default arguments
> + if state is None:
> + self.state = 'NC'
> + if city is None:
> + self.city = 'Raleigh'
> + if organization is None:
> + self.organization = 'Red Hat'
> + if unit is None:
> + self.unit = 'SSSD'
> + if config_dir is None:
> + self.config_dir = '/etc/pki'
/etc/pki is not writable unless you're root. We should store the certs
in another directory writable by any user. Maybe this is something
Nikolai (CC) could help us with, I know we use fakeroot to set up the
directory structure, but I'm fuzzy on the details, so I don't know
myself which part of the tests we should exactly touch..
The constant SYSCONFDIR from module "config" might be used.
and it would be storedin our custom prefix (somewhere in /tmp ....)
We have more constants there.
"m4 template" is here src/tests/intg/config.py.m4
LS