Skip to content

A Lack of SelfControl

March 31, 2009

SelfControl

Just read a Wired piece about a new mac app called SelfControl. In a nutshell, it allows you to blacklist specific domains (and IPs) for a given time, allowing you to remove the distractions that keep you from your actual work (that’s the plan at least).

It’s a fun little app, with an interesting premise. While I was skimming its website this sentence caught my eye:

“Once started, it can not be undone by the application or by restarting the computer – you must wait for the timer to run out.”

Now, I see the reasoning behind not allowing the user to renege on his/her commitment to actually get work done, but there’s no way this little app was going to tell me what to do.

Ok, ok, I admit that’s a little over the top. The app isn’t meant to be fort Knox (it’s open source), and the developer’s goal was to make the casual user keep a promise to themselves. But at the same time, my interest was piqued. (From here on, some things get a bit technical. I encourage you to keep reading, but if you just want the solution you can skip down to the bottom. I won’t tell anyone.)

I looked around on Activity Monitor, but couldn’t find a daemon that was keeping me down. Dead end.

Two minutes and a git repository later, I’m elbow deep in source code, looking around. My eye gets drawn to IPFirewall.m.

The first declaration: NSString* const kIPFirewallExecutablePath = @"/sbin/ipfw";

Very suspicious. As I had no idea what ipfw was at that point, I decided to investigate. A quick man revealed that ipfw was an “IP firewall and traffic shaper control program.” Bingo.

Salient points from the man file:

An ipfw configuration, or ruleset, is made of a list of rules numbered

from 1 to 65535.  Packets are passed to ipfw from a number of different

places in the protocol stack (depending on the source and destination of

the packet, it is possible that ipfw is invoked multiple times on the

same packet).  The packet passed to the firewall is compared against each

of the rules in the firewall ruleset.  When a match is found, the action

corresponding to the matching rule is performed.

Rules can be added with the add command; deleted individually or in

groups with the delete command, and globally (except those in set 31)

with the flush command; displayed, optionally with the content of the

counters, using the show and list commands.  Finally, counters can be

reset with the zero and resetlog commands.

Sounds easy enough. I added YCombinator.com (174.132.225.106) to my SelfControl blacklist, and pushed the start button. My attempt to reach YC returned the expected “Safari can’t connect to the server” message. Back in Terminal, I gave sudo ipfw list(list all current ipfw rules) a shot:

02500 count ip from any to any // BEGIN SELFCONTROL BLOCK

02501 deny ip from me to 174.132.225.106

02502 count ip from any to any // END SELFCONTROL BLOCK

65535 allow ip from any to any

Looks easy enough, especially since Mr. Lambert was able to comment the block of rules that SelfControl is using (which could be helpful if you’ve got more ipfw rules than I do). I tried entering sudo ipfw delete 2501, and again attempted to connect to YCombinator.com. Success!

But was there any way to remove all of the rules? I went back into the app, and dug around in the source code a bit. Again I quickly found what I was looking for (kudos to Mr. Lambert for the clear code):

- (int)clearSelfControlBlockRuleSet {

NSArray* args = [NSArray arrayWithObjects:

@"delete",

@"set",

[NSString stringWithFormat: @"%d", kIPFirewallRuleSetNumber],

nil];

NSTask* task = [NSTask launchedTaskWithLaunchPath:kIPFirewallExecutablePath

arguments:args];

[task waitUntilExit];

int status = [task terminationStatus];

return status;
}

For those not completely fluent in code, the above method is the one SelfControl uses to remove the access blocks. It basically removes a set (a group of rules) from the ipfw list. Specifically, it removes the set at the index kIPFirewallRuleSetNumber.

A quick check to see what kIPFirewallRuleSetNumber was set to (19) and I was ready to go.

Without further ado, I present the simple command to resume your time-wasting ways (Note: You must enter your administrator password when you’re asked for this to work):

sudo ipfw delete set 19

Yup, it’s that easy. There goes my productivity again.

UPDATE: Uh oh. As Charlie Stigler pointed out, there’s a problem with this approach. Turns out SelfControl will reactivate the ipfw blocking after a time. Petard pointed to a better solution, which is to find the SelfControl helper and remove it. The command is then
sudo /Library/PrivilegedHelperTools/org.eyebeam.SelfControl `id -u` --remove
This resets the app quite nicely.

About these ads
41 Comments leave one →
  1. Charlie Stigler permalink
    April 1, 2009 1:24 am

    Hi,

    I’m Charlie Stigler. I wrote SelfControl in collaboration with Steve. This was my first application I’ve ever wrote (I’m in high school) and it’s sort of fun to see my source in an article of semi-investigative journalism.

    Come to think of it, maybe I should remove the ipfw comments–it might make it harder for the user to remove. I’m just worried then users might delete all their rules trying to get to the SelfControl ones. :-/

    What’s funny though is that in all of the comments I’ve seen, nobody has mentioned the easiest way to clear blocks… and I was afraid it would make the block useless.

    • jon permalink
      March 8, 2010 8:44 pm

      it was a good app until i found an even easier workaround. Simply change the day to tomorrow and the timer recognizes itself as complete.

  2. Charlie Stigler permalink
    April 1, 2009 1:47 am

    Oh, and also, that’s not actually going to work. I’ll leave it to you as an exercise to figure out what you did wrong. ;)

    ~Charlie

  3. petard permalink
    April 1, 2009 9:39 am

    @Charlie:
    This? http://tinyurl.com/dkaozc

  4. April 1, 2009 10:12 am

    @petard: Yes, that should do it. Yours is actually nice and elegant. I like buttons so my solution would just be to compile in a version with an extra button in the GUI and make it call the AppController’s “removeBlock” method, which is actually the exact opposite of the method that is called when your press the Start button. Plus, I mean, look at the comment in the header:

    // Gets authorization for and then immediately removes the block by calling
    // SelfControl’s helper tool with the appropriate arguments. This can be used
    // for testing, but should not be called at all during normal execution of the
    // program.

    and the one at the start of the implementation:

    // Remember not to use this method, it defeats the point of SelfControl!

    I sort of gave that one away…

  5. Charlie Stigler permalink
    April 1, 2009 6:52 pm

    Ooh, and one last bit I should mention:

    A new build is going to be coming soon. When that one comes out, I have a feeling this approach won’t work anymore. :)

    • Liz permalink
      August 19, 2010 8:19 pm

      Hi Charlie,

      I’m not sure if this defeats the purpose but it seems to me there’s a lot of us having the same problem. Could you post a “generic” fix in the app webpage ? I unfortunately decided to block my email and is causing me some problems, also I’m not a big fan of posting my email in any post but I guess I must in this case. I wrote you guys to the webpage contact form too but I still got no response.

      My email is : lixbeth_fv at yahoo.com

      Cheers,

      Liz

  6. sam j permalink
    April 2, 2009 9:52 am

    Frustratingly great program, Charlie.

  7. Stephen permalink
    April 13, 2009 2:19 pm

    Great… now I need a program to block my access to the terminal. Thanks.

  8. Juan permalink
    May 23, 2009 11:23 am

    Charlie, very nice app!

    You think it can be scripted or automated on several macs in my office in order to provide only certain access windows of time?

    Thaks,

    Juan

  9. August 21, 2009 6:11 pm

    ok, i have a problem.

    I installed self control and activated it for 12 hours, for which it worked flawlessly at not letting me access my blacklist, however the next day, i still had no access to these sites. 2 days later, I still have no access.

    I tried using both the commands above to remove the block, but no cigar.

    “ERROR: Not enough block information.”

    oh and I used appzapper on self-control hoping that would somehow fix it, but….

    wireless-169-235-61-3:~ anton$ sudo ipfw delete set 19
    wireless-169-235-61-3:~ anton$ kIPFirewallRuleSetNumber
    -bash: kIPFirewallRuleSetNumber: command not found
    wireless-169-235-61-3:~ anton$
    wireless-169-235-61-3:~ anton$ sudo /Library/PrivilegedHelperTools/org.eyebeam.SelfControl `id -u` –remove
    2009-08-21 16:10:02.175 org.eyebeam.SelfControl[354:a0b] ERROR: Not enough block information.

    HELP

    • August 29, 2009 12:56 pm

      Sorry you’ve been having these issues! Trying to kill the block yourself is a bad solution, it’s very difficult to do manually unless you are a computer expert. Please give me your email address and I’ll send over our one-click SelfControl Killer.

      • RadicalBison permalink
        October 27, 2009 8:47 pm

        Hey Charlie,

        Sorry to bother you, but I’ve been having the same problem. Think you could send me this wonderitem as well?

        radical.bison@yahoo.com = email address

      • Jess permalink
        October 29, 2009 6:25 pm

        me too please!!!

      • Soda permalink
        November 3, 2009 11:35 am

        Hello Charlie,

        Same problem here. Could you please send me your “one-click SelfControl Killer” as well?

        Thank you!

        contact@polycarbon.net

      • Kelsey permalink
        January 18, 2010 2:47 pm

        Could you also please send it to me? I’m having the same problem =(

        Thanks!

        email- basskl@jmu.edu

      • Lola permalink
        October 11, 2010 8:53 pm

        I can’t seem to kill self control help!
        lola.osin@gmail.com

  10. Kaylia permalink
    September 4, 2009 2:55 am

    Hey can I have that too? i’m having exactly the same issue! Except occasionally when the block is running it gives me access to the sites for 5 mins at a time haha

  11. Kaylia permalink
    September 5, 2009 2:12 am

    oops also my email address is happylookingkid@gmail.com

    Thanks!

  12. Carolyn permalink
    November 4, 2009 8:29 am

    Hey Charlie– I’ve also been having the same issue. When I began the program the timer showed 00:00:00, and it didn’t appear as if I actually added any sites to the Blacklist (though I attempted to add Facebook). I deleted the app, and 24 hours later, still can’t get on the sites.

    cbaumgarten@elon.edu

    Thanks!!

  13. rzzlebdazzle permalink
    November 17, 2009 6:07 pm

    Hi Charlie! I, too, am having the same problem as Charlie! The timer’s up, but I can’t re-access Facebook! It’s been permanently blocked – please help!

    Thanks!!!

  14. daniel permalink
    December 3, 2009 12:16 am

    hola charlie
    no puedo volver a hacer a funcionar mi SELF-CONTROL
    El contador está en 00:00:00
    y si quiero editar mi blacklist me dá un cartel que dice:
    “Block in progress
    The blacklist cannot be edited while a block is in progress.”

    Cómo hago para que funcione de nuevo?, me quedó el facebook bloqueado

    gracias!

    .d

  15. December 3, 2009 1:28 am

    rzzlebdazzle and daniel:

    Please send me an email via my contact form (http://charliestigler.com/contactme/contactme.php). I can then respond with the necessary attachment. I can’t send it directly to you two because you didn’t leave email addresses.

    • M. Fitzpatrick permalink
      December 23, 2009 4:52 pm

      My daughter loaded self control and blocked facebook. Then wanted to remove the bolck and couldn’t. Then she removed the app and still it is blocking facebook. Could you please advise??

      Thanks

      • December 24, 2009 12:40 am

        Again, I would advise contacting me via my contact form (http://charliestigler.com/contactme/contactme.php) so I can leave you an attachment via email.

        A tip for the future: please don’t try to remove SelfControl alone! That’s the best way to end up with a permablock, and you’re very unlikely to manage to get the block off.

  16. January 7, 2010 4:45 pm

    I had the same 00:00 problem until now… I added another website to the blacklist and SelfControl finally played the block expiration sound and allowed me to navigate as usual… I hope this might help someone. :)

  17. January 7, 2010 5:06 pm

    uh oh.
    apparently adding a new domain to the blacklist will remove the block just for moments, like loading a page or two from a blocked website…

    back from scratch… help anyone?

    • January 7, 2010 11:08 pm

      Please email me via my contact form! That’s the best way to handle this issue until it is eventually eradicated for good (I’m having a hard time reproducing it, which is why it still lives, but the numbers are going down).

  18. Kevin Leung permalink
    January 8, 2010 1:40 am

    Huzzah; I got it to work after moving org.eyebeam.SelfControl somewhere else
    then ipfw del
    then putting back org.eyebeam.SelfControl back in the folder

  19. Mia Brown permalink
    February 21, 2010 3:28 pm

    Charlie: can you please email me the address to uninstall self control? the timer is frozen at 00:00 and it won’t let me view the blacklist or take websites off of it. now facebook is blocked permanently and i don’t know how to unblock it. my email is: thehoint@comcast.net
    thanks!

  20. Nick Nguyen permalink
    April 19, 2010 12:58 am

    The same thing happened to me.
    Can you send me the email please?

    My email is nick85nguyen@yahoo.com

  21. Richard permalink
    May 9, 2010 7:16 pm

    I tried emailing you Charlie at your link but it didn’t work. Self Control permablocked me.

  22. Dean Jolly permalink
    June 22, 2010 8:38 pm

    I have the same problem as Richard above. My email is jdjolly@hotmail.it. Need your fix!

  23. August 5, 2010 5:57 am

    Hello, I have same problem, need a fix: martin.rosa@centrum.cz.

    Thank you.

  24. September 15, 2010 10:13 pm

    Hey Charlie, I’m having the same problem with the 00:00:00 blocks. Could you please email me the killer? peterpiekarczyk@gmail.com. Thanks!

  25. Stefano permalink
    September 21, 2010 6:35 am

    I installed selfcontrol, wasn’t able to open a few webistes (even some not blocked in the first place) after the time expired, tried the fix in the FAQs (no success), tried to uninstall the app, and now am not even able to download it (the sever denies connection)! Help!!!!! Could you please send me the killer at dichiaras@yahoo.it? Thanks!

  26. Miden permalink
    September 22, 2010 7:45 am

    Hey Charlie– tried to e-mail you but it didn’t work. Please please email me the app killer! I don’t know what to do!
    midenw@gmail.com

    • Amy Dun permalink
      October 29, 2010 1:35 pm

      Me too! I tried e-mailing but the form didn’t work. I’ve been stuck on 00.00.00 for days. Please e-mail me the app killer too! Charlie, thanks!

      (Awesome program otherwise!)

      amyraydun@gmail.com

  27. Daphne permalink
    October 4, 2010 12:18 am

    Hello, I’m having the same problem with the 00:00:00.
    Could you please send me the killer?
    daphneleaf@hotmail.com
    Thanks a lot!!!!

  28. Natalie permalink
    December 1, 2010 9:42 pm

    Hey Charlie,
    I’m having the same problem with the 00:00:00 block as everyone else. Could I have the killer as well? Thank you very much.

    • Natalie permalink
      December 1, 2010 9:43 pm

      *nwarner27@yahoo.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: