Code Monkey home page Code Monkey logo

sal-scripts's People

Contributors

a-zaleski avatar arubdesu avatar aschwanb avatar asemak avatar blahblah12345678924 avatar cah-edward-shorrock avatar clburlison avatar epackorigan avatar erikng avatar gavinelder avatar grahamgilbert avatar ingomeyer441 avatar johnmikee avatar joncrain avatar keeleysam avatar korylprince avatar lctrkid avatar loyaltyarm avatar ninxsoft avatar octomike avatar sheagcraig avatar thehilll avatar tordn avatar weswhet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sal-scripts's Issues

BigSur Issue

I am having issues with BigSur machines reporting in. It seems that some python modules are not found.

Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/munki_checkin.py", line 12, in <module>
    from munkilib import munkicommon
  File "/usr/local/munki/munkilib/munkicommon.py", line 35, in <module>
    from .info import *
  File "/usr/local/munki/munkilib/info.py", line 36, in <module>
    import LaunchServices
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/LaunchServices/__init__.py", line 10, in <module>
    import CoreServices
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/CoreServices/__init__.py", line 14, in <module>
    from CoreServices import (
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/CoreServices/LaunchServices/__init__.py", line 16, in <module>
    objc.pathForFramework(
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/objc/_dyld.py", line 136, in pathForFramework
    fpath, name, version = infoForFramework(dyld_find(path))
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/objc/_dyld.py", line 130, in dyld_find
    return dyld_framework(filename, framework_name, version)
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/site-packages/objc/_dyld.py", line 98, in dyld_framework
    raise ImportError("Framework %s could not be found" % (framework_name,))
ImportError: Framework CoreServices could not be found```

Curl failures

I've had mysterious curl failures at my JOB place.

Specifically, if I let curl negotiate to HTTP2 with our sal server, it fails. If I override this in the code to use HTTP1.1 it works.

If I change the path to curl to use a current brew-installed curl, it works.

While I wouldn't say I exhaustively tried to solve this issue, it did make me interested in an alternative approach to Sal client checkins.

I'm working on a branch using python requests with a custom HTTPAdapter that allows you to use the macOS keychain's roots (instead of libressl for curl or certifi for requests) for verifying the server.

.DS_Store causing iterdir to barf

2020-09-24 17:02:07,137 DEBUG /usr/local/sal/external_scripts/Encryption/encryption.py ran successfuly.
Traceback (most recent call last):
  File "/usr/local/sal/bin/sal-submit", line 359, in <module>
    main()
  File "/usr/local/sal/bin/sal-submit", line 55, in main
    run_plugins(run_type)
  File "/usr/local/sal/bin/sal-submit", line 130, in run_plugins
    run_external_scripts(run_type)
  File "/usr/local/sal/bin/sal-submit", line 142, in run_external_scripts
    for script in folder.iterdir():
  File "/usr/local/sal/Python.framework/Versions/3.8/lib/python3.8/pathlib.py", line 1118, in iterdir
    for name in self._accessor.listdir(self):
NotADirectoryError: [Errno 20] Not a directory: '/usr/local/sal/external_scripts/.DS_Store'

Ohai attributes are retrieved from stdout, which may include non-json output

Currently, Ohai attributes are retrieved directly from stdout. Depending on the configuration of Ohai, this may result in unrelated Ohai warnings being included when Sal attempts to parse the json.

For example, if the Ohai configuration includes ohai.log_location STDOUT Ohai's output may include something like [2019-03-22T10:56:06-07:00] WARN: Plugin Network: [inet] no ip address on utun4. When Sal attempts to parse this, it will throw an exception on the - character, which causes all of the Ohai data to be skipped.

Potentially, Sal could override the log level by passing something like -l fatal, but it might be best to leave this decision up to the admin and include a note in the wiki.

munki checkin keyerror

Apparently you can have a ManagedInstallReport that does not include an EndTime. We probably need to do a dict.get for these keys instead of just blindly trusting that they'll be there.

Troubleshooting informations

Hi,
I have deployed Sal using docker according to https://github.com/salopensource/sal/wiki/Getting-Started (using the latest tags to date) and I have a working munki repo on the same server. Test clients run sal-scripts 2.1.5 and Munki 3.6.4.
I am having issues getting the clients to report: the configuration looks good and the server logs too, but the machine group does not get populated. I tried to restart after setting the preferences SoftwareURL and key, and also to manually run /usr/local/sal/bin/sal-submit -d as root, which exits with code 0 producing no output/error at all. Therefore it's very hard to debug what could be going wrong...
Is there a better way to troubleshoot the client/server configuration? Thanks a lot in advance!
Simone

py3 bytes vs str issue in postfligh

Apr 15 2020 11:39:03 +0100     postflight stderr: Traceback (most recent call last):
  File "/usr/local/munki/postflight.d/sal-postflight", line 102, in <module>
    main()
  File "/usr/local/munki/postflight.d/sal-postflight", line 95, in main
    ensure_launchd_loaded()
  File "/usr/local/munki/postflight.d/sal-postflight", line 88, in ensure_launchd_loaded
    if LAUNCHD not in loaded_launchds and os.path.exists(LAUNCHD_PATH):
TypeError: a bytes-like object is required, not 'str'

Support different date formats than US

Describe the bug
sal-submit complains about unrecognized date format when using something else than US date format

To Reproduce
Use a different timezone than any US-timezone
Try to manuallly submit data to sal, using sal-submit

Expected behavior
Return of prompt, data populated in sal server.

Server (please complete the following information):

  • Host environment Docker on RHEL 7
  • Version 4.0.3 (really 4.x)

Client (please complete the following information):

  • OS: [macOS]

Additional context
Output from sal-submit command:

sudo /usr/local/sal/bin/sal-submit -v                                                                                           2019-11-01 19:49:37,065 INFO sal-submit Version: 3.0.0
2019-11-01 19:49:38,175 INFO Processing checkin modules...
Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 188, in <module>
    main()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 19, in main
    sus_report = get_sus_install_report()
  File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 93, in get_sus_install_report
    installed = datetime.datetime.strptime(line[-1], '%m/%d/%Y, %H:%M:%S')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_strptime.py", line 332, in _strptime
    (data_string, format))
ValueError: time data '2019-10-30, 18:43:41' does not match format '%m/%d/%Y, %H:%M:%S'
2019-11-01 19:49:39,913 INFO Processing plugins...
2019-11-01 19:49:43,822 INFO Processing inventory...
2019-11-01 19:49:44,321 INFO Inventory is out of date; submitting...
2019-11-01 19:49:45,773 INFO Processing catalogs...
2019-11-01 19:49:45,903 INFO Processing profiles...
2019-11-01 19:49:46,219 INFO Checkin complete.

If possible, please replicate the issue while Sal is in debug mode.
N/A

scripts version:

package-id: com.github.salopensource.sal_scripts
version: 3.0.0

Old, non-working, puppet in path breaks sal-submit

As requested by @grahamgilbert in #sal in the macadmins slack

sudo /usr/local/sal/bin/sal-submit 
Traceback (most recent call last):
  File "/usr/local/sal/bin/sal-submit", line 670, in <module>
    main()
  File "/usr/local/sal/bin/sal-submit", line 66, in main
    puppet_version = puppet_vers()
  File "/usr/local/sal/bin/sal-submit", line 276, in puppet_vers
    puppet_version = subprocess.check_output(command).strip()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This was apparently caused by having an old, non-working, puppet in $PATH:

puppet --version
zsh: /usr/local/bin/puppet: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: no such file or directory

rm /usr/local/bin/puppet resulted in:

sudo /usr/local/sal/bin/sal-submit 
Could not load Puppet: cannot load such file -- puppet

profiles checkin module throwing error

On 10.15.6 machine I am getting this error with my profiles. This is using Sal Scripts 3.2.1.

Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/profile_checkin.py", line 69, in <module>
    main()
  File "/usr/local/sal/checkin_modules/profile_checkin.py", line 35, in main
    data['organization'] = profile['ProfileOrganization'] or 'None'
KeyError: 'ProfileOrganization'

It looks like it deals with

data['organization'] = profile['ProfileOrganization'] or 'None'

Sal-Scripts fails to report to the Sal sever

been running into a problem with Sal-Scripts reporting to our Sal server. here is the output below.

** Details/Background **
2018 MBP running macOS 11.4 BigSur
started after I upgraded to BigSur from Catalina
so far i'm the only device in our org's fleet to have this problem
re-installs/reboots do not resolve the issue
Running Sal-Scripts 4.1.1, downloaded/installed today, reporting to Sal server 4.1.6 running in a docker container on CentOS7

** Output from debug **

REDACTED$ sudo /usr/local/sal/bin/sal-submit -d -v
Password:
2021-05-26 12:32:20,155 INFO sal-submit Version: 4.1.1
2021-05-26 12:32:20,155 DEBUG Sal client prefs:
2021-05-26 12:32:20,157 DEBUG ServerURL: REDACTED (prefs)
2021-05-26 12:32:20,157 DEBUG key: 75o3ca2u8v5y5krwl48ow6v2tsb55czz49uajjklmls8ns2cuok9hczbjeg8ahul79wagb6qxotob17ve7yrwvv8wndatfpxg69i6bqeol524qj3yreq0up7qu3fbfba (prefs)
2021-05-26 12:32:20,157 DEBUG BasicAuth: 1 (prefs)
2021-05-26 12:32:20,157 DEBUG SyncScripts: 1 (prefs)
2021-05-26 12:32:20,157 DEBUG SkipFacts: [] (prefs)
2021-05-26 12:32:20,157 DEBUG CACert: None (prefs)
2021-05-26 12:32:20,157 DEBUG SendOfflineReport: False (prefs)
2021-05-26 12:32:20,157 DEBUG SSLClientCertificate: None (prefs)
2021-05-26 12:32:20,157 DEBUG SSLClientKey: None (prefs)
2021-05-26 12:32:20,157 DEBUG MessageBlacklistPatterns: None (prefs)
2021-05-26 12:32:20,250 INFO Processing checkin modules...
Traceback (most recent call last):
File "/usr/local/sal/checkin_modules/machine_checkin.py", line 208, in
main()
File "/usr/local/sal/checkin_modules/machine_checkin.py", line 32, in main
extras.update(process_system_profile())
File "/usr/local/sal/checkin_modules/machine_checkin.py", line 45, in process_system_profile
machine_results["serial"] = system_profile["SPHardwareDataType"][0]["serial_number"]
KeyError: 'SPHardwareDataType'
2021-05-26 12:38:23,709 DEBUG '/usr/local/sal/checkin_modules/sal_checkin.py' ran successfully
2021-05-26 12:38:23,710 DEBUG '/usr/local/sal/checkin_modules/munki_checkin.py' ran successfully
2021-05-26 12:38:23,710 DEBUG '/usr/local/sal/checkin_modules/profile_checkin.py' ran successfully
2021-05-26 12:38:23,710 DEBUG '/usr/local/sal/checkin_modules/machine_checkin.py' had errors during execution!
2021-05-26 12:38:23,710 DEBUG '/usr/local/sal/checkin_modules/apple_sus_checkin.py' ran successfully
2021-05-26 12:38:23,712 INFO Processing plugins...
2021-05-26 12:38:23,712 WARNING No external data plist found.
2021-05-26 12:38:23,721 DEBUG Using MacKeychainClient
2021-05-26 12:38:23,722 DEBUG Checkin submission:
2021-05-26 12:38:23,723 DEBUG {
"Sal": {
"extra_data": {
"sal_version": "4.1.1",
"key": "75o3ca2u8v5y5krwl48ow6v2tsb55czz49uajjklmls8ns2cuok9hczbjeg8ahul79wagb6qxotob17ve7yrwvv8wndatfpxg69i6bqeol524qj3yreq0up7qu3fbfba"
},
"facts": {
"checkin_module_version": "1.1.0"
}
},
"Munki": {
"extra_data": {
"munki_version": "5.2.3.4295",
"manifest": "Testing",
"runtype": "auto"
},
"facts": {
"checkin_module_version": "1.2.0",
"RunType": "auto",
"StartTime": "2021-05-26 15:55:08 +0000",
"EndTime": "2021-05-26 15:55:16 +0000",
"arch": "x86_64",
"date": "2021-05-26T15:55:08+00:00",
"hostname": "REDACTED,
"ibridge_model_name": "Apple T2 Security Chip",
"ipv4_address": "REDACTED",
"ipv6_address": "",
"machine_model": "MacBookPro15,1",
"machine_type": "laptop",
"munki_version": "5.2.3.4295",
"os_build_last_component": 71,
"os_build_number": "20F71",
"os_vers": "11.4",
"os_vers_major": 11,
"os_vers_minor": 4,
"os_vers_patch": 0,
"serial_number": "SERIAL#REDACTED",
"x86_64_capable": true
},
"messages": [
{
"message_type": "WARNING",
REDACTED
},
{
"message_type": "WARNING",
"text": "Could not process item sal-osquery for update. No pkginfo found in catalogs: testing"
},
{
"message_type": "WARNING",
REDACTED
},
{
"message_type": "WARNING",
"text": "Could not process item sal-osquery for optional install. No pkginfo found in catalogs: testing"
},
{
"message_type": "WARNING",
"text": "ChangeUpdateServerTesting.mobileconfig is a featured item but not an optional install"
},
{
"message_type": "WARNING",
REDACTED
},
{
"message_type": "WARNING",
REDACTED
},
{
"message_type": "WARNING",
REDACTED
},
{
"message_type": "WARNING",
"text": "sal-osquery is a featured item but not an optional install"
},
{
"message_type": "WARNING",
"text": "Company Portal MDM is a featured item but not an optional install"
}
],
REDACTED
}
},
"Company Portal MDM 4.35.21050901": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Company Portal MDM 4.35.21050901",
"data": {
"description": "Microsoft Intune is a Microsoft cloud-based management solution that provides for mobile device and operating system management.",
"display_name": "Company Portal MDM",
"installed_size": 58355,
"installed_version": "4.35.21050901",
"type": "ManagedInstalls",
"self_serve": "False"
}
REDACTED
}
},
"1Password 7.8.4": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "1Password 7.8.4",
"data": {
"description": "1Password is a password manager that goes beyond simple password storage by integrating directly with your web browser to automatically log you into websites, enter credit card information, fill registration forms, and easily generate strong passwords.",
"display_name": "1Password",
"installed_size": 215197,
"installed_version": "7.8.4",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"AdoptOpenJDK 12 12.0.2+10-201910130913": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "AdoptOpenJDK 12 12.0.2+10-201910130913",
"data": {
"description": "AdoptOpenJDK 12 HotSpot",
"display_name": "AdoptOpenJDK 12",
"installed_size": 328204,
"installed_version": "12.0.2+10-201910130913",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Angry IP Scanner 3.7.6": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Angry IP Scanner 3.7.6",
"data": {
"description": "Angry IP Scanner - fast and friendly network scanner",
"display_name": "Angry IP Scanner",
"installed_size": 1749,
"installed_version": "3.7.6",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"bigsurblocker 20201111": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "bigsurblocker 20201111",
"data": {
"description": "",
"display_name": "bigsurblocker",
"installed_size": 169,
"installed_version": "20201111",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
REDACTED
}
},
"coconutBattery 3.9.5": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "coconutBattery 3.9.5",
"data": {
"description": "Displays info about your laptop battery.",
"display_name": "coconutBattery",
"installed_size": 14251,
"installed_version": "3.9.5",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Git 2.31.0": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Git 2.31.0",
"data": {
"description": "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.",
"display_name": "Git for Mac",
"installed_size": 50923,
"installed_version": "2.31.0",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"GlobalProtect 5.2.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "GlobalProtect 5.2.2",
"data": {
"description": "",
"display_name": "GlobalProtect",
"installed_size": 36080,
"installed_version": "5.2.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"GoogleChrome 91.0.4472.77": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "GoogleChrome 91.0.4472.77",
"data": {
"description": "Chrome is a fast, simple, and secure web browser, built for the modern web.",
"display_name": "Google Chrome",
"installed_size": 100630,
"installed_version": "91.0.4472.77",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"LastPass 4.4.0": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "LastPass 4.4.0",
"data": {
"description": "",
"display_name": "LastPass",
"installed_size": 12161,
"installed_version": "4.4.0",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Malwarebytes (newer than 4.7.9.3978)": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Malwarebytes (newer than 4.7.9.3978)",
"data": {
"description": "Proven Malwarebytes technology crushes the growing threat of Mac malware.\nSo you are protected and your machine keeps running silky smooth.\nFinally, cybersecurity smart enough for the Mac.",
"display_name": "Malwarebytes",
"installed_size": 55441,
"installed_version": "(newer than 4.7.9.3978)",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Microsoft Remote Desktop 10.5.1": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Microsoft Remote Desktop 10.5.1",
"data": {
"description": "With the Microsoft Remote Desktop app, you can connect to a remote PC and your work resources from almost anywhere. Experience the power of Windows with RemoteFX in a Remote Desktop client designed to help you get your work done wherever you are.",
"display_name": "Microsoft Remote Desktop",
"installed_size": 65498,
"installed_version": "10.5.1",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"MSTeams 1.00.411161": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "MSTeams 1.00.411161",
"data": {
"description": "Microsoft Teams is the new chat-centered workspace in Office 365. Keep all your content, tools, people, and conversations together in one place.",
"display_name": "Microsoft Teams",
"installed_size": 251577,
"installed_version": "1.00.411161",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"NoMAD 1.2.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "NoMAD 1.2.2",
"data": {
"description": "NoMAD is a helpful replacement for Active Directory bindings, using Kerberos and other resources to provide Active Directory services without a fragile binding plugin",
"display_name": "NoMAD",
"installed_size": 15875,
"installed_version": "1.2.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Office2019Suite 16.49.0": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Office2019Suite 16.49.0",
"data": {
"description": "",
"display_name": "Office2019Suite",
"installed_size": 9324660,
"installed_version": "16.49.0",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"OneDrive 21.30.211": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "OneDrive 21.30.211",
"data": {
"description": "\n Get to your files from anywhere, on any device, with Microsoft OneDrive. Share and work together with anyone in your work and life. With OneDrive for Business, you also get storage for your work files so you can share and collaborate on them with other people at your work or school/university. The OneDrive app for Mac makes it easy to work with your OneDrive files on your Mac.",
"display_name": "OneDrive",
"installed_size": 172977,
"installed_version": "21.30.211",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"OpenJDK 12.0.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "OpenJDK 12.0.2",
"data": {
"description": "",
"display_name": "OpenJDK",
"installed_size": 292834,
"installed_version": "12.0.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"OpenJDK 12 12.0.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "OpenJDK 12 12.0.2",
"data": {
"description": "OpenJDK is a free and open-source implementation of the Java Platform, Standard Edition.",
"display_name": "OpenJDK 12",
"installed_size": 313117,
"installed_version": "12.0.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Packages 1.2.9": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Packages 1.2.9",
"data": {
"description": "Whenever you need to create an installation package or distribution for Mac OS X 10.5 or later, Packages is the powerful and flexible solution you're looking for.",
"display_name": "Packages",
"installed_size": 12765,
"installed_version": "1.2.9",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Privileges 1.5.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Privileges 1.5.2",
"data": {
"description": "Privileges.app for macOS is designed to allow users to work as a standard user for day-to-day use, by providing a quick and easy way to get administrator rights when needed. When you do need admin rights, you can get them by clicking on the Privileges icon in your Dock.",
"display_name": "Privileges",
"installed_size": 6335,
"installed_version": "1.5.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"sal_scripts 4.1.1": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "sal_scripts 4.1.1",
"data": {
"description": "Client side scripts for Sal.",
"display_name": "sal_scripts",
"installed_size": 81394,
"installed_version": "4.1.1",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
REDACTED
}
},
"Slack 4.16.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Slack 4.16.2",
"data": {
"description": "Slack is a platform for team communication: everything in one place, instantly searchable, available wherever you go.",
"display_name": "Slack",
"installed_size": 78792,
"installed_version": "4.16.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"SuspiciousPackageApp 3.5.3": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "SuspiciousPackageApp 3.5.3",
"data": {
"description": "Suspicious Package: An Application for Inspecting OS X Installer Packages",
"display_name": "Suspicious Package App",
"installed_size": 6147,
"installed_version": "3.5.3",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"TextMate2 2.0.19": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "TextMate2 2.0.19",
"data": {
"description": "TextMate brings Apple's approach to operating systems into the world of text editors. By bridging UNIX underpinnings and GUI, TextMate cherry-picks the best of both worlds to the benefit of expert scripters and novice users alike.",
"display_name": "TextMate 2",
"installed_size": 23053,
"installed_version": "2.0.19",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Visual Studio Code 1.56.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Visual Studio Code 1.56.2",
"data": {
"description": "Code combines the streamlined UI of a modern editor with rich code assistance and navigation, and an integrated debugging experience \u2013 without the need for a full IDE.",
"display_name": "Visual Studio Code",
"installed_size": 178801,
"installed_version": "1.56.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"VMwareFusion12 12.1.2": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "VMwareFusion12 12.1.2",
"data": {
"description": "VMware Fusion is the easiest, fastest, and most reliable way to run Windows and other x86 based operating systems on a Mac without rebooting.",
"display_name": "VMWare Fusion Pro 12",
"installed_size": 637150,
"installed_version": "12.1.2",
"type": "ManagedInstalls",
"self_serve": "False"
}
},
"Webex Teams 3.0.13538.0": {
"date_managed": "2021-05-26T16:32:21.548475+00:00",
"status": "PRESENT",
"name": "Webex Teams 3.0.13538.0",
"data": {
"description": " ",
"display_name": "Webex Teams",
"installed_size": 111699,
"installed_version": "3.0.13538.0",
"type": "ManagedInstalls",
"self_serve": "False"
}
}
}
},
"Profiles": {
"facts": {
"checkin_module_version": "1.0.0"
},
"managed_items": {
"NoMAD AD/Shares": {
"name": "NoMAD AD/Shares",
"date_managed": "2021-04-26 21:28:25 +0000",
"status": "PRESENT",
"data": {
"payload 1": {
"PayloadContent": {
"ADDomain": "REDACTED",
"ChangePasswordType": "Kerberos",
"KerberosRealm": "REDACTED",
"LocalPasswordSync": true,
"LocalPasswordSyncOnMatchOnly": true,
REDACTED
},
"PersistExpiration": true,
"RenewTickets": true,
"SecondsToRenew": 3600,
"SelfServicePath": "/Applications/Managed Software Center.app",
"UseKeychain": true,
"UserSwitch": true
},
"PayloadDisplayName": "NoMAD",
"PayloadIdentifier": "com.trusourcelabs.NoMAD",
"PayloadType": "com.trusourcelabs.NoMAD",
"PayloadUUID": "E9892287-5EF9-4032-9794-8DDFC74BD7B8",
"PayloadVersion": 1
},
"payload 2": {
"PayloadContent": {
"Shares": [
{
"AutoMount": true,
"ConnectedOnly": false,
"Name": "Departments",
"URL": "REDACTED"
},
{
"AutoMount": true,
"ConnectedOnly": false,
"Name": "Corporate",
"URL": "REDACTED"
},
{
"AutoMount": true,
"ConnectedOnly": false,
"Name": "Scratch",
"URL": "REDACTED"
},
{
"AutoMount": true,
"ConnectedOnly": false,
"Name": "Home",
"URL": "REDACTED"
}
]
},
"PayloadDisplayName": "NoMAD Shares",
"PayloadIdentifier": "menu.nomad.shares",
"PayloadType": "menu.nomad.shares",
"PayloadUUID": "DE6D028E-A6AA-4383-AE88-9C672467EF00",
"PayloadVersion": 1
},
"payload_types": "com.trusourcelabs.NoMAD, menu.nomad.shares",
"profile_description": "This Profile configures the use of NoMAD to apply shares and Active Directory services",
"identifier": "org.REDACTED.F7DCB458-0204-4182-A8BB-8D5378211AE7",
"organization": "REDACTED",
"uuid": "259C689A-F270-455D-ACC3-5F827222014A",
"verification_state": ""
}
},
"MunkiDev": {
"name": "MunkiDev",
"date_managed": "2021-01-28 14:45:43 +0000",
"status": "PRESENT",
"data": {
"payload 1": {
"PayloadContent": {
"CatalogURL": "http://munkidev.REDACTED/catalogs",
"ClientIdentifier": "Testing",
"DaysBetweenNotifications": 1,
"FollowHTTPRedirects": "none",
"IconURL": "http://munkidev.REDACTED/icons",
"InstallAppleSoftwareUpdates": true,
"InstallRequiresLogout": false,
"LogFile": "/Library/Managed Installs/Logs/ManagedSoftwareUpdate.log",
"LogToSyslog": true,
"LoggingLevel": 1,
"MSUDebugLogEnabled": true,
"ManagedInstallDir": "/Library/Managed Installs",
"PackageURL": "http://munkidev.REDACTED/pkgs",
"PackageVerificationMode": "hash",
"ShowOptionalInstallsForHigherOSVersions": false,
"ShowRemovalDetail": true,
"SoftwareRepoURL": "http://munkidev.REDACTED/",
"SuppressAutoInstall": false,
"SuppressLoginwindowInstall": false,
"SuppressStopButtonOnInstall": true,
"SuppressUserNotification": false,
"UnattendedAppleUpdates": true,
"UseNotificationCenterDays": 3
},
"PayloadDisplayName": "Munki",
"PayloadIdentifier": "com.REDACTED.ProfileCreator.D4613D67-8B52-420A-9035-74660B4BFA7C.ManagedInstalls.359CF715-4E24-489E-A061-FD4ABD8FB6A5",
"PayloadOrganization": "REDACTED",
"PayloadType": "ManagedInstalls",
"PayloadUUID": "359CF715-4E24-489E-A061-FD4ABD8FB6A5",
"PayloadVersion": 1
},
"payload_types": "ManagedInstalls",
"profile_description": "None",
"identifier": "REDACTED.ProfileCreator.D4613D67-8B52-420A-9035-74660B4BFA7C",
"organization": "REDACTED",
"uuid": "D4613D67-8B52-420A-9035-74660B4BFA7C",
"verification_state": ""
}
},
"Management Profile": {
"name": "Management Profile",
"date_managed": "2021-02-19 16:38:38 +0000",
"status": "PRESENT",
"data": {
"payload 1": {
"PayloadContent": {},
"PayloadDescription": "Credential Profile for installing root certificate",
"PayloadDisplayName": "Credential Profile",
"PayloadIdentifier": "www.windowsintune.com.credentials",
"PayloadOrganization": "Microsoft",
"PayloadType": "com.apple.security.root",
"PayloadUUID": "16fb2545-152c-40de-9aca-9dcc799867ed",
"PayloadVersion": 1
},
"payload 2": {
"PayloadContent": {},
"PayloadDescription": "SCEP Profile for issuing a device certificate",
"PayloadDisplayName": "SCEP Profile",
"PayloadIdentifier": "Microsoft.Profiles.SCEP",
"PayloadOrganization": "REDACTED",
"PayloadType": "com.apple.security.scep",
"PayloadUUID": "8E1495C5-535B-4689-88C6-244315327A36",
"PayloadVersion": 1
},
"payload 3": {
"PayloadContent": {
"AccessRights": 8191,
"CheckInURL": "https://i.manage.microsoft.com/DeviceGatewayProxy/ioscheckinhandler.ashx?Platform=MacMDM",
"CheckOutWhenRemoved": true,
"IdentityCertificateUUID": "REDACTED",
"ServerCapabilities": [
"com.apple.mdm.per-user-connections"
],
"ServerURL": "https://i.manage.microsoft.com/DeviceGatewayProxy/ioshandler.ashx?Platform=MacMDM",
"SignMessage": false,
"Topic": "com.apple.mgmt.External.bbead177-ab07-REDACTED-18b20271983d",
"UseDevelopmentAPNS": false
},
"PayloadDescription": "Install this profile to get access to your company apps",
"PayloadDisplayName": "Management Profile",
"PayloadIdentifier": "Microsoft.Payloads.MDM",
"PayloadOrganization": "REDACTED",
"PayloadType": "com.apple.mdm",
"PayloadUUID": "67A5265B-12D4-4EB5-A2B3-72C683E33BCF",
"PayloadVersion": 1
},
"payload 4": {
"PayloadContent": {},
"PayloadDescription": "Credential Profile for installing root certificate",
"PayloadDisplayName": "Credential Profile",
"PayloadIdentifier": "www.windowsintune.com.credentials",
"PayloadOrganization": "Microsoft",
"PayloadType": "com.apple.security.root",
"PayloadUUID": "dc37b0d8-77a0-4941-95REDACTED34582b",
"PayloadVersion": 1
},
"payload_types": "com.apple.security.root, com.apple.security.scep, com.apple.mdm, com.apple.security.root",
"profile_description": "Install this profile to get access to your company apps",
"identifier": "Microsoft.Profiles.MDM",
"organization": "REDACTED",
"uuid": "C539BE6C-F080-4B24REDACTED6A4D6",
"verification_state": "verified"
}
}
}
},
"Apple Software Update": {
"facts": {
"checkin_module_version": "1.1.0",
"catalog": "https://swscan.apple.com/content/catalogs/others/index-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz",
"last_check": "2021-05-26T16:26:18+00:00"
},
"managed_items": {
"macOS 11.1": {
"date_managed": "2021-01-28T02:42:14+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.1"
}
},
"MRTConfigData": {
"date_managed": "2021-05-17T22:05:41+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "1.78"
}
},
"XProtectPlistConfigData": {
"date_managed": "2021-05-14T23:39:58+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "2146"
}
},
"macOS 11.2": {
"date_managed": "2021-02-08T22:42:09+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.2"
}
},
"macOS 11.2.1": {
"date_managed": "2021-02-09T23:48:42+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.2.1"
}
},
"macOS 11.2.2": {
"date_managed": "2021-02-26T01:22:09+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.2.2"
}
},
"macOS 11.2.3": {
"date_managed": "2021-03-09T03:03:17+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.2.3"
}
},
"macOS 11.3": {
"date_managed": "2021-04-27T01:38:44+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.3"
}
},
"macOS 11.3.1": {
"date_managed": "2021-05-17T21:20:59+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.3.1"
}
},
"macOS 11.4": {
"date_managed": "2021-05-26T17:43:55+00:00",
"status": "PRESENT",
"data": {
"type": "Apple SUS Install",
"version": "11.4"
}
}
},
"update_history": []
},
"plugin_results": []
}
2021-05-26 12:38:23,726 DEBUG Sending report
2021-05-26 12:38:23,731 DEBUG Starting new HTTPS connection (1): sal.REDACTED.org:443
2021-05-26 12:38:24,182 DEBUG https://REDACTED:443 "POST /checkin/ HTTP/1.1" 400 47
2021-05-26 12:38:24,183 DEBUG Response HTTP 400: Checkin JSON is missing required key "Machine"!
Traceback (most recent call last):
File "/usr/local/sal/bin/sal-submit", line 391, in
main()
File "/usr/local/sal/bin/sal-submit", line 85, in main
send_inventory(submission["Machine"]["extra_data"]["serial"])
KeyError: 'Machine'

curl subprocess stderr is empty string and not None

The --silent option has been added to curl in utils.py: https://github.com/salopensource/sal-scripts/blob/master/utils.py#L83 Because of this the following stderr will always be of type string and empty:

task = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = task.communicate()

This leads to all if stderr is not None: statments beint evaluated as True.

I don't know if this is intended behaviour but it would be good to change the statements to something like if stderr to make the behavour more explicit.

machine_checkin.py reads wrong os_version for older macOS systems

Commit f1e43dd introduced a regression for the operatingsystem plugin in SAL.

(I know they are officially unsupported..), but older clients have this os_version value:

<key>os_version</key>
<string>OS X 10.11.6 (15G22010)</string>

while the "new" naming scheme is:

<key>os_version</key>
<string>macOS 10.15 (19A583)</string>

This results in a TypeError in SAL within the operatingsystem plugin, because it tries to compare (sort) X with 10.15.

ERROR [django.request:228] Internal Server Error: /load_plugin/OperatingSystem/machine_group/1/
Traceback (most recent call last):
  File "/home/sal/.virtualenvs/sal/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/sal/.virtualenvs/sal/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/sal/.virtualenvs/sal/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/sal/.virtualenvs/sal/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "./server/non_ui_views.py", line 123, in plugin_load
    plugin_object.widget_content(request, group_type=group_type, group_id=group_id))
  File "./sal/plugin.py", line 241, in widget_content
    context = self.get_context(queryset, **kwargs)
  File "/home/sal/sal/server/plugins/operatingsystem/operatingsystem.py", line 69, in get_context
    (key, sorted(grouped[key], key=os_key, reverse=True)) for key in OS_TABLE.values()]
  File "/home/sal/sal/server/plugins/operatingsystem/operatingsystem.py", line 69, in <listcomp>
    (key, sorted(grouped[key], key=os_key, reverse=True)) for key in OS_TABLE.values()]
  File "/usr/lib/python3.7/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/lib/python3.7/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'int' and 'str'

I can create a PR, but I'm not sure where to catch this issue. It's probably best to catch this here and return 10.11.6 instead of X, but it could also be handled (ignored) in the sal plugin.

Issue converting Munki Conditions to a string

2020-09-24 17:01:49,357 INFO Processing checkin modules...
Traceback (most recent call last):
  File "/usr/local/sal/checkin_modules/munki_checkin.py", line 157, in <module>
    main()
  File "/usr/local/sal/checkin_modules/munki_checkin.py", line 42, in main
    value = ', '.join(value)
TypeError: sequence item 0: expected str instance, dict found

Apple SUS Checkin issue

I have a few clients that are failing to checkin because the Apple SUS checkin module has this error and kills the whole checkin from sending to the server.

Currently this is on a 10.11.6 (15G22010) Machine running Sal-Scripts 3.1.1.

/usr/local/sal/bin/sal-submit
Traceback (most recent call last):
File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 179, in
main()
File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 20, in main
sus_submission['facts'] = get_sus_facts()
File "/usr/local/sal/checkin_modules/apple_sus_checkin.py", line 68, in get_sus_facts
result['last_check'] = _get_log_time(line).isoformat()
AttributeError: 'NoneType' object has no attribute 'isoformat'

`utils.py` is ambiguous and may collide with other python modules

The pre/postflight scripts import utils from /usr/local/sal/ by appending that directory to the path: https://github.com/salopensource/sal-scripts/blob/master/payload/usr/local/munki/preflight#L7-L8
https://github.com/salopensource/sal-scripts/blob/master/payload/usr/local/munki/postflight#L7-L8

If a python module is available in the path with the name utils, it may break Sal and potentially Munki. Example of ManagedSoftwareUpdate.log on an impacted machine:

Oct 05 2018 20:42:45 -0700 Starting...
Oct 05 2018 20:42:45 -0700     Performing preflight tasks...
Oct 05 2018 20:42:45 -0700     preflight return code: 1
Oct 05 2018 20:42:45 -0700     preflight stderr: Traceback (most recent call last):
  File "/usr/local/munki/preflight", line 19, in <module>
    main()
  File "/usr/local/munki/preflight", line 15, in main
    utils.run_scripts(PREFLIGHT_DIR, sys.argv[1])
AttributeError: 'module' object has no attribute 'run_scripts'
Oct 05 2018 20:42:45 -0700     managedsoftwareupdate run aborted by preflight script: 1

This could be resolved by one of the following:

  • Rename utils.py to a unique name like salutils.py
  • Change to a relative import with something like from . import utils
  • Make it a package by adding a __init__.py and importing sal.utils

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.