Skip to content

Commit afeea60

Browse files
committed
Drop encryption on localhost. Fixes #140
1 parent c6578b8 commit afeea60

9 files changed

Lines changed: 81 additions & 70 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 2019-06-16 - Release 2.2.2
4+
5+
Published at [Puppet Forge](https://forge.puppet.com/leoarnold/cups/2.2.2)
6+
and [GitHub](https://github.com/leoarnold/puppet-cups/releases/tag/2.2.2).
7+
8+
### Summary
9+
10+
This release drops the use of encryption while talking to localhost via IPP.
11+
On localhost, HTTPS technically isn't necessary and since some users experienced
12+
CUPS SSL errors, we stop using it.
13+
314
## 2019-06-13 - Release 2.2.1
415

516
Published at [Puppet Forge](https://forge.puppet.com/leoarnold/cups/2.2.1)

lib/puppet/provider/cups_queue/cups.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create_class
5656
destroy
5757

5858
resource.should(:members).each do |member|
59-
lpadmin('-E', '-p', member, '-c', name)
59+
lpadmin('-p', member, '-c', name)
6060
end
6161

6262
run_property_setter(:access, :description, :location, :options, :shared,
@@ -68,7 +68,7 @@ def create_printer
6868
destroy
6969

7070
# Create a minimal raw queue first, then adapt it
71-
lpadmin('-E', '-p', name, '-v', 'file:///dev/null')
71+
lpadmin('-p', name, '-v', 'file:///dev/null')
7272

7373
run_parameter_setter(:model, :ppd)
7474

@@ -99,7 +99,7 @@ def run_attribute_setter(attribute, target_value)
9999
private :run_attribute_setter
100100

101101
def destroy
102-
lpadmin('-E', '-x', name) if queue_exists?
102+
lpadmin('-x', name) if queue_exists?
103103
end
104104

105105
### Property getters and setters
@@ -114,9 +114,9 @@ def accepting
114114

115115
def accepting=(value)
116116
if value == :true
117-
cupsaccept('-E', name)
117+
cupsaccept(name)
118118
else
119-
cupsreject('-E', name)
119+
cupsreject(name)
120120
end
121121
end
122122

@@ -127,15 +127,15 @@ def access
127127
end
128128

129129
def access=(value)
130-
lpadmin('-E', '-p', name, '-u', value['policy'] + ':' + value['users'].join(','))
130+
lpadmin('-p', name, '-u', value['policy'] + ':' + value['users'].join(','))
131131
end
132132

133133
def description
134134
query('printer-info')
135135
end
136136

137137
def description=(value)
138-
lpadmin('-E', '-p', name, '-D', value)
138+
lpadmin('-p', name, '-D', value)
139139
end
140140

141141
def enabled
@@ -144,9 +144,9 @@ def enabled
144144

145145
def enabled=(value)
146146
if value == :true
147-
while_root_allowed { cupsenable('-E', name) }
147+
while_root_allowed { cupsenable(name) }
148148
else
149-
cupsdisable('-E', name)
149+
cupsdisable(name)
150150
end
151151
end
152152

@@ -156,9 +156,9 @@ def held
156156

157157
def held=(value)
158158
if value == :true
159-
cupsdisable('-E', '--hold', name)
159+
cupsdisable('--hold', name)
160160
else
161-
cupsenable('-E', '--release', name)
161+
cupsenable('--release', name)
162162
end
163163
end
164164

@@ -167,7 +167,7 @@ def location
167167
end
168168

169169
def location=(value)
170-
lpadmin('-E', '-p', name, '-L', value)
170+
lpadmin('-p', name, '-L', value)
171171
end
172172

173173
def make_and_model
@@ -180,7 +180,7 @@ def make_and_model=(_value)
180180
end
181181

182182
def model=(value)
183-
lpadmin('-E', '-p', name, '-m', value)
183+
lpadmin('-p', name, '-m', value)
184184
end
185185

186186
def members
@@ -198,28 +198,28 @@ def options
198198

199199
def options=(options_should)
200200
options_should.each do |key, value|
201-
lpadmin('-E', '-p', name, '-o', "#{key}=#{value}")
201+
lpadmin('-p', name, '-o', "#{key}=#{value}")
202202
end
203203
end
204204

205205
def ppd=(value)
206-
lpadmin('-E', '-p', name, '-P', value)
206+
lpadmin('-p', name, '-P', value)
207207
end
208208

209209
def shared
210210
query('printer-is-shared')
211211
end
212212

213213
def shared=(value)
214-
lpadmin('-E', '-p', name, '-o', "printer-is-shared=#{value}")
214+
lpadmin('-p', name, '-o', "printer-is-shared=#{value}")
215215
end
216216

217217
def uri
218218
query('device-uri') if printer_exists?
219219
end
220220

221221
def uri=(value)
222-
lpadmin('-E', '-p', name, '-v', value)
222+
lpadmin('-p', name, '-v', value)
223223
end
224224

225225
private
@@ -310,7 +310,7 @@ def query_native_option(option)
310310
def vendor_options_is
311311
answer = {}
312312

313-
lpoptions('-E', '-p', name, '-l').each_line do |line|
313+
lpoptions('-p', name, '-l').each_line do |line|
314314
result = %r{\A(?<key>\w+)/(.*):(.*)\*(?<value>\w+)}.match(line)
315315
answer[result[:key]] = result[:value] if result
316316
end

manifests/queues/default.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
if ($::cups::default_queue) {
2020
exec { 'cups::queues::default':
21-
command => "lpadmin -E -d '${::cups::default_queue}'",
21+
command => "lpadmin -d '${::cups::default_queue}'",
2222
unless => "lpstat -d | grep -w '${::cups::default_queue}'",
2323
path => ['/usr/sbin/', '/usr/bin/', '/sbin/', '/bin/'],
2424
require => Cups_queue[$::cups::default_queue]

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leoarnold-cups",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"author": "Leo Arnold",
55
"summary": "Puppet module for the Common Unix Printing System (CUPS)",
66
"license": "MIT",

spec/acceptance/puppet/cups_issue_4781_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@
126126
context "when the queue is present, disabled and restricted to user 'sshd'" do
127127
context 'without specifying an ACL' do
128128
before(:all) do
129-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
130-
shell('cupsdisable -E Office')
129+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
130+
shell('cupsdisable Office')
131131
end
132132

133133
let(:manifest) do
@@ -150,8 +150,8 @@
150150

151151
context 'when admitting everybody' do
152152
before(:all) do
153-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
154-
shell('cupsdisable -E Office')
153+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
154+
shell('cupsdisable Office')
155155
end
156156

157157
let(:access) { "{ 'policy' => 'allow', users => ['all'] }" }
@@ -167,8 +167,8 @@
167167

168168
context 'when admitting just one specific user' do
169169
before(:all) do
170-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
171-
shell('cupsdisable -E Office')
170+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
171+
shell('cupsdisable Office')
172172
end
173173

174174
let(:access) { "{ 'policy' => 'allow', users => ['sshd'] }" }
@@ -184,8 +184,8 @@
184184

185185
context 'when denying several users' do
186186
before(:all) do
187-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
188-
shell('cupsdisable -E Office')
187+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
188+
shell('cupsdisable Office')
189189
end
190190

191191
let(:access) { "{ 'policy' => 'deny', users => ['root', 'sshd'] }" }
@@ -201,8 +201,8 @@
201201

202202
context 'when denying just one specific user' do
203203
before(:all) do
204-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
205-
shell('cupsdisable -E Office')
204+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
205+
shell('cupsdisable Office')
206206
end
207207

208208
let(:access) { "{ 'policy' => 'deny', users => ['sshd'] }" }
@@ -218,8 +218,8 @@
218218

219219
context 'when denying several users' do
220220
before(:all) do
221-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
222-
shell('cupsdisable -E Office')
221+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
222+
shell('cupsdisable Office')
223223
end
224224

225225
let(:access) { "{ 'policy' => 'deny', users => ['root', 'sshd'] }" }
@@ -235,8 +235,8 @@
235235

236236
context 'when denying everybody' do
237237
before(:all) do
238-
shell('lpadmin -E -p Office -v /dev/null -u allow:sshd')
239-
shell('cupsdisable -E Office')
238+
shell('lpadmin -p Office -v /dev/null -u allow:sshd')
239+
shell('cupsdisable Office')
240240
end
241241

242242
let(:access) { "{ 'policy' => 'deny', users => ['all'] }" }

spec/acceptance/puppet/cups_queue_properties_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
context 'when changing only the property' do
1919
describe 'access' do
2020
before(:all) do
21-
shell("lpadmin -E -p #{Shellwords.escape(name)} -u allow:all")
21+
shell("lpadmin -p #{Shellwords.escape(name)} -u allow:all")
2222
end
2323

2424
context 'with policy => allow' do
@@ -134,7 +134,7 @@
134134

135135
describe 'accepting' do
136136
before(:all) do
137-
shell("cupsreject -E #{Shellwords.escape(name)}")
137+
shell("cupsreject #{Shellwords.escape(name)}")
138138
end
139139

140140
context 'when set to true' do
@@ -186,7 +186,7 @@
186186

187187
describe 'description' do
188188
before(:all) do
189-
shell("lpadmin -E -p #{Shellwords.escape(name)} -D 'color'")
189+
shell("lpadmin -p #{Shellwords.escape(name)} -D 'color'")
190190
end
191191

192192
let(:manifest) do
@@ -213,7 +213,7 @@
213213

214214
describe 'enabled' do
215215
before(:all) do
216-
shell("cupsdisable -E #{Shellwords.escape(name)}")
216+
shell("cupsdisable #{Shellwords.escape(name)}")
217217
end
218218

219219
context 'when set to true' do
@@ -265,7 +265,7 @@
265265

266266
describe 'held' do
267267
before(:all) do
268-
shell("cupsenable -E --release #{Shellwords.escape(name)}")
268+
shell("cupsenable --release #{Shellwords.escape(name)}")
269269
end
270270

271271
context 'when set to true' do
@@ -317,7 +317,7 @@
317317

318318
describe 'location' do
319319
before(:all) do
320-
shell("lpadmin -E -p #{Shellwords.escape(name)} -L 'Room 451'")
320+
shell("lpadmin -p #{Shellwords.escape(name)} -L 'Room 451'")
321321
end
322322

323323
let(:manifest) do
@@ -345,7 +345,7 @@
345345
describe 'options' do
346346
context 'when using native options' do
347347
before(:all) do
348-
shell("lpadmin -E -p #{Shellwords.escape(name)}" \
348+
shell("lpadmin -p #{Shellwords.escape(name)}" \
349349
' -o auth-info-required=negotiate' \
350350
' -o job-sheets-default=banner,banner' \
351351
' -o printer-error-policy=retry-current-job')
@@ -375,7 +375,7 @@
375375

376376
context 'when using vendor options' do
377377
before(:all) do
378-
shell("lpadmin -E -p #{Shellwords.escape(name)} -o Duplex=None")
378+
shell("lpadmin -p #{Shellwords.escape(name)} -o Duplex=None")
379379
end
380380

381381
let(:manifest) do
@@ -407,7 +407,7 @@
407407

408408
describe 'shared' do
409409
before(:all) do
410-
shell("lpadmin -E -p #{Shellwords.escape(name)} -o printer-is-shared=false")
410+
shell("lpadmin -p #{Shellwords.escape(name)} -o printer-is-shared=false")
411411
end
412412

413413
context 'when set to true' do

spec/classes/init_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
context "when the catalog contains the corresponding 'cups_queue' resource" do
177177
let(:pre_condition) { "cups_queue { 'Office': ensure => 'printer' }" }
178178

179-
it { is_expected.to contain_exec('cups::queues::default').with(command: "lpadmin -E -d 'Office'") }
179+
it { is_expected.to contain_exec('cups::queues::default').with(command: "lpadmin -d 'Office'") }
180180

181181
it { is_expected.to contain_exec('cups::queues::default').with(unless: "lpstat -d | grep -w 'Office'") }
182182

spec/spec_helper_acceptance.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def ensure_cups_is_running
2929

3030
def add_printers(*names)
3131
names.each do |name|
32-
shell("lpadmin -E -p #{Shellwords.escape(name)} -m drv:///sample.drv/generic.ppd -o printer-is-shared=false")
32+
shell("lpadmin -p #{Shellwords.escape(name)} -m drv:///sample.drv/generic.ppd -o printer-is-shared=false")
3333
end
3434
end
3535

@@ -39,16 +39,16 @@ def add_printers_to_classes(class_members)
3939
members = class_members[classname]
4040
members = %w[Dummy] if members.empty?
4141
members.each do |printername|
42-
shell("lpadmin -E -p #{Shellwords.escape(printername)} -c #{Shellwords.escape(classname)}")
42+
shell("lpadmin -p #{Shellwords.escape(printername)} -c #{Shellwords.escape(classname)}")
4343
end
44-
shell("lpadmin -E -p #{Shellwords.escape(classname)} -o printer-is-shared=false")
44+
shell("lpadmin -p #{Shellwords.escape(classname)} -o printer-is-shared=false")
4545
end
4646
remove_queues('Dummy')
4747
end
4848

4949
def remove_queues(*names)
5050
names.flatten.each do |name|
51-
shell("lpadmin -E -x #{Shellwords.escape(name)}", acceptable_exit_codes: [0, 1])
51+
shell("lpadmin -x #{Shellwords.escape(name)}", acceptable_exit_codes: [0, 1])
5252
end
5353
end
5454

0 commit comments

Comments
 (0)