{"id":743,"date":"2019-10-28T14:55:42","date_gmt":"2019-10-28T19:55:42","guid":{"rendered":"http:\/\/www.brunerd.com\/blog\/?p=743"},"modified":"2019-10-28T17:27:06","modified_gmt":"2019-10-28T22:27:06","slug":"time-to-die-when-mac-app-and-package-certificates-expire","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2019\/10\/28\/time-to-die-when-mac-app-and-package-certificates-expire\/","title":{"rendered":"Time to Die: When Mac app and package certificates expire"},"content":{"rendered":"\n<p>So I had a Draft about this <em>last week<\/em> but an usure feeling. I thought: &#8220;Do I really have anything to contribute?  <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/derflounder.wordpress.com\/2019\/10\/16\/certificate-used-to-sign-older-apple-software-expiring-on-october-24-2019\/\" target=\"_blank\">Folks are already aware of this.<\/a> What can I really add?&#8221; So, I let it slide, then Thurday came and <a rel=\"noreferrer noopener\" aria-label=\"there was a hiccup (opens in a new tab)\" href=\"https:\/\/www.jamf.com\/jamf-nation\/discussions\/33717\/heads-up-apple-s-installer-certificate-expires-today\" target=\"_blank\">there was a hiccup<\/a>: Apple hadn&#8217;t refreshed all their packages! Oh noes. Could <em>this<\/em> have been something my script could have helped head off? <strong>No <\/strong><em>but<\/em> it might have made examining the packages Thursday afternoon a <em>bit<\/em> easier. So with that, I present <strong><a href=\"https:\/\/gist.github.com\/brunerd\/1e8402b70ab02115852badfd1536fd41\">certChecker.command<\/a><\/strong><\/p>\n\n\n\n<p>I&#8217;d advise just copy pasting the <a rel=\"noreferrer noopener\" aria-label=\"raw script (opens in a new tab)\" href=\"https:\/\/gist.github.com\/brunerd\/1e8402b70ab02115852badfd1536fd41\/raw\/643047ee8b39740990da3908e92c81b7ac126b8e\/certChecker.command\" target=\"_blank\">raw script<\/a> into a new <a rel=\"noreferrer noopener\" aria-label=\"BBEdit (opens in a new tab)\" href=\"https:\/\/www.barebones.com\/products\/bbedit\/download.html\" target=\"_blank\">BBEdit<\/a> document and saving it as &#8220;<strong>certChecker.command<\/strong>&#8220;. The extension matters, BBEdit will set the executable bit and you won&#8217;t have to mess with cleaning off the com.apple.quaratine flag as you would if you downloaded it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"339\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/certChecker-Output1.png\" alt=\"\" class=\"wp-image-769\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/certChecker-Output1.png 569w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/certChecker-Output1-300x179.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><figcaption>Not much of a looker at the command line but comes together nicely in Quick Look<\/figcaption><\/figure>\n\n\n\n<p>The need to find expired packages is critical if you use Jamf Pro to deploy your packages. macOS will throw an error if you try and install a pkg with an expired cert via the <code>installer<\/code> command line tool. It will suggest you use the <code>-allowUntrusted<\/code> flag, however this is <em>not<\/em> an option with Jamf Pro. You either have to get a new resigned package or <a rel=\"noreferrer noopener\" aria-label=\"repack it (opens in a new tab)\" href=\"https:\/\/gist.github.com\/brunerd\/6a0104cab32c0c372653555b072a98db\" target=\"_blank\">repack it<\/a>. Repacking is basically expanding the pacakge then flattening it again. This will strip out <em>all<\/em> certs. <strong><a href=\"https:\/\/gist.github.com\/brunerd\/6a0104cab32c0c372653555b072a98db\">repackPKGs.command<\/a><\/strong> is useful for when vendors have forgotten to issue new packages and you need a working package.<\/p>\n\n\n\n<p>Cert validation caveat: some packages can expire <em>yet<\/em> remain valid! These are signed with \u201ctrusted time stamps&#8221; and Suspicious Package <a href=\"https:\/\/www.mothersruin.com\/software\/SuspiciousPackage\/faq.html#trusted-timestamps\">explains this quite well<\/a>. Their tool can better help you assess what a package will do when it&#8217;s expiration occurs. For <strong><a href=\"https:\/\/gist.github.com\/brunerd\/1e8402b70ab02115852badfd1536fd41\">certChecker.command<\/a><\/strong> I use pkgutil&#8217;s assesment for package files but for apps all we have is the the &#8220;not after&#8221; date.<\/p>\n\n\n\n<p>Speaking of apps: the <strong>Install macOS Mojave.app<\/strong> from the <a rel=\"noreferrer noopener\" aria-label=\"App Store (opens in a new tab)\" href=\"https:\/\/itunes.apple.com\/us\/app\/macos-mojave\/id1398502828?ls=1&amp;mt=12\" target=\"_blank\">App Store<\/a> was giving me the \u201cdamaged\u201d message on Thursday around 1PM CST&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"263\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-Installer-Damaged.png\" alt=\"\" class=\"wp-image-770\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-Installer-Damaged.png 532w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-Installer-Damaged-300x148.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/figure>\n\n\n\n<p>The application certs were all VALID, my script said so, what gives? Doing a bit of sleuthing revealed InstallESD.dmg to be different between the two installers. I used <code>find<\/code> to run a <code>md5<\/code> on all the files in each installer and send the output to two files. Running find from <em>inside<\/em> the apps keeps the base paths the same and allows for easy comparison with diff or XCode&#8217;s FileMerge (a favorite).<\/p>\n\n\n\n<p><code>#compare two apps in Terminal<br>cd &lt;ye olde installer app&gt;<br>find . -type f -exec md5 {} \\; | sort &gt; ~\/Desktop\/YE_OLDE.txt<br>cd &lt;new installer app&gt;<br>find . -type f -exec md5 {} \\; | sort &gt; ~\/Desktop\/NEWNESS.txt<br>cd ~\/Desktop<br>diff YE_OLDE.txt NEWNESS.txt<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"435\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-diffs.png\" alt=\"\" class=\"wp-image-775\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-diffs.png 934w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-diffs-300x140.png 300w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-diffs-768x358.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><figcaption>FileMerge inside XCode.app is a great visual diff&#8217;er<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"286\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-OLD.png\" alt=\"\" class=\"wp-image-771\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-OLD.png 688w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-OLD-300x125.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><figcaption>Turns out we have some stowaways in the old installer.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"281\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-NEW.png\" alt=\"\" class=\"wp-image-772\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-NEW.png 692w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Mojave-InstallESD-NEW-300x122.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><figcaption>All is well, app cert and InstallESD packages are looking good.<\/figcaption><\/figure>\n\n\n\n<p>By ~3pm CST they&#8217;d gotten everything fixed and the packages inside were all good. Not since the <a href=\"https:\/\/www.jamf.com\/jamf-nation\/discussions\/13469\/quicktime-pkg-fails-cause-certificate-issue\">great expiration of 2015<\/a>, have we had to care about expiring Apple packages. This time Apple has only pushed the app certs out 1 1\/2 years to April 12th, 2021. That&#8217;s not long! The packages <em>inside<\/em> InstallESD.dmg are good however until April 14, 2029. Which one will win? Will we care (will we be able to roll back?) I&#8217;ll leave that as an exercise\/rhetorical question for someone else.<\/p>\n\n\n\n<p>In the meantime you might have other packages lurking in your distribution points that need updating or <a rel=\"noreferrer noopener\" aria-label=\"repacking (opens in a new tab)\" href=\"https:\/\/gist.github.com\/brunerd\/6a0104cab32c0c372653555b072a98db\" target=\"_blank\">repacking<\/a>. If so give  <strong><a href=\"https:\/\/gist.github.com\/brunerd\/1e8402b70ab02115852badfd1536fd41\">certChecker.command<\/a><\/strong> a whirl to ferret them out. I hope it saves you some time and effort &lt;insert reference to Roy Batty and &#8220;<a rel=\"noreferrer noopener\" aria-label=\"tears in the rain here (opens in a new tab)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Tears_in_rain_monologue\" target=\"_blank\">tears in the rain here<\/a>&#8221; :&gt;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I had a Draft about this last week but an usure feeling. I thought: &#8220;Do I really have anything to contribute? Folks are already aware of this. What can I really add?&#8221; So, I let it slide, then Thurday came and there was a hiccup: Apple hadn&#8217;t refreshed all their packages! Oh noes. Could [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,5,12],"tags":[],"class_list":["post-743","post","type-post","status-publish","format-standard","hentry","category-apple","category-os-x","category-packages","category-scripting"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=743"}],"version-history":[{"count":10,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/743\/revisions"}],"predecessor-version":[{"id":778,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/743\/revisions\/778"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}