• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Solved: Not_allowed_to_perform_deliveries_as_root

Z

zymsys

Guest
I ran into a problem today and thought I'd post the solution here in case anyone else runs into it.

I am migrating customers from my old server with no control panel, but with vchkpasswd to Plesk. I wrote a script that takes the vpasswd file and assorted .qmail files and generates a script that calls mail.sh to migrate account information. This morning it migrated an email account that had an alias which contained an underscore. The old system replaced _ with :, so it generated the following mail.sh parameter:

-aliases add:first:last

The script ran just fine, but this account wouldn't receive email. All other accounts in the domain worked, and some aliases to this account worked, but not the regular name for it.

It turns out that in /var/qmail/users/assign the : was written unchanged into the user ID field, and this caused mail deliver failures with the error "Not_allowed_to_perform_deliveries_as_root". I guess when the parser failed it gave a zero for the user's UID.

I updated my script that generates the configuration to replace : with _ and manually updated the user with the problem and now all is well.

I hope this helps someone!
 
Sure... Bear in mind that this is a work in progress. I've probably migrated 20 or so clients with it so far, and I'm still running into little things like this. Also I didn't write it with wide deployment in mind, so it may not be useful unless you're already a techie. Here it is:
Code:
#!/usr/local/bin/php
<?
$forward = array();
$box = array();
$alias = array();

$dir = "/home/vpopmail/domains/{$argv[1]}/";
$dh = opendir($dir);
if ($dh === false)
{
        echo "Can't open $dir.\n";
        exit;
}
while (($file = readdir($dh)) !== false)
{
        if (substr($file,0,7)=='.qmail-')
        {
                $local = substr($file,7);
                $dq = explode("\n",file_get_contents($dir.$file));
                foreach ($dq as $ln)
                {
                        $ln = trim($ln);
                        if ($ln == '') continue;
                        $fc = substr($ln,0,1);
                        if ($fc == '&')
                                $forward[$local] = substr($ln,1);
                        else if ($fc == '/')
                        {
                                $lp = explode('/',$ln);
                                $alias[$local] = $lp[5];
                        }
                        else if ($fc == '|')
                                $pipe[$local] = $ln;
                        else
                                $forward[$local] = $ln;
                }
        }
}
closedir($dh);

$fd = fopen("{$dir}vpasswd",'r');
while (!feof($fd))
{
        $ln = trim(fgets($fd,4096));
        $lp = explode(':',$ln);
        $box[$lp[0]] = str_replace(array("!","("),array("\!","\("),$lp[7]);
}
fclose($fd);
$allmail = array_keys(array_merge($box,$forward));
foreach ($allmail as $email)
{
        if ($email == '') continue;
        $opts = array("-c $email@{$argv[1]}");
        if (isset($box[$email]))
        {
                $opts[] = "-mailbox true";
                if ($box[$email] != '') $opts[] = "-passwd {$box[$email]}";
        }
        $myaliases = array();
        foreach ($alias as $e=>$a)
        {
                if ($a == $email) $myaliases[] = str_replace(":","_",$e);
        }
        if (count ($myaliases)>0)
        {
                $opts[] = "-aliases add:".implode(',',$myaliases);
        }
        if ($forward[$email]!='')
        {
                $opts[] = "-redirect true";
                $opts[] = "-rediraddr ".$forward[$email];
        }
        echo "/usr/local/psa/bin/mail.sh ".implode(' ',$opts)."\n";
}
?>
 
Back
Top