Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm) v2.6.x
Author Message
sockettf
Hangin' Around



Joined: Mar 13, 2009
Posts: 28

PostPosted: Wed Jun 24, 2009 4:37 am Reply with quote

Got Sentinel running in two different sites, one is the last RN 2.3.1 and the other is a phpnuke 7.6 patched 3.1 site. When a hacker is blocked the email admin function does not work but the blocker and the htacces writing yes. (yes, the option "email" is checked in blocker configuration).

This issue happens in the two sites.

Any idea?
Does anyone got this issue?.
 
View user's profile Send private message
eldorado
Involved
Involved



Joined: Sep 10, 2008
Posts: 424
Location: France,Translator

PostPosted: Wed Jun 24, 2009 5:42 am Reply with quote

are they hosted at the same place?
Do you have email on user activation?
 
View user's profile Send private message Visit poster's website MSN Messenger
sockettf







PostPosted: Wed Jun 24, 2009 7:19 am Reply with quote

they are hosted at the same provider, but different accounts.

Email on user activación is ON and working fine, and all the rest modules working exept this Sentinel admin email.

Tegonuke Mailer is active on both (SMTP).
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Jun 24, 2009 9:17 am Reply with quote

Since you are using Tegonuke Mailer does that mean that you don't have access to the phpmail function?

I don't know if Sentinel is written to use Tegonuke Mailer. I would have to look or Montego would have to respond.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Palbin







PostPosted: Wed Jun 24, 2009 9:19 am Reply with quote

I will look tonight, but I would say that NS isn't written to use the Mailer. At least not in regular nuke.
 
sockettf







PostPosted: Wed Jun 24, 2009 10:44 am Reply with quote

NS is written to use the mailer, i think, here is the full function write_mail at nukesentinel.php:

Code:


function write_mail($banip, $blocker_row, $abmatch="") {
  global $ab_config, $nuke_config, $db, $prefix, $user_prefix, $nsnst_const;
  if($blocker_row['activate'] > 0 AND $blocker_row['activate'] < 6) {
    $admincontact = explode("\r\n", $ab_config['admin_contact']);
    if(!empty($nsnst_const['query_string']) && $nsnst_const['query_string'] > "") {
      $query_url = $nsnst_const['query_string'];
    } else {
      $query_url = _AB_NOTAVAILABLE;
    }
    if(!empty($nsnst_const['get_string']) && $nsnst_const['get_string'] > "") {
      $get_url = $nsnst_const['get_string'];
    } else {
      $get_url = _AB_NOTAVAILABLE;
    }
    if(!empty($nsnst_const['post_string']) && $nsnst_const['post_string'] > "") {
      $post_url = $nsnst_const['post_string'];
    } else {
      $post_url = _AB_NOTAVAILABLE;
    }
    $subject = _AB_BLOCKEDFROM." ".$banip;
    $message  = _AB_CREATEDBY.": "._AB_NUKESENTINEL." ".$ab_config['version_number']."\n";
    $message .= _AB_DATETIME.": ".date("Y-m-d H:i:s T \G\M\T O",$nsnst_const['ban_time'])."\n";
    $message .= _AB_IPBLOCKED.": ".$banip."\n";
    $message .= _AB_USERID.": ".$nsnst_const['ban_username']." (".$nsnst_const['ban_user_id'].")\n";
    $message .= _AB_REASON.": ".$blocker_row['reason']."\n";
    if($abmatch != "") { $message .= _AB_MATCH.": ".$abmatch."\n"; }
    $message .= "--------------------\n";
    $message .= _AB_REFERER.": ".$nsnst_const['referer']."\n";
    $message .= _AB_USERAGENT.": ".$nsnst_const['user_agent']."\n";
    $message .= _AB_HTTPHOST.": ".$nsnst_const['http_host']."\n";
    $message .= _AB_SCRIPTNAME.": ".$nsnst_const['script_name']."\n";
    $message .= _AB_QUERY.": ".$query_url."\n";
    $message .= _AB_GET.": ".$get_url."\n";
    $message .= _AB_POST.": ".$post_url."\n";
    $message .= _AB_X_FORWARDED.": ".$nsnst_const['forward_ip']."\n";
    $message .= _AB_CLIENT_IP.": ".$nsnst_const['client_ip']."\n";
    $message .= _AB_REMOTE_ADDR.": ".$nsnst_const['remote_addr']."\n";
    $message .= _AB_REMOTE_PORT.": ".$nsnst_const['remote_port']."\n";
    $message .= _AB_REQUEST_METHOD.": ".$nsnst_const['request_method']."\n";
    if($blocker_row['email_lookup'] == 1) {
      $message .= "--------------------\n"._AB_WHOISFOR."\n";
      // Copyright 2004(c) Raven PHP Scripts
      if(!@file_get_contents("http://ws.arin.net/cgi-bin/whois.pl?queryinput=".$nsnst_const['remote_ip'])) {
        $msg = ('Unable to query WhoIs information for '.$nsnst_const['remote_ip'].'.');
      } else {
        $data = @file_get_contents("http://ws.arin.net/cgi-bin/whois.pl?queryinput=".$nsnst_const['remote_ip']);
        $data = explode('Search results for: ',$data);
        $data = explode('#',$data[1]);
        $data = explode('(NET-',strip_tags($data[0]));
        if(empty($data[1])) $msg .= $data[0];
        else {
          $data = explode(')',$data[1]);
          if(!@file_get_contents("http://ws.arin.net/cgi-bin/whois.pl?queryinput="."!%20NET-".strip_tags($data[0]))) {
            $data = 'Unable to query WhoIs information for '.strip_tags($data[0]).'.';
          } else {
            $data = @file_get_contents("http://ws.arin.net/cgi-bin/whois.pl?queryinput="."!%20NET-".strip_tags($data[0]));
            $data = explode('Search results for: ',$data);
            $data = explode('Name',$data[1],2);
            $data = explode('# ARIN WHOIS ',$data[1]);
          }
          $msg .= 'OrgName'.nl2br($data[0]);
        }
      }
      $message .= strip_tags($msg);
    } elseif($blocker_row['email_lookup'] == 2) {
      $message .= "--------------------\n";
      // Copyright 2004(c) NukeScripts
      if(!@file_get_contents("http://dnsstuff.com/tools/whois.ch?ip=".$nsnst_const['remote_ip'])) {
        $data = 'Unable to query WhoIs information for '.$nsnst_const['remote_ip'].'.';
      } else {
        $data = @file_get_contents("http://dnsstuff.com/tools/whois.ch?email=on&ip=".$nsnst_const['remote_ip']);
        $data = str_replace("</H1><H5>", "\n", $data);
        $data = str_replace("status = \"Getting WHOIS results...\";", "\n", $data);
        $data = str_replace("status = \"Done!\";", "\n", $data);
      }
      $message .= strip_tags($data);
    }
    $adminmail = $nuke_config['adminmail'];
    if (defined('TNML_IS_ACTIVE')) {
      $params = array('batch' => 1);
      tnml_fMailer($admincontact, $subject, $message, $adminmail, '', $params);
    } else {
      for($i=0, $maxi=count($admincontact); $i < $maxi; $i++) {
        @mail($admincontact[$i], $subject, $message,"From: $adminmail\r\nX-Mailer: "._AB_NUKESENTINEL);
      }
    }
  }
}


Note here, The mailer is used in different manner as I see in other modules.
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Wed Jun 24, 2009 11:38 am Reply with quote

In non RavenNuke (tm) sites, Nuke Sentinel (tm) will use PHP's built in phpmail() function as it is the only option available.
Using you have the blocker configuration set to email you, which your first post indicates you have, then the first thing to rule out is your host having restrictions on the phpmail() function.
Some hosts do not allow it at all but if users are getting their activation email, that also seems unlikely to be the problem.
Moving on...
Is your NS admin email address an email address associated with your domain? Some hosts restrict phpmail() is the 'sender' email address is not for the same domain it is being sent from.
 
View user's profile Send private message Send e-mail
sockettf







PostPosted: Wed Jun 24, 2009 12:21 pm Reply with quote

In both sites the TN Mailer is installed and active the write_mail function is the same in both Sentinel versions (the installed and de included in RN). In this function the presence of TN Mailer is checked:

Code:
if (defined('TNML_IS_ACTIVE')) { 

....
....


Maybe the problem is the issue with the dnsstuff?

also, my NS email is my webmaster account assosiated to my domain.
 
Guardian2003







PostPosted: Wed Jun 24, 2009 12:35 pm Reply with quote

You can try removing the ampersand @ at the beginning of the mail function to see if any errors are recorded in your server error log.
 
sockettf







PostPosted: Sat Jun 27, 2009 10:05 am Reply with quote

As update: I've just changed in nukesentinel.php the line:

Code:
if (defined('TNML_IS_ACTIVE')) {


to:

Code:
if (!defined('TNML_IS_ACTIVE')) {


And started again to receive the "Blocked Abuse" emails in my webmaster IN box via PHP mail function.

Fixed with this, but there are some bad code related to TN Mailer in Sentinel I think.
 
Palbin







PostPosted: Sat Jun 27, 2009 11:40 am Reply with quote

I will make a mantis issue for the team to look into. Thanks!
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Thu Aug 06, 2009 9:35 pm Reply with quote

sockettf, sorry that this took so long to get to. I have been swamped this summer. I am the author of the TegoNuke(tm) Mailer. I would back out the "fix" you applied above as essentially what you have done is force NukeSentinel(tm) to use PHP's mail() function rather than the Mailer. But, I have to ask why you are even using the Mailer and SMTP if the mail() function is enabled on your site. I would just reset that bit of code back in nukesentinel.php, turn off the Mailer and be back in business.

However, if you want the real fix, here it goes. I wasn't handling all combinations of TO addresses correctly. All the other RavenNuke(tm) code passes both the email address and a from name, but NukeSentinel(tm) does not pass the from name. I just wasn't handling that case properly and so it was trying to send to an invalid email address. To fix this (to use what I have just committed to the 2.4.0 release of RavenNuke(tm)), do this:

=== OPEN FILE ===

includes/tegonuke/mailer/mailer.php

=== FIND CODE ===

Code:


   /*
   * Validate to and from information and build Swift Address objects
   */
   if (!is_array($to)) {
      $oRecipients = new Swift_Address($to);
   } elseif (count($to) == 1) {
      $oRecipients = new Swift_Address($to[0][0], (isset($to[0][1])) ? $to[0][1] : null);
   } else {
      $oRecipients =& new Swift_RecipientList();
      foreach($to as $recipient) {
         $oRecipients->addTo((is_array($recipient) and isset($recipient[0])) ? $recipient[0] : $recipient, (is_array($recipient) and isset($recipient[1])) ? $recipient[1] : null);
      }
   }


=== REPLACE WITH ===

Code:


   /*
   * Validate to and from information and build Swift Address objects
   */
   if (!is_array($to)) {
      $oRecipients = new Swift_Address($to);
   } elseif (count($to) == 1) {
      $oRecipients = new Swift_Address(
         (is_array($to[0])) ? $to[0][0] : $to[0],
         (is_array($to[0]) && isset($to[0][1])) ? $to[0][1] : null
      );
   } else {
      $oRecipients =& new Swift_RecipientList();
      foreach($to as $recipient) {
         $oRecipients->addTo(
            (is_array($recipient) && isset($recipient[0])) ? $recipient[0] : $recipient,
            (is_array($recipient) && isset($recipient[1])) ? $recipient[1] : null
         );
      }
   }


=== DONE ===

That should fix you right up.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
sockettf







PostPosted: Fri Aug 07, 2009 2:59 am Reply with quote

Thanks Montego for the real fix Smile.

The main reason for why Im using the TN Mailer SMTP is the problem with the hotmail.com accounts, my hotmail users dont receive emails from php mail function. Only using SMTP the msn users can receibe notifications and activation email.

Thanks, again, I can go now with SMTP.
 
montego







PostPosted: Tue Aug 11, 2009 6:23 am Reply with quote

Ah, interesting, and very good to know. Thank you for the tip!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm) v2.6.x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©