Import Upstream version 4.12.4

This commit is contained in:
geos_one
2025-08-12 22:28:56 +02:00
parent 03a8170b15
commit 9181ee2487
1629 changed files with 874094 additions and 554378 deletions

View File

@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# Makefile.in generated by automake 1.17 from Makefile.am.
# contrib/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# Copyright (C) 1994-2024 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/freeipa
pkgincludedir = $(includedir)/freeipa
pkglibdir = $(libdir)/freeipa
@@ -157,10 +159,8 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in
am__DIST_COMMON = $(srcdir)/Makefile.in README.md
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -187,31 +187,33 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing aclocal-1.16
ACLOCAL = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' aclocal-1.17
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 1
API_VERSION = 2.239
API_VERSION = 2.254
AR = ar
AUTOCONF = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing autoconf
AUTOHEADER = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing autoheader
AUTOMAKE = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing automake-1.16
AUTOCONF = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' autoconf
AUTOHEADER = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' autoheader
AUTOMAKE = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' automake-1.17
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration
CFLAGS = -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -Wshadow -Wstrict-prototypes -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration
CMOCKA_CFLAGS =
CMOCKA_LIBS = -lcmocka
CMOCKA_LIBS = -lcmocka
CONFIG_STATUS = ./config.status
CPP = gcc -E
CPPFLAGS =
CRYPTO_CFLAGS =
CRYPTO_LIBS = -lcrypto
CRYPTO_LIBS = -lcrypto
CSCOPE = cscope
CTAGS = ctags
CYGPATH_W = echo
DATA_VERSION = 20100614120000
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DIRSRV_CFLAGS = -DUSE_OPENLDAP -I/usr/include/dirsrv -I/usr/include/nspr4
DIRSRV_LIBS = -L/usr/lib64/dirsrv -lslapd
DIRSRV_CFLAGS = -DUSE_OPENLDAP -I/usr/include/dirsrv -I/usr/include/nspr4
DIRSRV_LIBS = -L/usr/lib64/dirsrv -lslapd
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
@@ -219,17 +221,20 @@ ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /usr/bin/grep -E
ETAGS = etags
EXEEXT =
FGREP = /usr/bin/grep -F
FILECMD = file
GETTEXT_DOMAIN = ipa
GETTEXT_MACRO_VERSION = 0.18
GIT_BRANCH = ipa-4-8
GIT_BRANCH = master
GIT_VERSION =
GMSGFMT = /usr/bin/msgfmt
GMSGFMT_015 = /usr/bin/msgfmt
GREP = /usr/bin/grep
HTTPD_GROUP = apache
INI_CFLAGS =
INI_LIBS = -lini_config -lbasicobjects -lref_array -lcollection
INI_LIBS = -lini_config -lbasicobjects -lref_array -lcollection
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
@@ -240,17 +245,22 @@ INTL_MACOSX_LIBS =
IPAPLATFORM = fedora
IPA_DATA_DIR = ${datarootdir}/ipa
IPA_SYSCONF_DIR = ${prefix}/etc/ipa
JSLINT = /usr/bin/jsl
JANSSON_CFLAGS =
JANSSON_LIBS = -ljansson
JSLINT = no
KRAD_LIBS = -lkrad
KRB5KDC_SERVICE = krb5kdc.service
KRB5_BUILD_VERSION = 1.21.3
KRB5_CFLAGS =
KRB5_GSSAPI_CFLAGS =
KRB5_GSSAPI_LIBS = -lgssapi_krb5
KRB5_LIBS = -lkrb5 -lk5crypto -lcom_err
KRB5_GSSAPI_LIBS = -lgssapi_krb5
KRB5_LIBS = -lkrb5 -lk5crypto -lcom_err
LD = /usr/bin/ld -m elf_x86_64
LDAP_CFLAGS =
LDAP_LIBS = -lldap_r -llber
LDAP_LIBS = -llber -lldap
LDFLAGS =
LIBCURL_CFLAGS = -DWITH_GZFILEOP
LIBCURL_LIBS = -lcurl
LIBICONV = -liconv
LIBINTL =
LIBINTL_LIBS =
@@ -259,14 +269,14 @@ LIBPDB_NAME = samba-passdb
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBVERTO_CFLAGS =
LIBVERTO_LIBS = -lverto
LIBVERTO_LIBS = -lverto
LIPO =
LN_S = ln -s
LTLIBICONV = -liconv
LTLIBINTL =
LTLIBOBJS =
LT_SYS_LIBRARY_PATH =
MAKEINFO = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing makeinfo
MAKEINFO = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
MK_ASSIGN = =
@@ -278,17 +288,17 @@ MSGFMT = /usr/bin/msgfmt
MSGFMT_015 = /usr/bin/msgfmt
MSGMERGE = /usr/bin/msgmerge
NAMED_GROUP = named
NDRNBT_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRNBT_LIBS = -lndr-nbt -lndr -lsamba-util -ltevent -ltalloc
NDRPAC_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRPAC_LIBS = -lndr-krb5pac -lndr-standard -lndr -lsamba-util -ltevent -ltalloc
NDR_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDR_LIBS = -lndr -lsamba-util -ltevent -ltalloc
NDRNBT_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRNBT_LIBS = -lndr-nbt -lndr -lsamba-util -ltevent -ltalloc
NDRPAC_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRPAC_LIBS = -lndr-krb5pac -lndr-standard -lndr -lsamba-util -ltevent -ltalloc
NDR_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDR_LIBS = -lndr -lsamba-util -ltevent -ltalloc
NM = /usr/bin/nm -B
NMEDIT =
NSPR_CFLAGS = -I/usr/include/nspr4
NSPR_LIBS = -lplds4 -lplc4 -lnspr4 -lpthread -ldl
NUM_VERSION = 40810
NSPR_CFLAGS = -I/usr/include/nspr4
NSPR_LIBS = -lplds4 -lplc4 -lnspr4 -lpthread -ldl
NUM_VERSION = 41204
OBJDUMP = objdump
OBJEXT = o
ODS_GROUP = ods
@@ -298,69 +308,76 @@ OTOOL64 =
PACKAGE = freeipa
PACKAGE_BUGREPORT = https://hosted.fedoraproject.org/projects/freeipa/newticket
PACKAGE_NAME = freeipa
PACKAGE_STRING = freeipa 4.8.10
PACKAGE_STRING = freeipa 4.12.4
PACKAGE_TARNAME = freeipa
PACKAGE_URL =
PACKAGE_VERSION = 4.8.10
PACKAGE_VERSION = 4.12.4
PATH_SEPARATOR = :
PKG_CONFIG = /usr/bin/pkg-config
PKG_CONFIG_LIBDIR =
PKG_CONFIG_PATH =
PLATFORM_PYTHON =
POPT_CFLAGS =
POPT_LIBS = -lpopt
POPT_LIBS = -lpopt
POSUB = po
PWQUALITY_CFLAGS =
PWQUALITY_LIBS = -lpwquality
PYLINT = yes
PYTHON = /usr/bin/python
PYTHON_EXEC_PREFIX = ${exec_prefix}
PYTHON_INSTALL_EXTRA_OPTIONS =
PYTHON_PLATFORM = linux
PYTHON_PREFIX = ${prefix}
PYTHON_VERSION = 3.9
PYTHON_VERSION = 3.13
RANLIB = ranlib
RESOLV_LIBS = -lresolv
RPMLINT =
SAMBA40EXTRA_LIBPATH = -L/usr/lib64/samba -Wl,-rpath=/usr/lib64/samba
SAMBAUTIL_CFLAGS = -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1
SAMBAUTIL_LIBS = -lsamba-util -ltevent -ltalloc
SAMBAUTIL_CFLAGS = -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1
SAMBAUTIL_LIBS = -lsamba-util -ltevent -ltalloc
SAMBA_SECURITY_LIBS = samba-security-private-samba
SASL_CFLAGS =
SASL_LIBS = -lsasl2
SASL_LIBS = -lsasl2
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
SSSCERTMAP_CFLAGS =
SSSCERTMAP_LIBS = -lsss_certmap
SSSCERTMAP_LIBS = -lsss_certmap
SSSIDMAP_CFLAGS =
SSSIDMAP_LIBS = -lsss_idmap
SSSIDMAP_LIBS = -lsss_idmap
SSSNSSIDMAP_CFLAGS =
SSSNSSIDMAP_LIBS = -lsss_nss_idmap
SSSNSSIDMAP_LIBS = -lsss_nss_idmap
STRIP = strip
TALLOC_CFLAGS =
TALLOC_LIBS = -ltalloc
TALLOC_LIBS = -ltalloc
TEVENT_CFLAGS =
TEVENT_LIBS = -ltevent -ltalloc
TEVENT_LIBS = -ltevent -ltalloc
UNISTRING_LIBS = -lunistring
UNLINK = /usr/bin/unlink
USE_NLS = yes
UUID_CFLAGS = -I/usr/include/uuid
UUID_LIBS = -luuid
UUID_CFLAGS = -I/usr/include/uuid
UUID_LIBS = -luuid
VENDOR_SUFFIX =
VERSION = 4.8.10
VERSION = 4.12.4
XGETTEXT = /usr/bin/xgettext
XGETTEXT_015 = /usr/bin/xgettext
XGETTEXT_EXTRA_OPTIONS =
XMLRPC_CFLAGS =
XMLRPC_LIBS = -lxmlrpc -lxmlrpc_client -lxmlrpc_util
abs_builddir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10/contrib
abs_srcdir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10/contrib
abs_top_builddir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10
abs_top_srcdir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10
XMLRPC_LIBS =
abs_builddir = /home/antorres/dev/freeipa-clean/contrib
abs_srcdir = /home/antorres/dev/freeipa-clean/contrib
abs_top_builddir = /home/antorres/dev/freeipa-clean
abs_top_srcdir = /home/antorres/dev/freeipa-clean
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__rm_f_notfound =
am__tar = tar --format=posix -chf - "$$tardir"
am__untar = tar -xf -
am__xargs_n = xargs -n
bindir = ${exec_prefix}/bin
build = x86_64-pc-linux-gnu
build_alias =
@@ -382,7 +399,7 @@ htmldir = ${docdir}
i18ntests =
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/install-sh
install_sh = ${SHELL} /home/antorres/dev/freeipa-clean/install-sh
krb5rundir = /run/krb5kdc
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
@@ -397,8 +414,8 @@ pkgpythondir = ${pythondir}/freeipa
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
pyexecdir = ${exec_prefix}/lib64/python3.9/site-packages
pythondir = ${prefix}/lib/python3.9/site-packages
pyexecdir = ${PYTHON_EXEC_PREFIX}/lib64/python3.13/site-packages
pythondir = ${PYTHON_PREFIX}/lib/python3.13/site-packages
runstatedir = /run
sbindir = ${exec_prefix}/sbin
selinux_makefile = /usr/share/selinux/devel/Makefile
@@ -406,7 +423,8 @@ sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
sysconfenvdir = ${prefix}/etc/sysconfig
systemdsystemunitdir = /usr/lib/systemd/system
systemdcatalogdir = ${prefix}/lib/systemd/catalog
systemdsystemunitdir = ${prefix}/lib/systemd/system
systemdtmpfilesdir = ${prefix}/lib/tmpfiles.d
target_alias =
top_build_prefix = ../
@@ -553,7 +571,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -641,8 +658,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -734,3 +751,10 @@ uninstall-am:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

View File

@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# Makefile.in generated by automake 1.17 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# Copyright (C) 1994-2024 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -157,10 +159,8 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in
am__DIST_COMMON = $(srcdir)/Makefile.in README.md
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -206,6 +206,8 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
CRYPTO_LIBS = @CRYPTO_LIBS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DATA_VERSION = @DATA_VERSION@
DEFS = @DEFS@
@@ -219,8 +221,10 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_DOMAIN = @GETTEXT_DOMAIN@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GIT_BRANCH = @GIT_BRANCH@
@@ -228,6 +232,7 @@ GIT_VERSION = @GIT_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
HTTPD_GROUP = @HTTPD_GROUP@
INI_CFLAGS = @INI_CFLAGS@
INI_LIBS = @INI_LIBS@
INSTALL = @INSTALL@
@@ -240,9 +245,12 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
IPAPLATFORM = @IPAPLATFORM@
IPA_DATA_DIR = @IPA_DATA_DIR@
IPA_SYSCONF_DIR = @IPA_SYSCONF_DIR@
JANSSON_CFLAGS = @JANSSON_CFLAGS@
JANSSON_LIBS = @JANSSON_LIBS@
JSLINT = @JSLINT@
KRAD_LIBS = @KRAD_LIBS@
KRB5KDC_SERVICE = @KRB5KDC_SERVICE@
KRB5_BUILD_VERSION = @KRB5_BUILD_VERSION@
KRB5_CFLAGS = @KRB5_CFLAGS@
KRB5_GSSAPI_CFLAGS = @KRB5_GSSAPI_CFLAGS@
KRB5_GSSAPI_LIBS = @KRB5_GSSAPI_LIBS@
@@ -251,6 +259,8 @@ LD = @LD@
LDAP_CFLAGS = @LDAP_CFLAGS@
LDAP_LIBS = @LDAP_LIBS@
LDFLAGS = @LDFLAGS@
LIBCURL_CFLAGS = @LIBCURL_CFLAGS@
LIBCURL_LIBS = @LIBCURL_LIBS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_LIBS = @LIBINTL_LIBS@
@@ -310,6 +320,8 @@ PLATFORM_PYTHON = @PLATFORM_PYTHON@
POPT_CFLAGS = @POPT_CFLAGS@
POPT_LIBS = @POPT_LIBS@
POSUB = @POSUB@
PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
PWQUALITY_LIBS = @PWQUALITY_LIBS@
PYLINT = @PYLINT@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
@@ -318,9 +330,12 @@ PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
RESOLV_LIBS = @RESOLV_LIBS@
RPMLINT = @RPMLINT@
SAMBA40EXTRA_LIBPATH = @SAMBA40EXTRA_LIBPATH@
SAMBAUTIL_CFLAGS = @SAMBAUTIL_CFLAGS@
SAMBAUTIL_LIBS = @SAMBAUTIL_LIBS@
SAMBA_SECURITY_LIBS = @SAMBA_SECURITY_LIBS@
SASL_CFLAGS = @SASL_CFLAGS@
SASL_LIBS = @SASL_LIBS@
SED = @SED@
@@ -359,8 +374,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -406,6 +423,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
sysconfenvdir = @sysconfenvdir@
systemdcatalogdir = @systemdcatalogdir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target_alias = @target_alias@
@@ -553,7 +571,6 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -641,8 +658,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -734,3 +751,10 @@ uninstall-am:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

118
contrib/README.md Normal file
View File

@@ -0,0 +1,118 @@
# In-tree development debugging and testing
lite-server and lite-client enable fast development, debugging, and
performance analysis of server or client code from an in-tree source
directory. The lite-server runs a local web server that uses a remote
LDAP and KRB5 server.
## Prerequisites
### Remote IPA server
Lite-server and lite-client require a running IPA server. The server
should have a similar LDAP schema and IPA version as the in-tree
sources. Some features may not work if the differences are too great.
The lite-server only needs a working LDAP server and KRB5 server. For
KdcProxy or CA-related features the Apache HTTPd and pki-tomcatd service
must be running, too.
If the lite-client is configured for remote-server instead of
lite-server, then the lite-client uses the HTTP API of the remote
server.
### Local setup
1. Configure and build FreeIPA according to ``BUILD.txt``, TL;DR
```
$ sudo dnf builddep -b --spec freeipa.spec.in --best --allowerasing --setopt=install_weak_deps=False
$ ./autogen.sh
$ make
```
2. Install additional dependencies for the lite-server
```
sudo dnf install -y python3-werkzeug python3-watchdog
```
3. The FQDN of the remote IPA server must be resolvable. In case the
server does not have a valid DNS entry, it is possible to add the
hostname and IP address to ``/etc/hosts``.
4. Create configuration files in ``~/.ipa``. The lite-server requires
an IPA configuration, CA certificate file, KRB5 configuration,
Kerberos TGT and a file based credential cache. The script
``contrib/lite-setup.py`` can create a all necessary files for you
and sets up ``default.conf``, ``krb5.conf``, ``ca.crt``, and
even ``ldap.conf``:
```
$ contrib/lite-setup.py master.ipa.example
```
5. Setup environment variables: the lite-setup script also creates a
shell source file that activates a virtualenv like environment. The
source files sets several environment variables for PATH, KRB5, LDAP,
IPA, and Python. The env allows you to run the lite server, ``ipa``
client commands, or OpenLDAP commands:
```
$ source ~/.ipa/activate.sh
```
4. Acquire a TGT
```
(ipaenv) $ kinit username
```
5. Run the lite-server
```
(ipaenv) $ make lite-server
```
6. Run ``ipa`` client commands in another shell session. The lite-setup
scripts provides a wrapper that uses the development sources, too.
```
$ source ~/.ipa/activate.sh
(ipaenv) $ which ipa
~/.ipa/ipa
(ipaenv) $ ipa ping
```
7. Deactivate the environment
```
(ipaenv) $ deactivate_ipaenv
```
## Limitations
The lite-server does not have access to the ra-agent certificate.
Therefore most CA and KRA (vault) operations are not supported.
## Tricks and tips
The lite-server has a functional Web UI at
http://localhost:8888/ipa/xml. The session is already authenticated
with the current TGT.
The lite-setup script has additional options
* ``--kdcproxy`` configures ``krb5.conf`` for Kerberos over HTTPS
* ``--debug`` enables IPA and KRB5 debugging
* ``--remote-server`` lets you run local client commands without a
local lite-server.
The ``make lite-server`` command supports arguments like
``PYTHON=/path/to/custom/interpreter`` or
``LITESERVER_ARGS='--enable-profiler=-'``.
By default the dev server supports HTTP only. To switch to HTTPS, you
can put a PEM file at ~/.ipa/lite.pem. The PEM file must contain a
server certificate, its unencrypted private key and intermediate chain
certs (if applicable).

118
contrib/cachelog Normal file
View File

@@ -0,0 +1,118 @@
#!/usr/bin/python3
#
# Copyright (C) 2021 FreeIPA Contributors see COPYING for license
#
# 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.
#
# 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 __future__ import division
from datetime import datetime
import logging
import re
from ipapython import admintool
from ipalib.facts import is_ipa_configured
# r'(?P<command>\S+)/1\(.*\): (?P<result>\S+) etime=(?P<etime>\d+)'
TIME_RE = re.compile(
r'\[(?P<date>.*)\] \[.*\].* \[pid \d+:tid \d+\] \[remote .*\] '
r'ipa: DEBUG: FINAL: Hits (?P<hits>\d+) Misses (?P<misses>\d+) '
r'Size (?P<size>\d+)'
)
DATE_FORMAT = '%a %b %d %H:%M:%S.%f %Y'
logger = logging.getLogger(__name__)
class cachelog(admintool.AdminTool):
command_name = "cachelog"
usage = "%prog [options]"
description = "Parse the Apache error log for cache performance data. " \
"Enable debugging by creating /etc/ipa/server.conf with " \
"the contents: [global]\\ndebug = True"
def __init__(self, options, args):
super(cachelog, self).__init__(options, args)
self.since = None
@classmethod
def add_options(cls, parser):
super(cachelog, cls).add_options(parser, debug_option=True)
parser.add_option(
"--command",
dest="command",
action="store",
default=None,
help="Command to analyze",
)
parser.add_option(
"--start-time",
dest="start_time",
action="store",
default=None,
help="time to begin analyzing logfile from, e.g. "
"Fri May 7 16:33:08.0 2021",
)
parser.add_option(
"--file",
dest="file",
action="store",
default="/var/log/httpd/error_log",
help="Log file to parse",
)
def validate_options(self):
super(cachelog, self).validate_options(needs_root=True)
if self.options.start_time:
self.since = datetime.strptime(
self.options.start_time,
DATE_FORMAT
)
def run(self):
super(cachelog, self).run()
if not is_ipa_configured():
logger.error("IPA server is not configured on this system.")
raise admintool.ScriptError()
with open(self.options.file, 'r') as f:
data = f.read()
matches = list(re.finditer(TIME_RE, data))
hits = 0
misses = 0
count = 0
for match in matches:
if self.since:
logtime = datetime.strptime(match.group('date'), DATE_FORMAT)
if logtime < self.since:
continue
hits += int(match.group('hits'))
misses += int(match.group('misses'))
count += 1
print('Total reads %d, hits %d, misses %d, avg %1.4f' %
(hits + misses, hits, misses, hits / (hits + misses)))
if __name__ == '__main__':
cachelog.run_cli()

View File

@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# Makefile.in generated by automake 1.17 from Makefile.am.
# contrib/completion/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# Copyright (C) 1994-2024 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -70,6 +70,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/freeipa
pkgincludedir = $(includedir)/freeipa
pkglibdir = $(libdir)/freeipa
@@ -128,10 +130,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__installdirs = "$(DESTDIR)$(bashcompdir)"
SCRIPTS = $(bashcomp_SCRIPTS)
@@ -157,31 +158,33 @@ am__can_run_installinfo = \
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing aclocal-1.16
ACLOCAL = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' aclocal-1.17
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 1
API_VERSION = 2.239
API_VERSION = 2.254
AR = ar
AUTOCONF = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing autoconf
AUTOHEADER = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing autoheader
AUTOMAKE = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing automake-1.16
AUTOCONF = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' autoconf
AUTOHEADER = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' autoheader
AUTOMAKE = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' automake-1.17
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration
CFLAGS = -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -Wshadow -Wstrict-prototypes -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration
CMOCKA_CFLAGS =
CMOCKA_LIBS = -lcmocka
CMOCKA_LIBS = -lcmocka
CONFIG_STATUS = ./config.status
CPP = gcc -E
CPPFLAGS =
CRYPTO_CFLAGS =
CRYPTO_LIBS = -lcrypto
CRYPTO_LIBS = -lcrypto
CSCOPE = cscope
CTAGS = ctags
CYGPATH_W = echo
DATA_VERSION = 20100614120000
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DIRSRV_CFLAGS = -DUSE_OPENLDAP -I/usr/include/dirsrv -I/usr/include/nspr4
DIRSRV_LIBS = -L/usr/lib64/dirsrv -lslapd
DIRSRV_CFLAGS = -DUSE_OPENLDAP -I/usr/include/dirsrv -I/usr/include/nspr4
DIRSRV_LIBS = -L/usr/lib64/dirsrv -lslapd
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
@@ -189,17 +192,20 @@ ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /usr/bin/grep -E
ETAGS = etags
EXEEXT =
FGREP = /usr/bin/grep -F
FILECMD = file
GETTEXT_DOMAIN = ipa
GETTEXT_MACRO_VERSION = 0.18
GIT_BRANCH = ipa-4-8
GIT_BRANCH = master
GIT_VERSION =
GMSGFMT = /usr/bin/msgfmt
GMSGFMT_015 = /usr/bin/msgfmt
GREP = /usr/bin/grep
HTTPD_GROUP = apache
INI_CFLAGS =
INI_LIBS = -lini_config -lbasicobjects -lref_array -lcollection
INI_LIBS = -lini_config -lbasicobjects -lref_array -lcollection
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
@@ -210,17 +216,22 @@ INTL_MACOSX_LIBS =
IPAPLATFORM = fedora
IPA_DATA_DIR = ${datarootdir}/ipa
IPA_SYSCONF_DIR = ${prefix}/etc/ipa
JSLINT = /usr/bin/jsl
JANSSON_CFLAGS =
JANSSON_LIBS = -ljansson
JSLINT = no
KRAD_LIBS = -lkrad
KRB5KDC_SERVICE = krb5kdc.service
KRB5_BUILD_VERSION = 1.21.3
KRB5_CFLAGS =
KRB5_GSSAPI_CFLAGS =
KRB5_GSSAPI_LIBS = -lgssapi_krb5
KRB5_LIBS = -lkrb5 -lk5crypto -lcom_err
KRB5_GSSAPI_LIBS = -lgssapi_krb5
KRB5_LIBS = -lkrb5 -lk5crypto -lcom_err
LD = /usr/bin/ld -m elf_x86_64
LDAP_CFLAGS =
LDAP_LIBS = -lldap_r -llber
LDAP_LIBS = -llber -lldap
LDFLAGS =
LIBCURL_CFLAGS = -DWITH_GZFILEOP
LIBCURL_LIBS = -lcurl
LIBICONV = -liconv
LIBINTL =
LIBINTL_LIBS =
@@ -229,14 +240,14 @@ LIBPDB_NAME = samba-passdb
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBVERTO_CFLAGS =
LIBVERTO_LIBS = -lverto
LIBVERTO_LIBS = -lverto
LIPO =
LN_S = ln -s
LTLIBICONV = -liconv
LTLIBINTL =
LTLIBOBJS =
LT_SYS_LIBRARY_PATH =
MAKEINFO = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/missing makeinfo
MAKEINFO = ${SHELL} '/home/antorres/dev/freeipa-clean/missing' makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
MK_ASSIGN = =
@@ -248,17 +259,17 @@ MSGFMT = /usr/bin/msgfmt
MSGFMT_015 = /usr/bin/msgfmt
MSGMERGE = /usr/bin/msgmerge
NAMED_GROUP = named
NDRNBT_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRNBT_LIBS = -lndr-nbt -lndr -lsamba-util -ltevent -ltalloc
NDRPAC_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRPAC_LIBS = -lndr-krb5pac -lndr-standard -lndr -lsamba-util -ltevent -ltalloc
NDR_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDR_LIBS = -lndr -lsamba-util -ltevent -ltalloc
NDRNBT_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRNBT_LIBS = -lndr-nbt -lndr -lsamba-util -ltevent -ltalloc
NDRPAC_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDRPAC_LIBS = -lndr-krb5pac -lndr-standard -lndr -lsamba-util -ltevent -ltalloc
NDR_CFLAGS = -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1
NDR_LIBS = -lndr -lsamba-util -ltevent -ltalloc
NM = /usr/bin/nm -B
NMEDIT =
NSPR_CFLAGS = -I/usr/include/nspr4
NSPR_LIBS = -lplds4 -lplc4 -lnspr4 -lpthread -ldl
NUM_VERSION = 40810
NSPR_CFLAGS = -I/usr/include/nspr4
NSPR_LIBS = -lplds4 -lplc4 -lnspr4 -lpthread -ldl
NUM_VERSION = 41204
OBJDUMP = objdump
OBJEXT = o
ODS_GROUP = ods
@@ -268,69 +279,76 @@ OTOOL64 =
PACKAGE = freeipa
PACKAGE_BUGREPORT = https://hosted.fedoraproject.org/projects/freeipa/newticket
PACKAGE_NAME = freeipa
PACKAGE_STRING = freeipa 4.8.10
PACKAGE_STRING = freeipa 4.12.4
PACKAGE_TARNAME = freeipa
PACKAGE_URL =
PACKAGE_VERSION = 4.8.10
PACKAGE_VERSION = 4.12.4
PATH_SEPARATOR = :
PKG_CONFIG = /usr/bin/pkg-config
PKG_CONFIG_LIBDIR =
PKG_CONFIG_PATH =
PLATFORM_PYTHON =
POPT_CFLAGS =
POPT_LIBS = -lpopt
POPT_LIBS = -lpopt
POSUB = po
PWQUALITY_CFLAGS =
PWQUALITY_LIBS = -lpwquality
PYLINT = yes
PYTHON = /usr/bin/python
PYTHON_EXEC_PREFIX = ${exec_prefix}
PYTHON_INSTALL_EXTRA_OPTIONS =
PYTHON_PLATFORM = linux
PYTHON_PREFIX = ${prefix}
PYTHON_VERSION = 3.9
PYTHON_VERSION = 3.13
RANLIB = ranlib
RESOLV_LIBS = -lresolv
RPMLINT =
SAMBA40EXTRA_LIBPATH = -L/usr/lib64/samba -Wl,-rpath=/usr/lib64/samba
SAMBAUTIL_CFLAGS = -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1
SAMBAUTIL_LIBS = -lsamba-util -ltevent -ltalloc
SAMBAUTIL_CFLAGS = -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1
SAMBAUTIL_LIBS = -lsamba-util -ltevent -ltalloc
SAMBA_SECURITY_LIBS = samba-security-private-samba
SASL_CFLAGS =
SASL_LIBS = -lsasl2
SASL_LIBS = -lsasl2
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
SSSCERTMAP_CFLAGS =
SSSCERTMAP_LIBS = -lsss_certmap
SSSCERTMAP_LIBS = -lsss_certmap
SSSIDMAP_CFLAGS =
SSSIDMAP_LIBS = -lsss_idmap
SSSIDMAP_LIBS = -lsss_idmap
SSSNSSIDMAP_CFLAGS =
SSSNSSIDMAP_LIBS = -lsss_nss_idmap
SSSNSSIDMAP_LIBS = -lsss_nss_idmap
STRIP = strip
TALLOC_CFLAGS =
TALLOC_LIBS = -ltalloc
TALLOC_LIBS = -ltalloc
TEVENT_CFLAGS =
TEVENT_LIBS = -ltevent -ltalloc
TEVENT_LIBS = -ltevent -ltalloc
UNISTRING_LIBS = -lunistring
UNLINK = /usr/bin/unlink
USE_NLS = yes
UUID_CFLAGS = -I/usr/include/uuid
UUID_LIBS = -luuid
UUID_CFLAGS = -I/usr/include/uuid
UUID_LIBS = -luuid
VENDOR_SUFFIX =
VERSION = 4.8.10
VERSION = 4.12.4
XGETTEXT = /usr/bin/xgettext
XGETTEXT_015 = /usr/bin/xgettext
XGETTEXT_EXTRA_OPTIONS =
XMLRPC_CFLAGS =
XMLRPC_LIBS = -lxmlrpc -lxmlrpc_client -lxmlrpc_util
abs_builddir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10/contrib/completion
abs_srcdir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10/contrib/completion
abs_top_builddir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10
abs_top_srcdir = /home/abokovoy/src/freeipa-build/freeipa-4-8-10
XMLRPC_LIBS =
abs_builddir = /home/antorres/dev/freeipa-clean/contrib/completion
abs_srcdir = /home/antorres/dev/freeipa-clean/contrib/completion
abs_top_builddir = /home/antorres/dev/freeipa-clean
abs_top_srcdir = /home/antorres/dev/freeipa-clean
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__rm_f_notfound =
am__tar = tar --format=posix -chf - "$$tardir"
am__untar = tar -xf -
am__xargs_n = xargs -n
bindir = ${exec_prefix}/bin
build = x86_64-pc-linux-gnu
build_alias =
@@ -352,7 +370,7 @@ htmldir = ${docdir}
i18ntests =
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/abokovoy/src/freeipa-build/freeipa-4-8-10/install-sh
install_sh = ${SHELL} /home/antorres/dev/freeipa-clean/install-sh
krb5rundir = /run/krb5kdc
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
@@ -367,8 +385,8 @@ pkgpythondir = ${pythondir}/freeipa
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
pyexecdir = ${exec_prefix}/lib64/python3.9/site-packages
pythondir = ${prefix}/lib/python3.9/site-packages
pyexecdir = ${PYTHON_EXEC_PREFIX}/lib64/python3.13/site-packages
pythondir = ${PYTHON_PREFIX}/lib/python3.13/site-packages
runstatedir = /run
sbindir = ${exec_prefix}/sbin
selinux_makefile = /usr/share/selinux/devel/Makefile
@@ -376,7 +394,8 @@ sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
sysconfenvdir = ${prefix}/etc/sysconfig
systemdsystemunitdir = /usr/lib/systemd/system
systemdcatalogdir = ${prefix}/lib/systemd/catalog
systemdsystemunitdir = ${prefix}/lib/systemd/system
systemdtmpfilesdir = ${prefix}/lib/tmpfiles.d
target_alias =
top_build_prefix = ../../
@@ -465,7 +484,6 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -530,8 +548,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -623,3 +641,10 @@ uninstall-am: uninstall-bashcompSCRIPTS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

View File

@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# Makefile.in generated by automake 1.17 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# Copyright (C) 1994-2024 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -70,6 +70,8 @@ am__make_running_with_option = \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
am__rm_f = rm -f $(am__rm_f_notfound)
am__rm_rf = rm -rf $(am__rm_f_notfound)
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -128,10 +130,9 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
{ test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
}
am__installdirs = "$(DESTDIR)$(bashcompdir)"
SCRIPTS = $(bashcomp_SCRIPTS)
@@ -176,6 +177,8 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CRYPTO_CFLAGS = @CRYPTO_CFLAGS@
CRYPTO_LIBS = @CRYPTO_LIBS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CYGPATH_W = @CYGPATH_W@
DATA_VERSION = @DATA_VERSION@
DEFS = @DEFS@
@@ -189,8 +192,10 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GETTEXT_DOMAIN = @GETTEXT_DOMAIN@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GIT_BRANCH = @GIT_BRANCH@
@@ -198,6 +203,7 @@ GIT_VERSION = @GIT_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
HTTPD_GROUP = @HTTPD_GROUP@
INI_CFLAGS = @INI_CFLAGS@
INI_LIBS = @INI_LIBS@
INSTALL = @INSTALL@
@@ -210,9 +216,12 @@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
IPAPLATFORM = @IPAPLATFORM@
IPA_DATA_DIR = @IPA_DATA_DIR@
IPA_SYSCONF_DIR = @IPA_SYSCONF_DIR@
JANSSON_CFLAGS = @JANSSON_CFLAGS@
JANSSON_LIBS = @JANSSON_LIBS@
JSLINT = @JSLINT@
KRAD_LIBS = @KRAD_LIBS@
KRB5KDC_SERVICE = @KRB5KDC_SERVICE@
KRB5_BUILD_VERSION = @KRB5_BUILD_VERSION@
KRB5_CFLAGS = @KRB5_CFLAGS@
KRB5_GSSAPI_CFLAGS = @KRB5_GSSAPI_CFLAGS@
KRB5_GSSAPI_LIBS = @KRB5_GSSAPI_LIBS@
@@ -221,6 +230,8 @@ LD = @LD@
LDAP_CFLAGS = @LDAP_CFLAGS@
LDAP_LIBS = @LDAP_LIBS@
LDFLAGS = @LDFLAGS@
LIBCURL_CFLAGS = @LIBCURL_CFLAGS@
LIBCURL_LIBS = @LIBCURL_LIBS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBINTL_LIBS = @LIBINTL_LIBS@
@@ -280,6 +291,8 @@ PLATFORM_PYTHON = @PLATFORM_PYTHON@
POPT_CFLAGS = @POPT_CFLAGS@
POPT_LIBS = @POPT_LIBS@
POSUB = @POSUB@
PWQUALITY_CFLAGS = @PWQUALITY_CFLAGS@
PWQUALITY_LIBS = @PWQUALITY_LIBS@
PYLINT = @PYLINT@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
@@ -288,9 +301,12 @@ PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
RESOLV_LIBS = @RESOLV_LIBS@
RPMLINT = @RPMLINT@
SAMBA40EXTRA_LIBPATH = @SAMBA40EXTRA_LIBPATH@
SAMBAUTIL_CFLAGS = @SAMBAUTIL_CFLAGS@
SAMBAUTIL_LIBS = @SAMBAUTIL_LIBS@
SAMBA_SECURITY_LIBS = @SAMBA_SECURITY_LIBS@
SASL_CFLAGS = @SASL_CFLAGS@
SASL_LIBS = @SASL_LIBS@
SED = @SED@
@@ -329,8 +345,10 @@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__rm_f_notfound = @am__rm_f_notfound@
am__tar = @am__tar@
am__untar = @am__untar@
am__xargs_n = @am__xargs_n@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -376,6 +394,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
sysconfenvdir = @sysconfenvdir@
systemdcatalogdir = @systemdcatalogdir@
systemdsystemunitdir = @systemdsystemunitdir@
systemdtmpfilesdir = @systemdtmpfilesdir@
target_alias = @target_alias@
@@ -465,7 +484,6 @@ ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
@@ -530,8 +548,8 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-$(am__rm_f) $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -623,3 +641,10 @@ uninstall-am: uninstall-bashcompSCRIPTS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
# Tell GNU make to disable its built-in pattern rules.
%:: %,v
%:: RCS/%,v
%:: RCS/%
%:: s.%
%:: SCCS/s.%

View File

@@ -1,86 +1,37 @@
#!/usr/bin/env python3
#!/usr/bin/python3
#
# Copyright (C) 2017 FreeIPA Contributors see COPYING for license
#
"""In-tree development server
The dev server requires a Kerberos TGT and a file based credential cache:
$ mkdir -p ~/.ipa
$ export KRB5CCNAME=~/.ipa/ccache
$ kinit admin
$ make lite-server
Optionally you can set KRB5_CONFIG to use a custom Kerberos configuration
instead of /etc/krb5.conf.
To run the lite-server with another Python interpreter:
$ make lite-server PYTHON=/path/to/bin/python
To enable profiling:
$ make lite-server LITESERVER_ARGS='--enable-profiler=-'
By default the dev server supports HTTP only. To switch to HTTPS, you can put
a PEM file at ~/.ipa/lite.pem. The PEM file must contain a server certificate,
its unencrypted private key and intermediate chain certs (if applicable).
Prerequisite
------------
Additionally to build and runtime requirements of FreeIPA, the dev server
depends on the werkzeug framework and optionally watchdog for auto-reloading.
You may also have to enable a development COPR.
$ sudo dnf install -y dnf-plugins-core
$ sudo dnf builddep --spec freeipa.spec.in
$ sudo dnf install -y python3-werkzeug python3-watchdog
$ ./autogen.sh
For more information see
* http://www.freeipa.org/page/Build
* http://www.freeipa.org/page/Testing
See README.md for more details.
"""
from __future__ import print_function
import logging
import linecache
import os
import optparse # pylint: disable=deprecated-module
import ssl
import sys
import time
import tracemalloc
import warnings
import ipalib
from ipalib import api
from ipalib.errors import NetworkError
from ipalib.krb_utils import krb5_parse_ccache
from ipalib.krb_utils import krb5_unparse_ccache
# Don't import any ipa modules here so tracemalloc can trace memory usage.
import gssapi
# pylint: disable=import-error
from werkzeug.contrib.profiler import ProfilerMiddleware
from werkzeug.middleware.profiler import ProfilerMiddleware
from werkzeug.exceptions import NotFound
from werkzeug.serving import run_simple
from werkzeug.utils import redirect, append_slash_redirect
from werkzeug.wsgi import DispatcherMiddleware, SharedDataMiddleware
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.middleware.shared_data import SharedDataMiddleware
# pylint: enable=import-error
logger = logging.getLogger(os.path.basename(__file__))
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
IMPORTDIR = os.path.dirname(os.path.dirname(os.path.abspath(ipalib.__file__)))
if BASEDIR != IMPORTDIR:
warnings.warn(
"ipalib was imported from '{}' instead of '{}'!".format(
IMPORTDIR, BASEDIR),
RuntimeWarning
)
STATIC_FILES = {
'/ipa/ui': os.path.join(BASEDIR, 'install/ui'),
@@ -90,20 +41,52 @@ STATIC_FILES = {
}
def display_tracemalloc(snapshot, key_type='lineno', limit=10):
snapshot = snapshot.filter_traces((
tracemalloc.Filter(False, "<frozen importlib._bootstrap*"),
tracemalloc.Filter(False, "<unknown>"),
tracemalloc.Filter(False, "*/idna/*.py"),
))
top_stats = snapshot.statistics(key_type)
print("Top {} lines".format(limit))
for index, stat in enumerate(top_stats[:limit], 1):
frame = stat.traceback[0]
# replace "/path/to/module/file.py" with "module/file.py"
filename = os.sep.join(frame.filename.split(os.sep)[-2:])
print("#{}: {}:{}: {:.1f} KiB".format(
index, filename, frame.lineno, stat.size // 1024))
line = linecache.getline(frame.filename, frame.lineno).strip()
if line:
print(' {}'.format(line))
other = top_stats[limit:]
if other:
size = sum(stat.size for stat in other)
print("{} other: {:.1f} KiB".format(len(other), size // 1024))
total = sum(stat.size for stat in top_stats)
current, peak = tracemalloc.get_traced_memory()
print("Total allocated size: {:8.1f} KiB".format(total // 1024))
print("Current size: {:8.1f} KiB".format(current // 1024))
print("Peak size: {:8.1f} KiB".format(peak // 1024))
def get_ccname():
"""Retrieve and validate Kerberos credential cache
Only FILE schema is supported.
"""
from ipalib import krb_utils
ccname = os.environ.get('KRB5CCNAME')
if ccname is None:
raise ValueError("KRB5CCNAME env var is not set.")
scheme, location = krb5_parse_ccache(ccname)
scheme, location = krb_utils.krb5_parse_ccache(ccname)
if scheme != 'FILE': # MEMORY makes no sense
raise ValueError("Unsupported KRB5CCNAME scheme {}".format(scheme))
if not os.path.isfile(location):
raise ValueError("KRB5CCNAME file '{}' does not exit".format(location))
return krb5_unparse_ccache(scheme, location)
return krb_utils.krb5_unparse_ccache(scheme, location)
class KRBCheater:
@@ -123,6 +106,22 @@ class KRBCheater:
return self.app(environ, start_response)
class TracemallocMiddleware:
def __init__(self, app, api):
self.app = app
self.api = api
def __call__(self, environ, start_response):
# We are only interested in request traces.
# Each request is handled in a new process.
tracemalloc.clear_traces()
try:
return self.app(environ, start_response)
finally:
snapshot = tracemalloc.take_snapshot()
display_tracemalloc(snapshot, limit=self.api.env.lite_tracemalloc)
class StaticFilesMiddleware(SharedDataMiddleware):
def get_directory_loader(self, directory):
# override directory loader to support index.html
@@ -143,6 +142,18 @@ class StaticFilesMiddleware(SharedDataMiddleware):
def init_api(ccname):
"""Initialize FreeIPA API from command line
"""
from ipalib import __file__ as ipalib_file
from ipalib import api
from ipalib.errors import NetworkError
importdir = os.path.dirname(os.path.dirname(os.path.abspath(ipalib_file)))
if importdir != BASEDIR:
warnings.warn(
"ipalib was imported from '{}' instead of '{}'!".format(
importdir, BASEDIR),
RuntimeWarning
)
parser = optparse.OptionParser()
parser.add_option(
@@ -169,6 +180,12 @@ def init_api(ccname):
default=None,
type='str',
)
parser.add_option(
'--enable-tracemalloc',
help="Enable memory tracer",
default=0,
type='int',
)
api.env.in_server = True
api.env.startup_traceback = True
@@ -185,11 +202,12 @@ def init_api(ccname):
lite_host=options.host,
webui_prod=options.prod,
lite_profiler=options.enable_profiler,
lite_tracemalloc=options.enable_tracemalloc,
lite_pem=api.env._join('dot_ipa', 'lite.pem'),
)
api.finalize()
api_time = time.time()
logger.info("API initialized in %03f sec", api_time - start_time)
logger.info("API initialized in %0.3f sec", api_time - start_time)
# Validate LDAP connection and pre-fetch schema
# Pre-fetching makes the lite-server behave similar to mod_wsgi. werkzeug's
@@ -213,7 +231,9 @@ def init_api(ccname):
# must have its own connection.
ldap2.disconnect()
ldap_time = time.time()
logger.info("LDAP schema retrieved %03f sec", ldap_time - api_time)
logger.info("LDAP schema retrieved %0.3f sec", ldap_time - api_time)
return api
def redirect_ui(app):
@@ -236,6 +256,10 @@ def redirect_ui(app):
def main():
# workaround, start tracing IPA imports and API init ASAP
if any('--enable-tracemalloc' in arg for arg in sys.argv):
tracemalloc.start()
try:
ccname = get_ccname()
except ValueError as e:
@@ -246,7 +270,15 @@ def main():
print(" kinit\n", file=sys.stderr)
sys.exit(1)
init_api(ccname)
api = init_api(ccname)
if api.env.lite_tracemalloc:
# print memory snapshot of import + init
snapshot = tracemalloc.take_snapshot()
display_tracemalloc(snapshot, limit=api.env.lite_tracemalloc)
del snapshot
# From here on, only trace requests.
tracemalloc.clear_traces()
if os.path.isfile(api.env.lite_pem):
ctx = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
@@ -270,6 +302,9 @@ def main():
))
app = ProfilerMiddleware(app, profile_dir=profile_dir)
if api.env.lite_tracemalloc:
app = TracemallocMiddleware(app, api)
app = StaticFilesMiddleware(app, STATIC_FILES)
app = redirect_ui(app)

192
contrib/lite-setup.py Executable file
View File

@@ -0,0 +1,192 @@
#!/usr/bin/python3
#
# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
#
"""Configure lite-server environment.
See README.md for more details.
"""
import argparse
import os
import socket
from urllib.request import urlopen
DEFAULT_CONF = """\
[global]
host = {args.hostname}
server = {args.servername}
basedn = {args.basedn}
realm = {args.realm}
domain = {args.domain}
xmlrpc_uri = {args.xmlrpc_uri}
ldap_uri = ldap://{args.servername}
debug = {args.debug}
enable_ra = False
ra_plugin = dogtag
dogtag_version = 10
"""
KRB5_CONF = """\
[libdefaults]
default_realm = {args.realm}
dns_lookup_realm = false
dns_lookup_kdc = false
rdns = false
ticket_lifetime = 24h
forwardable = true
udp_preference_limit = 0
default_ccache_name = FILE:{args.ccache}
[realms]
{args.realm} = {{
kdc = {args.kdc}
master_kdc = {args.kdc}
admin_server = {args.kadmin}
default_domain = ipa.example
pkinit_anchors = FILE:{args.ca_crt}
pkinit_pool = FILE:{args.ca_crt}
http_anchors = FILE:{args.ca_crt}
}}
[domain_realm]
.ipa.example = {args.realm}
ipa.example = {args.realm}
{args.servername} = {args.realm}
"""
LDAP_CONF = """\
URI ldaps://{args.servername}
BASE {args.basedn}
TLS_CACERT {args.ca_crt}
SASL_MECH GSSAPI
SASL_NOCANON on
"""
IPA_BIN = """\
#!/bin/sh
exec python3 -m ipaclient $*
"""
ACTIVATE = """\
deactivate_ipaenv () {{
export PS1="${{_OLD_IPAENV_PS1}}"
export PATH="${{_OLD_IPAENV_PATH}}"
unset _OLD_IPAENV_PS1
unset _OLD_IPAENV_PATH
unset KRB5_CONFIG
unset KRB5CCNAME
unset LDAPCONF
unset IPA_CONFDIR
unset PYTHONPATH
unset -f deactivate_ipaenv
}}
export _OLD_IPAENV_PS1="${{PS1:-}}"
export _OLD_IPAENV_PATH="${{PATH:-}}"
export PS1="(ipaenv) ${{PS1:-}}"
export PATH="{args.dot_ipa}:${{PATH:-}}"
export KRB5_CONFIG="{args.krb5_conf}"
export KRB5CCNAME="{args.ccache}"
{args.tracecomment}export KRB5_TRACE=/dev/stderr
export LDAPCONF="{args.ldap_conf}"
export IPA_CONFDIR="{args.dot_ipa}"
export PYTHONPATH="{args.basedir}"
"""
MSG = """\
Configured for server '{args.servername}' and realm '{args.realm}'.
To activate the IPA test env:
source {args.activate}
kinit
make lite-server
To deactivate the IPA test env and to unset the env vars:
deactivate_ipaenv
The source file configures the env vars:
export KRB5_CONFIG="{args.krb5_conf}"
export KRB5CCNAME="{args.ccache}"
export LDAPCONF="{args.ldap_conf}"
export IPA_CONFDIR="{args.dot_ipa}"
export PYTHONPATH="{args.basedir}"
"""
parser = argparse.ArgumentParser()
parser.add_argument("servername", help="IPA server name")
parser.add_argument("domain", default=None, nargs="?")
parser.add_argument(
"--kdcproxy", action="store_true", help="Use KRB5 over HTTPS (KDC-Proxy)"
)
parser.add_argument(
"--debug",
action="store_true",
help="Enable debug mode for lite-server and KRB5",
)
parser.add_argument(
"--remote-server",
action="store_true",
help="Configure client to use a remote server instead of lite-server",
)
def main():
args = parser.parse_args()
if args.domain is None:
args.domain = args.servername.lower().split(".", 1)[1]
else:
args.domain = args.domain.lower().rstrip(".")
args.realm = args.domain.upper()
args.hostname = socket.gethostname()
args.basedn = ",".join(f"dc={part}" for part in args.domain.split("."))
args.tracecomment = "" if args.debug else "#"
if args.kdcproxy:
args.kdc = f"https://{args.servername}/KdcProxy"
args.kadmin = f"https://{args.servername}/KdcProxy"
else:
args.kdc = f"{args.servername}:88"
args.kadmin = f"{args.servername}:749"
if args.remote_server:
args.xmlrpc_uri = f"https://{args.servername}/ipa/xml"
else:
args.xmlrpc_uri = f"http://localhost:8888/ipa/xml"
args.basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
args.dot_ipa = os.path.expanduser("~/.ipa")
args.default_conf = os.path.join(args.dot_ipa, "default.conf")
args.ca_crt = os.path.join(args.dot_ipa, "ca.crt")
args.krb5_conf = os.path.join(args.dot_ipa, "krb5.conf")
args.ldap_conf = os.path.join(args.dot_ipa, "ldap.conf")
args.ccache = os.path.join(args.dot_ipa, "ccache")
args.ipa_bin = os.path.join(args.dot_ipa, "ipa")
args.activate = os.path.join(args.dot_ipa, "activate.sh")
if not os.path.isdir(args.dot_ipa):
os.makedirs(args.dot_ipa, mode=0o750)
with urlopen(f"http://{args.servername}/ipa/config/ca.crt") as req:
ca_data = req.read()
with open(args.ca_crt, "wb") as f:
f.write(ca_data)
with open(args.default_conf, "w") as f:
f.write(DEFAULT_CONF.format(args=args))
with open(args.krb5_conf, "w") as f:
f.write(KRB5_CONF.format(args=args))
with open(args.ldap_conf, "w") as f:
f.write(LDAP_CONF.format(args=args))
with open(args.ipa_bin, "w") as f:
f.write(IPA_BIN.format(args=args))
os.fchmod(f.fileno(), 0o755)
with open(args.activate, "w") as f:
f.write(ACTIVATE.format(args=args))
print(MSG.format(args=args))
if __name__ == "__main__":
main()

154
contrib/perflog Normal file
View File

@@ -0,0 +1,154 @@
#!/usr/bin/python3
#
# Copyright (C) 2021 FreeIPA Contributors see COPYING for license
#
# 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.
#
# 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 __future__ import division
from datetime import datetime
import logging
import re
from statistics import mean
from ipapython import admintool
from ipalib.facts import is_ipa_configured
TIME_RE = re.compile(
r'\[(?P<date>.*)\] \[.*\].* \[pid \d+:tid \d+\] \[remote .*\] '
r'ipa: DEBUG: \[jsonserver_session\] (?P<principal>\S+): '
r'(?P<command>\S+)/1\(.*\): (?P<result>\S+) etime=(?P<etime>\d+)'
)
DATE_FORMAT = '%a %b %d %H:%M:%S.%f %Y'
logger = logging.getLogger(__name__)
class parselog(admintool.AdminTool):
command_name = "parselog"
usage = "%prog [options]"
description = "Parse the Apache error log for performance data. " \
"Enable debugging by creating /etc/ipa/server.conf with " \
"the contents: [global]\\ndebug = True"
def __init__(self, options, args):
super(parselog, self).__init__(options, args)
self.times = {}
self.exceptions = {}
self.since = None
@classmethod
def add_options(cls, parser):
super(parselog, cls).add_options(parser, debug_option=True)
parser.add_option(
"--command",
dest="command",
action="store",
default=None,
help="Command to analyze",
)
parser.add_option(
"--start-time",
dest="start_time",
action="store",
default=None,
help="time to begin analyzing logfile from",
)
parser.add_option(
"--file",
dest="file",
action="store",
default="/var/log/httpd/error_log",
help="Log file to parse",
)
def validate_options(self):
super(parselog, self).validate_options(needs_root=True)
if self.options.start_time:
self.since = datetime.strptime(
self.options.start_time,
DATE_FORMAT
)
def display_times(self, data, title, empty):
print(title)
output = False
for command in data:
if not data[command]:
continue
# Average dropping the min and max
if len(data[command]) > 5:
meantime = mean(sorted(data[command])[1:-1])
num = len(data[command]) - 2
else:
meantime = mean(data[command])
num = len(data[command])
print(
' Mean %s: %0.f ns of %d executions' % (
command,
meantime,
num)
)
output = True
if not output:
print(f' No {empty} found')
return
def run(self):
super(parselog, self).run()
if not is_ipa_configured():
logger.error("IPA server is not configured on this system.")
raise admintool.ScriptError()
with open(self.options.file, 'r') as f:
data = f.read()
matches = list(re.finditer(TIME_RE, data))
if self.options.command:
command = self.options.command.replace('-', '_')
else:
command = None
for match in matches:
if self.since:
logtime = datetime.strptime(match.group('date'), DATE_FORMAT)
if logtime < self.since:
continue
if command is None or match.group('command') == command:
cmd = match.group('command')
if cmd not in self.times:
self.times[cmd] = []
if cmd not in self.exceptions:
self.exceptions[cmd] = []
if match.group('result') == 'SUCCESS':
self.times[cmd].append(float(match.group('etime')))
else:
self.exceptions[cmd].append(float(match.group('etime')))
if self.times or self.exceptions:
self.display_times(self.times, "Successful commands:", "commands")
self.display_times(self.exceptions, "Exceptions:", "exceptions")
else:
print('No commands or exceptions found')
if __name__ == '__main__':
parselog.run_cli()