HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //sbin/postfix-nochroot
#!/usr/bin/perl

# this script configures Postfix to not use chroot, restarts Postfix to apply
# the change, and removes the chroot files.  See the man page or the
# following blog post for more details:
# http://etbe.coker.com.au/2008/08/02/postfix-and-chroot/

use strict;

my $file = "/etc/postfix/master.cf";
my $rsyslog_postfix_conf = "/etc/rsyslog.d/postfix.conf";
my $rsyslog_postfix_sock = "/var/spool/postfix/dev/log";

my $rsyslog_initrc = "/etc/init.d/rsyslog";

if(-e "$file.bak")
{
  print "\"$file.bak\" already exists, aborting\n";
  exit(1);
}
open(MAIN, "<$file") or die "Can't open \"$file\"";
open(NEW, ">$file.new") or die "Can't open \"$file.new\"";

while(<MAIN>)
{
  if($_ =~ /^#/)
  {
    print NEW $_;
    next;
  }
  chomp;
  if($_ =~ /(^([^\s]+\s+){4})-(.*)$/)
  {
    print NEW "# modified to disable chroot\n";
    print NEW "$1n$3\n";
  }
  else
  {
    print NEW "$_\n";
  }
}
close(NEW);
close(MAIN);
rename("$file","$file.bak") or die "Can't rename \"$file\" to \"$file.bak\", aborting\n";
rename("$file.new", "$file") or die "Can't rename \"$file.new\" to \"$file\", inconsistent state\n";

my $script = "/etc/init.d/postfix";
open(STATUS,"$script status|") or die "Can't check postfix status\n";

my $status = <STATUS>;

if($status =~ /postfix is running/)
{
  system("$script stop");
}
rsyslog_postfix_socket_disable();
mysystem('rm', '-rf', qw(
	/var/spool/postfix/dev
	/var/spool/postfix/etc
	/var/spool/postfix/lib
	/var/spool/postfix/usr
    ));
if($status =~ /postfix is running/)
{
  system("$script start");
}
exit(0);

sub rsyslog_postfix_socket_disable
{
    if ( -f $rsyslog_postfix_conf )
    {
	my $from = $rsyslog_postfix_conf; 
	my $to = $rsyslog_postfix_conf . '.bak';
	rename($from, $to)
		or die qq|$0: can't rename("$from", "$to"): $!\n|;
    }
    if ( -S $rsyslog_postfix_sock && -x $rsyslog_initrc )
    {
	mysystem($rsyslog_initrc, 'restart');
    }
}

sub mysystem
{
    system(@_);
    if ( $? != 0 )
    {
	print STDERR "$0: exec(" . join(',', map(qq|"$_"|, @_)) . ") ";
    }
    if ($? == -1)
    {
	mysystem_error(\@_, "failed: $!");
    }
    elsif ($? & 127)
    {
	mysystem_error(\@_, "child died with signal %d, %s coredump",
	       ($? & 127),  ($? & 128) ? 'with' : 'without');
    }
    elsif ( $? )
    {
	mysystem_error(\@_, "child exited with value %d", $? >> 8);
    }
    return $?;
}

sub mysystem_error
{
    my ($args, $fmt, @fmtargs) = @_;
    print STDERR "$0: exec(", join(',', map(qq|"$_"|, @$args)),
	    ") ", sprintf($fmt, @fmtargs), "\n";
}