From 95c1f6ec3e37b54675b5665ed56873143c6a80d5 Mon Sep 17 00:00:00 2001 From: Doninelli Davide Date: Wed, 9 Oct 2024 11:35:59 +0200 Subject: [PATCH] 2 in 1 Add hosts_allow and host_deny at the share level Add inherit_acl and host msdfs at the share level Fix netbios_name default string https://github.com/rehanone/puppet-samba/issues/55 regenerated REFERENCE.md added +4 in samba test resource --- REFERENCE.md | 38 +++++++++++++++++++++++++++++++++++++- manifests/init.pp | 2 +- manifests/share.pp | 20 ++++++++++++++++++++ spec/defines/share_spec.rb | 2 +- 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index dd71747..e230eb3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -188,7 +188,7 @@ Data type: `Variant[Undef, String]` This sets the NetBIOS name by which a Samba server is known. -Default value: `'%{facts.hostname}'` +Default value: `'%{facts.networking.hostname}'` ##### `domain_master` @@ -584,6 +584,10 @@ The following parameters are available in the `samba::share` defined type: * [`writable`](#-samba--share--writable) * [`available`](#-samba--share--available) * [`browseable`](#-samba--share--browseable) +* [`inherit_acl`](#-samba--share--inherit_acl) +* [`host_msdfs`](#-samba--share--host_msdfs) +* [`hosts_allow`](#-samba--share--hosts_allow) +* [`hosts_deny`](#-samba--share--hosts_deny) * [`copy`](#-samba--share--copy) * [`create_mask`](#-samba--share--create_mask) * [`directory_mask`](#-samba--share--directory_mask) @@ -652,6 +656,38 @@ This controls whether this share is seen in the list of available shares in a ne Default value: `undef` +##### `inherit_acl` + +Data type: `Optional[Boolean]` + +The inherit acl parameter in Samba controls whether Access Control Lists (ACLs) set on parent directories are automatically inherited by new files and subdirectories created within them. + +Default value: `undef` + +##### `host_msdfs` + +Data type: `Optional[Boolean]` + +The host msdfs parameter controls whether the Samba server acts as an MSDFS root, facilitating redirection of file shares in a distributed file system. + +Default value: `undef` + +##### `hosts_allow` + +Data type: `Optional[Array[String]]` + +The hosts allow parameter limit access to these ip-addresses. + +Default value: `undef` + +##### `hosts_deny` + +Data type: `Optional[Array[String]]` + +The hosts deny parameter deny access to these ip-addresses. + +Default value: `undef` + ##### `copy` Data type: `Optional[String]` diff --git a/manifests/init.pp b/manifests/init.pp index e6e890e..f458deb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -175,7 +175,7 @@ # Main smb.conf options Variant[Undef, String] $workgroup = 'WORKGROUP', Variant[Undef, String] $server_string = '%h server (Samba Server Version %v)', - Variant[Undef, String] $netbios_name = '%{facts.hostname}', + Variant[Undef, String] $netbios_name = '%{facts.networking.hostname}', Variant[Boolean, String] $domain_master = 'auto', Variant[Boolean, String] $preferred_master = 'auto', Variant[Undef, Boolean] $local_master = true, diff --git a/manifests/share.pp b/manifests/share.pp index 9c3827b..607b49e 100644 --- a/manifests/share.pp +++ b/manifests/share.pp @@ -17,6 +17,18 @@ # @param browseable # This controls whether this share is seen in the list of available shares in a net view and in the browse list. # +# @param inherit_acl +# The inherit acl parameter in Samba controls whether Access Control Lists (ACLs) set on parent directories are automatically inherited by new files and subdirectories created within them. +# +# @param host_msdfs +# The host msdfs parameter controls whether the Samba server acts as an MSDFS root, facilitating redirection of file shares in a distributed file system. +# +# @param hosts_allow +# The hosts allow parameter limit access to these ip-addresses. +# +# @param hosts_deny +# The hosts deny parameter deny access to these ip-addresses. +# # @param copy # This parameter allows you to "clone" service entries. The specified service is simply duplicated under the current service's name. # @@ -104,6 +116,10 @@ Optional[Boolean] $writable = undef, Optional[Boolean] $available = undef, Optional[Boolean] $browseable = undef, + Optional[Boolean] $host_msdfs = undef, + Optional[Boolean] $inherit_acl = undef, + Optional[Array[String]] $hosts_allow = undef, + Optional[Array[String]] $hosts_deny = undef, Optional[String] $copy = undef, Optional[String] $create_mask = undef, Optional[String] $directory_mask = undef, @@ -163,6 +179,10 @@ "${title}-writable": target => $target, key => 'writable', value => $writable; "${title}-available": target => $target, key => 'available', value => $available; "${title}-browseable": target => $target, key => 'browseable', value => $browseable; + "${title}-host_msdfs": target => $target, key => 'host msdfs', value => $host_msdfs; + "${title}-inherit_acl": target => $target, key => 'inherit acl', value => $inherit_acl; + "${title}-hosts_allow": target => $target, key => 'hosts allow', value => $hosts_allow; + "${title}-hosts_deny": target => $target, key => 'hosts deny', value => $hosts_deny; "${title}-copy": target => $target, key => 'copy', value => $copy; "${title}-create mask": target => $target, key => 'create mask', value => $create_mask; "${title}-directory mask": target => $target, key => 'directory mask', value => $directory_mask; diff --git a/spec/defines/share_spec.rb b/spec/defines/share_spec.rb index 4c746da..acf2082 100644 --- a/spec/defines/share_spec.rb +++ b/spec/defines/share_spec.rb @@ -43,7 +43,7 @@ } it { - is_expected.to have_samba__option_resource_count(63) + is_expected.to have_samba__option_resource_count(67) } end end