#1808 - Include source IP in error mails
| Identifier | #1808 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Include source IP in error mails |
| Status | Completed |
| Tags |
Type: Security (custom) |
| Handling member | Chris Graham |
| Addon | core |
| Description | Error mails may actually highlight a hacker/bot, so knowing the source IP will be useful.
Note that if the error email is auto-sent to ocProducts we should not have the IP in that version, as this would be a privacy violation. |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
Depending on my finances, I'll sponsor it, but sadly I can't guarantee it. But I feel this is a big security issue now.
It's unlikely someone is actively trying to hack, more likely it's just a dum bot, which will be going over potentially millions of sites looking for common vulnerabilities.
If the mails themselves are a nuisance, just set up a simple mail filter rule to auto-delete them.
Maybe it's private hosting?
Here's a super-fudge.
sources/failure.php
mail_wrap(do_lang('ERROR_OCCURRED_SUBJECT',get_page_name(),NULL,NULL,get_site_default_lang()).' '.cms_version_pretty(),$mail,array($agency_email_address),'','','',3,NULL,true,NULL,true);
-->
mail_wrap(do_lang('ERROR_OCCURRED_SUBJECT',get_page_name(),NULL,NULL,get_site_default_lang()).' '.cms_version_pretty(),$mail.get_ip_address(),array($agency_email_address),'','','',3,NULL,true,NULL,true);
I just dumped the IP on the end of the mail
Do this in same file:
dispatch_notification($notification_type,NULL,do_lang('ERROR_OCCURRED_SUBJECT',get_page_name(),NULL,NULL,get_site_default_lang()),$mail,NULL,A_FROM_SYSTEM_PRIVILEGED);
-->
dispatch_notification($notification_type,NULL,do_lang('ERROR_OCCURRED_SUBJECT',get_page_name(),NULL,NULL,get_site_default_lang()),$mail.get_ip_address(),NULL,A_FROM_SYSTEM_PRIVILEGED);
This change should work regardless of notification type, as that's just a matter of how they are collected/sent.
Doing it for the error log would be possible but it'd be a different part of the code, and not retroactive. It'd be harder though because with a change in the logging format kicking in retroactively it wouldn't know how to column it, unless we do it with care. Not something I can do in a "super-fudge" ;)