Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 951803 Details for
Bug 1150061
Kerberos systemd start should WAIT until the KDC is really running
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Sample script which waits for the KDC to become ready
wait_for_kdc_becoming_ready1.sh.txt (text/plain), 5.91 KB, created by
Roland Mainz
on 2014-10-29 14:06:35 UTC
(
hide
)
Description:
Sample script which waits for the KDC to become ready
Filename:
MIME Type:
Creator:
Roland Mainz
Created:
2014-10-29 14:06:35 UTC
Size:
5.91 KB
patch
obsolete
>#/bin/ksh > ># ># Copyright 2014 by Roland Mainz <rmainz@redhat.com>. All Rights Reserved. ># ># Export of this software from the United States of America may ># require a specific license from the United States Government. ># It is the responsibility of any person or organization contemplating ># export to obtain such a license before exporting. ># ># WITHIN THAT CONSTRAINT, permission to use, copy, modify, and ># distribute this software and its documentation for any purpose and ># without fee is hereby granted, provided that the above copyright ># notice appear in all copies and that both that copyright notice and ># this permission notice appear in supporting documentation, and that ># the name of M.I.T. not be used in advertising or publicity pertaining ># to distribution of the software without specific, written prior ># permission. Furthermore if you modify this software you must label ># your software as modified software and not distribute it in such a ># fashion that it might be confused with the original M.I.T. software. ># M.I.T. makes no representations about the suitability of ># this software for any purpose. It is provided "as is" without express ># or implied warranty. ># > >namespace com.redhat.krb5.tests >{ > typeset -T kdc_t=( > typeset realmname > integer kdcport=-1 > integer kadmindport=-1 > > typeset testdirbase # base of test dir > > # internal variables > integer kdc_pid=-1 > integer kadmind_pid=-1 > > typeset krb5_kdc_profile # exported as KRB5_KDC_PROFILE > > function write_kdc_profile > { >cat >"${_.krb5_kdc_profile}" <<EOF >[kdcdefaults] > kdc_ports = ${_.kdcport} > >[realms] > ${_.realmname} = { > kadmind_port = ${_.kadmindport} > acl_file = ${_.testdirbase}/kadm5.acl > admin_keytab = ${_.testdirbase}/kadm5.keytab > database_name = ${_.testdirbase}/principal > key_stash_file = ${_.testdirbase}/.k5.${_.realmname} > > max_life = 12h 0m 0s > max_renewable_life = 7d 0h 0m 0s > master_key_type = des3-hmac-sha1 > supported_enctypes = des3-hmac-sha1:normal des-cbc-crc:normal des-cbc-crc:v4 > } > >[logging] > kdc = FILE:${_.testdirbase}/kdc.log > admin_server = FILE:${_.testdirbase}/kadmin.log > default = FILE:${_.testdirbase}/default.log > >EOF > } > > function create_db > { > typeset -x KRB5_KDC_PROFILE="${_.krb5_kdc_profile}" > typeset -x KRB5_CONFIG='/dev/null' > > # kdb5_util -W forces use of /dev/urandom instead > # of /dev/random > { > printf '%s\n' "$1" > printf '%s\n' "$1" > } | kdb5_util -W create -r "${_.realmname}" -s > } > > function add_admin_user > { > typeset -x KRB5_KDC_PROFILE="${_.krb5_kdc_profile}" > typeset -x KRB5_CONFIG='/dev/null' > > { > # add admin user > printf 'addprinc %s@%s\n' "$1" "${_.realmname}" > printf '%s\n' "$2" > printf '%s\n' "$2" > } | kadmin.local -r "${_.realmname}" > } > > function add_user > { > typeset -x KRB5_KDC_PROFILE="${_.krb5_kdc_profile}" > typeset -x KRB5_CONFIG='/dev/null' > > { > # add plain user > printf 'addprinc %s\n' "$1" > printf '%s\n' "$2" > printf '%s\n' "$2" > } | kadmin.local -r "${_.realmname}" > } > > function run_kdc > { > typeset -x KRB5_KDC_PROFILE="${_.krb5_kdc_profile}" > typeset -x KRB5_CONFIG='/dev/null' > > (( _.kdc_pid != -1 )) && return 1 > > krb5kdc -n -r "${_.realmname}" & > (( _.kdc_pid=$! )) > > # Wait until the KDC becomes ready > # (we probe the KDC process itself because a simple > # $ sleep 10 # is not reliable when the system > # is paging/swapping or simply too slow (e.g. > # embedded system)) > typeset pout > integer i pres > for (( i=100; i > 0 ; i-- )) ; do > sleep 0.25 > > pout="${ /usr/bin/pstack ${_.kdc_pid} 2>'/dev/null' ; > (( pres=$? )) ; }" > if (( pres != 0 )) || \ > [[ "${pout}" == ~(E)[[:space:]]+_*(epoll|poll) ]] ; then > break > fi > done > > # KDC process still running ? > kill -0 ${_.kdc_pid} 2>'/dev/null' || \ > { print -u2 -f $"KDC failed.\n" ; return 1 ; } > > return 0 > } > > function terminate_kdc > { > (( _.kdc_pid == -1 )) && return 1 > > kill -s TERM ${_.kdc_pid} > wait ${_.kdc_pid} > (( _.kdc_pid=-1 )) > > return 0 > } > ) >} > > ># ># main ># >function main >{ > compound config=( > kdctestdir='/tmp/kdctest1' > # hostname --fqdn fails sometimes with DHCP > #hostname="$(hostname -A | read ; print -- "$REPLY")" > hostname='localhost' > integer kdcport=10088 > integer kadmindport=10749 > realmname='CHICKENMONSTER.COM' > ) > > rm -Rf "${config.kdctestdir}" || return 1 > rm -Rf "/tmp/krb5cc_dir_$(id -u)" || return 1 > mkdir "${config.kdctestdir}" || return 1 > > typeset KRB5_CONFIG="${config.kdctestdir}/krb5.conf" > cat >"${KRB5_CONFIG}" <<EOF >[libdefaults] > default_realm = ${config.realmname} > default_ccache_name = DIR:/tmp/krb5cc_dir_%{uid} > >[realms] > ${config.realmname} = { > kdc = ${config.hostname}:${config.kdcport} > admin_server = ${config.hostname}:${config.kadmindport} > } >EOF > > # > # Setup a KDC > # > .com.redhat.krb5.tests.kdc_t k1=( > realmname="${config.realmname}" > testdirbase="${config.kdctestdir}" > krb5_kdc_profile="${config.kdctestdir}/kdc.conf" > kdcport=config.kdcport > kadmindport=config.kadmindport > ) > > k1.write_kdc_profile > k1.create_db 'tiger12maus' > k1.add_admin_user 'admin/admin' 'tiger12maus' > k1.add_user 'test001' 'tiger12maus' > > > k1.run_kdc || { print -u2 -f $"Cannot start KDC.\n" ; return 1 ; } > > > # > # Run applications we want to test, > # with shell tracing enabled so that we can see which > # application prints a specific output > # > export KRB5_CONFIG > > set -o xtrace > > kdestroy -q -A > kinit "admin/admin@${config.realmname}" <<<$'tiger12maus\n' > kinit "test001@${config.realmname}" <<<$'tiger12maus\n' > klist -A > > set +o xtrace > > # > # Tests done, terminate KDC and clean up > # > k1.terminate_kdc > > return 0 >} > ># ># start. ># >set -o nounset # complain if we use unset/undefined variables > >(( .sh.version >= 20140721 )) || \ > print -u2 -f $"%s: Warning: Script requires ksh93v- or better.\n" "$0" > >set -o errexit # failure to load a builtin is fatal >builtin cat >builtin id >builtin mkdir >builtin rm >set +o errexit > >main > ># EOF.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1150061
: 951803