Hostbill knowledgebase url too long

When using hostbill knowledgebase you may notice articles with long url’s are not working whereas articles with short urls do,

Add this to your php.ini

suhosin.get.max_array_index_length = 300
suhosin.request.max_array_index_length = 300
suhosin.get.max_name_length = 300
suhosin.request.max_varname_length = 300

Plesk API 404

Suddenly without warning our whmcs started returning a – (hyphen) when trying to create a package, looked in /usr/local/psa/admin/logs/httpsd_access_log and saw 404 errors for enterprise/control/agent.php

The default plesk filename for the agent file begins upper case –

/usr/local/psa/admin/htdocs/enterprise/control/Agent.php

Whereas whmcs calls lowercase agent.php

Weird, anyway create a symbolic link from agent.php -> Agent.php:

cd /usr/local/psa/admin/htdocs/enterprise/control/

ln -s Agent.php agent.php

CSF Firewall Parser

I’m currently working on a CSF firewall parser, csf generates lots of useful info about user processes and I wanted a way to investigate these messages and lessen abusive behaviour on our servers, there are a couple of screenshots below, the code is pretty alpha at the moment but if anyone wants a copy just contact me.

WHMCS Onapp Configurable Options

I couldn’t seem to figure out how the whmcs configurable options worked in onapp, by looking through the code its become apparent that the module uses the sort order of the configurable option and adds that on to the base package, so for e.g. you have a base vps package set to 5Gb and wanted to offer upgrades to 10 and 15, you would create configurable options named: 5, 10, 15 but would set the sort order on these as 0, 5, 10 respectively, if the user chooses the 10 configurable option the resulting disk space would be 5Gb + 5 (the sort order value).

Kayako Separate outgoing SMTP

I thought this was going to be impossible, we’re trying to setup several companies in one kayako, outgoing smtp settings are global and not per queue, to fix this I set the details for the outgoing smtp to 127.0.01 with no auth, this send out the messages with the from address properly configured as per the queue.

This probably wont work on every setup but it works on mine which is a standard cpanel setup.

REST PUT 403

I was testing a REST interface and always getting 403 – forbidden, turns out this is the apache default response for put requests, well at least thats how its setup by default on apache with cPanel, to fix create a conf file:

/usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN.COM/*.conf

And add:

<Directory /wheverever>
Order allow,deny
Allow from all
</Directory>

Then test apache aint gonna break with:

/scripts/verify_vhost_includes

If all ok, then restart apahce from WHM and you are good to go.

 

Exim redeliver / reinject mails

 perl redeliver.pl MAILBOX
Where MAILBOX is the mailbox file
my $file = shift || die "need file\n";
my $gto  = shift; # global to.  if present, override other per-email decision
my $msg  = '';
my $to   = '';
my $from = '';

open(I, "<$file") || die "Can't open $file\n";
while (<I>) {
  if (/^From /) {
    if ($msg) {
      if ($to && $from) {
        do_mail($from, $to, $msg);
      } else {
        print STDERR "have a message but no recips\n";
      }
    } else {
      print STDERR "saw From w/ no message\n";
    }
    $msg  = '';
    $from = '';
    $to   = '';
  } elsif (/^Return-path:\s*<(.*)>$/) {
    $from = $1;
  } elsif (/^Envelope-to:\s*(\S+)\s*$/) {
    $to = $1;
  } elsif (/^Delivery-date:\s*/) {
    ; # just ignore
  } else {
    $msg .= $_;
  }
}
close(I);

if ($msg && $to && $from) {
  do_mail($from, $to, $msg);
}

sub do_mail {
  my $f = shift;
  my $t = shift;
  my $m = shift;
  $t = $gto if ($gto);

  print "$f -> $t\n";
  #print "MAIL FROM:<$f>\nRCPT TO:<$t>\nDATA\n$m\n.\n";
  open(P, "|/usr/lib/sendmail -f $f $t") || warn "can't open sendmail: $!\n";
  print P $m, "\n.\n";
  close(P);
}