aboutsummaryrefslogtreecommitdiff
path: root/net/socat
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2021-07-25 21:19:42 +0300
committerPaul Fertser <fercerpav@gmail.com>2021-07-25 22:26:34 +0300
commit8f0bd0b4fe8b5bced4e6e2f6b11082281ec5372d (patch)
tree7132f105ebbfee9c24716211185121e21e7b25ca /net/socat
parentf4afa4189e7ae35aa1ba1a6a60f5ed7dba877f6c (diff)
net: socat: add option user
Allow UCI configuration to specify username to run this service as. Defaults to root. Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'net/socat')
-rw-r--r--net/socat/Makefile2
-rw-r--r--net/socat/files/socat.config1
-rw-r--r--net/socat/files/socat.init8
3 files changed, 9 insertions, 2 deletions
diff --git a/net/socat/Makefile b/net/socat/Makefile
index 081563f32..8b36f4dd7 100644
--- a/net/socat/Makefile
+++ b/net/socat/Makefile
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=socat
PKG_VERSION:=1.7.3.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.dest-unreach.org/socat/download
diff --git a/net/socat/files/socat.config b/net/socat/files/socat.config
index 7df6358be..196ab9c47 100644
--- a/net/socat/files/socat.config
+++ b/net/socat/files/socat.config
@@ -3,3 +3,4 @@
config socat 'http'
option enable '0'
option SocatOptions '-d -d TCP6-LISTEN:8000,fork TCP4:192.168.1.20:80'
+ option user 'nobody'
diff --git a/net/socat/files/socat.init b/net/socat/files/socat.init
index a4d3c8224..03573a01e 100644
--- a/net/socat/files/socat.init
+++ b/net/socat/files/socat.init
@@ -12,7 +12,8 @@ validate_section_socat()
{
uci_load_validate socat socat "$1" "$2" \
'enable:bool:1' \
- 'SocatOptions:or(string, list(string))'
+ 'SocatOptions:or(string, list(string))' \
+ 'user:string:root'
}
append_param_command()
@@ -23,6 +24,7 @@ append_param_command()
socat_instance()
{
local is_list
+ local user
[ "$2" = 0 ] || {
echo "validation failed"
@@ -39,6 +41,10 @@ socat_instance()
else
config_list_foreach "$1" SocatOptions append_param_command
fi
+ config_get user "$1" user
+ if [ -n "$user" ]; then
+ procd_set_param user $user
+ fi
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance