Page 1 of 1

Reducing Security Breach timeout

PostPosted: April 20th, 2011, 2:12 pm
by sensei
Good Afternoon,

I successfully hacked the amount of time for the unique ip's and wondered if I can reduce the the amount of time it punishes the the offenders of link sharing. I'm looking at a 5 min punishment. Since we have a webcast going, 15 mins is like standing on the wall during a 20 min recess.

Thanks!
Marc

Re: Reducing Security Breach timeout

PostPosted: April 21st, 2011, 1:12 am
by Jason Caldwell
Hi Marc.

Please create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
("ws_plugin__s2member_after_loaded", "my_function");
function my_function ()
    {
        $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] = 300;
        /* This is in seconds. 300 seconds = 5 minutes. */
    }
?>

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 11:38 am
by sensei
Hi Jason or anyone else that can answer this.

I already have a s2-hacks.php file to hack the unique ip address time with the following code:

Code: Select all
<?php
add_filter 
("ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip""s2_concurrency_time_per_ip");
function 
s2_concurrency_time_per_ip ()
{
    return 
"72 hours";
}
?>


Can I add the "security breach" snippet to the same php file or do I need to create another php file inside the mu-plugins. I tried it in the same file but didn't seem to have an affect on the security breach timeout.

Thanks!

Marc

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 11:54 am
by Cristián Lávaque
You should be able to have them both in the same file without a problem.

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 12:49 pm
by sensei
Cristian,

Does this look correct?

Thanks!

Marc

Code: Select all
<?php
add_filter 
("ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip", "s2_concurrency_time_per_ip");
function s2_concurrency_time_per_ip ()
{
    return "72 hours";
}

add_action ("ws_plugin__s2member_after_loaded", "my_function");
function my_function ()
{
    $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] = 300;
    /* This is in seconds. 300 seconds = 5 minutes. */
}
?>

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 1:03 pm
by Cristián Lávaque
Hi Marc. :)

Yes. Without knowing if the code works or not, that's how I'd put them together in the file.

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 1:10 pm
by sensei
It's not giving me the choice in the drop down once I load the file. Is this something that will override the 15 minute timeout?

Thanks for your help!

Marc

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 1:31 pm
by Cristián Lávaque
I'm guessing that since the value is not in the drop-down, then it can't show it as an option. But you're forcing that value with your hack, so it is safe to assume that, as long as the code is correct, it'll do what you expect it to do. Where did you get the function that is not from this thread? If Jason gave it to you, I know it'll be correct.

Re: Reducing Security Breach timeout

PostPosted: April 26th, 2011, 1:38 pm
by sensei
I gathered the function from another thread that Jason posted.

Re: Reducing Security Breach timeout

PostPosted: April 27th, 2011, 2:12 am
by Jason Caldwell
Yes, that code is correct.

And Cristián is correct too, there is no official Filter for max_ip_restriction_time, because this is a configurable option in s2Members' General Options panel.

In your case though, you are not happy with the available options; so, this code is overriding the option value dynamically. Thus, it won't show up in your options panel, because it's not an available option ( yet ).

I'm adding the 5 minute option to the next release, so this code will not be necessary in s2Member v3.6+.

Code: Select all
<?php
add_action 
("ws_plugin__s2member_after_loaded", "my_function");
function my_function ()
{
    $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] = 300;
    /* This is in seconds. 300 seconds = 5 minutes. */
?>

Re: Reducing Security Breach timeout

PostPosted: April 27th, 2011, 2:43 pm
by Cristián Lávaque
Can I have an option for 6 minutes and 17 seconds? :geek:

Re: Reducing Security Breach timeout

PostPosted: April 29th, 2011, 12:20 pm
by Jason Caldwell
LOL :D ( I can take a hint )

Re: Reducing Security Breach timeout

PostPosted: April 29th, 2011, 1:07 pm
by Cristián Lávaque
:lol: