Unverified Commit 6f365769 authored by Nathan Ward's avatar Nathan Ward Committed by GitHub
Browse files

Always include update section in ldap config (#190)

parent cefbf166
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ describe 'freeradius::module::ldap' do
      .with_content(%r{^\s+identity = 'cn=root,dc=example,dc=com'\n})
      .with_content(%r{^\s+password = 'test password'\n})
      .with_content(%r{^\s+base_dn = 'dc=example,dc=com'\n})
      .with_content(%r{^\s+update \{\n})
      .without_content(%r{^\s+connect_timeout = .*})
      .with_ensure('present')
      .with_group('radiusd')
@@ -146,4 +147,20 @@ describe 'freeradius::module::ldap' do
      is_expected.to compile.and_raise_error(%r{parameter 'password' expects a match for Freeradius::Password})
    end
  end

  context 'with update passed' do
    let(:params) do
      super().merge(
        update: [
          "reply:Framed-IP-Address := 'radiusFramedIPAddress'",
          "control:Password-With-Header	+= 'userPassword'",
        ],
      )
    end

    it do
      is_expected.to contain_file('/etc/raddb/mods-available/test')
        .with_content(%r{^\s+update \{\n\s+control:Password-With-Header	\+= 'userPassword'\n\s+reply:Framed-IP-Address := 'radiusFramedIPAddress'\n\s+\}\n})
    end
  end
end
+3 −3
Original line number Diff line number Diff line
@@ -162,16 +162,16 @@ ldap <%= @name %> {
#		request:			+= 'radiusRequestAttribute'
#		reply:				+= 'radiusReplyAttribute'
#	}
	update {
<%- if @update -%>
		<%= @update.join("\n		") %>
		<%= @update.sort.join("\n		") %>
<%- else -%>
	update {
		control:Password-With-Header	+= 'userPassword'
		control:			+= 'radiusControlAttribute'
		request:			+= 'radiusRequestAttribute'
		reply:				+= 'radiusReplyAttribute'
	}
<%- end -%>
	}


	#  Set to yes if you have eDirectory and want to use the universal