Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log all 'locked out' failures #859

Closed
Starpaul20 opened this issue Jul 3, 2014 · 32 comments
Closed

Log all 'locked out' failures #859

Starpaul20 opened this issue Jul 3, 2014 · 32 comments
Assignees
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:enhancement Type: Enhancement. Contains minor improvements t:feature Type: Feature. Implements new functionality
Milestone

Comments

@Starpaul20
Copy link
Member

If locked out of the Admin CP due to bad password, log these failures.

@Starpaul20 Starpaul20 added this to the 1.8 Beta 3 milestone Jul 3, 2014
@Starpaul20 Starpaul20 self-assigned this Jul 3, 2014
@euantorano
Copy link
Member

THis should be an easy one, so I'll stake claim to it early 😆

@euantorano
Copy link
Member

Started work in #861. Need to test locally.

@euantorano
Copy link
Member

Ok, that seems to work for me locally. The log entry is pretty basic in the form as follows:

    Administrator login attempt for user ID 1 locked out from IP address ::1.

@euantorano
Copy link
Member

This should be done if somebody from SQA could test?

@JordanMussi
Copy link
Contributor

image

Can I also suggest logging what user was logged into the frontend at that time as well as the admin account attempting to be logged into?

@euantorano
Copy link
Member

That's odd. I'll have to test again, though it might require a mod to the function logging admin actions.

@Sama34
Copy link
Contributor

Sama34 commented Jul 13, 2014

4651dfb should fix the SQL error.

I suppose $mybb->user['uid'] will not be defined if the user is trying to log-in.

@euantorano simply pass the data to the log_admin_action() function and format it in the administrator logs page (:

@euantorano
Copy link
Member

Nice one, cheers Omar. I'll look at it ASAP.

On 13 Jul 2014, at 21:08, Omar Gonzalez notifications@github.com wrote:

4651dfb should fix the SQL error.

I suppose $mybb->user['uid'] will not be defined if the user is trying to log-in.

@euantorano simply pass the data to the log_admin_action() function and format it in the administrator logs page (:


Reply to this email directly or view it on GitHub.

@euantorano
Copy link
Member

@JordanMussi, the patch by @Sama34 fixes the issue. Could you please pull and test again? I've also simplified the log string rather than duplicating the IP info.

@JordanMussi
Copy link
Contributor

Yeah it works...

My suggestions... 👅

  • The format for other logging strings is Edited user #2 (Test), Activated user #2 (Test) etc. so you should probably do: Administrator login attempt for user #{1} ({2}) locked out. (1 replaced with id and 2 with the username)
  • User attached to the log (for the username column of the logs table) should be of the logged in user in the frontend or none if it is a guest...

@JordanMussi JordanMussi removed the fixed label Jul 16, 2014
@euantorano
Copy link
Member

Should already do #2. The username is fetched in the log_admin_action() function.

On 16 Jul 2014, at 21:07, Jordan Mussi notifications@github.com wrote:

Yeah it works...

My suggestions...

The format for other logging strings is Edited user #2 (Test), Activated user #2 (Test) etc. so you should probably do: Administrator login attempt for user #{1} ({2}) locked out. (1 replaced with id and 2 with the username)
User attached to the log (for the username column of the logs table) should be of the logged in user in the frontend or none if it is a guest...

Reply to this email directly or view it on GitHub.

@JordanMussi
Copy link
Contributor

I don't fully follow... It doesn't look like you've done that in #861...

@euantorano
Copy link
Member

If the user has a front-end login, it will show the username. If they aren't logged in on the front-end, it won't.

I'll capture a screenshot tonight.

@JordanMussi
Copy link
Contributor

Really? Are you sure you've pushed that code?

@euantorano
Copy link
Member

Pretty sure. Last I checked log_admin_action does it all.

On 17 Jul 2014, at 19:25, Jordan Mussi notifications@github.com wrote:

Really? Are you sure you've pushed that code?


Reply to this email directly or view it on GitHub.

@JordanMussi
Copy link
Contributor

log_admin_action takes the currently logged in admin. Since it logs when there is no admin logged in there is nothing to capture...

@euantorano
Copy link
Member

Are you sure? Line 30/31 of admin/inc/functions.php:

$log_entry = array(
    "uid" => (int)$mybb->user['uid'],

Surely that'll grab the current user ID? I'm sure my local install had a currently logged in user. I didn't get a chance to screenshot last night but will tonight.

@JordanMussi
Copy link
Contributor

Yes but look at admin/index.php line 169
That replaces the $mybb->user with the user that is being attempted to be logged in to.

Also at line 302 $mybb->user doesn't seem to be set...

@euantorano
Copy link
Member

Ah, in which case I'll have to create a temporary $front_end_user variable and assign it, but the actual display of the action will still be off :(

@euantorano
Copy link
Member

To add the user details properly, I'm going to have to change quite a lot of stuff in admin/index.php. WHat does everybody else think? In the interests of moving on, I think it's probably passible as is. @mybb/developers...

@euantorano
Copy link
Member

Also, this is how the logs currently look...

screen shot 2014-07-18 at 19 58 26

@Starpaul20
Copy link
Member Author

Couldn't you just use the user id of the user being locked out?

@Sama34
Copy link
Contributor

Sama34 commented Jul 19, 2014

Or use "Guest" as the username.

"euan" should be formatted in the first line. Don't we do this with other logs (formatting usernames in the details, if not then ignore me)?

@JordanMussi
Copy link
Contributor

The username column should contain the frontend user attempting to login (not necessarily the admin account that is being entered into the admin login form) but if it requires a lot of effort I'm happy to skip.

@euantorano, you haven't committed the part where is also adds the username to the log language line.

@euantorano
Copy link
Member

I'm pretty sure I did commit that Jordan. I'd say we call this complete for now in the interest of hitting Beta 3. I can always enhance it later.

@JordanMussi
Copy link
Contributor

Damn, my bad. I didn't see a notification of the commit. 👅

@euantorano
Copy link
Member

😉

@Sama34 Sama34 reopened this Jul 20, 2014
@Sama34
Copy link
Contributor

Sama34 commented Jul 20, 2014

I don't think this was meant to be closed?

@DiogoParrinha
Copy link
Contributor

@euantorano

@euantorano
Copy link
Member

@PirataNervo See this: http://community.mybb.com/thread-155809-post-1087393.html#pid1087393

Pretty much sums up where I'm at with this.

DiogoParrinha pushed a commit that referenced this issue Jul 21, 2014
Starting work on logging admin lockouts for #859.
@DiogoParrinha
Copy link
Contributor

Merged then. A new issue should be opened to correct that.

@euantorano
Copy link
Member

Yes, can wait till 1.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:1.8 Branch: 1.8.x s:resolved Status: Resolved. Solution implemented or scheduled t:enhancement Type: Enhancement. Contains minor improvements t:feature Type: Feature. Implements new functionality
Projects
None yet
Development

No branches or pull requests

5 participants