Class: HttpdConfigmapGenerator::Sssd
- Defined in:
- lib/httpd_configmap_generator/base/sssd.rb
Constant Summary
Constants inherited from Base
Base::APACHE_USER, Base::HTTP_KEYTAB, Base::IPA_COMMAND, Base::KERBEROS_CONFIG_FILE, Base::LDAP_ATTRS, Base::PAM_CONFIG, Base::SSSD_CONFIG, Base::TIMESTAMP_FORMAT
Constants included from Base::Network
Base::Network::HOSTNAME_COMMAND
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#sssd ⇒ Object
Returns the value of attribute sssd.
Instance Method Summary collapse
- #add_service(service) ⇒ Object
- #configure_domain(domain) ⇒ Object
- #configure_ifp ⇒ Object
-
#initialize(opts = {}) ⇒ Sssd
constructor
A new instance of Sssd.
- #load(file_path) ⇒ Object
- #save(file_path) ⇒ Object
- #section(key) ⇒ Object
Methods inherited from Base
#debug_msg, #err_msg, #info_msg, #optional_options, #required_options, #run_configure, #validate_options
Methods included from Base::Pam
Methods included from Base::Network
#domain, #domain_from_host, #fetch_network_file, #host_reachable?, #realm, #update_hostname
Methods included from Base::Kerberos
Methods included from Base::FileHelper
#cp_template, #create_target_directory, #delete_target_file, #file_binary?, #path_join, #rm_file, #template_directory
Methods included from Base::ConfigHelper
Methods included from Base::Command
#command_run, #command_run!, #log_command_error
Constructor Details
#initialize(opts = {}) ⇒ Sssd
Returns a new instance of Sssd.
8 9 10 11 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 8 def initialize(opts = {}) @opts = opts @sssd = nil end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
6 7 8 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 6 def opts @opts end |
#sssd ⇒ Object
Returns the value of attribute sssd.
5 6 7 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 5 def sssd @sssd end |
Instance Method Details
#add_service(service) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 30 def add_service(service) services = section("sssd")["services"] services = (services.split(",").map(&:strip) | [service]).join(", ") sssd.section("sssd")["services"] = services sssd.section(service) end |
#configure_domain(domain) ⇒ Object
24 25 26 27 28 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 24 def configure_domain(domain) domain = section("domain/#{domain}") domain["ldap_user_extra_attrs"] = LDAP_ATTRS.keys.join(", ") domain["entry_cache_timeout"] = 600 end |
#configure_ifp ⇒ Object
37 38 39 40 41 42 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 37 def configure_ifp add_service("ifp") ifp = section("ifp") ifp["allowed_uids"] = "#{APACHE_USER}, root" ifp["user_attributes"] = LDAP_ATTRS.keys.collect { |k| "+#{k}" }.join(", ") end |
#load(file_path) ⇒ Object
13 14 15 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 13 def load(file_path) @sssd = IniParse.open(file_path) end |
#save(file_path) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 17 def save(file_path) return unless sssd config_file_backup(file_path) info_msg("Saving SSSD to #{file_path}") sssd.save(file_path) end |
#section(key) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/httpd_configmap_generator/base/sssd.rb', line 44 def section(key) if key =~ /^domain\/.*$/ key = sssd.entries.collect(&:key).select { |k| k.downcase == key.downcase }.first || key end sssd.section(key) end |