<div dir="ltr">Hi Michael,<div><br></div><div>I am running a shell script in which it downloads all the channels  along  with the errata for my centos 7 spacewalk server.</div><div>In the script for authentication, i need to hard-code  SPACEWALK_USER=admin,  and SPACEWALK_PASS=abcdef</div><div><br></div><div>Instead of hard coding is there any way to encrypt this in shell script.</div><div><br></div><div>Please provide your inputs.</div><div><br></div><div>Here is the shell script</div><div><br></div><div><div>#!/bin/sh</div><div>MAILTO=root</div><div><br></div><div># try to create the lock and check the outcome</div><div>LOCKFILE=/var/run/spacewalk_sync.lock</div><div>if [ -e "$LOCKFILE" ]; then<br></div><div> echo "Another instance already running. Aborting."</div><div> exit 1</div><div>else</div><div> touch "$LOCKFILE"</div><div>fi</div><div>trap "rm ${LOCKFILE}" EXIT</div><div><br></div><div>#sync channels and publish updates</div><div><br></div><div>/usr/bin/spacewalk-repo-sync -c mm_centos7  >/dev/null</div><div>/usr/bin/spacewalk-repo-sync -c centos7-updates >/dev/null</div><div><br></div><div><br></div><div><br></div><div>#get errata file and checksums</div><div>cd /tmp</div><div>wget -N <a href="http://cefs.steve-meier.de/errata.latest.xml">http://cefs.steve-meier.de/errata.latest.xml</a> 1>/dev/null 2>&1</div><div>wget -N <a href="http://cefs.steve-meier.de/errata.latest.md5">http://cefs.steve-meier.de/errata.latest.md5</a> 1>/dev/null 2>&1</div><div>wget -N <a href="http://www.redhat.com/security/data/oval/com.redhat.rhsa-all.xml.bz2">http://www.redhat.com/security/data/oval/com.redhat.rhsa-all.xml.bz2</a> 1>/dev/null 2>&1</div><div>bunzip2 -f /tmp/com.redhat.rhsa-all.xml.bz2</div><div><br></div><div>#verify integrity</div><div><br></div><div>grep "errata.latest.xml$" errata.latest.md5 > myerrata.md5</div><div>md5sum -c myerrata.md5 1>/dev/null 2>&1</div><div><br></div><div>if [ "$?" == 0 ]; then</div><div> #ok - import errata</div><div><br></div><div> SPACEWALK_PASS=abcdef  SPACEWALK_USER=admin /opt/tools/<a href="http://errata-import.pl">errata-import.pl</a> --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</div><div><br></div><div> if [ "$?" != 0 ]; then</div><div> echo "It seems like there was a problem while publishing the most recent errata..."</div><div> exit 1</div><div> fi</div><div><br></div><div> rm /tmp/myerrata.md5</div><div>else</div><div> #errata information possibly invalid</div><div> echo "ERROR: md5 checksum mismatch, check download!"</div><div> exit 1</div><div>fi</div></div><div><br></div><div><br></div><div>Thanks</div><div>Sreenivasa</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 8, 2017 at 12:27 PM, Michael Mraka <span dir="ltr"><<a href="mailto:michael.mraka@redhat.com" target="_blank">michael.mraka@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sreenivasa Katra:<br>
> Hello,<br>
><br>
> How do i encrypt "admin" username and "password" of spacewalk server in<br>
> shell script?.<br>
<br>
Hello,<br>
<br>
what do you want to achieve? Why do you want to encrypt it?<br>
<br>
<br>
--<br>
Michael Mráka<br>
System Management Engineering, Red Hat<br>
<br>
______________________________<wbr>_________________<br>
Spacewalk-list mailing list<br>
<a href="mailto:Spacewalk-list@redhat.com">Spacewalk-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/spacewalk-<wbr>list</a></blockquote></div><br></div>