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.

pre addon domain?

Discussion in 'General Discussion' started by dibarra, Jan 1, 2008.

  1. dibarra

    dibarra Active Member
    PartnerNOC

    Joined:
    Jun 14, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    I set up /scripts/prewwwacct (and it's working wonderfully). So far from what I wrote it lets me use a custom common domains list and include wildcards (e.g. hotmail.* bankofamerica.* *.chasebank*.*) and if the domain being added matches these common domains, it will end the account creation process.

    It works fine, but of course addon domains don't call prewwwacct, nor wwwacct. I was wondering if anyone knows of some cPanel hook that'll allow me to call custom code when a domain is added onto a cPanel, and a hook that's called when a domain is being parked. Thanks!
     
  2. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    I'm interested in this, how do you stop the account creation process? is what you use for stopping reliable?

    There is also a facility in cpanel for this. I've some scripts available that allow you to automatically update the banned domain list -- for instance, so you have the latest URIBL domains listed. Check them out here.
     
  3. dibarra

    dibarra Active Member
    PartnerNOC

    Joined:
    Jun 14, 2007
    Messages:
    38
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    Pretty much all I do is compare regexes and if it matches, it will slip the domain into /usr/local/cpanel/etc/commondomains

    That way, when prewwwacct cleans up, and wwwacct starts, it will check common domains, and error out as the domain being a common domain.

    I've also heard of people simply getting a process listing, and killing the pid of the account creation script.

    I did see that particular link when I was researching, brianoz, but I don't really want our servers hosting domain names that are obviously phishing domains, but not necessarily in the blacklist. Wildcards make this a bit easier. Now that I think about it, I think a combination of blocking based on pattern matching and blacklisting would be most effective.

    I'm guessing that there is no method to hook addon or parked domains, which leaves me back at square one. I'll continue researching and post if I find something.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Actually, there are more hooks you can call. Refer to README in /usr/local/cpanel/hooks/ for some documentation. To get a feel for what the code of a hook should look like, refer to change_password.example in /usr/local/cpanel/hooks/passwd.

    Since the API2 call for creating an addon domain is AddonDomain::addaddondomain, you could create a hook in /usr/local/cpanel/hooks/addondomain/ (note, all lowercase) called addaddondomain to hook addon domains.

    Offhand, I don't know the API2 function for adding a parked domain.
     
  5. esupport.org.ua

    esupport.org.ua Well-Known Member

    Joined:
    Nov 16, 2004
    Messages:
    65
    Likes Received:
    0
    Trophy Points:
    6
    It is a really great!
    But what I can receive variables? From cpanelevent params?
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Until API2 documentation is completed, if you are unsure what parameters are passed to a hook, I'd recommend dumping the XML input to a file so you can analyze the XML (including cpanelevent params) that is being passed to the hook.

    EDIT: Note, I am assuming that you are attempting this with other API calls such as those that handle addon domains and such. It would be a very bad idea to store anything related to the change password hook in plain text.
     
    #6 cPanelDavidG, Feb 6, 2008
    Last edited: Feb 6, 2008
Loading...

Share This Page