diff options
author | David Phillips <david@sighup.nz> | 2017-03-17 21:40:20 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-03-17 21:40:20 +1300 |
commit | 165301c42b14a7096eaa31f631c402361872db88 (patch) | |
tree | 12222660f46df9a9f053b7c78f7fff4094e4a71c /saxrobot | |
parent | 84664ecaacaa1d480d02dc836dfd6a33f552e325 (diff) | |
download | idalius-165301c42b14a7096eaa31f631c402361872db88.tar.xz |
Add privellege dropping
Diffstat (limited to 'saxrobot')
-rwxr-xr-x | saxrobot | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2,6 +2,7 @@ use strict; use warnings; +use POSIX qw(setuid setgid); use POE; use POE::Kernel; use POE::Component::IRC; @@ -33,8 +34,15 @@ POE::Session->create( heap => { irc => $irc }, ); +drop_priv(); + $poe_kernel->run(); +sub drop_priv { + setgid($config{gid}) or die "Failed to setgid: $!\n"; + setuid($config{uid}) or die "Failed to setuid: $!\n"; +} + sub _start { my $heap = $_[HEAP]; my $irc = $heap->{irc}; |