I encountered an interesting issue recently I thought I’d document and share.
We have essentially two Munki servers, an “internal” server, visible only to the internal network, running on a Linux VM, using Apache. The repo it serves is also synced to Amazon S3 storage, which is served via CloudFront, and is (obviously) available eternally to clients.
One of our testers noted a problem getting a certain release of a certain software package:
This seemed strange as we could verify the file (a dmg) was actually present in the repo. But one of our engineers pointed out there was a “+” in the filename (or, actually, two):
pkgs/apps/pcoip-client_26.08.0-rc0+5-8be81eb928-26.08.0rc0+5.dmg
So to simplify testing, I created a test manifest: manifests/greg+test.
I could download it from our local Munki repo server:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>catalogs</key>
<array>
<string>production</string>
</array>
<!-- snip -->
</dict>
</plist>
But once synced to S3, our Munki client failed to download it:
$ sudo managedsoftwareupdate --id "greg+test" -vvv
Managed Software Update Tool
Version 7.1.0.5685
<snip>
Getting manifest greg+test...
<snip>
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>manifests/greg test</Key><RequestId>redacted</RequestId><Redacted></Error>
You can see the request was for "manifests/greg+test”, but CloudFront interpreted it as "manifests/greg test”; in other words, it interpreted the + as a space.
A fix/workaround would be for Munki to encode all + signs in URLs as "%2B” — in brief testing that still works with our internal Apache server, but I’m not certain it will work with all web servers. Technically, in URL paths the + should be treated as a literal plus sign, while a space should be encoded as %20. Only in URL query parameters should a + be interpreted as a space.
For now, our fix was to simply rename the disk image to not contain any + characters in the filename.
Curious if others have encountered this, and what your thoughts might be about Munki encoding + as %2B in URL paths.
-Greg