mirror of
https://github.com/aljazceru/addons.git
synced 2026-01-31 18:55:32 +01:00
Add allow network to smb (#333)
* Add allow network to smb * Bump version
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## 4.0
|
||||
- New option `allow_hosts` to limit access
|
||||
|
||||
## 3.0
|
||||
- Update base image
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Samba share",
|
||||
"version": "3.0",
|
||||
"version": "4.0",
|
||||
"slug": "samba",
|
||||
"description": "Expose Hass.io folders with SMB/CIFS",
|
||||
"url": "https://home-assistant.io/addons/samba/",
|
||||
@@ -21,7 +21,12 @@
|
||||
},
|
||||
"username": "",
|
||||
"password": "",
|
||||
"interface": ""
|
||||
"interface": "",
|
||||
"allow_hosts": [
|
||||
"10.0.0.0/8",
|
||||
"172.16.0.0/12",
|
||||
"192.168.0.0/16"
|
||||
]
|
||||
},
|
||||
"schema": {
|
||||
"workgroup": "str",
|
||||
@@ -36,7 +41,8 @@
|
||||
},
|
||||
"username": "str",
|
||||
"password": "str",
|
||||
"interface": "str"
|
||||
"interface": "str",
|
||||
"allow_hosts": ["str"]
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-samba"
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ MAP_SSL=$(jq --raw-output '.map.ssl' $CONFIG_PATH)
|
||||
MAP_SHARE=$(jq --raw-output '.map.share' $CONFIG_PATH)
|
||||
MAP_BACKUP=$(jq --raw-output '.map.backup' $CONFIG_PATH)
|
||||
INTERFACE=$(jq --raw-output '.interface // empty' $CONFIG_PATH)
|
||||
ALLOW_HOSTS=$(jq --raw-output '.allow_hosts | join(" ")' $CONFIG_PATH)
|
||||
|
||||
function write_config() {
|
||||
echo "
|
||||
@@ -35,6 +36,7 @@ function write_config() {
|
||||
sed -i "s/%%WORKGROUP%%/$WORKGROUP/g" /etc/smb.conf
|
||||
sed -i "s/%%NAME%%/$NAME/g" /etc/smb.conf
|
||||
sed -i "s/%%INTERFACE%%/$INTERFACE/g" /etc/smb.conf
|
||||
sed -i "s/%%ALLOW_HOSTS%%/$ALLOW_HOSTS/g" /etc/smb.conf
|
||||
|
||||
##
|
||||
# Write shares to config
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
disable spoolss = yes
|
||||
|
||||
log level = 2
|
||||
|
||||
|
||||
bind interfaces only = yes
|
||||
interfaces = %%INTERFACE%%
|
||||
hosts allow = %%ALLOW_HOSTS%%
|
||||
|
||||
#guest account = root
|
||||
#map to guest = Bad Password
|
||||
|
||||
Reference in New Issue
Block a user