proxy/installer/configure-proxy.sh | 154 +++++++++++++++++++++++--------------
1 file changed, 98 insertions(+), 56 deletions(-)
New commits:
commit aba79d8c16b0c187350e96f155037c5cb5828e31
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 01:17:55 2009 +0100
replaced /etc/squid with SQUID_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index d8e82d9..b3c3c44 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -101,7 +101,7 @@ HTTPDCONF_DIR=/etc/httpd/conf
HTTPDCONFD_DIR=/etc/httpd/conf.d
HTMLPUB_DIR=/var/www/html/pub
JABBERD_DIR=/etc/jabberd
-
+SQUID_DIR=/etc/squid
SYSTEM_ID=$(/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2)
@@ -223,7 +223,7 @@ SQUID_SIZE=$(df -P /var/spool/squid | awk '{a=$4} END
{printf("%d", a * 60 / 100
sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/c2s.xml >
$JABBERD_DIR/c2s.xml
sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/sm.xml >
$JABBERD_DIR/sm.xml
sed "s|cache_dir ufs /var/spool/squid 15000 16 256|cache_dir ufs /var/spool/squid
$SQUID_SIZE 16 256|g" \
- < $DIR/squid.conf > /etc/squid/squid.conf
+ < $DIR/squid.conf > $SQUID_DIR/squid.conf
sed -e "s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
-e "s/\${session.http_proxy}/$HTTP_PROXY/g" \
-e "s/\${session.http_proxy_username}/$HTTP_USERNAME/g" \
@@ -323,7 +323,7 @@ if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
$HTTPDCONFD_DIR/ssl.conf \
$RHNCONF_DIR/rhn.conf \
$RHNCONF_DIR/cluster.ini \
- /etc/squid/squid.conf \
+ $SQUID_DIR/squid.conf \
$HTTPDCONFD_DIR/cobbler-proxy.conf \
$HTTPDCONF_DIR/httpd.conf \
$HTTPDCONFD_DIR/rhn_proxy.conf \
commit 5d76154a8aa74985af5145f18c3d7e03be3ffe5d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 01:11:24 2009 +0100
don't mix `...` and $(...)
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 635059d..d8e82d9 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -29,7 +29,7 @@ INTERACTIVE=1
while [ $# -ge 1 ]; do
case $1 in
--help | -h) print_help;;
- --answer-file=*) . `echo $1 | cut -d= -f2`;;
+ --answer-file=*) . $(echo $1 | cut -d= -f2);;
--non-interactive) INTERACTIVE=0;;
esac
shift
@@ -103,10 +103,10 @@ HTMLPUB_DIR=/var/www/html/pub
JABBERD_DIR=/etc/jabberd
-SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
+SYSTEM_ID=$(/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2)
DIR=/usr/share/doc/proxy/conf-template
-HOSTNAME=`hostname`
+HOSTNAME=$(hostname)
default_or_input "Proxy version to activate" VERSION $(rpm -q --queryformat
%{version} spacewalk-proxy-installer|cut -d. -f1-2)
@@ -206,7 +206,7 @@ if [ $MONITORING -eq 0 ]; then
#and with cluster.ini
echo "Configuring monitoring."
default_or_input "Monitoring parent" MONITORING_PARENT
"$RHN_PARENT"
- RESOLVED_IP=`/usr/bin/getent hosts $RHN_PARENT | cut -f1 -d' '`
+ RESOLVED_IP=$(/usr/bin/getent hosts $RHN_PARENT | cut -f1 -d' ')
default_or_input "Monitoring parent IP" MONITORING_PARENT_IP
"$RESOLVED_IP"
default_or_input "Enable monitoring scout" ENABLE_SCOUT
"Y/n"
ENABLE_SCOUT=$(yes_no $ENABLE_SCOUT)
@@ -276,12 +276,12 @@ else
echo "Using CA key at $SSL_BUILD_DIR/RHN-ORG-PRIVATE-SSL-KEY."
fi
-RPM_CA=`grep noarch $SSL_BUILD_DIR/latest.txt`
+RPM_CA=$(grep noarch $SSL_BUILD_DIR/latest.txt)
if [ ! -f $SSL_BUILD_DIR/$RPM_CA ]; then
echo "Generating distributable RPM for CA public certificate:"
/usr/bin/rhn-ssl-tool --gen-ca -q --rpm-only --dir="$SSL_BUILD_DIR"
- RPM_CA=`grep noarch $SSL_BUILD_DIR/latest.txt`
+ RPM_CA=$(grep noarch $SSL_BUILD_DIR/latest.txt)
fi
if [ ! -f $HTMLPUB_DIR/$RPM_CA ] || [ ! -f $HTMLPUB_DIR/RHN-ORG-TRUSTED-SSL-CERT ]; then
@@ -303,7 +303,7 @@ echo "Generating SSL key and public certificate:"
config_error $? "SSL key generation failed!"
echo "Installing SSL certificate for Apache and Jabberd:"
-rpm -Uv `/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm`
+rpm -Uv $(/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm)
mv $HTTPDCONFD_DIR/ssl.conf $HTTPDCONFD_DIR/ssl.conf.bak
sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
$HTTPDCONF_DIR/ssl.crt/server.crt|g" \
commit b1c1fa89fb931bdb4ed71eedcbcc5c0e34bf31c7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 01:03:42 2009 +0100
let's do math inside awk
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 1e80f23..635059d 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -218,7 +218,7 @@ fi
# df -P give free space in kB
# * 60 / 100 is 60% of that space
# / 1024 is to get value in MB
-SQUID_SIZE=$(( `df -P /var/spool/squid | awk '{a=$4} END {print a}'` * 60 / 100 /
1024 ))
+SQUID_SIZE=$(df -P /var/spool/squid | awk '{a=$4} END {printf("%d", a * 60
/ 100 / 1024)}')
sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/c2s.xml >
$JABBERD_DIR/c2s.xml
sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/sm.xml >
$JABBERD_DIR/sm.xml
commit e58f05817f8324ae44efd1bf792b5185e986385f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:57:10 2009 +0100
command args formated more readable way
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index d9bebfe..1e80f23 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -77,7 +77,13 @@ yes_no() {
config_error () {
if [ $1 -gt 0 ]; then
echo "$2 Installation interrupted."
- /usr/bin/rhn-proxy-activate --server="$RHN_PARENT"
--http-proxy="$HTTP_PROXY" --http-proxy-username="$HTTP_USERNAME"
--http-proxy-password="$HTTP_PASSWORD" --ca-cert="$CA_CHAIN"
--deactivate --non-interactive
+ /usr/bin/rhn-proxy-activate \
+ --server="$RHN_PARENT" \
+ --http-proxy="$HTTP_PROXY" \
+ --http-proxy-username="$HTTP_USERNAME" \
+ --http-proxy-password="$HTTP_PASSWORD" \
+ --ca-cert="$CA_CHAIN" \
+ --deactivate --non-interactive
exit $1
fi
}
@@ -159,7 +165,13 @@ default_or_input "Country code" SSL_COUNTRY ''
default_or_input "Email" SSL_EMAIL "$TRACEBACK_EMAIL"
-/usr/bin/rhn-proxy-activate --server="$RHN_PARENT"
--http-proxy="$HTTP_PROXY" --http-proxy-username="$HTTP_USERNAME"
--http-proxy-password="$HTTP_PASSWORD" --ca-cert="$CA_CHAIN"
--version="$VERSION" --non-interactive
+/usr/bin/rhn-proxy-activate --server="$RHN_PARENT" \
+ --http-proxy="$HTTP_PROXY" \
+ --http-proxy-username="$HTTP_USERNAME" \
+ --http-proxy-password="$HTTP_PASSWORD" \
+ --ca-cert="$CA_CHAIN" \
+ --version="$VERSION" \
+ --non-interactive
config_error $? "Proxy activation failed!"
$YUM_OR_UPDATE spacewalk-proxy-management
@@ -249,9 +261,15 @@ fi
if [ ! -f $SSL_BUILD_DIR/RHN-ORG-PRIVATE-SSL-KEY ]; then
echo "Generating CA key and public certificate:"
- /usr/bin/rhn-ssl-tool --gen-ca -q --dir="$SSL_BUILD_DIR"
--set-common-name="$SSL_COMMON" \
- --set-country="$SSL_COUNTRY" --set-city="$SSL_CITY"
--set-state="$SSL_STATE" \
- --set-org="$SSL_ORG" --set-org-unit="$SSL_ORGUNIT"
--set-email="$SSL_EMAIL" \
+ /usr/bin/rhn-ssl-tool --gen-ca -q \
+ --dir="$SSL_BUILD_DIR" \
+ --set-common-name="$SSL_COMMON" \
+ --set-country="$SSL_COUNTRY" \
+ --set-city="$SSL_CITY" \
+ --set-state="$SSL_STATE" \
+ --set-org="$SSL_ORG" \
+ --set-org-unit="$SSL_ORGUNIT" \
+ --set-email="$SSL_EMAIL" \
$RHNSSLTOOLPWD
config_error $? "CA certificate generation failed!"
else
@@ -272,9 +290,15 @@ if [ ! -f $HTMLPUB_DIR/$RPM_CA ] || [ ! -f
$HTMLPUB_DIR/RHN-ORG-TRUSTED-SSL-CERT
fi
echo "Generating SSL key and public certificate:"
-/usr/bin/rhn-ssl-tool --gen-server -q --no-rpm --set-hostname "$HOSTNAME"
--dir="$SSL_BUILD_DIR" \
- --set-country="$SSL_COUNTRY" --set-city="$SSL_CITY"
--set-state="$SSL_STATE" \
- --set-org="$SSL_ORG" --set-org-unit="$SSL_ORGUNIT"
--set-email="$SSL_EMAIL" \
+/usr/bin/rhn-ssl-tool --gen-server -q --no-rpm \
+ --set-hostname "$HOSTNAME" \
+ --dir="$SSL_BUILD_DIR" \
+ --set-country="$SSL_COUNTRY" \
+ --set-city="$SSL_CITY" \
+ --set-state="$SSL_STATE" \
+ --set-org="$SSL_ORG" \
+ --set-org-unit="$SSL_ORGUNIT" \
+ --set-email="$SSL_EMAIL" \
$RHNSSLTOOLPWD
config_error $? "SSL key generation failed!"
@@ -292,12 +316,21 @@ CHANNEL_LABEL="rhn_proxy_config_$SYSTEM_ID"
default_or_input "Create and populate configuration channel $CHANNEL_LABEL?"
POPULATE_CONFIG_CHANNEL 'Y/n'
POPULATE_CONFIG_CHANNEL=$(yes_no $POPULATE_CONFIG_CHANNEL)
if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
- rhncfg-manager create-channel --server-name "$RHN_PARENT"
rhn_proxy_config_$SYSTEM_ID
- rhncfg-manager update --server-name "$RHN_PARENT"
--channel=rhn_proxy_config_$SYSTEM_ID \
- $HTTPDCONFD_DIR/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
- $HTTPDCONFD_DIR/cobbler-proxy.conf $HTTPDCONF_DIR/httpd.conf
$HTTPDCONFD_DIR/rhn_proxy.conf \
- $HTTPDCONFD_DIR/proxy_broker.conf $HTTPDCONFD_DIR/proxy_redirect.conf \
- $JABBERD_DIR/c2s.xml $JABBERD_DIR/sm.xml
+ rhncfg-manager create-channel --server-name "$RHN_PARENT" \
+ rhn_proxy_config_$SYSTEM_ID
+ rhncfg-manager update --server-name "$RHN_PARENT" \
+ --channel=rhn_proxy_config_$SYSTEM_ID \
+ $HTTPDCONFD_DIR/ssl.conf \
+ $RHNCONF_DIR/rhn.conf \
+ $RHNCONF_DIR/cluster.ini \
+ /etc/squid/squid.conf \
+ $HTTPDCONFD_DIR/cobbler-proxy.conf \
+ $HTTPDCONF_DIR/httpd.conf \
+ $HTTPDCONFD_DIR/rhn_proxy.conf \
+ $HTTPDCONFD_DIR/proxy_broker.conf \
+ $HTTPDCONFD_DIR/proxy_redirect.conf \
+ $JABBERD_DIR/c2s.xml \
+ $JABBERD_DIR/sm.xml
fi
echo "Enabling Spacewalk Proxy."
commit 8607736d2cd38687a4540963d676fa2b5b0a09c4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:48:03 2009 +0100
replaced /etc/httpd/conf with HTTPDCONF_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 84bbdcf..d9bebfe 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -91,6 +91,7 @@ if [ -f /usr/bin/yum ]; then
fi
SYSCONFIG_DIR=/etc/sysconfig/rhn
RHNCONF_DIR=/etc/rhn
+HTTPDCONF_DIR=/etc/httpd/conf
HTTPDCONFD_DIR=/etc/httpd/conf.d
HTMLPUB_DIR=/var/www/html/pub
JABBERD_DIR=/etc/jabberd
@@ -281,8 +282,8 @@ echo "Installing SSL certificate for Apache and Jabberd:"
rpm -Uv `/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm`
mv $HTTPDCONFD_DIR/ssl.conf $HTTPDCONFD_DIR/ssl.conf.bak
-sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
- -e "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key|g" \
+sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
$HTTPDCONF_DIR/ssl.crt/server.crt|g" \
+ -e "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
$HTTPDCONF_DIR/ssl.key/server.key|g" \
-e "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|"
< $HTTPDCONFD_DIR/ssl.conf.bak > $HTTPDCONFD_DIR/ssl.conf
@@ -294,7 +295,7 @@ if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
rhncfg-manager create-channel --server-name "$RHN_PARENT"
rhn_proxy_config_$SYSTEM_ID
rhncfg-manager update --server-name "$RHN_PARENT"
--channel=rhn_proxy_config_$SYSTEM_ID \
$HTTPDCONFD_DIR/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
- $HTTPDCONFD_DIR/cobbler-proxy.conf /etc/httpd/conf/httpd.conf
$HTTPDCONFD_DIR/rhn_proxy.conf \
+ $HTTPDCONFD_DIR/cobbler-proxy.conf $HTTPDCONF_DIR/httpd.conf
$HTTPDCONFD_DIR/rhn_proxy.conf \
$HTTPDCONFD_DIR/proxy_broker.conf $HTTPDCONFD_DIR/proxy_redirect.conf \
$JABBERD_DIR/c2s.xml $JABBERD_DIR/sm.xml
fi
commit 562466f5be96fd005206b0f15d6b37824b023376
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:44:13 2009 +0100
replaced /etc/jabberd with JABBERD_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 450e002..84bbdcf 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -93,6 +93,8 @@ SYSCONFIG_DIR=/etc/sysconfig/rhn
RHNCONF_DIR=/etc/rhn
HTTPDCONFD_DIR=/etc/httpd/conf.d
HTMLPUB_DIR=/var/www/html/pub
+JABBERD_DIR=/etc/jabberd
+
SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
@@ -205,8 +207,8 @@ fi
# / 1024 is to get value in MB
SQUID_SIZE=$(( `df -P /var/spool/squid | awk '{a=$4} END {print a}'` * 60 / 100 /
1024 ))
-sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/c2s.xml >
/etc/jabberd/c2s.xml
-sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/sm.xml >
/etc/jabberd/sm.xml
+sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/c2s.xml >
$JABBERD_DIR/c2s.xml
+sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/sm.xml >
$JABBERD_DIR/sm.xml
sed "s|cache_dir ufs /var/spool/squid 15000 16 256|cache_dir ufs /var/spool/squid
$SQUID_SIZE 16 256|g" \
< $DIR/squid.conf > /etc/squid/squid.conf
sed -e "s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
@@ -294,7 +296,7 @@ if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
$HTTPDCONFD_DIR/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
$HTTPDCONFD_DIR/cobbler-proxy.conf /etc/httpd/conf/httpd.conf
$HTTPDCONFD_DIR/rhn_proxy.conf \
$HTTPDCONFD_DIR/proxy_broker.conf $HTTPDCONFD_DIR/proxy_redirect.conf \
- /etc/jabberd/c2s.xml /etc/jabberd/sm.xml
+ $JABBERD_DIR/c2s.xml $JABBERD_DIR/sm.xml
fi
echo "Enabling Spacewalk Proxy."
commit 0b1bce2eef8c3b0681956527e7714326c4a1493d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:41:50 2009 +0100
cat | sed is rarely needed
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index dfd5b40..450e002 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -205,12 +205,11 @@ fi
# / 1024 is to get value in MB
SQUID_SIZE=$(( `df -P /var/spool/squid | awk '{a=$4} END {print a}'` * 60 / 100 /
1024 ))
-cat $DIR/c2s.xml | sed "s/\${session.hostname\}/$HOSTNAME/g" >
/etc/jabberd/c2s.xml
-cat $DIR/sm.xml | sed "s/\${session.hostname\}/$HOSTNAME/g" >
/etc/jabberd/sm.xml
-cat $DIR/squid.conf | sed "s|cache_dir ufs /var/spool/squid 15000 16 256|cache_dir
ufs /var/spool/squid $SQUID_SIZE 16 256|g" \
- > /etc/squid/squid.conf
-cat $DIR/rhn.conf | \
- sed -e "s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
+sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/c2s.xml >
/etc/jabberd/c2s.xml
+sed "s/\${session.hostname\}/$HOSTNAME/g" < $DIR/sm.xml >
/etc/jabberd/sm.xml
+sed "s|cache_dir ufs /var/spool/squid 15000 16 256|cache_dir ufs /var/spool/squid
$SQUID_SIZE 16 256|g" \
+ < $DIR/squid.conf > /etc/squid/squid.conf
+sed -e "s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
-e "s/\${session.http_proxy}/$HTTP_PROXY/g" \
-e "s/\${session.http_proxy_username}/$HTTP_USERNAME/g" \
-e "s/\${session.http_proxy_password}/$HTTP_PASSWORD/g" \
@@ -218,13 +217,12 @@ cat $DIR/rhn.conf | \
-e "s/\${session.traceback_mail}/$TRACEBACK_EMAIL/g" \
-e "s/\${session.use_ssl:0}/$USE_SSL/g" \
-e "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
- > $RHNCONF_DIR/rhn.conf
-cat $DIR/cluster.ini | \
- sed -e "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
+ < $DIR/rhn.conf > $RHNCONF_DIR/rhn.conf
+sed -e "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
-e "s/\${session.rhn_monitoring_parent_ip}/$MONITORING_PARENT_IP/g"
\
-e "s/\${session.rhn_monitoring_parent}/$MONITORING_PARENT/g" \
-e "s/\${session.scout_shared_key}/$SCOUT_SHARED_KEY/g" \
- > $RHNCONF_DIR/cluster.ini
+ < cat $DIR/cluster.ini > $RHNCONF_DIR/cluster.ini
#Setup the cobbler stuff, needed to use koan through a proxy
@@ -281,10 +279,10 @@ echo "Installing SSL certificate for Apache and Jabberd:"
rpm -Uv `/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm`
mv $HTTPDCONFD_DIR/ssl.conf $HTTPDCONFD_DIR/ssl.conf.bak
-cat $HTTPDCONFD_DIR/ssl.conf.bak | \
- sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
+sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
-e "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key|g" \
- -e "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|" >
$HTTPDCONFD_DIR/ssl.conf
+ -e "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|"
+ < $HTTPDCONFD_DIR/ssl.conf.bak > $HTTPDCONFD_DIR/ssl.conf
CHANNEL_LABEL="rhn_proxy_config_$SYSTEM_ID"
commit adbbdbdc947df94740c921090810de1442bf318d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:34:39 2009 +0100
replace sed |sed | sed | ... with only one sed -e -e -e
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index efce6c5..dfd5b40 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -209,19 +209,21 @@ cat $DIR/c2s.xml | sed
"s/\${session.hostname\}/$HOSTNAME/g" > /etc/jabberd/c2s.
cat $DIR/sm.xml | sed "s/\${session.hostname\}/$HOSTNAME/g" >
/etc/jabberd/sm.xml
cat $DIR/squid.conf | sed "s|cache_dir ufs /var/spool/squid 15000 16 256|cache_dir
ufs /var/spool/squid $SQUID_SIZE 16 256|g" \
/etc/squid/squid.conf
-cat $DIR/rhn.conf | sed
"s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
- | sed "s/\${session.http_proxy}/$HTTP_PROXY/g" \
- | sed "s/\${session.http_proxy_username}/$HTTP_USERNAME/g" \
- | sed "s/\${session.http_proxy_password}/$HTTP_PASSWORD/g" \
- | sed "s/\${session.rhn_parent}/$RHN_PARENT/g" \
- | sed "s/\${session.traceback_mail}/$TRACEBACK_EMAIL/g" \
- | sed "s/\${session.use_ssl:0}/$USE_SSL/g" \
- | sed "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
+cat $DIR/rhn.conf | \
+ sed -e "s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_CHAIN|g" \
+ -e "s/\${session.http_proxy}/$HTTP_PROXY/g" \
+ -e "s/\${session.http_proxy_username}/$HTTP_USERNAME/g" \
+ -e "s/\${session.http_proxy_password}/$HTTP_PASSWORD/g" \
+ -e "s/\${session.rhn_parent}/$RHN_PARENT/g" \
+ -e "s/\${session.traceback_mail}/$TRACEBACK_EMAIL/g" \
+ -e "s/\${session.use_ssl:0}/$USE_SSL/g" \
+ -e "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
$RHNCONF_DIR/rhn.conf
-cat $DIR/cluster.ini | sed
"s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
- | sed "s/\${session.rhn_monitoring_parent_ip}/$MONITORING_PARENT_IP/g"
\
- | sed "s/\${session.rhn_monitoring_parent}/$MONITORING_PARENT/g" \
- | sed "s/\${session.scout_shared_key}/$SCOUT_SHARED_KEY/g" \
+cat $DIR/cluster.ini | \
+ sed -e "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
+ -e "s/\${session.rhn_monitoring_parent_ip}/$MONITORING_PARENT_IP/g"
\
+ -e "s/\${session.rhn_monitoring_parent}/$MONITORING_PARENT/g" \
+ -e "s/\${session.scout_shared_key}/$SCOUT_SHARED_KEY/g" \
$RHNCONF_DIR/cluster.ini
@@ -279,10 +281,10 @@ echo "Installing SSL certificate for Apache and Jabberd:"
rpm -Uv `/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm`
mv $HTTPDCONFD_DIR/ssl.conf $HTTPDCONFD_DIR/ssl.conf.bak
-cat $HTTPDCONFD_DIR/ssl.conf.bak \
- | sed "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
- | sed "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key|g" \
- | sed "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|" >
$HTTPDCONFD_DIR/ssl.conf
+cat $HTTPDCONFD_DIR/ssl.conf.bak | \
+ sed -e "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
+ -e "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key|g" \
+ -e "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|" >
$HTTPDCONFD_DIR/ssl.conf
CHANNEL_LABEL="rhn_proxy_config_$SYSTEM_ID"
commit 4d331d61b1da51824bf951f8a6941d9cbfefa321
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:28:41 2009 +0100
replaced /var/www/html/pub with HTMLPUB_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index efa67c8..efce6c5 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -92,6 +92,7 @@ fi
SYSCONFIG_DIR=/etc/sysconfig/rhn
RHNCONF_DIR=/etc/rhn
HTTPDCONFD_DIR=/etc/httpd/conf.d
+HTMLPUB_DIR=/var/www/html/pub
SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
@@ -262,9 +263,9 @@ if [ ! -f $SSL_BUILD_DIR/$RPM_CA ]; then
RPM_CA=`grep noarch $SSL_BUILD_DIR/latest.txt`
fi
-if [ ! -f /var/www/html/pub/$RPM_CA ] || [ ! -f
/var/www/html/pub/RHN-ORG-TRUSTED-SSL-CERT ]; then
- echo "Copying CA public certificate to /var/www/html/pub for distribution to
clients:"
- cp $SSL_BUILD_DIR/RHN-ORG-TRUSTED-SSL-CERT $SSL_BUILD_DIR/$RPM_CA /var/www/html/pub/
+if [ ! -f $HTMLPUB_DIR/$RPM_CA ] || [ ! -f $HTMLPUB_DIR/RHN-ORG-TRUSTED-SSL-CERT ]; then
+ echo "Copying CA public certificate to $HTMLPUB_DIR for distribution to
clients:"
+ cp $SSL_BUILD_DIR/RHN-ORG-TRUSTED-SSL-CERT $SSL_BUILD_DIR/$RPM_CA $HTMLPUB_DIR/
fi
echo "Generating SSL key and public certificate:"
commit 46a978924da8b8b8c4d41f4d70de6b78ba6f5983
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:24:53 2009 +0100
replace /etc/httpd/conf.d with HTTPDCONFD_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index a2f5caa..efa67c8 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -91,6 +91,7 @@ if [ -f /usr/bin/yum ]; then
fi
SYSCONFIG_DIR=/etc/sysconfig/rhn
RHNCONF_DIR=/etc/rhn
+HTTPDCONFD_DIR=/etc/httpd/conf.d
SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
@@ -228,8 +229,8 @@ PROTO="http";
if [ $USE_SSL -eq 1 ]; then
PROTO="https"
fi
-echo "ProxyPass /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >
/etc/httpd/conf.d/cobbler-proxy.conf
-echo "ProxyPassReverse /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >>
/etc/httpd/conf.d/cobbler-proxy.conf
+echo "ProxyPass /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >
$HTTPDCONFD_DIR/cobbler-proxy.conf
+echo "ProxyPassReverse /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >>
$HTTPDCONFD_DIR/cobbler-proxy.conf
# lets do SSL stuff
SSL_BUILD_DIR="/root/ssl-build"
@@ -276,11 +277,11 @@ config_error $? "SSL key generation failed!"
echo "Installing SSL certificate for Apache and Jabberd:"
rpm -Uv `/usr/bin/rhn-ssl-tool --gen-server --rpm-only --dir="$SSL_BUILD_DIR"
2>/dev/null |grep noarch.rpm`
-mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf.bak
-cat /etc/httpd/conf.d/ssl.conf.bak \
+mv $HTTPDCONFD_DIR/ssl.conf $HTTPDCONFD_DIR/ssl.conf.bak
+cat $HTTPDCONFD_DIR/ssl.conf.bak \
| sed "s|^SSLCertificateFile /etc/pki/tls/certs/localhost.crt$|SSLCertificateFile
/etc/httpd/conf/ssl.crt/server.crt|g" \
| sed "s|^SSLCertificateKeyFile
/etc/pki/tls/private/localhost.key$|SSLCertificateKeyFile
/etc/httpd/conf/ssl.key/server.key|g" \
- | sed "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|" >
/etc/httpd/conf.d/ssl.conf
+ | sed "s|</VirtualHost>|SSLProxyEngine on\n</VirtualHost>|" >
$HTTPDCONFD_DIR/ssl.conf
CHANNEL_LABEL="rhn_proxy_config_$SYSTEM_ID"
@@ -289,9 +290,9 @@ POPULATE_CONFIG_CHANNEL=$(yes_no $POPULATE_CONFIG_CHANNEL)
if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
rhncfg-manager create-channel --server-name "$RHN_PARENT"
rhn_proxy_config_$SYSTEM_ID
rhncfg-manager update --server-name "$RHN_PARENT"
--channel=rhn_proxy_config_$SYSTEM_ID \
- /etc/httpd/conf.d/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
- /etc/httpd/conf.d/cobbler-proxy.conf /etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/rhn_proxy.conf \
- /etc/httpd/conf.d/proxy_broker.conf /etc/httpd/conf.d/proxy_redirect.conf \
+ $HTTPDCONFD_DIR/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
+ $HTTPDCONFD_DIR/cobbler-proxy.conf /etc/httpd/conf/httpd.conf
$HTTPDCONFD_DIR/rhn_proxy.conf \
+ $HTTPDCONFD_DIR/proxy_broker.conf $HTTPDCONFD_DIR/proxy_redirect.conf \
/etc/jabberd/c2s.xml /etc/jabberd/sm.xml
fi
commit 33d7ea9ef9366ca14c42c2fd7596258047f92ca6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:21:48 2009 +0100
replace /etc/rhn with RHNCONF_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 5ae3bc4..a2f5caa 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -90,6 +90,7 @@ if [ -f /usr/bin/yum ]; then
[ "$INTERACTIVE" = "0" ] &&
YUM_OR_UPDATE="$YUM_OR_UPDATE -y"
fi
SYSCONFIG_DIR=/etc/sysconfig/rhn
+RHNCONF_DIR=/etc/rhn
SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
@@ -192,7 +193,7 @@ if [ $MONITORING -eq 0 ]; then
default_or_input "Monitoring parent IP" MONITORING_PARENT_IP
"$RESOLVED_IP"
default_or_input "Enable monitoring scout" ENABLE_SCOUT
"Y/n"
ENABLE_SCOUT=$(yes_no $ENABLE_SCOUT)
- MSG=$(echo -n "Your scout shared key (can be found on parent\nin
/etc/rhn/cluster.ini as key scoutsharedkey)")
+ MSG=$(echo -n "Your scout shared key (can be found on parent\nin
$RHNCONF_DIR/cluster.ini as key scoutsharedkey)")
default_or_input "$MSG" SCOUT_SHARED_KEY ''
fi
@@ -214,12 +215,12 @@ cat $DIR/rhn.conf | sed
"s|\${session.ca_chain:/usr/share/rhn/RHNS-CA-CERT}|$CA_
| sed "s/\${session.traceback_mail}/$TRACEBACK_EMAIL/g" \
| sed "s/\${session.use_ssl:0}/$USE_SSL/g" \
| sed "s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
- > /etc/rhn/rhn.conf
+ > $RHNCONF_DIR/rhn.conf
cat $DIR/cluster.ini | sed
"s/\${session.enable_monitoring_scout:0}/$ENABLE_SCOUT/g" \
| sed "s/\${session.rhn_monitoring_parent_ip}/$MONITORING_PARENT_IP/g"
\
| sed "s/\${session.rhn_monitoring_parent}/$MONITORING_PARENT/g" \
| sed "s/\${session.scout_shared_key}/$SCOUT_SHARED_KEY/g" \
- > /etc/rhn/cluster.ini
+ > $RHNCONF_DIR/cluster.ini
#Setup the cobbler stuff, needed to use koan through a proxy
@@ -288,7 +289,7 @@ POPULATE_CONFIG_CHANNEL=$(yes_no $POPULATE_CONFIG_CHANNEL)
if [ "$POPULATE_CONFIG_CHANNEL" = "1" ]; then
rhncfg-manager create-channel --server-name "$RHN_PARENT"
rhn_proxy_config_$SYSTEM_ID
rhncfg-manager update --server-name "$RHN_PARENT"
--channel=rhn_proxy_config_$SYSTEM_ID \
- /etc/httpd/conf.d/ssl.conf /etc/rhn/rhn.conf /etc/rhn/cluster.ini /etc/squid/squid.conf
\
+ /etc/httpd/conf.d/ssl.conf $RHNCONF_DIR/rhn.conf $RHNCONF_DIR/cluster.ini
/etc/squid/squid.conf \
/etc/httpd/conf.d/cobbler-proxy.conf /etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/rhn_proxy.conf \
/etc/httpd/conf.d/proxy_broker.conf /etc/httpd/conf.d/proxy_redirect.conf \
/etc/jabberd/c2s.xml /etc/jabberd/sm.xml
commit 9b590abafa9891a662cdfa62d530e778d328c78a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:17:42 2009 +0100
replace /etc/sysconfig/rhn with $SYSCONFIG_DIR
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index e1070d1..5ae3bc4 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -89,15 +89,16 @@ if [ -f /usr/bin/yum ]; then
# add -y for non-interactive installation
[ "$INTERACTIVE" = "0" ] &&
YUM_OR_UPDATE="$YUM_OR_UPDATE -y"
fi
+SYSCONFIG_DIR=/etc/sysconfig/rhn
-SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt
/etc/sysconfig/rhn/systemid | cut -d- -f2`
+SYSTEM_ID=`/usr/bin/xsltproc /usr/share/rhn/get_system_id.xslt $SYSCONFIG_DIR/systemid |
cut -d- -f2`
DIR=/usr/share/doc/proxy/conf-template
HOSTNAME=`hostname`
default_or_input "Proxy version to activate" VERSION $(rpm -q --queryformat
%{version} spacewalk-proxy-installer|cut -d. -f1-2)
-default_or_input "RHN Parent" RHN_PARENT $(awk -F= '/serverURL=/ {split($2,
a, "/")} END { print a[3]}' /etc/sysconfig/rhn/up2date)
+default_or_input "RHN Parent" RHN_PARENT $(awk -F= '/serverURL=/ {split($2,
a, "/")} END { print a[3]}' $SYSCONFIG_DIR/up2date)
if [ "$RHN_PARENT" == "rhn.redhat.com" ]; then
RHN_PARENT="xmlrpc.rhn.redhat.com"
@@ -112,7 +113,7 @@ default_or_input "Traceback email" TRACEBACK_EMAIL
''
default_or_input "Use SSL" USE_SSL 'Y/n'
USE_SSL=$(yes_no $USE_SSL)
-default_or_input "CA Chain" CA_CHAIN $(awk -F'[=;]' '/sslCACert=/
{a=$2} END { print a}' /etc/sysconfig/rhn/up2date)
+default_or_input "CA Chain" CA_CHAIN $(awk -F'[=;]' '/sslCACert=/
{a=$2} END { print a}' $SYSCONFIG_DIR/up2date)
if ! /sbin/runuser apache -s /bin/sh --command="[ -r $CA_CHAIN ]" ; then
echo Error: File $CA_CHAIN is not readable by apache user.
commit 5ee5023293c03958f00d8dc1337ad9f25d92f518
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sat Mar 28 00:08:25 2009 +0100
call set | grep only once
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 036f3e7..e1070d1 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -46,10 +46,12 @@ default_or_input () {
#var_a=${var_b:-word}
#which is like: var_a = $var_b ? word
DEFAULT=${CURRENT_VALUE:-$DEFAULT}
+ local VARIABLE_ISSET=$(set | grep "^$VARIABLE=")
+
echo -n "$MSG [$DEFAULT]: "
- if [ "$INTERACTIVE" = "1" -a -z "`set | grep
\"^$VARIABLE=\"`" ]; then
+ if [ "$INTERACTIVE" = "1" -a -z "$VARIABLE_ISSET" ];
then
read INPUT
- elif [ -z "`set | grep \"^$VARIABLE=\"`" ]; then
+ elif [ -z "$VARIABLE_ISSET" ]; then
echo $DEFAULT
else
eval "DEFAULT=\$$VARIABLE"