ip addresses in user action log emails Topic is solved

Discussion regarding Joomla! 4.x security issues.

Moderators: mandville, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant / FPA - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

ip addresses in user action log emails

Post by jtalbot » Sat Nov 05, 2022 1:12 pm

Joomla 3.x included ip addresses in user action log emails, but joomla 4 does not. Is there a way to turn that on in Joomla 4?

Thanksl

User avatar
mjparadac
Joomla! Hero
Joomla! Hero
Posts: 2488
Joined: Mon Oct 29, 2012 3:58 pm

Re: ip addresses in user action log emails

Post by mjparadac » Mon Nov 07, 2022 5:11 pm

Hello jtalbot,
Click System, then Global Configuration, then find and click User Actions Log, enable the IP Logging option.

Regards,
You do not have the required permissions to view the files attached to this post.
Joomla Community Ambassador for A2 Hosting | A2 Hosting - Our speed, your success | https://www.a2hosting.com/joomla-hosting

jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

Re: ip addresses in user action log emails

Post by jtalbot » Mon Nov 07, 2022 6:02 pm

Thanks for the reply and the screenshot, but ip logging is already enabled and still the emails don't include the ip address.

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9799
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: ip addresses in user action log emails

Post by AMurray » Mon Nov 07, 2022 9:56 pm

Perhaps you need to edit the relevant email template, and include the IP address field/place-holder?

It may not do so by default, but J4's email templating function allows easy editing of system emails templates, and I believe it includes the User Action Log email message.
Regards - A Murray
General Support Moderator

jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

Re: ip addresses in user action log emails

Post by jtalbot » Mon Nov 07, 2022 10:11 pm

Thanks @AMurray for suggesting the email templating stuff. The User Actions Log email is indeed listed there, but ip address is not one of the available tags for the user actions log email :(

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9799
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: ip addresses in user action log emails

Post by AMurray » Tue Nov 08, 2022 11:06 am

Perhaps it simply can't be included in the email. It may have been removed since Joomla 3.

Did you switch on the IP Logging as suggested by @mjparadac? Maybe that also then turns "on" the ability to select the IP field for the email message.
Regards - A Murray
General Support Moderator

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17477
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: ip addresses in user action log emails

Post by toivo » Tue Nov 08, 2022 12:49 pm

jtalbot wrote:
Mon Nov 07, 2022 10:11 pm
The User Actions Log email is indeed listed there, but ip address is not one of the available tags for the user actions log email :(
The below experiment with Joomla 4.2.4 shows that a couple of minor additions to the Joomla core are needed to make the IP address available to different mail templates.

A modified version of the file administrator\components\com_actionlogs\src\Model\ActionlogModel.php is attached. Do not copy it to a live production environment! Here is a summary of the modifications:

line 87

Code: Select all

$this->sendNotificationEmails($loggedMessages, $user->name, $ip, $context);
line 107

Code: Select all

	protected function sendNotificationEmails($messages, $username, $ip, $context)
new line after 152

Code: Select all

			$m['ipaddress'] = $ip;
In addition, edit the database table mail_templates, locate a template, for example a row with the template_id 'com_users.registration.user.registration_mail' and add the string 'ipaddress' into the column 'params':

Code: Select all

{"tags":["name","sitename","activate","siteurl","username","ipaddress"]}
This addition makes the tag 'ipaddress' available under Insert Tags when editing the mail template.

I will create a feature request in https://issues.joomla.org so that developers can consider this addition to mail templates for inclusion in one of the future versions.
You do not have the required permissions to view the files attached to this post.
Toivo Talikka, Global Moderator

jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

Re: ip addresses in user action log emails

Post by jtalbot » Tue Nov 08, 2022 3:37 pm

toivo wrote:
Tue Nov 08, 2022 12:49 pm
I will create a feature request in https://issues.joomla.org so that developers can consider this addition to mail templates for inclusion in one of the future versions.
Great, thanks so much for doing this.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17477
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: ip addresses in user action log emails

Post by toivo » Fri Nov 11, 2022 9:01 am

Toivo Talikka, Global Moderator

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2932
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: ip addresses in user action log emails

Post by SharkyKZ » Fri Nov 11, 2022 9:03 am

[ redacted ]
You don't need the first two changes. IP address is already included in the message.
Last edited by toivo on Sat Nov 12, 2022 12:08 am, edited 1 time in total.
Reason: mod note: removed long quote

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17477
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: ip addresses in user action log emails

Post by toivo » Sat Nov 12, 2022 12:12 am

SharkyKZ wrote:
Fri Nov 11, 2022 9:03 am
You don't need the first two changes. IP address is already included in the message.
@SharkyKZ, you are absolutely right. The only mod required will therefore be this:

Code: Select all

			$m['ipaddress'] = $message->ip_address;
Toivo Talikka, Global Moderator

jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

Re: ip addresses in user action log emails

Post by jtalbot » Sat Aug 12, 2023 9:20 pm

I don't think the feature request has been implemented yet :^(, but in preparation, I added "ipaddress" to the 'params' column of the mail_templates database table, in the row for template_id com_actionlogs.notification:

Code: Select all

{"tags":["message","date","extension","username","ipaddress"]}
I then edited the mail template "User Actions Log: Notification Mail" as follows (IPADDRESS did show up in the tag list for this template):

Code: Select all

Action | Date | Extension | Name | IP Address
{MESSAGES} {MESSAGE} | {DATE} | {EXTENSION} | {USERNAME} | {IPADDRESS}
{/MESSAGES} 
Now when I get an action log email, it contains (the literal) {IPADDRESS}; I assume it will be replaced by an actual ip address when the feature is implemented.

jtalbot
Joomla! Apprentice
Joomla! Apprentice
Posts: 26
Joined: Mon Jan 26, 2009 3:44 am

Re: ip addresses in user action log emails

Post by jtalbot » Sun Aug 13, 2023 5:45 pm

When asked to vote on the importance of an issue in the Joomla issue tracker, which one is higher importance - importance 1 or importance 5?

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9799
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: ip addresses in user action log emails

Post by AMurray » Sun Aug 13, 2023 9:35 pm

I assume 5 is the highest and 1 is the lowest. That's usually the way I would read such things when it comes to votes or ratings.
Regards - A Murray
General Support Moderator


Post Reply

Return to “Security in Joomla! 4.x”