xolo-admin 1.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/xadm +3 -0
- data/data/client/xolo +152 -79
- data/lib/xolo/admin/command_line.rb +18 -5
- data/lib/xolo/admin/connection.rb +4 -2
- data/lib/xolo/admin/credentials.rb +94 -50
- data/lib/xolo/admin/highline_terminal.rb +14 -47
- data/lib/xolo/admin/interactive.rb +144 -15
- data/lib/xolo/admin/jamf_pro.rb +14 -0
- data/lib/xolo/admin/options.rb +37 -3
- data/lib/xolo/admin/processing.rb +76 -7
- data/lib/xolo/admin/progress_history.rb +1 -1
- data/lib/xolo/admin/title.rb +31 -24
- data/lib/xolo/admin/validate.rb +219 -41
- data/lib/xolo/admin/version.rb +53 -18
- data/lib/xolo/core/base_classes/title.rb +254 -18
- data/lib/xolo/core/base_classes/version.rb +47 -7
- data/lib/xolo/core/constants.rb +7 -3
- data/lib/xolo/core/security_cmd.rb +128 -0
- data/lib/xolo/core/version.rb +1 -1
- data/lib/xolo/core.rb +1 -0
- metadata +4 -9
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Copyright 2025 Pixar
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the terms set forth in the LICENSE.txt file available at
|
|
4
|
+
# at the root of this project.
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# frozen_string_literal: true
|
|
9
|
+
|
|
10
|
+
# main module
|
|
11
|
+
module Xolo
|
|
12
|
+
|
|
13
|
+
module Core
|
|
14
|
+
|
|
15
|
+
# Personal credentials for users of 'xadm', stored in the login keychain
|
|
16
|
+
#
|
|
17
|
+
module SecurityCmd
|
|
18
|
+
|
|
19
|
+
# Constants
|
|
20
|
+
##############################
|
|
21
|
+
##############################
|
|
22
|
+
|
|
23
|
+
# The security command
|
|
24
|
+
SEC_COMMAND = '/usr/bin/security'
|
|
25
|
+
|
|
26
|
+
# exit status when the login keychain can't be accessed because we aren't in a GUI session
|
|
27
|
+
SEC_STATUS_NO_GUI_ERROR = 36
|
|
28
|
+
|
|
29
|
+
# exit status when the keychain password provided is incorrect
|
|
30
|
+
SEC_STATUS_AUTH_ERROR = 51
|
|
31
|
+
|
|
32
|
+
# exit status when the desired item isn't found in the keychain
|
|
33
|
+
SEC_STATUS_NOT_FOUND_ERROR = 44
|
|
34
|
+
|
|
35
|
+
# Module methods
|
|
36
|
+
##############################
|
|
37
|
+
##############################
|
|
38
|
+
|
|
39
|
+
# when this module is included
|
|
40
|
+
def self.included(includer)
|
|
41
|
+
Xolo.verbose_include includer, self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Instance Methods
|
|
45
|
+
##########################
|
|
46
|
+
##########################
|
|
47
|
+
|
|
48
|
+
# Run the security command in interactive mode on a given keychain,
|
|
49
|
+
# passing in a subcommand and its arguments. so that they don't appear in the
|
|
50
|
+
# `ps` output
|
|
51
|
+
#
|
|
52
|
+
# @param cmd [String] the subcommand being passed to 'security' with
|
|
53
|
+
# all needed options. It will not be visible outide this process, so
|
|
54
|
+
# its OK to put passwords into the options.
|
|
55
|
+
#
|
|
56
|
+
# @return [String] the stdout of the 'security' command.
|
|
57
|
+
#
|
|
58
|
+
######
|
|
59
|
+
def run_security(cmd)
|
|
60
|
+
output = Xolo::BLANK
|
|
61
|
+
errs = Xolo::BLANK
|
|
62
|
+
|
|
63
|
+
Open3.popen3("#{SEC_COMMAND} -i") do |stdin, stdout, stderr, wait_thr|
|
|
64
|
+
# pid = wait_thr.pid # pid of the started process.
|
|
65
|
+
stdin.puts cmd
|
|
66
|
+
stdin.close
|
|
67
|
+
|
|
68
|
+
output = stdout.read
|
|
69
|
+
errs = stderr.read
|
|
70
|
+
|
|
71
|
+
@security_exit_status = wait_thr.value # Process::Status object returned.
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# exit 44 is 'The specified item could not be found in the keychain'
|
|
75
|
+
return output.chomp if @security_exit_status.success?
|
|
76
|
+
|
|
77
|
+
case @security_exit_status.exitstatus
|
|
78
|
+
when SEC_STATUS_AUTH_ERROR
|
|
79
|
+
raise Xolo::KeychainError, 'Problem accessing login keychain. Is it locked?'
|
|
80
|
+
|
|
81
|
+
when SEC_STATUS_NOT_FOUND_ERROR
|
|
82
|
+
raise Xolo::NoSuchItemError, "No xolo admin password. Please run 'xadm config'"
|
|
83
|
+
|
|
84
|
+
else
|
|
85
|
+
errs.chomp!
|
|
86
|
+
errs =~ /: returned\s+(-?\d+)$/
|
|
87
|
+
errnum = Regexp.last_match(1)
|
|
88
|
+
desc = errnum ? security_error_desc(errnum) : errs
|
|
89
|
+
desc ||= errs
|
|
90
|
+
raise Xolo::KeychainError, "#{desc.gsub("\n", '; ')}; exit status #{@security_exit_status.exitstatus}"
|
|
91
|
+
end # case
|
|
92
|
+
end # run_security
|
|
93
|
+
|
|
94
|
+
# use `security error` to get a description of an error number
|
|
95
|
+
##############
|
|
96
|
+
def security_error_desc(num)
|
|
97
|
+
desc = `#{SEC_COMMAND} error #{num}`
|
|
98
|
+
return if desc.include?('unknown error')
|
|
99
|
+
|
|
100
|
+
desc.chomp.split(num).last
|
|
101
|
+
rescue
|
|
102
|
+
nil
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# given a string, wrap it in single quotes and escape internal single quotes
|
|
106
|
+
# and backslashes so it can be used in the interactive 'security' command
|
|
107
|
+
#
|
|
108
|
+
# @param str[String] the string to escape
|
|
109
|
+
#
|
|
110
|
+
# @return [String] the escaped string
|
|
111
|
+
###################
|
|
112
|
+
def security_escape(str)
|
|
113
|
+
# first escape backslashes
|
|
114
|
+
str = str.to_s.gsub '\\', '\\\\\\'
|
|
115
|
+
|
|
116
|
+
# then single quotes
|
|
117
|
+
str.gsub! "'", "\\\\'"
|
|
118
|
+
|
|
119
|
+
# if other things need escaping, add them here
|
|
120
|
+
|
|
121
|
+
"'#{str}'"
|
|
122
|
+
end # security_escape
|
|
123
|
+
|
|
124
|
+
end # module Prefs
|
|
125
|
+
|
|
126
|
+
end # module Admin
|
|
127
|
+
|
|
128
|
+
end # module Xolo
|
data/lib/xolo/core/version.rb
CHANGED
data/lib/xolo/core.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xolo-admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Lasell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -68,14 +68,8 @@ dependencies:
|
|
|
68
68
|
version: '2.1'
|
|
69
69
|
description: |
|
|
70
70
|
== Xolo
|
|
71
|
-
Xolo (sorta pronounced 'show-low') is an HTTPS server and set of command-line tools for macOS that provide automatable access to the software deployment and patch management aspects of {Jamf Pro}[https://www.jamf.com/products/jamf-pro/] and the {Jamf Title Editor}[https://learn.jamf.com/en-US/bundle/title-editor/page/About_Title_Editor.html]. It enhances Jamf Pro's abilities in many ways
|
|
71
|
+
Xolo (sorta pronounced 'show-low') is an HTTPS server and set of command-line tools for macOS that provide automatable access to the software deployment and patch management aspects of {Jamf Pro}[https://www.jamf.com/products/jamf-pro/] and the {Jamf Title Editor}[https://learn.jamf.com/en-US/bundle/title-editor/page/About_Title_Editor.html]. It enhances Jamf Pro's abilities in many ways.
|
|
72
72
|
|
|
73
|
-
* Management of titles and versions/patches is scriptable and automatable, allowing developers and admins to integrate with CI/CD workflows.
|
|
74
|
-
* Simplifies and standardizes the complex, multistep manual process of managing titles and patches using the Title Editor and Patch Management web interfaces.
|
|
75
|
-
* Client installs can be performed by remotely via ssh and/or MDM
|
|
76
|
-
* Automated pre-release piloting of new versions/patches
|
|
77
|
-
* Titles can be expired (auto-uninstalled) after a period of disuse, reclaiming unused licenses.
|
|
78
|
-
* And more!
|
|
79
73
|
|
|
80
74
|
The xolo-admin gem packages the code needed to run 'xadm', the command-line tool for system administrators to deploy and maintain software titles using Xolo.
|
|
81
75
|
email: xolo@pixar.com
|
|
@@ -118,6 +112,7 @@ files:
|
|
|
118
112
|
- lib/xolo/core/json_wrappers.rb
|
|
119
113
|
- lib/xolo/core/loading.rb
|
|
120
114
|
- lib/xolo/core/output.rb
|
|
115
|
+
- lib/xolo/core/security_cmd.rb
|
|
121
116
|
- lib/xolo/core/version.rb
|
|
122
117
|
homepage: https://pixaranimationstudios.github.io/xolo-home/
|
|
123
118
|
licenses:
|