Using UID and GID given for Tinyproxy, fixes #118
This commit is contained in:
@@ -11,17 +11,17 @@ import (
|
|||||||
|
|
||||||
func (c *configurator) MakeConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string, uid, gid int) error {
|
func (c *configurator) MakeConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string, uid, gid int) error {
|
||||||
c.logger.Info("%s: generating tinyproxy configuration file", logPrefix)
|
c.logger.Info("%s: generating tinyproxy configuration file", logPrefix)
|
||||||
lines := generateConf(logLevel, port, user, password)
|
lines := generateConf(logLevel, port, user, password, uid, gid)
|
||||||
return c.fileManager.WriteLinesToFile(string(constants.TinyProxyConf),
|
return c.fileManager.WriteLinesToFile(string(constants.TinyProxyConf),
|
||||||
lines,
|
lines,
|
||||||
files.Ownership(uid, gid),
|
files.Ownership(uid, gid),
|
||||||
files.Permissions(0400))
|
files.Permissions(0400))
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string) (lines []string) {
|
func generateConf(logLevel models.TinyProxyLogLevel, port uint16, user, password string, uid, gid int) (lines []string) {
|
||||||
confMapping := map[string]string{
|
confMapping := map[string]string{
|
||||||
"User": "nonrootuser",
|
"User": fmt.Sprintf("%d", uid),
|
||||||
"Group": "tinyproxy",
|
"Group": fmt.Sprintf("%d", gid),
|
||||||
"Port": fmt.Sprintf("%d", port),
|
"Port": fmt.Sprintf("%d", port),
|
||||||
"Timeout": "600",
|
"Timeout": "600",
|
||||||
"DefaultErrorFile": "\"/usr/share/tinyproxy/default.html\"",
|
"DefaultErrorFile": "\"/usr/share/tinyproxy/default.html\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user