[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


# try to create the lock and check the outcome
if [ -e "$LOCKFILE" ]; then
 echo "Another instance already running. Aborting."
 exit 1
 touch "$LOCKFILE"
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 --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

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


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?.


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

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