Skip to content

Comments

Add the Chrome user agent when fetching initial Citrix page#1948

Merged
acodega merged 2 commits intoInstallomator:mainfrom
ccaviness:main
Jan 22, 2025
Merged

Add the Chrome user agent when fetching initial Citrix page#1948
acodega merged 2 commits intoInstallomator:mainfrom
ccaviness:main

Conversation

@ccaviness
Copy link
Contributor

It appears Citrix is blocking the cURL user agent.

Returns error with default user agent:

❯ curl -s -L $urlToParse
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;www&#46;citrix&#46;com&#47;downloads&#47;workspace&#45;app&#47;mac&#47;workspace&#45;app&#45;for&#45;mac&#45;latest&#46;html" on this server.<P>
Reference&#32;&#35;18&#46;a724c317&#46;1728485712&#46;585faa1
<P>https&#58;&#47;&#47;errors&#46;edgesuite&#46;net&#47;18&#46;a724c317&#46;1728485712&#46;585faa1</P>
</BODY>
</HTML>

Returns full page with Chrome user agent:

❯ curl -s -L --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" $urlToParse | wc -l
    3633

@kryptonit1
Copy link
Contributor

The user agent needs to be added to the htmlDocument variable in the newVersionString function as well. The label will otherwise not be able to fetch a value to the appNewVersion variable.

@acodega
Copy link
Collaborator

acodega commented Dec 6, 2024

How does this compare to #1987 ? Would be great if you and @pmex could collab cause I think these are slightly different from each other. (Sorry for the delay in our response)

@pmex
Copy link
Contributor

pmex commented Dec 6, 2024

Oh, I didn't see this one.
Seems like I both need to better att finding other's PR´s and at using the nice variables in Installomator :-/
I would say that the end result for the curl command is the same, but this solution is cleaner. I'll close my PR.
Sorry for the confusion!

@dan-snelson
Copy link
Contributor

In a single test, the following worked as expected for me:

citrixworkspace)
    #credit: Erik Stam (@erikstam) and #Philipp on MacAdmins Slack
    name="Citrix Workspace"
    type="pkgInDmg"
    curlOptions=( --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36")
    parseURL() {
        urlToParse='https://www.citrix.com/downloads/workspace-app/mac/workspace-app-for-mac-latest.html#ctx-dl-eula-external'
        htmlDocument=$(curl -s -L $urlToParse $curlOptions)
        xmllint --html --xpath "string(//a[contains(@rel, 'downloads.citrix.com')]/@rel)" 2> /dev/null <(print $htmlDocument)
    }
    downloadURL="https:$(parseURL)"
    newVersionString() {
        urlToParse='https://www.citrix.com/downloads/workspace-app/mac/workspace-app-for-mac-latest.html'
         htmlDocument=$(curl -fs $urlToParse $curlOptions)
         xmllint --html --xpath 'string(//p[contains(., "Version")])' 2> /dev/null <(print $htmlDocument)
     }
     appNewVersion=$(newVersionString | cut -d ' ' -f2 | cut -d '(' -f1)
     versionKey="CitrixVersionString"
     expectedTeamID="S272Y5R93J"
     ;;

❯ echo $downloadURL
https://downloads.citrix.com/23004/CitrixWorkspaceApp.dmg?__gda__=exp=1733506337~acl=/*~hmac=53acead06911939fd07dba532e65258f5151a4c33cfcb76cfda9f958b24d996b

❯ echo $appNewVersion
24.09.10.26
Screenshot 2024-12-06 at 11 28 59 AM

@acodega acodega linked an issue Jan 7, 2025 that may be closed by this pull request
@acodega acodega added this to the v10.7 milestone Jan 7, 2025
@acodega acodega added the application-issue App label issue that's not an Installomator bug. Vendor changed their installer, their website, etc. label Jan 7, 2025
@acodega
Copy link
Collaborator

acodega commented Jan 8, 2025

Better fix in #2057

@acodega acodega closed this Jan 8, 2025
@acodega acodega reopened this Jan 8, 2025
@acodega
Copy link
Collaborator

acodega commented Jan 8, 2025

Nevermind, label is fixing something else.

@scriptingosx
Copy link
Collaborator

so, which PR is the canonical one to fix this label?

@pmex
Copy link
Contributor

pmex commented Jan 21, 2025

I've closed my PR, so this one should be the only one left to fix the label.

@acodega acodega merged commit 3d293d3 into Installomator:main Jan 22, 2025
@KUSU2
Copy link

KUSU2 commented Jan 24, 2025

Looks like this wasn't fixed all the way. @dan-snelson has $curlOptions appended in the htmlDocument parameter that provides the final fix. See his comment above for the full code. Without $curlOptions it will fail to download.

2025-01-24 13:37:07 : ERROR : citrixworkspace : error downloading https:
ls: Citrix Workspace.dmg: No such file or directory
2025-01-24 13:37:07 : ERROR : citrixworkspace : File list: 
2025-01-24 13:37:07 : ERROR : citrixworkspace : File type: Citrix Workspace.dmg: cannot open `Citrix Workspace.dmg' (No such file or directory)
2025-01-24 13:37:07 : INFO  : citrixworkspace : Installomator did not close any apps, so no need to reopen any apps.
2025-01-24 13:37:07 : ERROR : citrixworkspace : ERROR: Error downloading https: error:
* URL rejected: Port number was not a decimal number between 0 and 65535
* Closing connection
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535

2025-01-24 13:37:07 : REQ   : citrixworkspace : ################## End Installomator, exit code 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application-issue App label issue that's not an Installomator bug. Vendor changed their installer, their website, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken app label: citrixworkspace

7 participants