You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/06/28 11:34:06 UTC
svn commit: r1497700 -
/incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh
Author: srimanth
Date: Fri Jun 28 09:34:06 2013
New Revision: 1497700
URL: http://svn.apache.org/r1497700
Log:
AMBARI-2519. Add download CSV action for security wizard. (srimanth)
Modified:
incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh
Modified: incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh?rev=1497700&r1=1497699&r2=1497700&view=diff
==============================================================================
--- incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh (original)
+++ incubator/ambari/branches/branch-1.2.5/ambari-server/src/main/resources/scripts/keytabs.sh Fri Jun 28 09:34:06 2013
@@ -49,6 +49,7 @@ processCSVFile () {
rm -f commands.chmod;
rm -f commands.addprinc;
rm -f commands.xst
+ rm -f commands.xst.cp
rm -f commands.chown.1
rm -f commands.chmod.1
rm -f commands.chmod.2
@@ -56,6 +57,7 @@ processCSVFile () {
seenHosts="";
seenPrincipals="";
+ echo "mkdir -p ./tmp_keytabs" >> commands.mkdir;
cat $csvFile | while read line; do
hostName=`echo $line|cut -d , -f 1`;
service=`echo $line|cut -d , -f 2`;
@@ -75,8 +77,13 @@ processCSVFile () {
seenPrincipals="$seenPrincipals$principal"
fi
+ tmpKeytabFile=${keytabFile/\/etc\/security\/keytabs/`pwd`/tmp_keytabs}
newKeytabFile=${keytabFile/\/etc\/security\/keytabs/`pwd`/keytabs_$hostName}
- echo -e "kadmin.local -q \"xst -k $newKeytabFile $principal\"" >> commands.xst;
+ if [ ! -f $tmpKeytabFile ]; then
+ echo "kadmin.local -q \"xst -k $tmpKeytabFile $principal\"" >> commands.xst;
+ fi
+ echo "cp $tmpKeytabFile $newKeytabFile" >> commands.xst.cp
+
if [ "$service" == "SPNEGO User" ]; then
echo "chmod 440 $newKeytabFile" >> commands.chmod.2
else
@@ -137,6 +144,7 @@ processCSVFile () {
echo "# Creating Kerberos Principal keytabs in host specific keytab folders"
echo "###########################################################################"
cat commands.xst;
+ cat commands.xst.cp;
echo ""
echo "###########################################################################"
echo "# Changing ownerships of host specific keytab files"
@@ -148,11 +156,17 @@ processCSVFile () {
echo "###########################################################################"
cat commands.chmod.1
cat commands.chmod.2
+ echo ""
+ echo "###########################################################################"
+ echo "# Cleanup"
+ echo "###########################################################################"
+ echo "rm -rf ./tmp_keytabs"
rm -f commands.mkdir;
rm -f commands.chmod;
rm -f commands.addprinc;
rm -f commands.xst
+ rm -f commands.xst.cp
rm -f commands.chown.1
rm -f commands.chmod.1
rm -f commands.chmod.2