Skip to content

Commit

Permalink
Merge pull request #1129 from komidore64/katellodebug
Browse files Browse the repository at this point in the history
866972 - katello-debug needs to take headpin into consideration
  • Loading branch information
komidore64 committed Nov 28, 2012
2 parents 3bebe6e + cd426e7 commit 8cb07b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
38 changes: 21 additions & 17 deletions cli/bin/katello-debug-certificates
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

PREFIX=' '
PERMS=0
PERMS=0

function cert_info() {
CERT=$1
DESCR=$2
[[ -n "$DESCR" ]] && echo -e "$DESCR"
if [[ -n "$CERT" ]]; then
if [[ -n "$CERT" ]]; then
SERIAL=$(echo "$CERT" | grep "Serial Number" -A1 | tail -n1 | awk '{print $1}')
DN=$(echo "$CERT" | grep "Subject:" | sed 's/\s*Subject: //')
CA=$(echo "$CERT" | grep "CA" | head -n1 | awk '{print $1}')
Expand All @@ -25,7 +25,7 @@ function certutils_cert_info() {
CERT=$1
DESCR=$2
[[ -n "$DESCR" ]] && echo -e "$DESCR"
if [[ -n "$CERT" ]]; then
if [[ -n "$CERT" ]]; then
SERIAL=$(echo "$CERT" | grep "Serial Number" -A1 | head -n2 | tail -n1 | awk '{print $1}')
DN=$(echo "$CERT" | grep "Subject:" | sed 's/\s*Subject: //')
CA=$(echo "$CERT" | grep "Certificate Basic Constraints" -A1| tail -n1 | sed 's/^\s*Data: //')
Expand All @@ -45,20 +45,22 @@ function cert_file_info() {
CERT=$( openssl x509 -noout -text -in "$CERTFILE" )
cert_info "$CERT" "$CERTFILE"
path_perms "$CERTFILE"
else
else
cert_info "" "$CERTFILE"
fi
}

function nss_info() {
echo "NSS DB - Broker Key"
echo -e "$PREFIX$(certutil -d /etc/pki/katello/nssdb -K -f /etc/katello/nss_db_password-file|grep broker)\n"
path_perms "/etc/katello/nss_db_password-file"
certutils_cert_info "$(certutil -d /etc/pki/katello/nssdb -L -n ca)" 'NSS DB - CA'
certutils_cert_info "$(certutil -d /etc/pki/katello/nssdb -L -n broker)" 'NSS DB - Broker'
for f in `ls /etc/pki/katello/nssdb/*`; do
path_perms "$f"
done
if [ -d "/etc/pki/katello/nssdb" ]; then
echo "NSS DB - Broker Key"
echo -e "$PREFIX$(certutil -d /etc/pki/katello/nssdb -K -f /etc/katello/nss_db_password-file|grep broker)\n"
path_perms "/etc/katello/nss_db_password-file"
certutils_cert_info "$(certutil -d /etc/pki/katello/nssdb -L -n ca)" 'NSS DB - CA'
certutils_cert_info "$(certutil -d /etc/pki/katello/nssdb -L -n broker)" 'NSS DB - Broker'
for f in $(ls /etc/pki/katello/nssdb/*); do
path_perms "$f"
done
fi
}

function keystore_info() {
Expand All @@ -68,11 +70,13 @@ function keystore_info() {
function path_perms() {
if [ $PERMS = 1 ]; then
CERTPATH=$1
while [ "$CERTPATH" != '/' ]; do
LSOUT=$(ls -lahd "$CERTPATH")
echo "$PREFIX$LSOUT"
CERTPATH=$(dirname "$CERTPATH")
done
if [ -e "$CERTPATH" ]; then
while [ "$CERTPATH" != '/' ]; do
LSOUT=$(ls -lahd "$CERTPATH")
echo "$PREFIX$LSOUT"
CERTPATH=$(dirname "$CERTPATH")
done
fi
fi
echo ""
}
Expand Down
7 changes: 3 additions & 4 deletions src/script/katello-debug
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ end
puts "detected deployment: \t#{deployment}"

# Define what we want to collect
sources = []

MISC = [
"/var/log/audit/audit.log",
"/var/log/httpd",
Expand All @@ -74,7 +72,7 @@ KATELLO_HEADPIN = [
"/etc/katello/thin.yml",
"/etc/katello/katello-configure.conf",
"/etc/httpd/conf.d/katello.conf",
"/etc/katello/environment.db"
"/etc/katello/environment.rb"
]

ELASTIC_SEARCH = [
Expand Down Expand Up @@ -106,6 +104,7 @@ EXCLUDES = [


# sources list for katello or headpin deployment
sources = []
sources += MISC
sources += KATELLO_HEADPIN
sources += ELASTIC_SEARCH
Expand Down Expand Up @@ -179,7 +178,7 @@ if deployment == 'katello'
end

# Create certificates report
output = `katello-debug-certificates >> #{File.join(target_dir, "certificates")}`
output = `katello-debug-certificates --perms >> #{File.join(target_dir, "certificates")}`

# Add list of ssl-build dir
output = `find /root/ssl-build -ls | sort -k 11 > #{File.join(target_dir, "ssl_build_dir")}`
Expand Down

0 comments on commit 8cb07b0

Please sign in to comment.