├── .editorconfig ├── .envrc ├── .gitattributes ├── .github ├── CODEOWNERS └── workflows │ ├── ci.yml │ └── stale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .mdlrc ├── .overcommit.yml ├── .vscode └── extensions.json ├── .yamllint ├── Berksfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile ├── LICENSE ├── README.md ├── TESTING.md ├── attributes └── default.rb ├── chefignore ├── documentation └── .gitkeep ├── kitchen.dokken.yml ├── kitchen.exec.yml ├── kitchen.global.yml ├── kitchen.yml ├── metadata.rb ├── recipes └── default.rb ├── renovate.json ├── spec ├── default_spec.rb └── spec_helper.rb ├── templates └── sssd.conf.erb └── test └── integration └── default └── default_spec.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root=true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | indent_style = space 13 | indent_size = 2 14 | 15 | # Avoid issues parsing cookbook files later 16 | charset = utf-8 17 | 18 | # Avoid cookstyle warnings 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | lint-unit: 12 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 13 | 14 | integration: 15 | needs: lint-unit 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | os: 20 | - almalinux-8 21 | - amazonlinux-2 22 | - centos-7 23 | - centos-stream-8 24 | - debian-10 25 | - debian-11 26 | - fedora-latest 27 | - opensuse-leap-15 28 | - rockylinux-8 29 | - ubuntu-1804 30 | - ubuntu-2004 31 | suite: 32 | - "default" 33 | 34 | fail-fast: false 35 | 36 | steps: 37 | - name: Check out code 38 | uses: actions/checkout@v4 # v4 39 | - name: Install Chef 40 | uses: actionshub/chef-install@3.0.0 41 | - name: Dokken 42 | uses: actionshub/test-kitchen@3.0.0 43 | env: 44 | CHEF_LICENSE: accept-no-persist 45 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 46 | with: 47 | suite: ${{ matrix.suite }} 48 | os: ${{ matrix.os }} 49 | - name: Print debug output on failure 50 | if: failure() 51 | run: | 52 | set -x 53 | sudo journalctl -l --since today 54 | KITCHEN_LOCAL_YAML=kitchen.dokken.yml /usr/bin/kitchen exec ${{ matrix.suite }}-${{ matrix.os }} -c "journalctl -l" 55 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mark stale issues and pull requests 3 | 4 | "on": 5 | schedule: [cron: "0 0 * * *"] 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v9 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | close-issue-message: > 15 | Closing due to inactivity. 16 | If this is still an issue please reopen or open another issue. 17 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 18 | Thanks, Sous-Chefs. 19 | days-before-close: 7 20 | days-before-stale: 365 21 | stale-issue-message: > 22 | Marking stale due to inactivity. 23 | Remove stale label or comment or this will be closed in 7 days. 24 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 25 | Thanks, Sous-Chefs. 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .config 3 | InstalledFiles 4 | pkg 5 | test/tmp 6 | test/version_tmp 7 | tmp 8 | _Store 9 | *~ 10 | *# 11 | .#* 12 | \#*# 13 | *.un~ 14 | *.tmp 15 | *.bk 16 | *.bkup 17 | 18 | # editor files 19 | .idea 20 | .*.sw[a-z] 21 | 22 | # ruby/bundler/rspec files 23 | .ruby-version 24 | .ruby-gemset 25 | .rvmrc 26 | Gemfile.lock 27 | .bundle 28 | *.gem 29 | coverage 30 | spec/reports 31 | 32 | # YARD / rdoc artifacts 33 | .yardoc 34 | _yardoc 35 | doc/ 36 | rdoc 37 | 38 | # chef infra stuff 39 | Berksfile.lock 40 | .kitchen 41 | kitchen.local.yml 42 | vendor/ 43 | .coverage/ 44 | .zero-knife.rb 45 | Policyfile.lock.json 46 | 47 | # vagrant stuff 48 | .vagrant/ 49 | .vagrant.d/ 50 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | ul-indent: false # MD007 3 | line-length: false # MD013 4 | no-duplicate-heading: false # MD024 5 | reference-links-images: false # MD052 6 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013", "~MD024", "~MD025" 2 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreCommit: 3 | TrailingWhitespace: 4 | enabled: true 5 | YamlLint: 6 | enabled: true 7 | required_executable: "yamllint" 8 | ChefSpec: 9 | enabled: true 10 | required_executable: "chef" 11 | command: ["chef", "exec", "rspec"] 12 | Cookstyle: 13 | enabled: true 14 | required_executable: "cookstyle" 15 | command: ["cookstyle"] 16 | MarkdownLint: 17 | enabled: false 18 | required_executable: "npx" 19 | command: ["npx", "markdownlint-cli2", "'**/*.md'"] 20 | include: ["**/*.md"] 21 | 22 | CommitMsg: 23 | HardTabs: 24 | enabled: true 25 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "rebornix.ruby", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | rules: 4 | line-length: 5 | max: 256 6 | level: warning 7 | document-start: disable 8 | braces: 9 | forbid: false 10 | min-spaces-inside: 0 11 | max-spaces-inside: 1 12 | min-spaces-inside-empty: -1 13 | max-spaces-inside-empty: -1 14 | comments: 15 | min-spaces-from-content: 1 16 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'apt' 7 | end 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG for sssd_ldap 2 | 3 | This file is used to list changes made in each version of sssd_ldap. 4 | 5 | ## Unreleased 6 | 7 | ## 5.2.8 - *2024-05-02* 8 | 9 | ## 5.2.7 - *2024-05-02* 10 | 11 | Updated sssd.conf template to be sensitive by default 12 | 13 | ## 5.2.6 - *2023-10-31* 14 | 15 | ## 5.2.5 - *2023-09-28* 16 | 17 | ## 5.2.4 - *2023-09-04* 18 | 19 | ## 5.2.3 - *2023-09-04* 20 | 21 | ## 5.2.2 - *2023-06-08* 22 | 23 | ## 5.2.1 - *2023-06-08* 24 | 25 | Standardise files with files in sous-chefs/repo-management 26 | 27 | ## 5.2.0 - *2022-02-04* 28 | 29 | - Add sssd-ldap package installation for Suse distros 30 | - Remove delivery and move to calling RSpec directly via a reusable workflow 31 | - Update tested platforms 32 | 33 | ## 5.1.2 - *2021-08-31* 34 | 35 | - Standardise files with files in sous-chefs/repo-management 36 | 37 | ## 5.1.1 - *2021-06-01* 38 | 39 | - Standardise files with files in sous-chefs/repo-management 40 | 41 | ## 5.1.0 - *2021-04-01* 42 | 43 | - Sous Chefs Adoption 44 | - Cookstyle Fixes 45 | 46 | ## 5.0.09 (2019-01-11) 47 | 48 | - Require Chef 13+ and remove Debian 7 support 49 | 50 | ## 4.2.5 (2018-07-25) 51 | 52 | - Give full path to authconfig to avoid /sbin not being in the path 53 | 54 | ## 4.2.3 (2018-07-23) 55 | 56 | - Allow option to keep nscd installed where found 57 | 58 | ## 4.2.2 (2018-03-13) 59 | 60 | - If nscd is installed when authconfig is run, it will prepend to /etc/sssd/sssd.conf so make sure we remove it before sssd is installed not after 61 | 62 | ## 4.2.1 (2017-11-06) 63 | 64 | - Fix the URL in the issues_url and source_url metadata 65 | - Add Chef 12 testing to Travis CI 66 | - Remove broken shell_fallback functionality which resulted in log warnings 67 | 68 | ## 4.2.0 (2017-08-13) 69 | 70 | - [GH-32] - Support for amazon platform family 71 | - Remove Ubuntu 12.04 support and testing as 12.04 is EOL 72 | - Convert integration tests from ServerSpec to InSpec 73 | - Move the template out the default dir since we require Chef 12 74 | - Switch to dokken images for Travis testing and add Debian 7 / Debian 9 testing 75 | 76 | ## 4.1.2 (2017-05-08) 77 | 78 | - Update apache2 license string to be a SPDX standard string 79 | - Replaced hard coded root group with ohai root_group attribute to fix FreeBSD 80 | 81 | ## 4.1.1 (2017-03-06) 82 | 83 | - Allow the user to ensure that sensitive resource data is not logged by the chef-client. Default value: false. 84 | - Test with Local Delivery instead of Rake 85 | 86 | ## 4.1.0 (2016-09-15) 87 | 88 | - Remove chef 11 compat in the metadata 89 | - Require Chef 12.1 90 | - attributized filter_users and filter_groups configuration options; fixes #11 91 | 92 | ## 4.0.0 (2016-07-19) 93 | 94 | - Transferred cookbook ownership to Chef 95 | - Added chef_version metadata 96 | - Updated the minimum supported Chef version to 12.0 97 | - Switched linting to Cookstyle and added a Rakefile for simplified testing 98 | 99 | ## 3.1.0 (2016-04-27) 100 | 101 | - Added back support for RHEL 5 by making sure not to enable the sudo service on RHEL < 6 as the package is too old 102 | - Switched Test Kitchen testing in Travis CI to kitchen-dokken 103 | - Added support for Ubuntu 15.10+ by removing the hardcoded Upstart service provider on Ubuntu 13.10 or later. Chef 12 can auto determine the provider to use 104 | - Added testing on Fedora 23 / Debian 8 / Ubuntu 16.04 / CentOS 5 in Travis CI 105 | 106 | ## 3.0.1 (2015-12-24) 107 | 108 | - Added 2 new attributes for enabling autofs and ssh support, both of which default to false 109 | - nil values for config options are now skipped in the config to prevent bad configs from being written out 110 | - Added test kitchen integration testing in Travis CI 111 | 112 | ## 3.0.0 (2015-10-22) 113 | 114 | - BREAKING: All config file attributes have been moved into the `node['sssd_ldap']['sssd_conf']` hash. You can add any key value config items to this by just adding to the hash. 115 | - Add test kitchen config. Example: `node['sssd_ldap']['sssd_conf']['something'] = true` 116 | - Update Travis to run unit/lint testing via ChefDK instead of Gems and to run kitchen-docker for integration testing 117 | - Use the standard Chef rubocop config 118 | - Update development deps to the latest in the Gemfile 119 | - Require at least Chef 11 120 | 121 | ## 2.0.0 122 | 123 | - BREAKING: Change default['sssd_ldap']['ldap_tls_cacertdir'] to default['sssd_ldap']['ldap_tls_cacert'] and use per platform value 124 | - BREAKING: default['sssd_ldap']['ldap_sudo'] is a boolean value now not a string 125 | - BREAKING: nsswitch.conf is no longer templated, but edited inline instead 126 | - BREAKING: NSCD package is now removed instead of stopping the service 127 | - Debian support added 128 | - ldap_group_name added to sssd.confg via default['sssd_ldap']['ldap_group_name'] attribute 129 | - source_url and issues_url added to the metadata 130 | - sssd is always restarted after templating the config now 131 | - Chefspec unit tests added 132 | - Use standard chef .gitignore file 133 | - Update rules in the .rubocop.yml file 134 | - Have Travis test on Ruby 2.2 and remove 1.9 from testing 135 | - Add a Berksfile 136 | - Update Gemfile deps and break out into groups 137 | - Add a license file 138 | - Add cookbook version badge to the readme 139 | - Additional files added to the chefignore file 140 | 141 | ## 1.0.2 142 | 143 | - Added support for min_id / max_id 144 | - Added support for conditional sudoers 145 | - Added attributes to the Readme 146 | - Updated Rubocop to 0.27 147 | 148 | ## 1.0.0 149 | 150 | - Switch modes to be strings not ints 151 | - Remove duplicate reference to the config template 152 | - Add shell_fallback attribute 153 | - Support Ubuntu 13.04 and later with Upstart 154 | - Allow authenticating to servers that don't require binding 155 | 156 | ## 0.1.6 157 | 158 | - Supports Ubuntu 159 | 160 | ## 0.1.5 161 | 162 | - Added some more configurable attributes 163 | 164 | ## 0.1.0 165 | 166 | - Initial release of sssd_ldap 167 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please refer to 4 | [https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) 5 | -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | # Reference: http://danger.systems/reference.html 2 | 3 | # A pull request summary is required. Add a description of the pull request purpose. 4 | # Changelog must be updated for each pull request that changes code. 5 | # Warnings will be issued for: 6 | # Pull request with more than 400 lines of code changed 7 | # Pull reqest that change more than 5 lines without test changes 8 | # Failures will be issued for: 9 | # Pull request without summary 10 | # Pull requests with code changes without changelog entry 11 | 12 | def code_changes? 13 | code = %w(libraries attributes recipes resources files templates) 14 | code.each do |location| 15 | return true unless git.modified_files.grep(/#{location}/).empty? 16 | end 17 | false 18 | end 19 | 20 | def test_changes? 21 | tests = %w(spec test kitchen.yml kitchen.dokken.yml) 22 | tests.each do |location| 23 | return true unless git.modified_files.grep(/#{location}/).empty? 24 | end 25 | false 26 | end 27 | 28 | failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10 29 | 30 | warn 'This is a big Pull Request.' if git.lines_of_code > 400 31 | 32 | warn 'This is a Table Flip.' if git.lines_of_code > 2000 33 | 34 | # Require a CHANGELOG entry for non-test changes. 35 | if !git.modified_files.include?('CHANGELOG.md') && code_changes? 36 | failure 'Please include a CHANGELOG entry.' 37 | end 38 | 39 | # Require Major Minor Patch version labels 40 | unless github.pr_labels.grep /minor|major|patch/i 41 | warn 'Please add a release label to this pull request' 42 | end 43 | 44 | # A sanity check for tests. 45 | if git.lines_of_code > 5 && code_changes? && !test_changes? 46 | warn 'This Pull Request is probably missing tests.' 47 | end 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sssd_ldap Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/sssd_ldap.svg)](https://supermarket.chef.io/cookbooks/sssd_ldap) 4 | [![CI State](https://github.com/sous-chefs/sssd_ldap/workflows/ci/badge.svg)](https://github.com/sous-chefs/sssd_ldap/actions?query=workflow%3Aci) 5 | [![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) 6 | [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) 7 | [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) 8 | 9 | This cookbook installs SSSD and configures it for LDAP authentication. As part of the setup of SSSD it will also remove the NSCD package as NSCD is known to interfere with SSSD (). 10 | 11 | ## Requirements 12 | 13 | ### Platforms 14 | 15 | - Redhat 16 | - Centos 17 | - Amazon 18 | - Scientific 19 | - Oracle 20 | - Ubuntu 21 | - Debian 22 | 23 | ### Chef 24 | 25 | - Chef 13+ 26 | 27 | ### Cookbooks 28 | 29 | - none 30 | 31 | ## Attributes 32 | 33 | Arbitrary key/value pairs may be added to the `['sssd_conf']` attribute object. These key/values will be expanded in the domain block of `sssd.conf`. This allows you to set any SSSD configuration value you want, not just ones provided by the attributes in this cookbook. 34 | 35 | Attribute | Value | Comment 36 | ------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ 37 | `['sssd_conf']['id_provider']` | `'ldap'` | 38 | `['sssd_conf']['auth_provider']` | `'ldap'` | 39 | `['sssd_conf']['chpass_provider']` | `'ldap'` | 40 | `['sssd_conf']['sudo_provider']` | `'ldap'` | 41 | `['sssd_conf']['enumerate']` | `'true'` | 42 | `['sssd_conf']['cache_credentials']` | `'false'` | 43 | `['sssd_conf']['ldap_schema']` | `'rfc2307bis'` | 44 | `['sssd_conf']['ldap_uri']` | `'ldap://something.yourcompany.com'` | 45 | `['sssd_conf']['ldap_search_base']` | `'dc=yourcompany,dc=com'` | 46 | `['sssd_conf']['ldap_user_search_base']` | `'ou=People,dc=yourcompany,dc=com'` | 47 | `['sssd_conf']['ldap_user_object_class']` | `'posixAccount'` | 48 | `['sssd_conf']['ldap_user_name']` | `'uid'` | 49 | `['sssd_conf']['override_homedir']` | `nil` | 50 | `['sssd_conf']['ldap_group_search_base']` | `'ou=Groups,dc=yourcompany,dc=com'` | 51 | `['sssd_conf']['ldap_group_object_class']` | `'posixGroup'` | 52 | `['sssd_conf']['ldap_id_use_start_tls']` | `'true'` | 53 | `['sssd_conf']['ldap_tls_reqcert']` | `'never'` | 54 | `['sssd_conf']['ldap_tls_cacert']` | `'/etc/pki/tls/certs/ca-bundle.crt'` or `'/etc/ssl/certs/ca-certificates.crt'` | defaults for RHEL and others respectively 55 | `['sssd_conf']['ldap_default_bind_dn']` | `'cn=bindaccount,dc=yourcompany,dc=com'` | if you have a domain that doesn't require binding set this attributes to nil 56 | `['sssd_conf']['ldap_default_authtok']` | `'bind_password'` | if you have a domain that doesn't require binding set this to nil 57 | `['authconfig_params']` | `'--enablesssd --enablesssdauth --enablelocauthorize --update'` | 58 | `['sssd_conf']['access_provider']` | `nil` | Should be set to `'ldap'` 59 | `['sssd_conf']['ldap_access_filter']` | `nil` | Can use simple LDAP filter such as `'uid=abc123'` or more expressive LDAP filters like `'(&(objectClass=employee)(department=ITSupport))'` 60 | `['sssd_conf']['min_id']` | `'1'` | default, used to ignore lower uid/gid's 61 | `['sssd_conf']['max_id']` | `'0'` | default, used to ignore higher uid/gid's 62 | `['ldap_sudo']` | `false` | Adds ldap enabled sudoers (true/false) 63 | `['ldap_ssh']` | `false` | Adds ldap enabled ssh keys (true/false) 64 | `['ldap_autofs']` | `false` | Adds ldap enabled autofs config (true/false) 65 | `['uninstall_nscd']` | `true` | Allows configuration to not uninstall nscd package if required 66 | 67 | ## Recipes 68 | 69 | - default: Installs and configures sssd daemon 70 | 71 | ## CA Certificates 72 | 73 | If you manage your own CA then the easiest way to inject the certificate for system-wide use is as follows: 74 | 75 | ### RHEL 76 | 77 | ``` 78 | cp ca.crt /etc/pki/ca-trust/source/anchors 79 | update-ca-trust enable 80 | update-ca-trust extract 81 | ``` 82 | 83 | ### Debian 84 | 85 | ``` 86 | cp ca.crt /usr/local/share/ca-certificates 87 | update-ca-certificates 88 | ``` 89 | 90 | ## Maintainers 91 | 92 | This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/) 93 | 94 | ## Contributors 95 | 96 | This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) 97 | 98 | ### Backers 99 | 100 | Thank you to all our backers! 101 | 102 | ![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) 103 | 104 | ### Sponsors 105 | 106 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. 107 | 108 | ![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) 109 | ![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) 110 | ![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) 111 | ![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) 112 | ![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) 113 | ![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) 114 | ![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) 115 | ![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) 116 | ![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) 117 | ![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) 118 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD). 4 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: sssd_ldap 3 | # Attributes:: default 4 | # 5 | # Copyright:: 2013-2017, Limelight Networks, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | default['sssd_ldap']['sssd_conf_sensitive'] = true 21 | default['sssd_ldap']['filter_users'] = %w(root named avahi haldaemon dbus radiusd news nscd) 22 | default['sssd_ldap']['filter_groups'] = [] 23 | default['sssd_ldap']['sssd_conf']['id_provider'] = 'ldap' 24 | default['sssd_ldap']['sssd_conf']['auth_provider'] = 'ldap' 25 | default['sssd_ldap']['sssd_conf']['chpass_provider'] = 'ldap' 26 | default['sssd_ldap']['sssd_conf']['sudo_provider'] = 'ldap' 27 | default['sssd_ldap']['sssd_conf']['enumerate'] = 'true' 28 | default['sssd_ldap']['sssd_conf']['cache_credentials'] = 'false' 29 | 30 | default['sssd_ldap']['sssd_conf']['ldap_schema'] = 'rfc2307bis' 31 | default['sssd_ldap']['sssd_conf']['ldap_uri'] = 'ldap://something.yourcompany.com' 32 | default['sssd_ldap']['sssd_conf']['ldap_search_base'] = 'dc=yourcompany,dc=com' 33 | default['sssd_ldap']['sssd_conf']['ldap_user_search_base'] = 'ou=People,dc=yourcompany,dc=com' 34 | default['sssd_ldap']['sssd_conf']['ldap_user_object_class'] = 'posixAccount' 35 | default['sssd_ldap']['sssd_conf']['ldap_user_name'] = 'uid' 36 | default['sssd_ldap']['sssd_conf']['override_homedir'] = nil 37 | 38 | default['sssd_ldap']['sssd_conf']['ldap_group_search_base'] = 'ou=Groups,dc=yourcompany,dc=com' 39 | default['sssd_ldap']['sssd_conf']['ldap_group_object_class'] = 'posixGroup' 40 | default['sssd_ldap']['sssd_conf']['ldap_group_name'] = 'cn' 41 | 42 | default['sssd_ldap']['sssd_conf']['ldap_id_use_start_tls'] = 'true' 43 | default['sssd_ldap']['sssd_conf']['ldap_tls_reqcert'] = 'never' 44 | default['sssd_ldap']['sssd_conf']['ldap_tls_cacert'] = value_for_platform_family('rhel' => '/etc/pki/tls/certs/ca-bundle.crt', 'amazon' => '/etc/pki/tls/certs/ca-bundle.crt', 'default' => '/etc/ssl/certs/ca-certificates.crt') 45 | 46 | # if you have a domain that doesn't require binding set these two attributes to nil 47 | default['sssd_ldap']['sssd_conf']['ldap_default_bind_dn'] = 'cn=bindaccount,dc=yourcompany,dc=com' 48 | default['sssd_ldap']['sssd_conf']['ldap_default_authtok'] = 'bind_password' 49 | 50 | default['sssd_ldap']['authconfig_params'] = '--enablesssd --enablesssdauth --enablelocauthorize --update' 51 | 52 | default['sssd_ldap']['sssd_conf']['access_provider'] = nil # Should be set to 'ldap' 53 | default['sssd_ldap']['sssd_conf']['ldap_access_filter'] = nil # Can use simple LDAP filter such as 'uid=abc123' or more expressive LDAP filters like '(&(objectClass=employee)(department=ITSupport))' 54 | 55 | default['sssd_ldap']['sssd_conf']['min_id'] = '1' 56 | default['sssd_ldap']['sssd_conf']['max_id'] = '0' 57 | default['sssd_ldap']['ldap_sudo'] = false 58 | default['sssd_ldap']['ldap_autofs'] = false 59 | default['sssd_ldap']['ldap_ssh'] = false 60 | 61 | # If you need nscd to stay installed set this to false. 62 | # See https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/usingnscd-sssd.html 63 | default['sssd_ldap']['uninstall_nscd'] = true 64 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a Chef Infra Server or Supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | ehthumbs.db 9 | Icon? 10 | nohup.out 11 | Thumbs.db 12 | .envrc 13 | 14 | # EDITORS # 15 | ########### 16 | .#* 17 | .project 18 | .settings 19 | *_flymake 20 | *_flymake.* 21 | *.bak 22 | *.sw[a-z] 23 | *.tmproj 24 | *~ 25 | \#* 26 | REVISION 27 | TAGS* 28 | tmtags 29 | .vscode 30 | .editorconfig 31 | 32 | ## COMPILED ## 33 | ############## 34 | *.class 35 | *.com 36 | *.dll 37 | *.exe 38 | *.o 39 | *.pyc 40 | *.so 41 | */rdoc/ 42 | a.out 43 | mkmf.log 44 | 45 | # Testing # 46 | ########### 47 | .circleci/* 48 | .codeclimate.yml 49 | .delivery/* 50 | .foodcritic 51 | .kitchen* 52 | .mdlrc 53 | .overcommit.yml 54 | .rspec 55 | .rubocop.yml 56 | .travis.yml 57 | .watchr 58 | .yamllint 59 | azure-pipelines.yml 60 | Dangerfile 61 | examples/* 62 | features/* 63 | Guardfile 64 | kitchen*.yml 65 | mlc_config.json 66 | Procfile 67 | Rakefile 68 | spec/* 69 | test/* 70 | 71 | # SCM # 72 | ####### 73 | .git 74 | .gitattributes 75 | .gitconfig 76 | .github/* 77 | .gitignore 78 | .gitkeep 79 | .gitmodules 80 | .svn 81 | */.bzr/* 82 | */.git 83 | */.hg/* 84 | */.svn/* 85 | 86 | # Berkshelf # 87 | ############# 88 | Berksfile 89 | Berksfile.lock 90 | cookbooks/* 91 | tmp 92 | 93 | # Bundler # 94 | ########### 95 | vendor/* 96 | Gemfile 97 | Gemfile.lock 98 | 99 | # Policyfile # 100 | ############## 101 | Policyfile.rb 102 | Policyfile.lock.json 103 | 104 | # Documentation # 105 | ############# 106 | CODE_OF_CONDUCT* 107 | CONTRIBUTING* 108 | documentation/* 109 | TESTING* 110 | UPGRADING* 111 | 112 | # Vagrant # 113 | ########### 114 | .vagrant 115 | Vagrantfile 116 | -------------------------------------------------------------------------------- /documentation/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/sssd_ldap/a8c13b1b1d7fb165987892b8f25f90daa31e16b2/documentation/.gitkeep -------------------------------------------------------------------------------- /kitchen.dokken.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: dokken 3 | privileged: true 4 | chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> 5 | 6 | transport: { name: dokken } 7 | provisioner: { name: dokken } 8 | 9 | platforms: 10 | - name: almalinux-8 11 | driver: 12 | image: dokken/almalinux-8 13 | pid_one_command: /usr/lib/systemd/systemd 14 | 15 | - name: almalinux-9 16 | driver: 17 | image: dokken/almalinux-9 18 | pid_one_command: /usr/lib/systemd/systemd 19 | 20 | - name: amazonlinux-2023 21 | driver: 22 | image: dokken/amazonlinux-2023 23 | pid_one_command: /usr/lib/systemd/systemd 24 | 25 | - name: centos-7 26 | driver: 27 | image: dokken/centos-7 28 | pid_one_command: /usr/lib/systemd/systemd 29 | 30 | - name: centos-stream-8 31 | driver: 32 | image: dokken/centos-stream-8 33 | pid_one_command: /usr/lib/systemd/systemd 34 | 35 | - name: centos-stream-9 36 | driver: 37 | image: dokken/centos-stream-9 38 | pid_one_command: /usr/lib/systemd/systemd 39 | 40 | - name: debian-9 41 | driver: 42 | image: dokken/debian-9 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-10 46 | driver: 47 | image: dokken/debian-10 48 | pid_one_command: /bin/systemd 49 | 50 | - name: debian-11 51 | driver: 52 | image: dokken/debian-11 53 | pid_one_command: /bin/systemd 54 | 55 | - name: debian-12 56 | driver: 57 | image: dokken/debian-12 58 | pid_one_command: /bin/systemd 59 | 60 | - name: fedora-latest 61 | driver: 62 | image: dokken/fedora-latest 63 | pid_one_command: /usr/lib/systemd/systemd 64 | 65 | - name: opensuse-leap-15 66 | driver: 67 | image: dokken/opensuse-leap-15 68 | pid_one_command: /usr/lib/systemd/systemd 69 | 70 | - name: oraclelinux-7 71 | driver: 72 | image: dokken/oraclelinux-7 73 | pid_one_command: /usr/lib/systemd/systemd 74 | 75 | - name: oraclelinux-8 76 | driver: 77 | image: dokken/oraclelinux-8 78 | pid_one_command: /usr/lib/systemd/systemd 79 | 80 | - name: oraclelinux-9 81 | driver: 82 | image: dokken/oraclelinux-9 83 | pid_one_command: /usr/lib/systemd/systemd 84 | 85 | - name: rockylinux-8 86 | driver: 87 | image: dokken/rockylinux-8 88 | pid_one_command: /usr/lib/systemd/systemd 89 | 90 | - name: rockylinux-9 91 | driver: 92 | image: dokken/rockylinux-9 93 | pid_one_command: /usr/lib/systemd/systemd 94 | 95 | - name: ubuntu-18.04 96 | driver: 97 | image: dokken/ubuntu-18.04 98 | pid_one_command: /bin/systemd 99 | 100 | - name: ubuntu-20.04 101 | driver: 102 | image: dokken/ubuntu-20.04 103 | pid_one_command: /bin/systemd 104 | 105 | - name: ubuntu-22.04 106 | driver: 107 | image: dokken/ubuntu-22.04 108 | pid_one_command: /bin/systemd 109 | 110 | - name: ubuntu-23.04 111 | driver: 112 | image: dokken/ubuntu-23.04 113 | pid_one_command: /bin/systemd 114 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /kitchen.global.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_infra 4 | product_name: chef 5 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 6 | channel: stable 7 | install_strategy: once 8 | chef_license: accept 9 | enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> 10 | multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> 11 | deprecations_as_errors: true 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | 14 | verifier: 15 | name: inspec 16 | 17 | platforms: 18 | - name: almalinux-8 19 | - name: almalinux-9 20 | - name: amazonlinux-2023 21 | - name: centos-7 22 | - name: centos-stream-8 23 | - name: centos-stream-9 24 | - name: debian-9 25 | - name: debian-10 26 | - name: debian-11 27 | - name: debian-12 28 | - name: fedora-latest 29 | - name: opensuse-leap-15 30 | - name: oraclelinux-7 31 | - name: oraclelinux-8 32 | - name: oraclelinux-9 33 | - name: rockylinux-8 34 | - name: rockylinux-9 35 | - name: ubuntu-18.04 36 | - name: ubuntu-20.04 37 | - name: ubuntu-22.04 38 | - name: ubuntu-23.04 39 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: vagrant 3 | 4 | provisioner: 5 | name: chef_infra 6 | deprecations_as_errors: true 7 | chef_license: accept-no-persist 8 | 9 | verifier: 10 | name: inspec 11 | 12 | platforms: 13 | 14 | - name: almalinux-8 15 | - name: amazonlinux-2 16 | - name: centos-7 17 | - name: centos-stream-8 18 | - name: debian-10 19 | - name: debian-11 20 | - name: fedora-latest 21 | - name: opensuse-leap-15 22 | - name: rockylinux-8 23 | - name: ubuntu-18.04 24 | - name: ubuntu-20.04 25 | 26 | suites: 27 | - name: default 28 | run_list: sssd_ldap::default 29 | attributes: { 30 | sssd_ldap: { 31 | ldap_sudo: true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'sssd_ldap' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Sets up SSSD for LDAP on Ubuntu and RHEL systems' 6 | version '5.2.8' 7 | source_url 'https://github.com/sous-chefs/sssd_ldap' 8 | issues_url 'https://github.com/sous-chefs/sssd_ldap/issues' 9 | 10 | supports 'redhat' 11 | supports 'centos' 12 | supports 'amazon' 13 | supports 'scientific' 14 | supports 'oracle' 15 | supports 'ubuntu' 16 | supports 'debian' 17 | 18 | chef_version '>= 13' 19 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Tim Smith() 3 | # Cookbook:: sssd_ldap 4 | # Recipe:: default 5 | # 6 | # Copyright:: 2018-2019, Chef Software, Inc. 7 | # Copyright:: 2013-2017, Limelight Networks, Inc. 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | 22 | # NSCD and SSSD don't play well together. 23 | # https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/usingnscd-sssd.html 24 | package 'nscd' do 25 | action :remove 26 | only_if { node['sssd_ldap']['uninstall_nscd'] } 27 | end 28 | 29 | package 'sssd' do 30 | action :install 31 | end 32 | 33 | package 'sssd-ldap' do 34 | action :install 35 | only_if { platform_family?('suse') } 36 | end 37 | 38 | package 'libsss-sudo' do 39 | action :install 40 | only_if { platform_family?('debian') && node['sssd_ldap']['ldap_sudo'] } 41 | end 42 | 43 | # Only run on RHEL 44 | if platform_family?('rhel', 'amazon') 45 | 46 | # authconfig allows cli based intelligent manipulation of the pam.d files 47 | package 'authconfig' do 48 | action :install 49 | end 50 | 51 | # https://bugzilla.redhat.com/show_bug.cgi?id=975082 52 | ruby_block 'nsswitch sudoers' do 53 | block do 54 | edit = Chef::Util::FileEdit.new '/etc/nsswitch.conf' 55 | edit.insert_line_if_no_match(/^sudoers:/, 'sudoers: files') 56 | 57 | if node['sssd_ldap']['ldap_sudo'] 58 | # Add sss to the line if it's not there. 59 | edit.search_file_replace(/^sudoers:([ \t]*(?!sss\b)\w+)*[ \t]*$/, '\0 sss') 60 | else 61 | # Remove sss from the line if it is there. 62 | edit.search_file_replace(/^(sudoers:.*)\bsss[ \t]*/, '\1') 63 | end 64 | 65 | edit.write_file 66 | end 67 | 68 | action :nothing 69 | end 70 | 71 | # Have authconfig enable SSSD in the pam files 72 | execute 'authconfig' do 73 | command "/usr/sbin/authconfig #{node['sssd_ldap']['authconfig_params']}" 74 | notifies :run, 'ruby_block[nsswitch sudoers]', :immediately 75 | action :nothing 76 | end 77 | end 78 | 79 | # sssd automatically modifies the PAM files with pam-auth-update and /etc/nsswitch.conf, so all that's left is to configure /etc/sssd/sssd.conf 80 | template '/etc/sssd/sssd.conf' do 81 | source 'sssd.conf.erb' 82 | owner 'root' 83 | group node['root_group'] 84 | mode '0600' 85 | sensitive node['sssd_ldap']['sssd_conf_sensitive'] 86 | 87 | if platform_family?('rhel', 'amazon') 88 | # this needs to run immediately so it doesn't happen after sssd 89 | # service block below, or sssd won't start when recipe completes 90 | notifies :run, 'execute[authconfig]', :immediately 91 | end 92 | 93 | notifies :restart, 'service[sssd]' 94 | end 95 | 96 | service 'sssd' do 97 | supports status: true, restart: true, reload: true 98 | action [:enable, :start] 99 | end 100 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "groupName": "Actions", 7 | "matchUpdateTypes": ["minor", "patch", "pin"], 8 | "automerge": true, 9 | "addLabels": ["Release: Patch", "Skip: Announcements"] 10 | }, 11 | { 12 | "groupName": "Actions", 13 | "matchUpdateTypes": ["major"], 14 | "automerge": false, 15 | "addLabels": ["Release: Patch", "Skip: Announcements"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /spec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'sssd_ldap::default ubuntu 20.04' do 4 | let(:runner) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '20.04') } 5 | let(:chef_run) { runner.converge('sssd_ldap::default') } 6 | 7 | it 'installs sssd' do 8 | expect(chef_run).to install_package 'sssd' 9 | end 10 | 11 | it 'removes nscd' do 12 | expect(chef_run).to remove_package 'nscd' 13 | end 14 | 15 | it 'does not install libsss-sudo by default' do 16 | install = chef_run.package('libsss-sudo') 17 | expect(install).to do_nothing 18 | end 19 | 20 | it 'installs libsss-sudo if ldap_sudo attribute set' do 21 | chef_run.node.override['sssd_ldap']['ldap_sudo'] = true 22 | chef_run.converge('sssd_ldap::default') 23 | expect(chef_run).to install_package 'libsss-sudo' 24 | end 25 | 26 | it 'starts sssd' do 27 | expect(chef_run).to start_service 'sssd' 28 | end 29 | end 30 | 31 | describe 'sssd_ldap::default centos 6' do 32 | let(:runner) { ChefSpec::SoloRunner.new(platform: 'centos', version: '6') } 33 | let(:chef_run) { runner.converge('sssd_ldap::default') } 34 | 35 | it 'installs authconfig' do 36 | expect(chef_run).to install_package 'authconfig' 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.color = true 6 | config.log_level = :error 7 | end 8 | -------------------------------------------------------------------------------- /templates/sssd.conf.erb: -------------------------------------------------------------------------------- 1 | [sssd] 2 | config_file_version = 2 3 | services = nss, pam<% if node['sssd_ldap']['ldap_autofs'] %>, autofs<% end %><% if node['sssd_ldap']['ldap_ssh'] %>, ssh<% end %><% if node['sssd_ldap']['ldap_sudo'] && !(node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6)%>, sudo<% end %> 4 | domains = LDAP 5 | 6 | [nss] 7 | filter_users = <%= node['sssd_ldap']['filter_users'].join(',') %> 8 | filter_groups = <%= node['sssd_ldap']['filter_groups'].join(',') %> 9 | 10 | [pam] 11 | 12 | [domain/LDAP] 13 | <% node['sssd_ldap']['sssd_conf'].each do |key, value| %> 14 | <% if not value.nil? %><%= key %> = <%= value %><% end %> 15 | <% end %> 16 | -------------------------------------------------------------------------------- /test/integration/default/default_spec.rb: -------------------------------------------------------------------------------- 1 | describe service('sssd') do 2 | it { should be_enabled } 3 | it { should be_running } 4 | end 5 | 6 | describe package('sssd') do 7 | it { should be_installed } 8 | end 9 | 10 | if %w(debian ubuntu).include?(os[:family]) 11 | if os[:family] == 'debian' && os[:release].to_i <= 7 12 | describe package('libsss-sudo0') do 13 | it { should be_installed } 14 | end 15 | else 16 | describe package('libsss-sudo') do 17 | it { should be_installed } 18 | end 19 | end 20 | end 21 | --------------------------------------------------------------------------------