ruby-jss 1.6.0 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e0dafc4e4ff96d1752578ca2cdb38bd4410f6aa5a32d42d02b8abf499269ab0
4
- data.tar.gz: 5d4cb7b7846541246c029f9d562fed7a30eba677aeae8f50e186d0ebcef33a97
3
+ metadata.gz: ee3b11d92a6a8458b44076a60036f3f0444452f223d4b6d4d8511bb952eb84df
4
+ data.tar.gz: 4b4f15a1325b53ac1658adf9cd0b19fb05b371f67025036a4b50107afed1106d
5
5
  SHA512:
6
- metadata.gz: ca56f63003f45b7eeeda5adc2843dc399c4944126d116fc16dd8ce73b3a5af70333a581847b5e15641b76171e8bf6e7969622a52052fff1d25fbace4564c36d3
7
- data.tar.gz: 37dd3abb514c208cda9329296ce1b1f4aa9746adb1a93837920d47a62aa171db20bcd9aa20927012445e979b8b69ecc07642202eaef6f0faa9252b2bd28df9dc
6
+ metadata.gz: a00b4942915039bc4a1b71ccdc794c4fa4bb96a5e816579406b363a4250ddda27144942951e34e517f8cffd7e6a3e945408c59d6b9de504cec6c6dea87d3361b
7
+ data.tar.gz: ea75b60f659291a3791f5a551fba38da11e6943871e8d0ccb8af1150e525ad4869fc1f4a73e4597ac3b561b282a7ec8fcdf9be8ae458333958c8b2f22df530b5
data/CHANGES.md CHANGED
@@ -4,7 +4,51 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## \[1.6.0] - 2021-05-??
7
+ ## **IMPORTANT: Known Security Issue in v1.5.3 and below**
8
+
9
+ Versions of ruby-jss prior to 1.6.0 contain a known security issue due to the use of the 'plist' gem.
10
+
11
+ This has been resolved in 1.6.0, which now uses the CFProperlyList gem.
12
+
13
+ Please update all installations of ruby-jss to at least v1.6.0.
14
+
15
+ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
16
+
17
+ ## \[1.6.4] - 2021-10-04
18
+
19
+ ### Fixed
20
+
21
+ - Removed erroneous call to generate self-service XML from JSS::RestrictedSoftware#rest_xml, restricted software items in Jamf Pro are not 'self servable'. Thanks to @marekluban for catching and reporting this one!
22
+
23
+ ### Added
24
+
25
+ - Attribute reader JSS::Computer#security, returning the hash of data from the 'security' subset of API computer data.
26
+
27
+ ## \[1.6.3] - 2021-09-13
28
+
29
+ ### Fixed
30
+
31
+ - Fixed a bug where some Jamf Pro API CollectionResource subclasses could not be fetched twice without a '.all' scache refresh
32
+
33
+ ### Changed
34
+
35
+ - DBConnection.valid_server? connection timeout raised to 60 seconds
36
+
37
+ - Update JSS.expand_min_os to handle the fact that OS versions from Apple now have three meaningful parts (major.minor.patch) and that the patch version might be an 'x', as well as the minor version.
38
+
39
+
40
+ ## \[1.6.1] - 2021-07-27
41
+
42
+ ### Fixed
43
+
44
+ - Resolved some more typo-errors regarding display names in the SelfServable mixin module.
45
+
46
+ ### Changed
47
+
48
+ - MySQL connections via the DBConnection class now report some authentication errors more clearly.
49
+
50
+
51
+ ## \[1.6.0] - 2021-05-24
8
52
 
9
53
  ### Fixed
10
54
 
data/README.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # ruby-jss: Working with the Jamf Pro Classic API in Ruby
2
2
  [![Gem Version](https://badge.fury.io/rb/ruby-jss.svg)](http://badge.fury.io/rb/ruby-jss)
3
3
 
4
+ ## **IMPORTANT: Known Security Issue in v1.5.3 and below**
5
+
6
+ Versions of ruby-jss prior to 1.6.0 contain a known security issue due to the use of the 'plist' gem.
7
+
8
+ This has been resolved in 1.6.0, which now uses the CFProperlyList gem.
9
+
10
+ Please update all installations of ruby-jss to at least v1.6.0.
11
+
12
+ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
13
+
4
14
  ### Table of contents
5
15
  * [DESCRIPTION](#description)
6
16
  * [SYNOPSIS](#synopsis)
@@ -373,10 +373,9 @@ module Jamf
373
373
  identifiers.each do |ident|
374
374
  next if ident == :id
375
375
 
376
- id = raw_data_by_other_identifier(ident, value, cnx: cnx)
377
- return id if id
376
+ data = raw_data_by_other_identifier(ident, value, cnx: cnx)
377
+ return data if data
378
378
  end # identifiers.each
379
- return
380
379
  end
381
380
  private_class_method :raw_data_by_value_only
382
381
 
@@ -392,9 +391,9 @@ module Jamf
392
391
  private_class_method :raw_data_by_id
393
392
 
394
393
  # Given an indentier attr. key, and a value,
395
- # return the id where that ident has that value, or nil
394
+ # return the raw data where that ident has that value, or nil
396
395
  #
397
- def self.raw_data_by_other_identifier(identifier, value, refresh: false, cnx: Jamf.cnx)
396
+ def self.raw_data_by_other_identifier(identifier, value, refresh: true, cnx: Jamf.cnx)
398
397
  # if the API supports filtering by this identifier, just use that
399
398
  return all(filter: "#{identifier}=='#{value}'", paged: true, page_size: 1, cnx: cnx).first if self::OBJECT_MODEL[identifier][:filter_key]
400
399
 
@@ -848,7 +848,6 @@ module Jamf
848
848
  # @param cnx[Jamf::Connection] the API connection for the object
849
849
  #
850
850
  def initialize(data, cnx: Jamf.cnx)
851
-
852
851
  raise Jamf::InvalidDataError, 'Invalid JSONObject data - must be a Hash' unless data.is_a? Hash
853
852
 
854
853
  @cnx = cnx
@@ -1021,8 +1020,7 @@ module Jamf
1021
1020
  value =
1022
1021
  if attr_def[:multi]
1023
1022
  raw_array = data[attr_name] || []
1024
-
1025
- raw_array.map! { |v| parse_single_init_value v, attr_name, attr_def }
1023
+ raw_array.map { |v| parse_single_init_value v, attr_name, attr_def }
1026
1024
  else
1027
1025
  parse_single_init_value data[attr_name], attr_name, attr_def
1028
1026
  end
data/lib/jamf/utility.rb CHANGED
@@ -140,7 +140,7 @@ module Jamf
140
140
  # "10.8.x" /^10\.8\.?\d*$/
141
141
  req_regexps = requirement.map do |r|
142
142
  if r.end_with?('.x')
143
- /^#{r.chomp('.x').gsub('.', '\.')}\.?\d*$/
143
+ /^#{r.chomp('.x').gsub('.', '\.')}(\.?\d*)*$/
144
144
 
145
145
  elsif r =~ /^\d+\.\d+$/
146
146
  /^#{r.gsub('.', '\.')}(.0)?$/
data/lib/jamf/version.rb CHANGED
@@ -27,6 +27,6 @@
27
27
  module Jamf
28
28
 
29
29
  ### The version of the Jamf module
30
- VERSION = '0.0.6a1'.freeze
30
+ VERSION = '0.0.8'.freeze
31
31
 
32
32
  end # module
@@ -584,6 +584,15 @@ module JSS
584
584
  # @return [Hash] the :name and :id of the site for this machine
585
585
  attr_reader :site
586
586
 
587
+ # @return [Hash] The security settings for this Computer
588
+ # Keys are:
589
+ # activation_lock: Boolean
590
+ # recovery_lock_enabled: Boolean
591
+ # secure_boot_level: String
592
+ # external_boot_level: String
593
+ # firewall_enabled: Boolean
594
+ attr_reader :security
595
+
587
596
  # @return [String] the name of the Software Update Server assigned to this machine.
588
597
  attr_reader :sus
589
598
 
@@ -798,6 +807,8 @@ module JSS
798
807
  @report_date = JSS.epoch_to_time @init_data[:general][:report_date_epoch]
799
808
  @sus = @init_data[:general][:sus]
800
809
 
810
+ @security = @init_data[:security] || {}
811
+
801
812
  @configuration_profiles = @init_data[:configuration_profiles]
802
813
 
803
814
  @management_status = @init_data[:general][:management_status]
@@ -187,7 +187,6 @@ module JSS
187
187
  site.add_element('name').text = @site
188
188
 
189
189
  obj << @scope.scope_xml
190
- add_self_service_xml doc
191
190
  doc.to_s
192
191
  end # rest_xml
193
192
 
@@ -361,9 +361,9 @@ module JSS
361
361
  #
362
362
  def self_service_display_name=(new_val)
363
363
  new_val = new_val.strip
364
- return nil if @self_service_dislay_name == new_val
364
+ return nil if @self_service_display_name == new_val
365
365
  raise JSS::InvalidDataError, 'Only macOS Self Service items have display names' unless self_service_targets.include? :macos
366
- @self_service_dislay_name = new_val
366
+ @self_service_display_name = new_val
367
367
  @need_to_update = true
368
368
  end
369
369
  # alias for backward compatibility with the typo
@@ -167,8 +167,6 @@ module JSS
167
167
  args[:read_timeout] ||= args[:timeout] ? args[:timeout] : DFT_TIMEOUT
168
168
  args[:write_timeout] ||= args[:timeout] ? args[:timeout] : DFT_TIMEOUT
169
169
 
170
-
171
-
172
170
  @port = args[:port]
173
171
  @socket = args[:socket]
174
172
  @mysql_name = args[:db_name]
@@ -178,7 +176,7 @@ module JSS
178
176
  @write_timeout = args[:write_timeout]
179
177
 
180
178
  # make sure we have a user, pw, server
181
- raise JSS::MissingDataError, 'No MySQL user specified, or listed in configuration.' unless args[:user]
179
+ raise JSS::MissingDataError, 'No MySQL user specified, or defined in configuration.' unless args[:user]
182
180
  raise JSS::MissingDataError, "Missing :pw (or :prompt/:stdin) for user '#{@user}'" unless args[:pw]
183
181
  raise JSS::MissingDataError, 'No MySQL Server hostname specified, or listed in configuration.' unless @server
184
182
 
@@ -204,6 +202,8 @@ module JSS
204
202
  @connected = true
205
203
 
206
204
  @server
205
+ rescue Mysql::ServerError::NotSupportedAuthMode => e
206
+ raise Mysql::ServerError::AccessDeniedError, "Probable unknown MySQL user '#{@user}'. Original error was 'Mysql::ServerError::NotSupportedAuthMode: #{e}' which is sometimes raised when the user does not exist on the server."
207
207
  end # connect
208
208
 
209
209
  ###
@@ -239,7 +239,7 @@ module JSS
239
239
  ###
240
240
  def valid_server?(server, port = DFT_PORT)
241
241
  mysql = Mysql.init
242
- mysql.options Mysql::OPT_CONNECT_TIMEOUT, 5
242
+ mysql.options Mysql::OPT_CONNECT_TIMEOUT, 60
243
243
  mysql.charset = DFT_CHARSET
244
244
 
245
245
  begin
data/lib/jss/utility.rb CHANGED
@@ -263,7 +263,7 @@ module JSS
263
263
  # "10.8.x" /^10\.8\.?\d*$/
264
264
  req_regexps = requirement.map do |r|
265
265
  if r.end_with?('.x')
266
- /^#{r.chomp('.x').gsub('.', '\.')}\.?\d*$/
266
+ /^#{r.chomp('.x').gsub('.', '\.')}(\.?\d*)*$/
267
267
 
268
268
  elsif r =~ /^\d+\.\d+$/
269
269
  /^#{r.gsub('.', '\.')}(.0)?$/
data/lib/jss/version.rb CHANGED
@@ -27,6 +27,6 @@
27
27
  module JSS
28
28
 
29
29
  ### The version of ruby-jss
30
- VERSION = '1.6.0'.freeze
30
+ VERSION = '1.6.4'.freeze
31
31
 
32
32
  end # module
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jss
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-24 00:00:00.000000000 Z
12
+ date: 2021-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: CFPropertyList