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.

Greylisting default disable

Discussion in 'E-mail Discussions' started by sparek-3, Jun 30, 2015.

  1. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I think there was some discussion of this on the Edge list, but that thread got really long really fast.

    Has there been any thought behind going from a "default enabled" with greylisting to a "default disabled"? Meaning that greylisting can be enabled server-wide by the server administrator, but individual web hosting accounts have to explicitly enable it in their cPanel for it to take affect for their account.

    I would kind of like that set up better. But, I may be in the minority. I'm just wondering if there's been any thought put into this as a process.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    It's opt-out instead of opt-in with the idea that administrators want to prevent as much SPAM as possible. However, here is the script referenced on our Edge-Users list that will disable greylisting for all users if that's your preference:

    Code:
    #!/usr/local/cpanel/3rdparty/bin/perl
    # cpanel - turn-off-greylisting.pl        Copyright(c) 2014 cPanel, Inc.
    #                                                  All rights Reserved.
    # copyright@cpanel.net                                http://cpanel.net
    # This code is subject to the cPanel license.
    # Unauthorized copying is prohibited.
    
    use strict;
    use warnings;
    use LWP::UserAgent ();
    use HTTP::Cookies  ();
    use JSON          ();
    
    my $accesshash;
    
    open my $accesshash_fh, '<', '/root/.accesshash'
    or die "Unable to open /root/.accesshash: $!";
    while (<$accesshash_fh>) {
      chomp;
      $accesshash .= $_;
    }
    
    my $useragent = LWP::UserAgent->new(
      cookie_jar => HTTP::Cookies->new,
      ssl_opts  => {
          verify_hostname => 0,
          SSL_verify_mode => 0x00
      },
    );
    $useragent->default_header( 'Authorization' => "WHM root:$accesshash" );
    
    my $listaccts = $useragent->get(
      'https://127.0.0.1:2087/json-api/listaccts?api.version=1'
    );
    my $content = eval { JSON::decode_json( $listaccts->decoded_content ) };
    my @usernames;
    foreach my $acct ( @{ $content->{'data'}{'acct'} } ) {
      push @usernames, $acct->{'user'};
    }
    print "Disabling Greylisting for " . scalar @usernames . " accounts:";
    
    foreach my $acct (@usernames) {
      my $success = $useragent->get(
          join(
              q{},
              "https://127.0.0.1:2087/json-api/",
              "cpanel",
              "?cpanel_jsonapi_apiversion=3",
              "&cpanel_jsonapi_user=$acct",
              "&cpanel_jsonapi_module=cPGreyList",
              "&cpanel_jsonapi_func=disable_all_domains",
          )
      );
      print $success->decoded_content;
    }
    You will need to run the "/usr/local/cpanel/bin/mkaccesshash" command if you don't already have an access hash in /root/.mkaccesshash.

    Thank you.
     
  3. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You would have to run this periodically, wouldn't you?

    After I started this thread, I pondered if I could just write a post wwwacct hook to disable greylisting for that account. That might would seem to be a better solution.

    I just didn't know if cPanel had any aims to default disable this, or offer a Tweak Setting that would "Enable greylisting by default OR Disable greylisting by default"

    Like I said, I may be in the minority with this and if I am I don't expect a lot of traction on this. I may look into doing the post wwwacct hook thing, if it's just me. I have kind of mixed feelings on greylisting in general.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,453
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    There are currently no plans for this, but feel free to submit a feature request via:

    Submit A Feature Request

    In the meantime, the plugin referenced by InfoPro is an alternative to implementing the script I posted into a post account creation hook.

    Thank you.
     
Loading...

Share This Page