mirror of
https://github.com/cmur2/dyndnsd.git
synced 2024-12-21 14:54:22 +01:00
Support dropping priviliges
This commit is contained in:
parent
f0bd538728
commit
1073312110
@ -24,6 +24,9 @@ Create a configuration file in YAML format somewhere:
|
|||||||
# listen address and port
|
# listen address and port
|
||||||
host: "0.0.0.0"
|
host: "0.0.0.0"
|
||||||
port: "80"
|
port: "80"
|
||||||
|
# optional: drop priviliges in case you want to but you may need sudo for external commands
|
||||||
|
user: "nobody"
|
||||||
|
group: "nogroup"
|
||||||
# logfile is optional, logs to STDOUT else
|
# logfile is optional, logs to STDOUT else
|
||||||
logfile: "dyndnsd.log"
|
logfile: "dyndnsd.log"
|
||||||
# interal database file
|
# interal database file
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'etc'
|
||||||
require 'logger'
|
require 'logger'
|
||||||
require 'ipaddr'
|
require 'ipaddr'
|
||||||
require 'json'
|
require 'json'
|
||||||
@ -144,6 +145,10 @@ module Dyndnsd
|
|||||||
Dyndnsd.logger.formatter = LogFormatter.new
|
Dyndnsd.logger.formatter = LogFormatter.new
|
||||||
|
|
||||||
Dyndnsd.logger.info "Starting..."
|
Dyndnsd.logger.info "Starting..."
|
||||||
|
|
||||||
|
# drop privs (first change group than user)
|
||||||
|
Process::Sys.setgid(Etc.getgrnam(config['group']).gid) if config['group']
|
||||||
|
Process::Sys.setuid(Etc.getpwnam(config['user']).uid) if config['user']
|
||||||
|
|
||||||
# configure metriks
|
# configure metriks
|
||||||
reporter = Metriks::Reporter::ProcTitle.new
|
reporter = Metriks::Reporter::ProcTitle.new
|
||||||
|
Loading…
Reference in New Issue
Block a user