repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1 value | license stringclasses 7 values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2 classes |
|---|---|---|---|---|---|---|---|---|
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_helloit/resources/cpe_helloit_la.rb | cpe_helloit/resources/cpe_helloit_la.rb | #
# Cookbook:: cpe_helloit
# Resources:: cpe_helloit_la
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_helloit_la
provides :cpe_helloit_la, :os => 'darwin'
default_action :manage
action :manage do
return unless node['cpe_helloit']['install']
return unless node['cpe_helloit']['manage_la']
base_label = 'com.github.ygini.hello-it'
launchagent_label = node.cpe_launchd_label(base_label)
launchagent_path = node.cpe_launchd_path('agent', base_label)
# Manage Hello-IT's default scripts and custom folders
# Create the main directory first
directory '/Library/Application Support/com.github.ygini.hello-it' do
owner 'root'
group 'wheel'
mode '0755'
recursive true
path '/Library/Application Support/com.github.ygini.hello-it'
action :create
end
# Use remote_directory to add any custom contents
[
'CustomImageForItem',
'CustomScripts',
'CustomStatusBarIcon',
].each do |item|
remote_directory item do
source "helloit/#{item}"
owner 'root'
group 'wheel'
mode '0755'
files_mode '0755'
path "/Library/Application Support/com.github.ygini.hello-it/#{item}"
purge true
action :create
notifies :disable, "launchd[#{launchagent_label}]", :immediately if ::File.exists?(launchagent_path)
end
end
# Triggered Launch Agent action
launchd launchagent_label do
action :nothing
type 'agent'
end
# Launch Agent
node.default['cpe_launchd'][base_label] =
node.default['cpe_helloit']['la']
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_helloit/resources/cpe_helloit_profile.rb | cpe_helloit/resources/cpe_helloit_profile.rb | #
# Cookbook:: cpe_helloit
# Resource:: cpe_helloit_profile
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_helloit_profile
provides :cpe_helloit_profile, :os => 'darwin'
default_action :config
# Enforce HelloIT settings
action :config do
return unless node['cpe_helloit']['install']
return unless node['cpe_helloit']['config']
hit_prefs = node['cpe_helloit']['prefs'].compact
if hit_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/RedundantCondition
hit_profile = {
'PayloadIdentifier' => "#{prefix}.helloit",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'F51AC3AB-5899-4871-B543-39A9DC19A494',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Hello IT Application Preferences',
'PayloadContent' => [],
}
unless hit_prefs.empty?
hit_profile['PayloadContent'].push(
'PayloadType' => 'com.github.ygini.Hello-IT',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.helloit",
'PayloadUUID' => 'E19A9326-64D3-4C82-9B1D-3A6264382D5E',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Hello IT Application Preferences',
)
hit_prefs.each_key do |key|
next if hit_prefs[key].nil?
hit_profile['PayloadContent'][0][key] = hit_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.helloit"] = hit_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_timemachine/metadata.rb | cpe_timemachine/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_timemachine'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Time Machine settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_timemachine/recipes/default.rb | cpe_timemachine/recipes/default.rb | #
# Cookbook:: cpe_timemachine
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_timemachine 'Apply Time Machine profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_timemachine/attributes/default.rb | cpe_timemachine/attributes/default.rb | #
# Cookbook:: cpe_timemachine
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
# Time Machine MC X Settings
default['cpe_timemachine']['mcx'] = {
'AutoBackup' => nil,
'BackupAllVolumes' => nil,
'BackupDestURL' => nil,
'BackupSkipSys' => nil,
'BackupSizeMB' => nil,
'MobileBackups' => nil,
}
# Time Machine Standard Settings
default['cpe_timemachine']['std'] = {
'AlwaysShowDeletedBackupsWarning' => nil,
'AutoBackup' => nil,
'DoNotOfferNewDisksForBackup' => nil,
'ExcludeByPath' => nil,
'MaxSize' => nil,
'RequiresACPower' => nil,
'SkipPaths' => nil,
'SkipSystemFiles' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_timemachine/resources/cpe_timemachine.rb | cpe_timemachine/resources/cpe_timemachine.rb | #
# Cookbook:: cpe_timemachine
# Resource:: cpe_timemachine
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_timemachine
default_action :run
unified_mode true
# Enforce Time Machine settings
action :run do
tm_mcx_prefs = node['cpe_timemachine']['mcx'].compact
tm_std_prefs = node['cpe_timemachine']['std'].compact
if tm_mcx_prefs.empty? && tm_std_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
tm_profile = {
'PayloadIdentifier' => "#{prefix}.timemachine",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'DA90E27E-5D08-4DDE-B8A0-AC77A36A6130',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Time Machine',
'PayloadContent' => [],
}
unless tm_mcx_prefs.empty?
tm_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.MCX.TimeMachine',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.timemachine.mcx",
'PayloadUUID' => '6BBA1688-149A-4623-AD11-2C9BFBD8F2B6',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Time Machine MC X',
)
tm_mcx_prefs.each_key do |key|
next if tm_mcx_prefs[key].nil?
tm_profile['PayloadContent'][0][key] = tm_mcx_prefs[key]
end
end
unless tm_std_prefs.empty?
tm_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.TimeMachine',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.timemachine",
'PayloadUUID' => '4F7D5D0F-29C1-473B-8629-FF3EE4940426',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Time Machine Standard',
)
tm_std_prefs.each_key do |key|
next if tm_std_prefs[key].nil?
tm_profile['PayloadContent'][-1][key] = tm_std_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.timemachine"] = tm_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_smartcard/metadata.rb | cpe_smartcard/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_passwordpolicy'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_passwordpolicy'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_smartcard/recipes/default.rb | cpe_smartcard/recipes/default.rb | #
# Cookbook:: cpe_smartcard
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_smartcard 'Apply Smart Card profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_smartcard/attributes/default.rb | cpe_smartcard/attributes/default.rb | #
# Cookbook:: cpe_smartcard
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_smartcard'] = {
'allowSmartCard' => nil,
'checkCertificateTrust' => nil,
'oneCardPerUser' => nil,
'UserPairing' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_smartcard/resources/cpe_smartcard.rb | cpe_smartcard/resources/cpe_smartcard.rb | #
# Cookbook:: cpe_smartcard
# Resource:: cpe_smartcard
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_smartcard
default_action :run
# Enforce Smart Card settings
action :run do
sc_prefs = node['cpe_smartcard'].compact
if sc_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
sc_profile = {
'PayloadIdentifier' => "#{prefix}.smartcard",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '83FAE4FC-9419-4256-AAC0-B566DAB8B667',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Smart Card',
'PayloadContent' => [],
}
unless sc_prefs.empty?
sc_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.security.smartcard',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.smartcard",
'PayloadUUID' => 'F95EBD39-45CB-4658-B038-C656057D527C',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Password Policy and ScreenSaver',
)
sc_prefs.each_key do |key|
next if sc_prefs[key].nil?
sc_profile['PayloadContent'][0][key] = sc_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.smartcard"] = sc_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_ard/metadata.rb | cpe_ard/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_ard'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Apple Remote Desktop Application settings / profile'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
depends 'cpe_helpers'
depends 'fb_helpers'
depends 'uber_helpers'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_ard/recipes/default.rb | cpe_ard/recipes/default.rb | #
# Cookbook:: cpe_ard
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_ard 'Apply Apple Remote Desktop configurations'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_ard/attributes/default.rb | cpe_ard/attributes/default.rb | #
# Cookbook:: cpe_ard
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_ard'] = {
'kickstart' => {
'enable' => false,
'manage' => false,
'tcc_profile_id' => nil, # string
},
'profile' => {
'prefs' => {
'AdminConsoleAllowsRemoteControl' => nil,
'LoadRemoteManagementMenuExtra' => nil,
},
},
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_ard/resources/cpe_ard.rb | cpe_ard/resources/cpe_ard.rb | #
# Cookbook:: cpe_ard
# Resource:: cpe_ard
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_ard
provides :cpe_ard, :os => 'darwin'
default_action :manage
action :manage do
manage_profile
kickstart if node['cpe_ard']['kickstart']['manage']
end
action_class do # rubocop:disable Metrics/BlockLength
def manage_profile
ard_prefs = node['cpe_ard']['profile']['prefs'].compact
if ard_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found - skipping profile "\
'enforcement')
return
end
prefix = node['cpe_profiles']['prefix']
# rubocop:disable Style/UnneededCondition
organization = node['organization'] ? node['organization'] : 'Pinterest'
# rubocop:enable Style/UnneededCondition
ard_profile = {
'PayloadIdentifier' => "#{prefix}.ardapp",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '2CAB3C80-54C4-4D61-A142-52C2EBB0DA8C',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Apple Remote Desktop Application',
'PayloadContent' => [],
}
unless ard_prefs.empty?
ard_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.RemoteManagement',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.ardapp",
'PayloadUUID' => '149EAD29-D27D-4639-8E8D-D8513B18A2B5',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Apple Remote Desktop Application',
)
ard_prefs.each_key do |key|
next if ard_prefs[key].nil?
ard_profile['PayloadContent'][0][key] = ard_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.ard"] = ard_profile
end
def kickstart
if node['cpe_ard']['kickstart']['enable']
enable
else
disable
end
end
def disable
# Disable ARD
execute 'Disable Apple Remote Desktop' do
command '/System/Library/CoreServices/RemoteManagement/ARDAgent.app/'\
'Contents/Resources/kickstart -deactivate -configure -access -off'
only_if { ard_server_running? }
end
end
def enable
# Enable ARD
# If running 10.14 and higher, we need a TCC profile installed with the
# appropriate configuration.
if node.os_at_least?('10.14')
tcc_profile_identifier = node['cpe_ard']['kickstart']['tcc_profile_id']
if tcc_profile_identifier.nil? || tcc_profile_identifier.empty?
# Bail if the attribute isn't set, or the command will fail.
Chef::Log.warn("#{cookbook_name}: Device is running 10.14 or higher "\
'and does not have necessary TCC profile chef attribute.')
return
else
# Bail if the profile doesn't exist with the correct configuration.
# https://support.apple.com/en-us/HT209161
unless node.profile_contains_content?(
'identifier \"com.apple.screensharing.agent\" and anchor apple',
tcc_profile_identifier,
)
Chef::Log.warn("#{cookbook_name}: Device is running 10.14 or higher "\
'and does not have necessary TCC profile installed with '\
'configuration for screensharing agent.')
return
end
end
end
execute 'Enable Apple Remote Desktop' do
command '/System/Library/CoreServices/RemoteManagement/ARDAgent.app'\
'/Contents/Resources/kickstart -activate -configure -allowAccessFor '\
'-allUsers -privs -all -clientopts -setmenuextra -menuextra no -restart '\
'-agent'
not_if { ard_server_running? }
end
end
def ard_server_running?
# There are only two methods documented online on how to check if ARD is
# running.
# 1. Using launchctl list as the currently logged in user
# 2. Various methods around grep | awk.
# Pgrep (while not ideal) allows us to remove the awk and grep. With newer
# versions of macOS, if we used launchctl we would have to do launchctl
# asuser UID launchctl list. This could also fail due to users not being
# logged in. This function allows it to work even at the loginwindow, since
# kickstart itself does not need this dependency to kickstart.
# Exit status of zero means it's on, exit 1 means it's off.
shell_out(
'/usr/bin/pgrep -f /System/Library/CoreServices/RemoteManagement/'\
'ARDAgent.app/Contents/MacOS/ARDAgent',
).exitstatus.zero?
end
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_passwordpolicy/metadata.rb | cpe_passwordpolicy/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_passwordpolicy'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_passwordpolicy'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_passwordpolicy/recipes/default.rb | cpe_passwordpolicy/recipes/default.rb | #
# Cookbook:: cpe_passwordpolicy
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_passwordpolicy 'Apply Password Policy/Screen Saver profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_passwordpolicy/attributes/default.rb | cpe_passwordpolicy/attributes/default.rb | #
# Cookbook:: cpe_passwordpolicy
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_passwordpolicy'] = {
'allowSimple' => nil,
'forcePIN' => nil,
'maxFailedAttempts' => nil,
'maxGracePeriod' => nil,
'maxInactivity' => nil,
'maxPINAgeInDays' => nil,
'minComplexChars' => nil,
'minLength' => nil,
'minutesUntilFailedLoginReset' => nil,
'pinHistory' => nil,
'requireAlphanumeric' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_passwordpolicy/resources/cpe_passwordpolicy.rb | cpe_passwordpolicy/resources/cpe_passwordpolicy.rb | #
# Cookbook:: cpe_passwordpolicy
# Resource:: cpe_passwordpolicy
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_passwordpolicy
default_action :run
unified_mode true
# Enforce password policy and screensaver settings
action :run do
pp_prefs = node['cpe_passwordpolicy'].compact
if pp_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
unless node['cpe_passwordpolicy']['maxInactivity'].nil?
unless node['cpe_passwordpolicy']['maxInactivity'] >= 10
Chef::Log.warn('maxInactivity time is too high!')
end
end
unless node['cpe_passwordpolicy']['maxGracePeriod'].nil?
unless node['cpe_passwordpolicy']['maxGracePeriod'] >= 0.08
Chef::Log.warn('maxGracePeriod password delay is too high!')
end
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
pp_profile = {
'PayloadIdentifier' => "#{prefix}.passwordpolicy",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'CEA1E58D-9D0F-453A-AA52-830986A8366C',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Password Policy and ScreenSaver',
'PayloadContent' => [],
}
unless pp_prefs.empty?
pp_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.mobiledevice.passwordpolicy',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.passwordpolicy",
'PayloadUUID' => '3B2AD6A9-F99E-4813-980A-4147617B2E75',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Password Policy and ScreenSaver',
)
pp_prefs.each_key do |key|
next if pp_prefs[key].nil?
pp_profile['PayloadContent'][0][key] = pp_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.passwordpolicy"] = pp_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_mcx/metadata.rb | cpe_mcx/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_mcx'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_mcx'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles' | ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_mcx/recipes/default.rb | cpe_mcx/recipes/default.rb | #
# Cookbook:: cpe_mcx
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
return unless macos?
cpe_mcx 'Apply MC X profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_mcx/attributes/default.rb | cpe_mcx/attributes/default.rb | #
# Cookbook:: cpe_mcx
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
default['cpe_mcx'] = {
'forceInternetSharingOff' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_mcx/resources/cpe_mcx.rb | cpe_mcx/resources/cpe_mcx.rb | #
# Cookbook:: cpe_mcx
# Resource:: cpe_mcx
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_mcx
default_action :run
unified_mode true
mcx_prefs = {}
action :run do
mcx_prefs = node['cpe_mcx'].compact
return if mcx_prefs.empty?
organization = node['organization'] ? node['organization'] : 'Pinterest'
prefix = node['cpe_profiles']['prefix']
node.default['cpe_profiles']["#{prefix}.mcx"] = {
'HasRemovalPasscode' => true,
'PayloadIdentifier' => "#{prefix}.mcx",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'FF1D4C80-5951-401B-9324-AABCFDAC8EE0',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'MC X',
'PayloadContent' => [
{
'PayloadType' => 'com.apple.ManagedClient.preferences',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.mcx",
'PayloadUUID' => '78175364-EB51-4366-BD39-6FB6C2EFA779',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'MCX',
'PayloadContent' => {
'com.apple.MCX' => {
'Forced' => [
{
'mcx_preference_settings' => mcx_prefs,
},
],
},
},
},
],
}
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/metadata.rb | cpe_firewall/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_firewall'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_firewall'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
supports 'windows'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/recipes/default.rb | cpe_firewall/recipes/default.rb | #
# Cookbook:: cpe_firewall
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless windows? || macos?
if windows?
include_recipe 'cpe_firewall::windows'
elsif macos?
include_recipe 'cpe_firewall::mac_os_x'
else
Chef::Log.warn('cpe_firewall called on incompatible platform.')
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/recipes/mac_os_x.rb | cpe_firewall/recipes/mac_os_x.rb | #
# Cookbook:: cpe_firewall
# Recipe:: mac_os_x
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_firewall 'Apply Firewall profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/recipes/windows.rb | cpe_firewall/recipes/windows.rb | #
# Cookbook:: cpe_firewall
# Recipe:: windows
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless windows?
windows_service 'firewall' do
service_name 'MpsSvc'
run_as_user 'NT AUTHORITY\LocalService'
startup_type :automatic
action :start
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/attributes/default.rb | cpe_firewall/attributes/default.rb | #
# Cookbook:: cpe_firewall
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_firewall'] = {
'EnableFirewall' => nil,
'BlockAllIncoming' => nil,
'EnableStealthMode' => nil,
'Applications' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_firewall/resources/cpe_firewall.rb | cpe_firewall/resources/cpe_firewall.rb | #
# Cookbook:: cpe_firewall
# Resource:: cpe_firewall
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_firewall
provides :cpe_firewall, :os => 'darwin'
default_action :run
# Enforce firewall settings
action :run do
fw_prefs = node['cpe_firewall'].compact
if fw_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/UnneededCondition
fw_profile = {
'PayloadIdentifier' => "#{prefix}.firewallpolicy",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '14B18D66-448C-46E0-B54F-D70DFF7BA302',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Firewall Policy',
'PayloadContent' => [],
}
unless fw_prefs.empty?
fw_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.security.firewall',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.firewallpolicy",
'PayloadUUID' => '9D929A84-994C-497C-8F34-DB32FACB25CD',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Firewall Policy',
)
fw_prefs.each_key do |key|
next if fw_prefs[key].nil?
fw_profile['PayloadContent'][0][key] = fw_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.firewallpolicy"] = fw_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_softwareupdate/metadata.rb | cpe_softwareupdate/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_softwareupdate'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_softwareupdate'
version '0.1.0'
chef_version '>= 14.14' if respond_to?(:chef_version)
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_softwareupdate/recipes/default.rb | cpe_softwareupdate/recipes/default.rb | #
# Cookbook:: cpe_softwareupdate
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_softwareupdate 'Apply SoftwareUpdate profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_softwareupdate/attributes/default.rb | cpe_softwareupdate/attributes/default.rb | #
# Cookbook:: cpe_softwareupdate
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_softwareupdate'] = {
# Commerce
'commerce' => {
'AutoUpdate' => nil,
'AutoUpdateRestartRequired' => nil,
},
# Store Agent
'stagent' => {
'AutoUpdate' => nil,
},
# SoftwareUpdate
'su' => {
'AllowPreReleaseInstallation' => nil,
'AutomaticallyInstallMacOSUpdates' => nil,
'AutomaticCheckEnabled' => nil,
'AutomaticDownload' => nil,
'CatalogURL' => nil,
'ConfigDataInstall' => nil,
'CriticalUpdateInstall' => nil,
'SUDisableEVCheck' => nil,
},
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_softwareupdate/resources/cpe_softwareupdate.rb | cpe_softwareupdate/resources/cpe_softwareupdate.rb | #
# Cookbook:: cpe_softwareupdate
# Resource:: cpe_softwareupdate
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_softwareupdate
provides :cpe_softwareupdate, :os => 'darwin'
default_action :run
# Enforce SoftwareUpdate settings
action :run do
susu_prefs = node['cpe_softwareupdate']['su'].compact
suc_prefs = node['cpe_softwareupdate']['commerce'].compact
sta_prefs = node['cpe_softwareupdate']['stagent'].compact
if susu_prefs.empty? && suc_prefs.empty? && sta_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/UnneededCondition
prefix = node['cpe_profiles']['prefix']
su_profile = {
'PayloadIdentifier' => "#{prefix}.softwareupdate",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '4BD8EB2F-6D7F-484B-8638-54FCD842AD35',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'SoftwareUpdate',
'PayloadContent' => [],
}
unless susu_prefs.empty?
su_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.SoftwareUpdate',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.softwareupdate",
'PayloadUUID' => '93190E8F-8820-4378-82AF-9F7BF071A06E',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'SoftwareUpdate (SoftwareUpdate)',
)
susu_prefs.each_key do |key|
next if susu_prefs[key].nil?
su_profile['PayloadContent'][0][key] = susu_prefs[key]
macos_userdefaults "Configure com.apple.SoftwareUpdate - #{key}" do
domain '/Library/Preferences/com.apple.SoftwareUpdate'
key key
value susu_prefs[key]
end
end
end
unless suc_prefs.empty?
su_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.commerce',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.commerce",
'PayloadUUID' => 'EA6ABD99-B904-4A36-A312-349AF97E1D4D',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'SoftwareUpdate (Commerce)',
)
suc_prefs.each_key do |key|
next if suc_prefs[key].nil?
su_profile['PayloadContent'][-1][key] = suc_prefs[key]
macos_userdefaults "Configure com.apple.commerce - #{key}" do
domain '/Library/Preferences/com.apple.commerce'
key key
value suc_prefs[key]
end
end
end
unless sta_prefs.empty?
su_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.storeagent',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.storeagent",
'PayloadUUID' => '7968D4CE-6957-4679-8EA7-189BB2EA2BFA',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'SoftwareUpdate (Store Agent)',
)
sta_prefs.each_key do |key|
next if sta_prefs[key].nil?
su_profile['PayloadContent'][-1][key] = sta_prefs[key]
macos_userdefaults "Configure com.apple.storeagent - #{key}" do
domain '/Library/Preferences/com.apple.storeagent'
key key
value sta_prefs[key]
end
end
end
node.default['cpe_profiles']["#{prefix}.softwareupdate"] = su_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_desktopwallpaper/metadata.rb | cpe_desktopwallpaper/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_desktopwallpaper'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Desktop Wallpaper settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_desktopwallpaper/recipes/default.rb | cpe_desktopwallpaper/recipes/default.rb | #
# Cookbook:: cpe_desktopwallpaper
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_desktopwallpaper 'Apply Desktop Wallpaper profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_desktopwallpaper/attributes/default.rb | cpe_desktopwallpaper/attributes/default.rb | #
# Cookbook:: cpe_desktopwallpaper
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
# Lock and Setup a wallpaper
default['cpe_desktopwallpaper']['OverridePicturePath'] = nil
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_desktopwallpaper/resources/cpe_desktopwallpaper.rb | cpe_desktopwallpaper/resources/cpe_desktopwallpaper.rb | #
# Cookbook:: cpe_desktopwallpaper
# Resource:: cpe_desktopwallpaper
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_desktopwallpaper
default_action :run
dw_prefs = {}
action :run do
dw_prefs = node['cpe_desktopwallpaper'].compact
return if dw_prefs.empty?
organization = node['organization'] ? node['organization'] : 'Pinterest'
prefix = node['cpe_profiles']['prefix']
node.default['cpe_profiles']["#{prefix}.desktopwallpaper"] = {
'PayloadIdentifier' => "#{prefix}.desktopwallpaper",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'CEC5E19F-AEEC-45BF-96EE-CCC0FAC66157',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Desktop Wallpaper',
'PayloadContent' => [
{
'PayloadType' => 'com.apple.desktop',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.desktopwallpaper",
'PayloadUUID' => '13CC19FC-5E0F-49E7-8F71-20D28C23AAF4',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Desktop Wallpaper',
'locked' => true,
'override-picture-path' =>
node['cpe_desktopwallpaper']['OveridePicturePath'],
},
],
}
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_setupassistant/metadata.rb | cpe_setupassistant/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_setupassistant'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages SetupAssistant settings / profile'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_setupassistant/recipes/default.rb | cpe_setupassistant/recipes/default.rb | #
# Cookbook:: cpe_setupassistant
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_setupassistant 'Apply Preference Pane Management'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_setupassistant/attributes/default.rb | cpe_setupassistant/attributes/default.rb | #
# Cookbook:: cpe_setupassistant
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
# Disable iCloud and SetupAssistant
default['cpe_setupassistant']['once']['DidSeeAppearanceSetup'] = nil
default['cpe_setupassistant']['once']['DidSeeApplePaySetup'] = nil
default['cpe_setupassistant']['once']['DidSeeAvatarSetup'] = nil
default['cpe_setupassistant']['once']['DidSeeCloudSetup'] = nil
default['cpe_setupassistant']['once']['DidSeePrivacy'] = nil
default['cpe_setupassistant']['once']['DidSeeSiriSetup'] = nil
default['cpe_setupassistant']['once']['DidSeeSyncSetup'] = nil
default['cpe_setupassistant']['once']['DidSeeSyncSetup2'] = nil
default['cpe_setupassistant']['once']['DidSeeTouchIDSetup'] = nil
default['cpe_setupassistant']['once']['DidSeeTrueTonePrivacy'] = nil
default['cpe_setupassistant']['once']['DidSeeiCloudLoginForStorageServices'] =
nil
default['cpe_setupassistant']['once']['LastPreLoginTasksPerformedBuild'] = nil
default['cpe_setupassistant']['once']['LastPreLoginTasksPerformedVersion'] = nil
default['cpe_setupassistant']['once']['LastPrivacyBundleVersion'] = nil
default['cpe_setupassistant']['once']['LastSeenBuddyBuildVersion'] = nil
default['cpe_setupassistant']['once']['LastSeenCloudProductVersion'] = nil
default['cpe_setupassistant']['once']['MiniBuddyLaunchReason'] = nil
default['cpe_setupassistant']['once']['MiniBuddyLaunchedPostMigration'] = nil
default['cpe_setupassistant']['once']['MiniBuddyShouldLaunchToResumeSetup'] =
nil
default['cpe_setupassistant']['once']['NSAddServicesToContextMenus'] = nil
default['cpe_setupassistant']['once']['PreviousBuildVersion'] = nil
default['cpe_setupassistant']['once']['PreviousSystemVersion'] = nil
default['cpe_setupassistant']['once']['RunNonInteractive'] = nil
default['cpe_setupassistant']['once']['SkipFirstLoginOptimization'] = nil
default['cpe_setupassistant']['managed']['SkipCloudSetup'] = nil
default['cpe_setupassistant']['managed']['SkipSiriSetup'] = nil
default['cpe_setupassistant']['managed']['SkipPrivacySetup'] = nil
default['cpe_setupassistant']['managed']['SkipiCloudStorageSetup'] = nil
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_setupassistant/resources/cpe_setupassistant.rb | cpe_setupassistant/resources/cpe_setupassistant.rb | #
# Cookbook:: cpe_setupassistant
# Resources:: cpe_setupassistant
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_setupassistant
provides :cpe_setupassistant, :os => 'darwin'
default_action :run
action :run do
saonce_prefs = node['cpe_setupassistant']['once'].compact
sam_prefs = node['cpe_setupassistant']['managed'].compact
if saonce_prefs.empty? && sam_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
organization = node['organization'] ? node['organization'] : 'Pinterest'
prefix = node['cpe_profiles']['prefix']
unless saonce_prefs.empty?
sa_profile = {
'PayloadIdentifier' => "#{prefix}.setupassistant",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '552E2A87-2B97-4626-AAE1-DF2113960074',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'SetupAssistant',
'PayloadContent' => [],
}
sa_profile['PayloadContent'].push(
{
'PayloadType' => 'com.apple.ManagedClient.preferences',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.setupassistant.once",
'PayloadUUID' => '4CB98425-1FA5-46FE-B68C-DCDA1C7A6960',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'SetupAssistant (Once)',
'PayloadContent' => {
'com.apple.SetupAssistant' => {
'Set-Once' => [
{
'mcx_preference_settings' => saonce_prefs,
},
],
},
},
},
)
node.default['cpe_profiles']["#{prefix}.setupassistant"] = sa_profile
end
unless sam_prefs.empty?
sam_profile = {
'PayloadIdentifier' => "#{prefix}.setupassistant.managed",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '4616f49c-5a67-4fb5-a3e5-c6855be7f8ba',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'SetupAssistant',
'PayloadContent' => [],
}
sam_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.SetupAssistant.managed',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.setupassistant.managed",
'PayloadUUID' => 'e7350af3-e683-4329-8eb0-11bd960d9fff',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'SetupAssistant (Managed)',
)
sam_prefs.each_key do |key|
next if sam_prefs[key].nil?
sam_profile['PayloadContent'][0][key] = sam_prefs[key]
end
node.default['cpe_profiles']["#{prefix}.setupassistant.managed"] =
sam_profile
end
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_windows_task/metadata.rb | cpe_windows_task/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_windows_task'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'BSD'
description 'Installs/Configures cpe_windows_task'
version '0.1.0'
supports 'windows'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_windows_task/recipes/default.rb | cpe_windows_task/recipes/default.rb | #
# Cookbook:: cpe_windows_task
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless windows?
cpe_windows_task 'Managing Windows tasks'
cpe_windows_task 'Cleaning up un-needed tasks' do
action :clean_up
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_windows_task/attributes/default.rb | cpe_windows_task/attributes/default.rb | #
# Cookbook:: cpe_windows_task
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_windows_task'] = {}
default['cpe_windows_task']['prefix'] = 'com.pinterest.chef'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_windows_task/resources/cpe_windows_task.rb | cpe_windows_task/resources/cpe_windows_task.rb | #
# Cookbook:: cpe_windows_task
# Resource:: cpe_windows_task
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_windows_task
default_action :run
action :run do
node['cpe_windows_task'].to_hash.each do |label, task|
next if label == 'prefix'
label = process_label(label, task)
action, task = process_task(label, task)
windows_task_resource(label, action, task)
end
end
action :clean_up do
process_task_labels
return if node['cpe_windows_task']['__cleanup'].nil?
node['cpe_windows_task']['__cleanup'].each do |task|
windows_task_resource(task, 'delete', nil)
end
end
def process_label(label, task)
return label if label.start_with?(node['cpe_windows_task']['prefix'])
# label does have the prefix so now we process
append_to_cleanup(label)
label = "#{node['cpe_windows_task']['prefix']}.#{label}"
node.default['cpe_windows_task'][label] = task
label
end
def process_task(label, task)
task['task_name'] = label
action = task['action'] ? task['action'] : 'create'
task.delete('action')
return action, task
end
def append_to_cleanup(label)
node.default['cpe_windows_task']['__cleanup'] = [] unless
node['cpe_windows_task']['__cleanup']
node.default['cpe_windows_task']['__cleanup'].push(label)
end
def windows_task_resource(label, action, task)
return unless label
res = Chef::Resource::WindowsTask.new(label, run_context)
unless task.nil?
task.to_hash.each do |key, val|
res.send(key.to_sym, val)
end
end
res.run_action action
res
end
TASK_DIRS = %w{ C:/Windows/System32/Tasks }
def find_managed_task_labels
tasks = TASK_DIRS.inject([]) do |results, dir|
edir = ::File.expand_path(dir)
entries = Dir.glob(
"#{edir}/*#{Chef::Util::PathHelper.escape_glob(node['cpe_windows_task']['prefix'])}*",
)
entries.any? ? results << entries : results
end
tasks.flatten
end
def process_task_labels
tasks = find_managed_task_labels
return if tasks.nil?
tasks.map! do |full_task_path|
label = full_task_path.split('/')[-1]
unless node['cpe_windows_task'].keys.include?(label)
append_to_cleanup(label)
end
end
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_8021x/metadata.rb | cpe_8021x/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_8021x'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Time Machine settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
depends 'cpe_utils' | ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_8021x/recipes/default.rb | cpe_8021x/recipes/default.rb | #
# Cookbook:: cpe_8021x
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_8021x 'Apply 802.1x profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_8021x/attributes/default.rb | cpe_8021x/attributes/default.rb | #
# Cookbook:: cpe_8021x
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
# Ethernet Settings
default['cpe_8021x']['ethernet'] = {
'AutoJoin' => nil,
}
# Debug Settings
default['cpe_8021x']['debug'] = {
'PrintPlist' => nil,
}
# Wireless Settings
default['cpe_8021x']['wifi'] = {
'AutoJoin' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_8021x/resources/cpe_8021x.rb | cpe_8021x/resources/cpe_8021x.rb | #
# Cookbook:: cpe_8021x
# Resource:: cpe_8021x
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_8021x
default_action :run
# Enforce 802.1x Settings
action :run do
ethernet_prefs = node['cpe_8021x']['ethernet'].compact
wifi_prefs = node['cpe_8021x']['wifi'].compact
debug_prefs = node['cpe_8021x']['debug'].compact
if ethernet_prefs.empty? && wifi_prefs.empty? && debug_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
eap_profile = {
'PayloadIdentifier' => "#{prefix}.8021x",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'E2A50C04-135A-4C7B-A771-E4ABB88DE993',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => '802.1x',
'PayloadContent' => [],
}
unless ethernet_prefs.empty?
eap_profile['PayloadContent'].push(
'PayloadType' => node['cpe_8021x']['ethernet']['PayloadType'] ?
node['cpe_8021x']['ethernet']['PayloadType'] :
'com.apple.firstethernet.managed',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.8021x.ethernet",
'PayloadUUID' => 'FC43EE42-65AB-43AF-BD1C-A36DF8B847C4',
'PayloadEnabled' => true,
'PayloadDisplayName' => '802.1x (Ethernet)',
)
ethernet_prefs.each_key do |key|
next if ethernet_prefs[key].nil?
eap_profile['PayloadContent'][0][key] = ethernet_prefs[key]
end
end
unless wifi_prefs.empty?
eap_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.wifi.managed',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.8021x.wifi",
'PayloadUUID' => '6873AEEB-BCBC-4FAC-865D-49025CBBD789',
'PayloadEnabled' => true,
'PayloadDisplayName' => '802.1x (Wifi)',
)
wifi_prefs.each_key do |key|
next if wifi_prefs[key].nil?
eap_profile['PayloadContent'][-1][key] = wifi_prefs[key]
end
end
unless debug_prefs.empty?
if node['cpe_8021x']['debug']['PrintPlist'] == true
print eap_profile.to_plist
end
end
node.default['cpe_profiles']["#{prefix}.8021x"] = eap_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_screensaver/metadata.rb | cpe_screensaver/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_screensaver'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_screensaver'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_screensaver/recipes/default.rb | cpe_screensaver/recipes/default.rb | #
# Cookbook:: cpe_screensaver
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_screensaver 'Apply Screen Saver profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_screensaver/attributes/default.rb | cpe_screensaver/attributes/default.rb | #
# Cookbook:: cpe_screensaver
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_screensaver'] = {
'askForPassword' => nil,
'askForPasswordDelay' => nil,
'idleTime' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_screensaver/resources/cpe_screensaver.rb | cpe_screensaver/resources/cpe_screensaver.rb | #
# Cookbook:: cpe_screensaver
# Resource:: cpe_screensaver
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
provides :cpe_screensaver
resource_name :cpe_screensaver
default_action :run
# Enforce screen saver settings
action :run do
ss_prefs = node['cpe_screensaver'].compact
if ss_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
unless node['cpe_screensaver']['idleTime'].nil?
unless node['cpe_screensaver']['idleTime'] <= 600
Chef::Log.warn(
'Screensaver idle time is too high!')
end
end
unless node['cpe_screensaver']['askForPasswordDelay'].nil?
unless node['cpe_screensaver']['askForPasswordDelay'] <= 5
Chef::Log.warn(
'Screensaver password delay is too high!')
end
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
ss_profile = {
'PayloadIdentifier' => "#{prefix}.screensaver",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '4FF566A6-269C-464A-9227-4D75D6313D45',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'ScreenSaver',
'PayloadContent' => [],
}
unless ss_prefs.empty?
ss_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.screensaver',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.screensaver",
'PayloadUUID' => '72E5524A-3EC0-4877-96C0-07901F2E49E9',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'ScreenSaver',
)
ss_prefs.each_key do |key|
next if ss_prefs[key].nil?
ss_profile['PayloadContent'][0][key] = ss_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.screensaver"] = ss_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_globalpreferences/metadata.rb | cpe_globalpreferences/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_globalpreferences'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages .GlobalPreferences settings / profile'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_globalpreferences/recipes/default.rb | cpe_globalpreferences/recipes/default.rb | #
# Cookbook:: cpe_globalpreferences
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_globalpreferences 'Apply GlobalPreferences profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_globalpreferences/attributes/default.rb | cpe_globalpreferences/attributes/default.rb | #
# Cookbook:: cpe_globalpreferences
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_globalpreferences'] = {
'MultipleSessionEnabled' => nil,
'NSQuitAlwaysKeepsWindows' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_globalpreferences/resources/cpe_globalpreferences.rb | cpe_globalpreferences/resources/cpe_globalpreferences.rb | #
# Cookbook:: cpe_globalpreferences
# Resource:: cpe_globalpreferences
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_globalpreferences
provides :cpe_globalpreferences, :os => 'darwin'
default_action :run
action :run do
gp_prefs = node['cpe_globalpreferences'].compact
if gp_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/UnneededCondition
gp_profile = {
'PayloadIdentifier' => "#{prefix}.globalpreferences",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '2B1C9890-B062-499B-B13D-3CDA9D40FF96',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Global Preferences',
'PayloadContent' => [],
}
unless gp_prefs.empty?
gp_profile['PayloadContent'].push(
'PayloadType' => '.GlobalPreferences',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.globalpreferences",
'PayloadUUID' => '97DD1F38-93EE-49C8-9ECD-B2C2EA29E77F',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Global Preferences',
)
gp_prefs.each_key do |key|
next if gp_prefs[key].nil?
gp_profile['PayloadContent'][0][key] = gp_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.globalpreferences"] = gp_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_applicationaccess/metadata.rb | cpe_applicationaccess/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_applicationaccess'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Apple System Preference Panes settings / profile'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_applicationaccess/recipes/default.rb | cpe_applicationaccess/recipes/default.rb | #
# Cookbook:: cpe_applicationaccess
# Resource:: cpe_applicationaccess
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_applicationaccess 'Apply Application Access profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_applicationaccess/attributes/default.rb | cpe_applicationaccess/attributes/default.rb | #
# Cookbook:: cpe_applicationaccess
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_applicationaccess'] = {
# Path Application Whitelist/Blacklist
'lists' => {
'pathBlackList' => nil,
'pathWhiteList' => nil,
'whiteList' => nil,
},
# Application Access Features
'features' => {
'allowAutoUnlock' => nil,
'allowCamera' => nil,
'allowCloudAddressBook' => nil,
'allowCloudBTMM' => nil,
'allowCloudDesktopAndDocuments' => nil,
'allowCloudDocumentSync' => nil,
'allowCloudFMM' => nil,
'allowCloudKeychainSync' => nil,
'allowCloudMail' => nil,
'allowCloudCalendar' => nil,
'allowCloudReminders' => nil,
'allowCloudBookmarks' => nil,
'allowCloudNotes' => nil,
'allowDefinitionLookup' => nil,
'allowMusicService' => nil,
'allowSpotlightInternetResults' => nil,
},
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_applicationaccess/resources/cpe_applicationaccess.rb | cpe_applicationaccess/resources/cpe_applicationaccess.rb | #
# Cookbook:: cpe_applicationaccess
# Resource:: cpe_applicationaccess
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_applicationaccess
provides :cpe_applicationaccess, :os => 'darwin'
default_action :run
action :run do
aa_prefs = node['cpe_applicationaccess']['features'].compact
aan_prefs = node['cpe_applicationaccess']['lists'].compact
if aa_prefs.empty? && aan_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
organization = node['organization'] ? node['organization'] : 'GitHub' # rubocop:disable Style/UnneededCondition
prefix = node['cpe_profiles']['prefix']
aa_profile = {
'PayloadIdentifier' => "#{prefix}.applicationaccess",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'D1B78DD9-13A1-4BC5-9F22-EF10042F6041',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Application Restrictions',
'PayloadContent' => [],
}
unless aa_prefs.empty?
aa_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.applicationaccess',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.applicationaccess",
'PayloadUUID' => '6493D033-179A-4E8D-AD85-FDBD09A28DCC',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Application Restrictions',
)
aa_prefs.each_key do |key|
next if aa_prefs[key].nil?
aa_profile['PayloadContent'][0][key] = aa_prefs[key]
end
end
unless aan_prefs.empty?
aa_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.applicationaccess.new',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.applicationaccess.new",
'PayloadUUID' => '23E11571-624B-4B74-89C0-12226EEEACD1',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Application Restrictions New',
'familyControlsEnabled' => true,
)
aan_prefs.each_key do |key|
next if aan_prefs[key].nil?
aa_profile['PayloadContent'][-1][key] = aan_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.applicationaccess"] = aa_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_gatekeeper/metadata.rb | cpe_gatekeeper/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_gatekeeper'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Apple Gatekeeper settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_gatekeeper/recipes/default.rb | cpe_gatekeeper/recipes/default.rb | #
# Cookbook:: cpe_gatekeeper
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_gatekeeper 'Apply Gatekeeper profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_gatekeeper/attributes/default.rb | cpe_gatekeeper/attributes/default.rb | #
# Cookbook:: cpe_gatekeeper
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_gatekeeper'] = {
# Gatekeeper control system policy
'control' => {
'EnableAssessment' => nil,
'AllowIdentifiedDevelopers' => nil,
},
# Gatekeeper managed system policy
'managed' => {
'DisableOverride' => nil,
},
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_gatekeeper/resources/cpe_gatekeeper.rb | cpe_gatekeeper/resources/cpe_gatekeeper.rb | #
# Cookbook:: cpe_gatekeeper
# Resource:: cpe_gatekeeper
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
provides :cpe_gatekeeper
resource_name :cpe_gatekeeper
default_action :run
unified_mode true
action :run do
gk_prefs = node['cpe_gatekeeper']['control'].compact
gkm_prefs = node['cpe_gatekeeper']['managed'].compact
if gk_prefs.empty? && gkm_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
organization = node['organization'] ? node['organization'] : 'Pinterest'
prefix = node['cpe_profiles']['prefix']
gk_profile = {
'PayloadIdentifier' => "#{prefix}.systempolicy",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '478DFE8E-E78A-4EDA-B04C-5C76BB0DACF9',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Gatekeeper',
'PayloadContent' => [],
}
unless gk_prefs.empty?
gk_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.systempolicy.control',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.systempolicy.control",
'PayloadUUID' => 'BA7A3E1D-3646-4A1B-9561-1C49653972DC',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'System Policy Control',
)
gk_prefs.each_key do |key|
next if gk_prefs[key].nil?
gk_profile['PayloadContent'][0][key] = gk_prefs[key]
end
end
unless gkm_prefs.empty?
gk_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.systempolicy.managed',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.systempolicy.managed",
'PayloadUUID' => 'A31CD444-DEAF-43AB-A3D9-A6920719BAC4',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'System Policy Managed',
)
gkm_prefs.each_key do |key|
next if gkm_prefs[key].nil?
gk_profile['PayloadContent'][-1][key] = gkm_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.systempolicy"] = gk_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_preferencesecurity/metadata.rb | cpe_preferencesecurity/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_preferencesecurity'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_preferencesecurity'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_preferencesecurity/recipes/default.rb | cpe_preferencesecurity/recipes/default.rb | #
# Cookbook:: cpe_preferencesecurity
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_preferencesecurity 'Apply Preference Security profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_preferencesecurity/attributes/default.rb | cpe_preferencesecurity/attributes/default.rb | #
# Cookbook:: cpe_preferencesecurity
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_preferencesecurity'] = {
'dontAllowLockMessageUI' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_preferencesecurity/resources/cpe_preferencesecurity.rb | cpe_preferencesecurity/resources/cpe_preferencesecurity.rb | #
# Cookbook:: cpe_preferencesecurity
# Resource:: cpe_preferencesecurity
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_preferencesecurity
default_action :run
unified_mode true
# Enforce preference security settings
action :run do
ps_prefs = node['cpe_preferencesecurity'].compact
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
ps_profile = {
'PayloadIdentifier' => "#{prefix}.preferencesecurity",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '316A8FD3-EDA5-464B-9533-636B8818097C',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Preference Security',
'PayloadContent' => [],
}
unless ps_prefs.empty?
ps_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.preference.security',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.preferencesecurity",
'PayloadUUID' => 'ACE7F9CF-3A7A-40E3-A386-C6F18B92C4AB',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Preference Security',
)
ps_prefs.each_key do |key|
next if ps_prefs[key].nil?
ps_profile['PayloadContent'][0][key] = ps_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.preferencesecurity"] = ps_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_loginwindow/metadata.rb | cpe_loginwindow/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_loginwindow'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages LoginWindow settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_loginwindow/recipes/default.rb | cpe_loginwindow/recipes/default.rb | #
# Cookbook:: cpe_loginwindow
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_loginwindow 'Apply Loginwindow profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_loginwindow/attributes/default.rb | cpe_loginwindow/attributes/default.rb | #
# Cookbook:: cpe_loginwindow
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_loginwindow'] = {
'LoginwindowText' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_loginwindow/resources/cpe_loginwindow.rb | cpe_loginwindow/resources/cpe_loginwindow.rb | #
# Cookbook:: cpe_loginwindow
# Resources:: cpe_loginwindow
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_loginwindow
default_action :run
unified_mode true
action :run do
lw_prefs = node['cpe_loginwindow'].compact
if lw_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
lw_profile = {
'PayloadIdentifier' => "#{prefix}.loginwindow",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'C23131A0-FB9B-4340-B6A1-DFF047452174',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'LoginWindow',
'PayloadContent' => [],
}
unless lw_prefs.empty?
lw_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.loginwindow',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.loginwindow",
'PayloadUUID' => '250697B2-654D-4E71-A7A6-EAB9255F9294',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'LoginWindow',
)
lw_prefs.each_key do |key|
next if lw_prefs[key].nil?
lw_profile['PayloadContent'][0][key] = lw_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.loginwindow"] = lw_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_dock/metadata.rb | cpe_dock/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_dock'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Dock settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_dock/recipes/default.rb | cpe_dock/recipes/default.rb | #
# Cookbook:: cpe_dock
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_dock 'Apply Dock profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_dock/attributes/default.rb | cpe_dock/attributes/default.rb | #
# Cookbook:: cpe_dock
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_dock'] = {
'static-apps' => nil,
'static-others' => nil,
'tilesize' => nil,
'orientation' => nil,
'mineffect' => nil,
'minimize-to-application' => nil,
'launchanim' => nil,
'autohide' => nil,
'show-process-indicators' => nil,
'static-only' => nil,
'contents-immutable' => nil,
'launchanim-immutable' => nil,
'magnify-immutable' => nil,
'magsize-immutable' => nil,
'mineffect-immutable' => nil,
'minimize-to-application-immutable' => nil,
'position-immutable' => nil,
'show-process-indicators-immutable' => nil,
'magnification' => nil,
'size-immutable' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_dock/resources/cpe_dock.rb | cpe_dock/resources/cpe_dock.rb | #
# Cookbook:: cpe_dock
# Resources:: cpe_dock
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
provides :cpe_dock
resource_name :cpe_dock
default_action :run
unified_mode true
action :run do
dock_prefs = node['cpe_dock'].compact
if dock_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
dock_profile = {
'PayloadIdentifier' => "#{prefix}.dock",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'A30A75F3-E518-4E33-9A6B-61083F428A08',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Dock',
'PayloadContent' => [],
}
unless dock_prefs.empty?
dock_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.dock',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.dock",
'PayloadUUID' => 'FB377593-8776-4A70-B55C-69D2E226DD6D',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Dock',
)
dock_prefs.each_key do |key|
next if dock_prefs[key].nil?
dock_profile['PayloadContent'][0][key] = dock_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.dock"] = dock_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_kernelextensions/metadata.rb | cpe_kernelextensions/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_kernelextensions'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Kernel Extensions settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_kernelextensions/recipes/default.rb | cpe_kernelextensions/recipes/default.rb | #
# Cookbook:: cpe_kernelextensions
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_kernelextensions 'Apply Kernel Extensions profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_kernelextensions/attributes/default.rb | cpe_kernelextensions/attributes/default.rb | #
# Cookbook:: cpe_kernelextensions
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_kernelextensions'] = {
'AllowUserOverrides' => nil,
'AllowedTeamIdentifiers' => nil,
'AllowedKernelExtensions' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_kernelextensions/resources/cpe_kernelextensions.rb | cpe_kernelextensions/resources/cpe_kernelextensions.rb | #
# Cookbook:: cpe_kernelextensions
# Resources:: cpe_kernelextensions
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2018-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_kernelextensions
default_action :run
action :run do
ke_prefs = node['cpe_kernelextensions'].compact
if ke_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
ke_profile = {
'PayloadIdentifier' => "#{prefix}.kernelextensions",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'C9CC8508-B976-47C8-92AD-706C5226B6A3',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Kernel Extensions',
'PayloadContent' => [],
}
unless ke_prefs.empty?
ke_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.syspolicy.kernel-extension-policy',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.kernelextensions",
'PayloadUUID' => '10300634-C1FB-476F-B0FA-981F9F879DCC',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Kernel Extensions',
)
ke_prefs.each_key do |key|
next if ke_prefs[key].nil?
ke_profile['PayloadContent'][0][key] = ke_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.kernelextensions"] = ke_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_submitdiaginfo/metadata.rb | cpe_submitdiaginfo/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_submitdiaginfo'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_submitdiaginfo'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_submitdiaginfo/recipes/default.rb | cpe_submitdiaginfo/recipes/default.rb | #
# Cookbook:: cpe_submitdiaginfo
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_submitdiaginfo 'Apply Submit Diag Info profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_submitdiaginfo/attributes/default.rb | cpe_submitdiaginfo/attributes/default.rb | #
# Cookbook:: cpe_submitdiaginfo
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_submitdiaginfo'] = {
'AutoSubmit' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_submitdiaginfo/resources/cpe_submitdiaginfo.rb | cpe_submitdiaginfo/resources/cpe_submitdiaginfo.rb | #
# Cookbook:: cpe_submitdiaginfo
# Resource:: cpe_submitdiaginfo
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_submitdiaginfo
provides :cpe_submitdiaginfo, :os => 'darwin'
default_action :run
# Enforce Submit Diag Info settings
action :run do
sd_prefs = node['cpe_submitdiaginfo'].compact
if sd_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/UnneededCondition
sd_profile = {
'PayloadIdentifier' => "#{prefix}.submitdiaginfo",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => 'C508D5C7-F9CE-4AC5-AE60-4583706B7866',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Submit Diag Info',
'PayloadContent' => [],
}
unless sd_prefs.empty?
sd_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.SubmitDiagInfo',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.submitdiaginfo",
'PayloadUUID' => '9241E172-6B8B-4C2D-91B4-F48854F9A3F4',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Submit Diag Info',
)
sd_prefs.each_key do |key|
next if sd_prefs[key].nil?
sd_profile['PayloadContent'][0][key] = sd_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.submitdiaginfo"] = sd_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_menulets/metadata.rb | cpe_menulets/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_menulets'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Manages Menulet settings / profile'
version '0.1.0'
supports 'mac_os_x'
depends 'cpe_profiles'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_menulets/recipes/default.rb | cpe_menulets/recipes/default.rb | #
# Cookbook:: cpe_menulets
# Recipes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_menulets 'Apply Menulets profile'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_menulets/attributes/default.rb | cpe_menulets/attributes/default.rb | #
# Cookbook:: cpe_menulets
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_menulets'] = {
'menuExtras' => nil,
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_menulets/resources/cpe_menulets.rb | cpe_menulets/resources/cpe_menulets.rb | #
# Cookbook:: cpe_menulets
# Resources:: cpe_menulets
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
resource_name :cpe_menulets
default_action :run
action :run do
ml_prefs = node['cpe_menulets'].compact
if ml_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest'
ml_profile = {
'PayloadIdentifier' => "#{prefix}.menulet",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '2E33AB8C-AFF6-4BA7-8110-412EC841423E',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Menulet',
'PayloadContent' => [],
}
unless ml_prefs.empty?
ml_profile['PayloadContent'].push(
'PayloadType' => 'com.apple.systemuiserver',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.menulet",
'PayloadUUID' => '37F77492-E026-423F-8F7B-567CC06A7585',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Menulet',
)
ml_prefs.each_key do |key|
next if ml_prefs[key].nil?
ml_profile['PayloadContent'][0][key] = ml_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.menulet"] = ml_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/metadata.rb | cpe_crypt/metadata.rb | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
name 'cpe_crypt'
maintainer 'Pinterest'
maintainer_email 'itcpe@pinterest.com'
license 'Apache-2.0'
description 'Installs/Configures cpe_crypt'
version '0.1.0'
chef_version '>= 14.14'
supports 'mac_os_x'
depends 'cpe_launchd'
depends 'cpe_profiles'
depends 'cpe_remote'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/recipes/default.rb | cpe_crypt/recipes/default.rb | #
# Cookbook:: cpe_crypt
# Recipe:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
return unless macos?
cpe_crypt_install 'Install Crypt package'
cpe_crypt_profile 'Apply Crypt profile'
cpe_crypt_authdb 'Manage Crypt authorization db settings'
cpe_crypt_ld 'Manage Crypt LaunchDaemon'
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/attributes/default.rb | cpe_crypt/attributes/default.rb | #
# Cookbook:: cpe_crypt
# Attributes:: default
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
default['cpe_crypt'] = {
'install' => false,
'uninstall' => false,
'profile' => true,
'manage_authdb' => true,
'manage_ld' => true,
'ld' => {
'program_arguments' => ['/Library/Crypt/checkin'],
'disabled' => false,
'run_at_load' => true,
'start_interval' => 120,
'type' => 'daemon',
},
'prefs' => {
# The ServerURL preference sets your Crypt Server. Crypt will not enforce
# FileVault if this preference isn't set. EX: "https://crypt.example.com"
'ServerURL' => nil, # String
# The SkipUsers preference allows you to define an array of users that will
# not be forced to enable FileVault. ['adminuser', 'mikedodge04']
'SkipUsers' => nil, # Array
# By default, the plist with the FileVault Key will be removed once it has
# been escrowed. In a future version of Crypt, there will be the
# possibility of verifying the escrowed key with the client. In preparation
# for this feature, you can now choose to leave the key on disk. bool
'RemovePlist' => nil, # Bool
# Crypt2 can rotate the recovery key, if the key is used to unlock the disk.
# There is a small caveat that this feature only works if the key is still
# present on the disk. This is set to TRUE by default.
'RotateUsedKey' => nil, # Bool
# Crypt2 can validate the recovery key if it is stored on disk. If the key
# fails validation, the plist is removed so it can be regenerated on next
# login. This is set to TRUE by default.
'ValidateKey' => nil, # Bool
# Crypt 2 can optionally add new users to be able to unlock FileVault 2
# volumes (when the disk is unlocked). This feature works up until macOS
# 10.12. The default for this is FALSE.
'FDEAddUser' => nil, # Bool
# As of version 2.3.0 you can now define a new location for where the
# recovery key is written to. Default for this is
# '/var/root/crypt_output.plist'.
'OutputPath' => nil, # Srting
# As of version 2.3.0 you can now define the time interval in Hours for how
# often Crypt tries to re-escrow the key, after the first successful escrow.
# Default for this is 1 hour.
'KeyEscrowInterval' => nil, # int
},
'pkg' => {
'name' => 'crypt',
'checksum' =>
'ecfb1d0632953cde8d95676b6d2812590fc515cd96709d0af125486917f72b32',
'receipt' => 'com.grahamgilbert.Crypt',
'version' => '3.3.0.178',
'pkg_name' => nil,
'pkg_url' => nil,
},
}
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/resources/cpe_crypt_profile.rb | cpe_crypt/resources/cpe_crypt_profile.rb | #
# Cookbook:: cpe_crypt
# Resources:: cpe_crypt_profile
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_crypt_profile
provides :cpe_crypt_profile, :os => 'darwin'
default_action :config
action :config do
return unless node['cpe_crypt']['install']
return unless node['cpe_crypt']['profile']
crypt_prefs = node['cpe_crypt']['prefs'].compact
if crypt_prefs.empty?
Chef::Log.info("#{cookbook_name}: No prefs found.")
return
end
prefix = node['cpe_profiles']['prefix']
organization = node['organization'] ? node['organization'] : 'Pinterest' # rubocop:disable Style/UnneededCondition
crypt_profile = {
'PayloadIdentifier' => "#{prefix}.crypt",
'PayloadRemovalDisallowed' => true,
'PayloadScope' => 'System',
'PayloadType' => 'Configuration',
'PayloadUUID' => '28A33C8B-6808-4457-B6CC-F866AD3272C2',
'PayloadOrganization' => organization,
'PayloadVersion' => 1,
'PayloadDisplayName' => 'Crypt',
'PayloadContent' => [],
}
unless crypt_prefs.empty?
crypt_profile['PayloadContent'].push(
'PayloadType' => 'com.grahamgilbert.crypt',
'PayloadVersion' => 1,
'PayloadIdentifier' => "#{prefix}.crypt",
'PayloadUUID' => 'F9A5E8E1-3C08-4D32-94A5-325009F9C999',
'PayloadEnabled' => true,
'PayloadDisplayName' => 'Crypt',
)
crypt_prefs.each_key do |key|
next if crypt_prefs[key].nil?
crypt_profile['PayloadContent'][0][key] = crypt_prefs[key]
end
end
node.default['cpe_profiles']["#{prefix}.crypt"] = crypt_profile
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/resources/cpe_crypt_ld.rb | cpe_crypt/resources/cpe_crypt_ld.rb | #
# Cookbook:: cpe_crypt
# Resources:: cpe_crypt_ld
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_crypt_ld
provides :cpe_crypt_ld, :os => 'darwin'
default_action :manage
action :manage do
return unless node['cpe_crypt']['install']
return unless node['cpe_crypt']['manage_ld']
# Manage Crypt checkin folder
directory '/Library/Crypt' do
owner 'root'
group 'wheel'
mode '0755'
end
# Define and install crypt checkin files
%w[
checkin
FoundationPlist.py
].each do |item|
cookbook_file "/Library/Crypt/#{item}" do
owner 'root'
group 'wheel'
mode '0755'
path "/Library/Crypt/#{item}"
source "crypt/#{item}"
end
end
# Launch Daemon
node.default['cpe_launchd']['com.grahamgilbert.crypt'] =
node.default['cpe_crypt']['ld']
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/resources/cpe_crypt_authdb.rb | cpe_crypt/resources/cpe_crypt_authdb.rb | #
# Cookbook:: cpe_crypt
# Resources:: cpe_crypt_authdb
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_crypt_authdb
provides :cpe_crypt_authdb, :os => 'darwin'
default_action :manage
action :manage do
return unless manage_authdb?
# If Crypt hasn't been installed don't configure the auth db
unless crypt_installed? || uninstall?
Chef::Log.warn('Crypt binary not installed!')
return
end
# First, validate whether or not the current settings are correct
# Get current settings from authdb
currently_in_authdb = crypt_currently_in_authdb
# Uninstall needs to go first, because you could have manage and uninstall
# set to true
unless currently_in_authdb && uninstall?
Chef::Log.debug('Crypt already removed from Authdb')
return
end
# TODO: manage_crypt_authorizationdb should have a real idempotency guard
if currently_in_authdb && manage?
Chef::Log.debug('Authdb already configured for Crypt')
return
end
manage_crypt_authorizationdb
end
action_class do
def crypt_mechanisms
[
'Crypt:Check,privileged',
'Crypt:CryptGUI',
'Crypt:Enablement,privileged',
].freeze
end
def manage?
node['cpe_crypt']['manage_authdb']
end
def uninstall?
node['cpe_crypt']['uninstall']
end
def manage_authdb?
if uninstall?
true
elsif manage?
true
else
false
end
end
def authdb
current_authdb = Mixlib::ShellOut.new(
'/usr/bin/security authorizationdb read system.login.console',
).run_command.stdout
Plist.parse_xml(current_authdb)
end
def crypt_currently_in_authdb
authdb_hash = authdb
if authdb_hash.nil?
Chef::Log.warn('Security authorization db contained no value!')
return false
end
# Crypt settings
correct_mechanisms = Set.new(['loginwindow:done'] + crypt_mechanisms)
existing_mechanisms = Set.new(authdb_hash['mechanisms'])
# Return true if Crypt is present in the authdb settings
correct_mechanisms.subset?(existing_mechanisms)
end
def manage_crypt_authorizationdb
authdb_hash = authdb
# Remove any existing Crypt configs from system.login.console parse
fixed_mechs =
authdb_hash['mechanisms'].reject { |e| crypt_mechanisms.include? e }
unless uninstall?
# Add the new Crypt mechanisms back into the authdb hash
# These must go *AFTER* "loginwindow:done"
crypt_index = fixed_mechs.index('loginwindow:done')
fixed_mechs.insert(crypt_index + 1, crypt_mechanisms).flatten!
end
authdb_hash['mechanisms'] = fixed_mechs
# Write settings back to disk
# Send it back to security authorizationdb
cmd = "echo \"#{Plist::Emit.dump(authdb_hash)}\" " +
'| /usr/bin/security authorizationdb write system.login.console'
execute 'security_authorizationdb_write' do
command cmd
end
end
def crypt_installed?
crypt_path =
'/Library/Security/SecurityAgentPlugins/Crypt.bundle/Contents/MacOS/Crypt'
::File.exist?(crypt_path)
end
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
pinterest/it-cpe-cookbooks | https://github.com/pinterest/it-cpe-cookbooks/blob/f021bd5f53d40256ef902e168399c0c3c04f2a9f/cpe_crypt/resources/cpe_crypt_install.rb | cpe_crypt/resources/cpe_crypt_install.rb | #
# Cookbook:: cpe_crypt
# Resources:: cpe_crypt_install
#
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright:: (c) 2017-present, Pinterest, Inc.
# All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found in the
# LICENSE file in the root directory of this source tree.
#
unified_mode true
resource_name :cpe_crypt_install
provides :cpe_crypt_install, :os => 'darwin'
default_action :manage
action :manage do
validate_install
install if install? && !uninstall?
remove if uninstall?
end
action_class do
def install?
node['cpe_crypt']['install']
end
def uninstall?
node['cpe_crypt']['uninstall']
end
# Forget the crypt2 package receipt
def forget_crypt_pkg
pkg = node['cpe_crypt']['pkg']
execute "/usr/sbin/pkgutil --forget #{pkg['receipt']}" do
not_if do
shell_out("/usr/sbin/pkgutil --pkg-info #{pkg['receipt']}").error?
end
action :run
end
end
def crypt_installed?
crypt_path =
'/Library/Security/SecurityAgentPlugins/Crypt.bundle/Contents/MacOS/Crypt'
::File.exist?(crypt_path)
end
def validate_install
forget_crypt_pkg if install? && !crypt_installed?
end
def install
pkg = node['cpe_crypt']['pkg']
# Install Crypt auth plugin
cpe_remote_pkg 'crypt' do
version pkg['version']
checksum pkg['checksum']
receipt pkg['receipt']
pkg_name pkg['pkg_name'] if pkg['pkg_name']
pkg_url pkg['pkg_url'] if pkg['pkg_url']
end
end
def remove
# Delete crypt directories
[
'/Library/Security/SecurityAgentPlugins/Crypt.bundle',
'/Library/Crypt',
].each do |item|
directory item do
action :delete
recursive true
end
end
# Delete default Crypt LaunchDaemon
launchd 'com.grahamgilbert.crypt' do
action :delete
end
forget_crypt_pkg
end
end
| ruby | Apache-2.0 | f021bd5f53d40256ef902e168399c0c3c04f2a9f | 2026-01-04T17:58:20.108383Z | false |
refinery/refinerycms-news | https://github.com/refinery/refinerycms-news/blob/8e89de6c68077da150fb48dc5feb44c8f85a775c/app/helpers/refinery/news/items_helper.rb | app/helpers/refinery/news/items_helper.rb | module Refinery
module News
module ItemsHelper
def news_item_archive_widget
items = Refinery::News::Item.select('publish_date').all_previous
return nil if items.blank?
render "/refinery/news/items/widgets/news_archive", :items => items
end
alias_method :news_archive_list, :news_item_archive_widget
def next_or_previous?(item)
item.next.present? or item.prev.present?
end
def news_item_teaser_enabled?
Refinery::News::Item.teasers_enabled?
end
def news_item_teaser(item)
if item.respond_to?(:custom_teaser) && item.custom_teaser.present?
item.custom_teaser.html_safe
else
truncate(item.body, {
:length => Refinery::Setting.find_or_set(:news_item_teaser_length, 250),
:preserve_html_tags => true
}).html_safe
end
end
def news_item_archive_links
html = ''
item_months = ::Refinery::News::Item.archived.group_by {|i| i.publish_date.beginning_of_month}
item_months.each do |month, items|
if items.present?
text = "#{t("date.month_names")[month.month]} #{month.year} (#{items.count})"
html += "<li>#{link_to(text, refinery.news_items_archive_path(:year => month.year, :month => month.month))}</li>"
end
end
content_tag('ul', raw(html))
end
def archive_date_format(date_for_month)
date_for_month ? "%B %Y" : "%Y"
end
end
end
end
| ruby | MIT | 8e89de6c68077da150fb48dc5feb44c8f85a775c | 2026-01-04T17:58:21.941874Z | false |
refinery/refinerycms-news | https://github.com/refinery/refinerycms-news/blob/8e89de6c68077da150fb48dc5feb44c8f85a775c/app/controllers/refinery/news/items_controller.rb | app/controllers/refinery/news/items_controller.rb | module Refinery
module News
class ItemsController < ::ApplicationController
before_action :find_page
before_action :find_published_news_items, :only => [:index]
before_action :find_news_item, :find_latest_news_items, :only => [:show]
def index
# render 'index'
end
def show
# render 'show'
end
def archive
if params[:month].present?
@archive_for_month = true
@archive_date = Time.parse("#{params[:month]}/#{params[:year]}")
@items = Item.archived.translated.by_archive(@archive_date).page(params[:page])
else
@archive_date = Time.parse("01/#{params[:year]}")
@items = Item.archived.translated.by_year(@archive_date).page(params[:page])
end
end
protected
def find_latest_news_items
@items = Item.latest.translated
end
def find_published_news_items
@items = Item.published.translated.page(params[:page])
end
def find_news_item
@item = Item.published.translated.friendly.find(params[:id])
end
def find_page
@page = ::Refinery::Page.find_by_link_url("/news") if defined?(::Refinery::Page)
end
end
end
end
| ruby | MIT | 8e89de6c68077da150fb48dc5feb44c8f85a775c | 2026-01-04T17:58:21.941874Z | false |
refinery/refinerycms-news | https://github.com/refinery/refinerycms-news/blob/8e89de6c68077da150fb48dc5feb44c8f85a775c/app/controllers/refinery/news/admin/items_controller.rb | app/controllers/refinery/news/admin/items_controller.rb | module Refinery
module News
module Admin
class ItemsController < ::Refinery::AdminController
crudify :'refinery/news/item', :order => "publish_date DESC"
private
def item_params
params.require(:item).permit(:title, :body, :content, :source, :publish_date, :expiration_date)
end
end
end
end
end
| ruby | MIT | 8e89de6c68077da150fb48dc5feb44c8f85a775c | 2026-01-04T17:58:21.941874Z | false |
refinery/refinerycms-news | https://github.com/refinery/refinerycms-news/blob/8e89de6c68077da150fb48dc5feb44c8f85a775c/app/models/refinery/news/item.rb | app/models/refinery/news/item.rb | require 'acts_as_indexed'
require 'mobility'
module Refinery
module News
class Item < Refinery::Core::BaseModel
extend FriendlyId
translates :title, :body, :slug
alias_attribute :content, :body
validates :title, :content, :publish_date, :presence => true
validates :source, length: {maximum: 255}, allow_blank: true
acts_as_indexed :fields => [:title, :body]
default_scope proc { order "publish_date DESC" }
friendly_id :title, :use => [:slugged, :mobility]
# If title changes tell friendly_id to regenerate slug when saving record
def should_generate_new_friendly_id?
attribute_changed?(:title)
end
def not_published? # has the published date not yet arrived?
publish_date > Time.now
end
def next
self.class.next(self).first
end
def prev
self.class.previous(self).first
end
class << self
def by_archive(archive_date)
where(:publish_date => archive_date.beginning_of_month..archive_date.end_of_month)
end
def by_year(archive_year)
where(:publish_date => archive_year.beginning_of_year..archive_year.end_of_year)
end
def all_previous
where(['publish_date <= ?', Time.now.beginning_of_month])
end
def next(item)
self.send(:with_exclusive_scope) do
where("publish_date > ?", item.publish_date).order("publish_date ASC")
end
end
def previous(item)
where("publish_date < ?", item.publish_date)
end
def not_expired
where(arel_table[:expiration_date].eq(nil).or(arel_table[:expiration_date].gt(Time.now)))
end
def published
not_expired.where("publish_date < ?", Time.now)
end
def latest(limit = 10)
published.limit(limit)
end
def live
not_expired.where("publish_date <= ?", Time.now)
end
def archived
where("publish_date <= ?", Time.now)
end
# rejects any page that has not been translated to the current locale.
def translated
includes(:translations).where(
translation_class.arel_table[:locale].eq(::Mobility.locale)
).where(
arel_table[:id].eq(translation_class.arel_table[:refinery_news_item_id])
).references(:translations)
end
def teasers_enabled?
Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'news')
end
def teaser_enabled_toggle!
currently = Refinery::Setting.find_or_set(:teasers_enabled, true, :scoping => 'news')
Refinery::Setting.set(:teasers_enabled, :value => !currently, :scoping => 'news')
end
end
end
end
end
| ruby | MIT | 8e89de6c68077da150fb48dc5feb44c8f85a775c | 2026-01-04T17:58:21.941874Z | false |
refinery/refinerycms-news | https://github.com/refinery/refinerycms-news/blob/8e89de6c68077da150fb48dc5feb44c8f85a775c/db/seeds.rb | db/seeds.rb | if defined?(::Refinery::User)
::Refinery::User.all.each do |user|
if user.plugins.where(:name => 'refinerycms_news').blank?
user.plugins.create(:name => 'refinerycms_news')
end
end
end
if defined?(::Refinery::Page)
unless ::Refinery::Page.where(:menu_match => "^/news.*$").any?
page = ::Refinery::Page.create(
:title => "News",
:link_url => "/news",
:deletable => false,
:menu_match => "^/news.*$"
)
::Refinery::Pages.default_parts.each do |default_page_part|
page.parts.create(title: default_page_part[:title], slug: default_page_part[:slug], body: nil)
end
end
end
| ruby | MIT | 8e89de6c68077da150fb48dc5feb44c8f85a775c | 2026-01-04T17:58:21.941874Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.