PHPackages                             munkireport/gsx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. munkireport/gsx

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

munkireport/gsx
===============

Module for munkireport.

v2.1(6y ago)22.9k3[1 issues](https://github.com/munkireport/gsx/issues)MITPHP

Since Nov 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/munkireport/gsx)[ Packagist](https://packagist.org/packages/munkireport/gsx)[ RSS](/packages/munkireport-gsx/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)DependenciesVersions (5)Used By (0)

GSX module
==========

[](#gsx-module)

- [GSX module](#gsx-module)
    - [Remarks](#remarks)
    - [Configuration](#configuration)
    - [Making the `certbundle.pem`](#making-the-certbundlepem)
    - [Populating GSX Information](#populating-gsx-information)

Updates warranty status from Apple, designed as a warranty module supplement.

The GSX table provides the following information:

- Warranty status
- Coverage end date
- Coverage start date
- Days of coverage remaining, as last pulled from GSX
- Estimated purchase date
- Country of purchase
- Registration date
- Product decryption
- Shipping configuration
- Contract coverage end date
- Contract coverage start date
- Warranty contract type
- Labor covered
- Parts covered
- Warranty Service Level Agreement
- Is Mac a GSX loaner Mac
- Human readable warranty status
- Is vintage Mac
- Is obsolete Mac

The GSX module also updates the warranty and machine tables with the following:

- Purchase date
- Warranty end date
- Warranty status
- Product description

---

Data can be viewed under the GSX tab on the client details page or using the GSX listings view

Remarks
-------

[](#remarks)

- Requires the SOAP extension installed in `php`
- The client triggers the server to do a lookup once a day
- Obsolete Macs are not available from Apple and are instead processed using the warranty module's back end
- Previously it was recommended to only enable the GSX or the Warranty module, this has changed with MunkiReport 2.14 and the GSX module requires the Warranty module to be enabled

Configuration
-------------

[](#configuration)

Before you use the GSX module, you need to configure the `.env` file with your GSX account information. Some variables are not required.

```
GSX_ENABLE=true
GSX_CERT='/path/to/certbundle.pem'
GSX_CERT_KEYPASS='pass'
GSX_SOLD_TO='00000xxxxx'
GSX_SHIP_TO='00000xxxxx'
GSX_USERNAME='gsx_user@domain.com'
GSX_DATE_FORMAT='m/d/y'
```

Making the `certbundle.pem`
---------------------------

[](#making-the-certbundlepem)

These steps assume you've created your SSL certificates using

When creating the `certbundle.pem`, you must have the six signed pems sent back from Apple as well as the four gsx-\* files generated by you that you sent to Apple. First put all 10 files into a folder. Let's call it GSX-Certs.

Within the GSX-Certs folder, you need to cat your `gsx-production.key` and the Applecare-XXXX-Prod.apple.com.chain.pem together to form the bundle. In Terminal, cd to the GSX-Certs folder. Then run "cat Applecare-APP1234-0000123456.Prod.apple.com.chain.pem `gsx-production.key` &gt; `certbundle.pem`" making sure to put your AppleCare and sold to number in place of the example numbers.

This will output a `certbundle.pem` file that is roughly 6.1KB in size. Treat this file and the rest of the GSX certificates as passwords. Protect them. All that's left is to make sure that the `certbundle.pem` contains the proper data, example below, and point MunkiReport to where it's stored in a web server readable place in the `config.php` with the `gsx_cert` parameter.

Additional material can be found at

Example `certbundle.pem`:

```
-----BEGIN CERTIFICATE-----
BLASOQ()*Q#()**)REW)*(EW*)*E)WUR)*EW(UR)
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
0990320003q43090435J403439590S-S=DS=-
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
)_#_)#)$IK_#@))KDE_)FD_SF)DSF_DS)FDS_FDSFSD
....
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: ....
DEK-Info: ...
BUNCH OF GIBBERISH
-----END RSA PRIVATE KEY-----

```

Populating GSX Information
--------------------------

[](#populating-gsx-information)

Once you've configured the GSX module you'll probably want to recheck all of your existing warranty data against Apple's API. For an individual machine, that's easy - just go to Clients &gt; Computer Name &gt; Show (menu in the upper-left corner) &gt; GSX &gt; Recheck Warranty Status. For an entire fleet, that's a fair amount of work. Let's automate this.

First, open MunkiReport, then click Listings &gt; GSX. In the upper-left corner of the page, click the pop-up menu, then click All to display all of your Macs. In the upper-right corner of the page, click CSV. Select everything on the page, copy it to the clipboard, and paste it into a new document in your favorite text editor (TextWrangler is free, just don't use TextEdit). Save it to your Desktop as `all-macs.csv`.

Next, we'll want to trim this down to just serial numbers. Open the Terminal, then paste this:

```
cd ~/Desktop && awk -F "\"*,\"*" '{print $2}' all-macs.csv > serials.txt`
```

Hit enter, and you should see a new text file appear on the Desktop, called `serials.txt`. Open that up in your text editor, and delete the first line (called Serial Number). Save and close.

Now, make a new document in your text editor, and call it `gsx_lookup_all.sh`, also saving it to your Desktop. Paste this:

```
#!/bin/bash

MR_BASE_URL='https://yourmunkireportserver/index.php?'
MR_LOGIN='datauser'
MR_PASSWORD='secretpassword'
COOKIE_JAR=$(curl -s --cookie-jar - --data "login=${MR_LOGIN}&password=${MR_PASSWORD}" ${MR_BASE_URL}/auth/login)
SESSION_COOKIE=$(echo $COOKIE_JAR | sed 's/.*PHPSESSID /PHPSESSID=/')

while read serial
do
   curl -s --cookie "$SESSION_COOKIE" ${MR_BASE_URL}/module/gsx/recheck_gsx/"$serial" >> gsx_lookup.log
done
