Gestion des ouvertures de ports

This commit is contained in:
Benjamin Bohard 2021-06-18 09:06:24 +02:00
parent ef56c63c85
commit 2cb0ff1e1f
2 changed files with 32 additions and 5 deletions

View File

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<creole> <creole>
<files> <files>
<service_access service='smbd'>
<port>139</port>
<port>445</port>
</service_access>
<service_restriction service='smbd'>
<ip interface='auto' netmask='smb_share_allowed_netmask' netmask_type='SymLinkOption' ip_type='SymLinkOption'>smb_share_allowed_network</ip>
</service_restriction>
</files> </files>
<containers> <containers>
<container name='partage' id='52'> <container name='partage' id='52'>
@ -11,20 +19,27 @@
</containers> </containers>
<variables> <variables>
<family name='Partages smb'> <family name='Partages smb'>
<variable name='use_smb_share' type='oui/non' description='Configurer des répertoires partagés' mode='expert'> <variable name='use_smb_share' type='oui/non' description='Configurer des répertoires partagés' mode='normal'>
<value>non</value> <value>non</value>
</variable> </variable>
<variable name='smb_share_name' type='string' description='Nom du répertoire partagé' mandatory='True' mode='expert' multi='True'/> <variable name='smb_share_path' type='string' description='Chemin du partage' mandatory='True' mode='normal'/>
<variable name='smb_share_path' type='string' description='Chemin du partage' mandatory='True' mode='expert'/> <variable name='smb_share_name' type='string' description='Nom du répertoire partagé' mandatory='True' mode='normal' multi='True'/>
<variable name='smb_share_allowed_network' type='network' description='Adresses autorisées à se connecter aux partages' mode='normal' multi='True' mandatory='True'/>
<variable name='smb_share_allowed_network' type='netmask' description='Masque de sous-réseau des réseaux autorisés à se connecter aux partages' mode='normal' mandatory='True'/>
</family> </family>
</variables> </variables>
<constraints> <constraints>
<group master='smb_share_name'> <group master='smb_share_path'>
<slave>smb_share_path</slave> <slave>smb_share_name</slave>
</group>
<group master='smb_share_allowed_network'>
<slave>smb_share_allowed_netmask</slave>
</group> </group>
<condition name='disabled_if_in' source='use_smb_share' fallback='True'> <condition name='disabled_if_in' source='use_smb_share' fallback='True'>
<param>non</param> <param>non</param>
<target type='variable'>smb_share_name</target> <target type='variable'>smb_share_name</target>
<target type='variable'>smb_share_allowed_network</target>
<target type='variable'>smb_share_allowed_netmask</target>
<target type='filelist'>smb_share</target> <target type='filelist'>smb_share</target>
</condition> </condition>
</constraints> </constraints>

12
posttemplate/02-smb_partages Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# partages multiples
if [ "$(CreoleGet use_smb_share non)" = "oui" ]; then
for path in $(CreoleGet smb_share_path); do
if [ ! -d $path ]; then
/bin/mkdir -p $path
chmod g+ws $path
fi
done
fi
exit 0