0

I'm trying to unzip a zip file in a remote server
This file was download first from jFrog repository
The following task should handle the unzip:

- name: Unzip Config.zip file
  community.windows.win_unzip:
    src: C:\files\config.zip
    dest: C:\files\
    recurse: no
    delete_archive: yes
  when: "'center_primary_appservers' in group_names"

But produced the following error

TASK [jfrog : Unzip Config.zip file] **************************************************************************************************************************************task path: /ansible/roles/jfrog/tasks/unzip_config.yml:1
redirecting (type: modules) ansible.builtin.win_unzip to community.windows.win_unzip
Using module file /usr/local/lib/python3.6/site-packages/ansible_collections/community/windows/plugins/modules/win_unzip.ps1
Pipelining is enabled.
<vm1.domain.com> ESTABLISH WINRM CONNECTION FOR USER: DOMAIN\hiddai on PORT 5985 TO vm1.domain.com
fatal: [vm1.domain.com]: FAILED! => {
    "changed": false,
    "dest": "C:\\files\\",
    "msg": "Error unzipping 'C:\\files\\config.zip' to 'C:\\files\\'! Filename contains relative paths which would extract outside the destination: \\src\\Build\\Trunk\\Src\\BuildProcess\\BuildMessageTemplates\\BuildAlertTemplate.htm",
    "removed": false,
    "src": "C:\\files\\config.zip"
}
META: 
META: 
META: 
META: 
META: 
META: 
META: 
META: ran handlers
META: ran handlers

I installed 7Zip on the remote machine and ran the task again - same result
To mention that:

  • this zip folder is extract with 7Zip tool only and not with the Windows built-in unzip tool...
  • the Expand-Archive command managed to extract the zip folder

What should I do in order the file to be unzip successfully with ansible win_unzip module?

Hiddai
  • 67
  • 2
  • 10
  • Report the problem to whoever created the zip file. This is a serious security risk. – Michael Hampton Aug 18 '21 at 13:39
  • @MichaelHampton - may you clarify about the security risk and how it is solve my issue? – Hiddai Aug 18 '21 at 20:46
  • A naïve unzip tool could overwrite any file in the disk because of that. If the zip file were malicious then this could compromise or destroy your installed OS. In this case it would just put the files in unexpected locations, and possibly overwrite something important. – Michael Hampton Aug 19 '21 at 01:45

0 Answers0