Using a password protected Windows Software Repository

47 views
Skip to first unread message

Paul A

unread,
Aug 13, 2016, 5:34:36 PM8/13/16
to Salt-users
Hi

Can anyone help advise how you can specify a basic html username/password to be used when installing a package? Reading the doco shows how to use a password protected git repository, but nothing about a standard http repository.

I can get it to work by putting in the u/p in the installer URL like this:

installer: 'http://username:pass...@192.168.19.171/FILE.exe'

but the issue is that on the minion, it downloads the file into a folder which shows the u/p:
C:\salt\var\cache\salt\minion\extrn_files\base\username...@192.168.19.171

i tried to copy the way git was being used by doing this, but without any luck:
user: username
password: password

Thanks

David Boucha

unread,
Aug 16, 2016, 12:04:32 PM8/16/16
to salt users list
can you show us a full sanitized version of your sls file?
> --
> You received this message because you are subscribed to the Google Groups "Salt-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Paul A

unread,
Aug 20, 2016, 3:03:27 AM8/20/16
to Salt-users
Hi, here is one that works, but stores the u/p in the cache folder
smp:
latest:
full_name: SMP
installer: 'http://username:pass...@192.168.19.171/program.exe'
install_flags: '-s'
uninstaller: '%LocalAppData%/program/uninstall.exe'
uninstall_flags: '--uninstall'
msiexec: False
locale: en_US
reboot: False

Adding in these lines, and remove the u/p from the URL did not work:

Loren Gordon

unread,
Aug 20, 2016, 8:29:17 AM8/20/16
to Salt-users
Since 2015.8, salt has supported rendering in winrepo files. So maybe keep the user/password in pillar?

{%- set user = pillar.get('pillar:path:to:user') %}
{%- set password = pillar.get('pillar:path:to:password') %}

smp:
  latest:
    full_name: SMP
    installer: 'http://{{ user }}:{{ password }}@192.168.19.171/program.exe'

    install_flags: '-s'
    uninstaller: '%LocalAppData%/program/uninstall.exe'
    uninstall_flags: '--uninstall'
    msiexec: False
    locale: en_US
    reboot: False


On Saturday, August 20, 2016 at 3:03:27 AM UTC-4, Paul A wrote:
Hi, here is one that works, but stores the u/p in the cache folder
smp:
  latest:
    full_name: SMP

Paul A

unread,
Aug 25, 2016, 4:29:41 AM8/25/16
to Salt-users
Hi

i tried this, but the folder it created had the username & password in the folder name:

Username...@192.168.19.193

Any other ideas?

Loren Gordon

unread,
Aug 25, 2016, 7:29:37 AM8/25/16
to Salt-users
Nope. :(

Not seeing an issue requesting this feature, either. Perhaps submit one?

-Loren

Paul A

unread,
Aug 26, 2016, 4:59:43 PM8/26/16
to Salt-users
Hi Loren

If I only knew how to code. My skill set goes as far as bash scripting :-(

Loren Gordon

unread,
Aug 26, 2016, 5:06:49 PM8/26/16
to Salt-users
You don't need to know how to code to request the feature. Just complete the form, https://github.com/saltstack/salt/issues/new.

Of course, you'll probably get it faster if you do code it yourself than if you wait for saltstack or another community member to do it, even counting the time it takes to learn a little python, git, and the structure of salt's source. :)

-Loren

Paul Azad

unread,
Sep 20, 2017, 7:29:01 PM9/20/17
to Salt-users
Hi

i know this is an old post - but am not able to use the pillar data in a package install. As soon as i do i get 'Unable to locate package'

minion:
    ----------
    PACKAGE:
        Unable to locate package PACKAGE

this is happening on both new packages i create where i use the pillar data as an install flag, or on the original package from this original post.

I am using salt mater 2016.11.0
Here is the original install package that i am getting the issue with (havent used this package in 12 months - so not sure when it stopped working)

smp:
  latest:
    full_name: SMP
    installer: 'http://{{ pillar['user'] }}:{{ pillar['password'] }}@192.168.9.193/smp.exe'
    install_flags: '-s'
    uninstaller: '%LocalAppData%/slack/Update.exe'
    uninstall_flags: '--uninstall -s'
    msiexec: False
    locale: en_US
    reboot: False

and this is the new package i created
application:
  '1.1.0':
    full_name: 'application'
    {% if grains['cpuarch'] == 'AMD64' %}
    uninstaller: '"%PROGRAMFILES%\application\uninstall.exe"'
    {% elif grains['cpuarch'] == 'x86' %}
    uninstaller: '"%PROGRAMFILES%\application\uninstall.exe"'
    {% endif %}
    install_flags: '{{ pillar['user'] }}:{{ pillar['password'] }}'
    msiexec: False
    locale: en_US
    reboot: False

If i remove the pillar section on either installer (ie change it to just text) and do a pkg.refresh_db and pkg.install - it works. So i know 100% the issue is to do with the pillar section. I have also tried to change the pillar section to this and get the same issue.

{%pillar.get('username') %} {%pillar.get('password') %}

Can anyone help as to the issue?

thanks

Paul Azad

unread,
Sep 22, 2017, 11:15:53 PM9/22/17
to Salt-users
Found the issue. Got it working using this:

install_flags: '{{ pillar['username'] }} {{ pillar['password'] }}'
Reply all
Reply to author
Forward
0 new messages