[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Spacewalk-list] Encrypting admin username and password of spacewalk server



Hi Michael,

I am running a shell script in which it downloads all the channels  along  with the errata for my centos 7 spacewalk server.
In the script for authentication, i need to hard-code  SPACEWALK_USER=admin,  and SPACEWALK_PASS=abcdef

Instead of hard coding is there any way to encrypt this in shell script.

Please provide your inputs.

Here is the shell script

#!/bin/sh
MAILTO=root

# try to create the lock and check the outcome
LOCKFILE=/var/run/spacewalk_sync.lock
if [ -e "$LOCKFILE" ]; then
 echo "Another instance already running. Aborting."
 exit 1
else
 touch "$LOCKFILE"
fi
trap "rm ${LOCKFILE}" EXIT

#sync channels and publish updates

/usr/bin/spacewalk-repo-sync -c mm_centos7  >/dev/null
/usr/bin/spacewalk-repo-sync -c centos7-updates >/dev/null



#get errata file and checksums
cd /tmp
wget -N http://cefs.steve-meier.de/errata.latest.xml 1>/dev/null 2>&1
wget -N http://cefs.steve-meier.de/errata.latest.md5 1>/dev/null 2>&1
wget -N http://www.redhat.com/security/data/oval/com.redhat.rhsa-all.xml.bz2 1>/dev/null 2>&1
bunzip2 -f /tmp/com.redhat.rhsa-all.xml.bz2

#verify integrity

grep "errata.latest.xml$" errata.latest.md5 > myerrata.md5
md5sum -c myerrata.md5 1>/dev/null 2>&1

if [ "$?" == 0 ]; then
 #ok - import errata

 SPACEWALK_PASS=abcdef  SPACEWALK_USER=admin /opt/tools/errata-import.pl --server 192.168.24.48 --errata errata.latest.xml --include-channels=mm_centos7,centos7-updates --rhsa-oval=/tmp/com.redhat.rhsa-all.xml --publish 1>/dev/null

 if [ "$?" != 0 ]; then
 echo "It seems like there was a problem while publishing the most recent errata..."
 exit 1
 fi

 rm /tmp/myerrata.md5
else
 #errata information possibly invalid
 echo "ERROR: md5 checksum mismatch, check download!"
 exit 1
fi


Thanks
Sreenivasa


On Fri, Sep 8, 2017 at 12:27 PM, Michael Mraka <michael mraka redhat com> wrote:
Sreenivasa Katra:
> Hello,
>
> How do i encrypt "admin" username and "password" of spacewalk server in
> shell script?.

Hello,

what do you want to achieve? Why do you want to encrypt it?


--
Michael Mráka
System Management Engineering, Red Hat

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list redhat com
https://www.redhat.com/mailman/listinfo/spacewalk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]