PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Reducing Security Breach timeout

s2Member Plugin. A Membership plugin for WordPress®.

Reducing Security Breach timeout

Postby sensei » April 20th, 2011, 2:12 pm

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
User avatar
sensei
Registered User
Registered User
 
Posts: 19
Joined: April 19, 2011

Re: Reducing Security Breach timeout

Postby Jason Caldwell » April 21st, 2011, 1:12 am

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. */
    }
?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Reducing Security Breach timeout

Postby sensei » April 26th, 2011, 11:38 am

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
Last edited by Cristián Lávaque on April 26th, 2011, 11:50 am, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
sensei
Registered User
Registered User
 
Posts: 19
Joined: April 19, 2011

Re: Reducing Security Breach timeout

Postby Cristián Lávaque » April 26th, 2011, 11:54 am

You should be able to have them both in the same file without a problem.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Reducing Security Breach timeout

Postby sensei » April 26th, 2011, 12:49 pm

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. */
}
?>
Last edited by Cristián Lávaque on April 26th, 2011, 1:04 pm, edited 2 times in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
sensei
Registered User
Registered User
 
Posts: 19
Joined: April 19, 2011

Re: Reducing Security Breach timeout

Postby Cristián Lávaque » April 26th, 2011, 1:03 pm

Hi Marc. :)

Yes. Without knowing if the code works or not, that's how I'd put them together in the file.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Reducing Security Breach timeout

Postby sensei » April 26th, 2011, 1:10 pm

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
User avatar
sensei
Registered User
Registered User
 
Posts: 19
Joined: April 19, 2011

Re: Reducing Security Breach timeout

Postby Cristián Lávaque » April 26th, 2011, 1:31 pm

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.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Reducing Security Breach timeout

Postby sensei » April 26th, 2011, 1:38 pm

I gathered the function from another thread that Jason posted.
User avatar
sensei
Registered User
Registered User
 
Posts: 19
Joined: April 19, 2011

Re: Reducing Security Breach timeout

Postby Jason Caldwell » April 27th, 2011, 2:12 am

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. */
?>
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Reducing Security Breach timeout

Postby Cristián Lávaque » April 27th, 2011, 2:43 pm

Can I have an option for 6 minutes and 17 seconds? :geek:
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Reducing Security Breach timeout

Postby Jason Caldwell » April 29th, 2011, 12:20 pm

LOL :D ( I can take a hint )
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Reducing Security Breach timeout

Postby Cristián Lávaque » April 29th, 2011, 1:07 pm

:lol:
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron