salt icon indicating copy to clipboard operation
salt copied to clipboard

file.managed is TOO secure

Open martinhbramwell opened this issue 12 years ago • 11 comments

In ./salt/salt/modules/file.py the method ...

get_managed(
    name,
    template,
    source,
    source_hash,
    etc, etc,

... demands inflexibly that the remote source provide a valid checksum for every file of type http, https or ftp.

Not all remote sources can be counted on to provide one. An alternative is needed, since a check sum is still required internally, once a file has been retrieved.

file.get_managed should agree with pkg.installed and permit a skip_verify argument. In that event, rather than check the validity of a check_sum, the routine should generate one as soon as the file is fully acquired.

martinhbramwell avatar Dec 15 '13 12:12 martinhbramwell

Sounds great! Thanks for the report.

basepi avatar Dec 16 '13 19:12 basepi

Thank you! I hope to be more help than that in future.

On Mon, Dec 16, 2013 at 2:12 PM, Colton Myers [email protected]:

Sounds great! Thanks for the report.

— Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/9272#issuecomment-30690234 .

martinhbramwell avatar Dec 16 '13 19:12 martinhbramwell

+1, this affects the archive.extracted state as well, when attempting to retrieve from a third party website (i.e. dynamically pulling in wordpress plugins).

EDIT: Patch from #9446 does allow the download and extraction to proceed, however as the name is munged when passed to the implicit file.managed state, and the filename which is searched for in the hash file is the munged file name, you are unable to effectively use a file with more than one hash present. I'm not sure if you want this in a separate issue or not.

garrickp avatar Feb 17 '15 17:02 garrickp

+1000

nafg avatar May 04 '15 02:05 nafg

Is using cmd.run with 'curl' the only other option while we wait for this feature?

syedaali avatar Oct 30 '15 05:10 syedaali

You can also curl the file down once, calculate the checksum yourself, and use that for the file.managed state.

basepi avatar Nov 03 '15 17:11 basepi

+1

adithep avatar Jan 28 '16 16:01 adithep

ZD-616

meggiebot avatar Feb 05 '16 19:02 meggiebot

Should we split out the name munging issue for the separate hash file, or has that been done already?

garrickp avatar Feb 29 '16 17:02 garrickp

@garrickp can you please clarify?

terminalmage avatar Mar 01 '16 15:03 terminalmage

For context see my edit to my initial comment - basically you can't use the hash file option for checking hashes on downloaded objects.

garrickp avatar Mar 01 '16 16:03 garrickp