diff --git a/AUTHORS.md b/AUTHORS.md index 22871f3..7261281 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -5,21 +5,22 @@ This list is sorted by the number of commits per contributor in _descending_ ord Avatar|Contributor|Contributions :-:|---|:-: @myii|[@myii](https://github.com/myii)|141 -@javierbertoli|[@javierbertoli](https://github.com/javierbertoli)|30 +@javierbertoli|[@javierbertoli](https://github.com/javierbertoli)|31 @gravyboat|[@gravyboat](https://github.com/gravyboat)|12 @bmcclure|[@bmcclure](https://github.com/bmcclure)|8 @aboe76|[@aboe76](https://github.com/aboe76)|8 @arthurzenika|[@arthurzenika](https://github.com/arthurzenika)|7 @nmadhok|[@nmadhok](https://github.com/nmadhok)|7 @dafyddj|[@dafyddj](https://github.com/dafyddj)|6 -@boltronics|[@boltronics](https://github.com/boltronics)|5 @jdkelleher|[@jdkelleher](https://github.com/jdkelleher)|5 -@daschatten|[@daschatten](https://github.com/daschatten)|4 +@boltronics|[@boltronics](https://github.com/boltronics)|5 @westurner|[@westurner](https://github.com/westurner)|4 +@daschatten|[@daschatten](https://github.com/daschatten)|4 @techhat|[@techhat](https://github.com/techhat)|3 @whiteinge|[@whiteinge](https://github.com/whiteinge)|3 @devster31|[@devster31](https://github.com/devster31)|3 @baby-gnu|[@baby-gnu](https://github.com/baby-gnu)|1 +@didiermfb|[@didiermfb](https://github.com/didiermfb)|1 @jerrykan|[@jerrykan](https://github.com/jerrykan)|1 @rpatterson|[@rpatterson](https://github.com/rpatterson)|1 @simonclausen|[@simonclausen](https://github.com/simonclausen)|1 @@ -29,4 +30,4 @@ Avatar|Contributor|Contributions --- -Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2025-04-10. +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2025-04-14. diff --git a/CHANGELOG.md b/CHANGELOG.md index 42baefc..59a489f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.11.2](https://github.com/saltstack-formulas/apt-formula/compare/v0.11.1...v0.11.2) (2025-04-14) + + +### Bug Fixes + +* **repositories:** force aptkey if signed-by and allow aptkey ([3e11c59](https://github.com/saltstack-formulas/apt-formula/commit/3e11c5999255f22f36e1fd63e10e9e553ed3f538)) + ## [0.11.1](https://github.com/saltstack-formulas/apt-formula/compare/v0.11.0...v0.11.1) (2025-04-10) diff --git a/FORMULA b/FORMULA index 5f31945..ec9b6c5 100644 --- a/FORMULA +++ b/FORMULA @@ -1,7 +1,7 @@ name: apt os: Debian, Ubuntu, Raspbian os_family: Debian -version: 0.11.1 +version: 0.11.2 release: 1 minimum_version: 2017.7 summary: Apt formula diff --git a/apt/map.jinja b/apt/map.jinja index d77073e..2355584 100644 --- a/apt/map.jinja +++ b/apt/map.jinja @@ -13,6 +13,8 @@ 'preferences': {}, 'remove_preferences': false, 'clean_preferences_d': false, + 'keyrings_dir': '/etc/apt/keyrings', + 'clean_keyrings_d': false, 'remove_apt_conf': false, 'clean_apt_conf_d': false, 'apt_conf_d': {}, @@ -52,6 +54,8 @@ 'preferences': {}, 'remove_preferences': false, 'clean_preferences_d': false, + 'keyrings_dir': '/etc/apt/keyrings', + 'clean_keyrings_d': false, 'remove_apt_conf': false, 'clean_apt_conf_d': false, 'apt_conf_d': {}, diff --git a/apt/repositories.sls b/apt/repositories.sls index 032cc47..beb3266 100644 --- a/apt/repositories.sls +++ b/apt/repositories.sls @@ -4,6 +4,8 @@ {% set clean_sources_list_d = apt.get('clean_sources_list_d', apt_map.clean_sources_list_d) %} {% set sources_list_dir = apt.get('sources_list_dir', apt_map.sources_list_dir) %} {% set repositories = apt.get('repositories', apt_map.repositories) %} +{% set keyrings_dir = apt.get('keyrings_dir', apt_map.keyrings_dir) %} +{% set clean_keyrings_d = apt.get('clean_keyrings_d', apt_map.clean_keyrings_d) %} {% set default_url = apt.get('default_url', apt_map.default_url) %} {% set keyring_package = apt.get('keyring_package', apt_map.default_keyring_package) %} @@ -30,6 +32,13 @@ - group: root - clean: {{ clean_sources_list_d }} +{{ keyrings_dir }}: + file.directory: + - mode: '0755' + - user: root + - group: root + - clean: {{ clean_keyrings_d }} + {% for repo, args in repositories.items() %} {% set r_opts = '' %} @@ -69,6 +78,9 @@ the latter will be used. #} {% if args.key_url is defined %} - key_url: {{ args.key_url }} + {% if 'signed-by=' in r_opts|lower and args.aptkey is not defined %} + - aptkey: false + {% endif %} {% elif args.key_text is defined %} - key_text: {{ args.key_text }} {% elif args.keyid is defined %} @@ -78,6 +90,9 @@ - clean_file: true - refresh: False - refresh_db: False + {% if args.aptkey is defined %} + - aptkey: {{ args.aptkey }} + {% endif %} - onchanges_in: - module: apt.refresh_db diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst index d18f516..baf26e8 100644 --- a/docs/AUTHORS.rst +++ b/docs/AUTHORS.rst @@ -18,7 +18,7 @@ This list is sorted by the number of commits per contributor in *descending* ord - 141 * - :raw-html-m2r:`@javierbertoli` - `@javierbertoli `_ - - 30 + - 31 * - :raw-html-m2r:`@gravyboat` - `@gravyboat `_ - 12 @@ -37,18 +37,18 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@dafyddj` - `@dafyddj `_ - 6 - * - :raw-html-m2r:`@boltronics` - - `@boltronics `_ - - 5 * - :raw-html-m2r:`@jdkelleher` - `@jdkelleher `_ - 5 - * - :raw-html-m2r:`@daschatten` - - `@daschatten `_ - - 4 + * - :raw-html-m2r:`@boltronics` + - `@boltronics `_ + - 5 * - :raw-html-m2r:`@westurner` - `@westurner `_ - 4 + * - :raw-html-m2r:`@daschatten` + - `@daschatten `_ + - 4 * - :raw-html-m2r:`@techhat` - `@techhat `_ - 3 @@ -61,6 +61,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@baby-gnu` - `@baby-gnu `_ - 1 + * - :raw-html-m2r:`@didiermfb` + - `@didiermfb `_ + - 1 * - :raw-html-m2r:`@jerrykan` - `@jerrykan `_ - 1 @@ -83,4 +86,4 @@ This list is sorted by the number of commits per contributor in *descending* ord ---- -Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2025-04-10. +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2025-04-14. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 717bd7f..7de8960 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,15 @@ Changelog ========= +`0.11.2 `_ (2025-04-14) +-------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **repositories:** force aptkey if signed-by and allow aptkey (\ `3e11c59 `_\ ) + `0.11.1 `_ (2025-04-10) -------------------------------------------------------------------------------------------------------- diff --git a/pillar.example b/pillar.example index 6f313a0..9a217ef 100644 --- a/pillar.example +++ b/pillar.example @@ -14,6 +14,9 @@ apt: remove_preferences: true clean_preferences_d: true + keyrings_dir: '/etc/apt/keyrings' + clean_keyrings_d: true + apt_conf_d: 30release: 'APT::Default-Release': stable @@ -126,6 +129,13 @@ apt: opts: trusted: 'yes' another: whatever + saltstack: + distro: stable + url: https://packages.broadcom.com/artifactory/saltproject-deb + comps: [main] + type: [binary] + key_url: https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public # yamllint disable-line rule:line-length + opts: "signed-by=/etc/apt/keyrings/salt-archive-keyring.pgp" preferences: 00-rspamd: diff --git a/test/integration/repositories/controls/repositories_spec.rb b/test/integration/repositories/controls/repositories_spec.rb index c08eef9..cac9731 100644 --- a/test/integration/repositories/controls/repositories_spec.rb +++ b/test/integration/repositories/controls/repositories_spec.rb @@ -64,4 +64,23 @@ describe file('/etc/apt/sources.list.d/raspbian-binary.list') do it { should_not exist } end + + describe file('/etc/apt/sources.list.d/saltstack.list') do + it { should exist } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + its('mode') { should cmp '0644' } + its(:content) do + should match( + %r{deb \[\s?signed-by=/etc/apt/keyrings/salt-archive-keyring.pgp\s?\] https://packages.broadcom.com/artifactory/saltproject-deb stable main} + ) + end + end + + describe file('/etc/apt/keyrings/salt-archive-keyring.pgp') do + it { should exist } + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + its('mode') { should cmp '0644' } + end end diff --git a/test/salt/pillar/repositories.sls b/test/salt/pillar/repositories.sls index 97aeb3b..ade535e 100644 --- a/test/salt/pillar/repositories.sls +++ b/test/salt/pillar/repositories.sls @@ -27,3 +27,11 @@ apt: url: http://archive.raspbian.org/raspbian type: [source] key_url: https://archive.raspbian.org/raspbian.public.key + saltstack: + filename: saltstack.list + distro: stable + url: https://packages.broadcom.com/artifactory/saltproject-deb + comps: [main] + type: [binary] + key_url: https://packages.broadcom.com/artifactory/api/security/keypair/SaltProjectKey/public # yamllint disable-line rule:line-length + opts: "signed-by=/etc/apt/keyrings/salt-archive-keyring.pgp"