Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable allow-insecure for apt::source defined types, includes new tes… #1014

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ The following parameters are available in the `apt::source` defined type:
* [`pin`](#pin)
* [`architecture`](#architecture)
* [`allow_unsigned`](#allow_unsigned)
* [`allow_insecure`](#allow_insecure)
* [`notify_update`](#notify_update)

##### <a name="location"></a>`location`
Expand Down Expand Up @@ -1036,6 +1037,16 @@ Specifies whether to authenticate packages from this release, even if the Releas

Default value: ``false``

##### <a name="allow_insecure"></a>`allow_insecure`

Data type: `Boolean`

Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked.
Unlike the `allow_unsigned` (trusted=yes) option, this should throw a warning that the interaction is insecure.
See [this comment](https://unix.stackexchange.com/a/480550) for a brief discussion of the difference and why this option might be preferable to `allow_unsigned`.

Default value: ``false``

##### <a name="notify_update"></a>`notify_update`

Data type: `Boolean`
Expand Down
8 changes: 5 additions & 3 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
Optional[Variant[Hash, Numeric, String]] $pin = undef,
Optional[String] $architecture = undef,
Boolean $allow_unsigned = false,
Boolean $allow_insecure = false,
Boolean $notify_update = true,
) {

Expand Down Expand Up @@ -129,9 +130,10 @@
'comment' => $comment,
'includes' => $includes,
'options' => delete_undef_values({
'arch' => $architecture,
'trusted' => $allow_unsigned ? {true => "yes", false => undef},
'signed-by' => $keyring,
'arch' => $architecture,
'trusted' => $allow_unsigned ? {true => "yes", false => undef},
'allow-insecure' => $allow_insecure ? {true => "yes", false => undef},
'signed-by' => $keyring,
}),
'location' => $_location,
'release' => $_release,
Expand Down
12 changes: 12 additions & 0 deletions spec/defines/source_compat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@
}
end

context 'when allow_insecure true' do
let :params do
{
'include' => { 'src' => false },
'location' => 'http://debian.mirror.iweb.ca/debian/',
'allow_insecure' => true,
}
end

it { is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb \[allow-insecure=yes\] http://debian.mirror.iweb.ca/debian/ jessie main\n}) }
end

context 'when allow_unsigned true' do
let :params do
{
Expand Down
13 changes: 13 additions & 0 deletions spec/defines/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@
end
end

context 'with allow_insecure true' do
let :params do
{
location: 'hello.there',
allow_insecure: true,
}
end

it {
is_expected.to contain_apt__setting('list-my_source').with(ensure: 'present').with_content(%r{# my_source\ndeb \[allow-insecure=yes\] hello.there jessie main\n})
}
end

context 'with allow_unsigned true' do
let :params do
{
Expand Down