The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need advice on postwwwacct addition to add in automatic domain keys and spf records

Discussion in 'General Discussion' started by meonsite, Apr 5, 2011.

  1. meonsite

    meonsite Member

    Joined:
    Aug 10, 2006
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hey guys, I read on a few blogs about adding in code at the end of postwwwacct to add dkim and spf to new accounts.

    This is what is there already..

    root@server [~]# vi /scripts/postwwwacct
    iplist =[]

    q = 0
    while q < len(iptaglist):
    iplist.append(str(iptaglist[q].childNodes[0].toxml()))
    q = q + 1



    f = open('/var/cpanel/userdata/' + newuser + '/main')
    ydata = yaml.load(f)
    f.close()
    sublist = ydata['sub_domains']
    addondict = ydata['addon_domains']
    parkedlist = ydata['parked_domains']
    domainlist = ydata['main_domain']
    domain = domainlist
    docroot, yip, alias = createvhosts.getvars(domain)
    if yip == iplist[0]:
    createvhosts.writeconfshared(newuser, domain, docroot, yip, alias)
    else:
    createvhosts.writeconfded(newuser, domain, docroot, yip, alias)

    proc = subprocess.Popen("/etc/init.d/nginx restart > /dev/null 2>&1", shell=True)
    output = proc.communicate()


    print "\nStarting install of Domainkeys\n";
    my %OPTS = @ARGV;
    my $user = $OPTS{'user'};
    system("/usr/local/cpanel/bin/domain_keys_installer",$user);
    system("/usr/local/cpanel/bin/spf_installer",$user);
    print "\nDone with install of Domainkeys\n";exit;

    --------------------------------------------------------------------

    It's not working for the new accounts, but I did run the scripts to get all the existing accounts dkim and spf and verified it was setup right on those accounts. So I just need a way to make it automatic for existing accounts. Is it because python code is on the top half of it and the commands I am using are perl?

    Kind of know just enough to be dangerous.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Re: Need advice on postwwwacct addition to add in automatic domain keys and spf recor

    You are correct that you wouldn't be able to have Python and Perl code intermeshed in one script file. You'll need to pick one language or the other to perform the operations.
     
Loading...

Share This Page