zengargoyle / selfcontrol

A port of the SelfControl (Mac OS X) application for Ubuntu, Debian, Linux.
http://svn.jklmnop.net/projects/SelfControl.html
44 stars 7 forks source link

Is it under active development ? #7

Open muddlebee opened 8 years ago

muddlebee commented 8 years ago

It doesn't seem to work for Ubuntu 14.04

zengargoyle commented 7 years ago

Sorry, but SelfControl has not been under active development since about 11.10 or so. For a while Ubuntu broke some of the DNS blocking functionality and then Unity sorta messed up the GUI part. It still uses old Gnome2/Gtk2 libraries. I stopped using Ubuntu around 11.04 so. You might be able to make it work by building directly from the master branch and fixing missing dependencies and checking through the issues and such. There are people still using it on later Ubuntu versions going by the occasional email I receive asking how to disable it :)

Sadly, the whole of SelfControl is just a simple bit of scripting some firewall config and hosts file editing with an at (cron) job to undo the blocking. The really nasty part of the code is all for the pretty GUI. The other complication is that if you know enough to fix any problems you have getting it to work then you know how to easily get around it and it is no longer actually useful as a self-control application......

On Mon, Nov 7, 2016 at 2:09 AM, Anwesh Nayak notifications@github.com wrote:

It doesn't seem to work for Ubuntu 14.04

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zengargoyle/selfcontrol/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYOsGNLd-fOsfvpjSy_2GkI25QbHVjSks5q7vjpgaJpZM4KrCOp .

brandonmp commented 7 years ago

As an alternative, this project (while not maintained either) seems to work still. It's just CLI but it's very straightforward.

Just clone the repo and add your time-sucking sites to site_list var in get-shit-done.sh (the ini file doesn't work for me for some reason).

then, to work or play, run sudo bash get-shit-done.sh (work/play)

(I'm not affiliated w/ any of these projects)

zengargoyle commented 7 years ago

Sadly, I think the whole point of SelfControl was "block this site for X amount of time" with no way to unblock it. Being able to turn it on and off is contrary to the whole point. :)

get-shit-done merely edits the hosts file. You could do that yourself and just comment/uncomment out lines. Or just keep two files 'hosts.play' and ' hosts.work' and ln -sf hosts.work hosts to turn it on and ln -sf hosts.play hosts to turn it off.

Maybe I should pull out the graphical UI part. SelfControl actually works just fine from the command line much the same way that GSD would, edit the ~.selfcontrol file and you can just do sudo SelfControl ~/.selfcontrol and it would work.

In reality, the reason for SelfControl in the first place was a pointy-clicky UI that required no skills to use, and not being able to turn it off at will.

On Tue, Jun 27, 2017 at 6:40 AM, brandon notifications@github.com wrote:

As an alternative, this project https://github.com/viccherubini/get-shit-done (while not maintained either) seems to work still. It's just CLI but it's very straightforward.

Just clone the repo and add your time-sucking sites to site_list var in get-shit-done.sh (the ini file doesn't work for me for some reason).

then, to work or play, run sudo bash get-shit-done.sh (work/play)

(I'm not affiliated w/ any of these projects)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zengargoyle/selfcontrol/issues/7#issuecomment-311361295, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYOsOLcc2070TdfnxgCASoyaeBGt7L0ks5sIQZJgaJpZM4KrCOp .

brandonmp commented 7 years ago

awesome, thanks @zengargoyle

I installed it, noticed it doesn't come with a default ~/.selfcontrol, and ran sudo SelfControl ~/.selfcontrol, which threw this:

$ sudo SelfControl ~/.selfcontrol
Use of uninitialized value $job in hash element at /usr/share/perl5/SelfControl/Root.pm line 158.

It looks like it created a ~/.selfcontrol, though:

$ cat ~/.selfcontrol
---
allow: 1
can_queue: 0
hosts:
  -
    - example.com
    - 192.0.32.10
jobs:
  '':
    - 1498839480
    -
      -
        - example.com
        - 192.0.32.10
timeout: 5
version: 2

It also looks like example.com is successfully blocked (even from within VMs, which is great)

A few questions:

zengargoyle commented 7 years ago

The .selfcontrol looks ok, except for the jobs: key. that '' (empty string) key means that you don't have the at program installed. Not having at installed is the source of the error message you saw and means that example.com will never be unblocked. :)

Since it won't happen automatically, you'll probably want to clean up the broken run and start over.

Remove the iptables blocks for example.com and start fresh

$ sudo iptables -D OUTPUT -j SelfControl $ sudo iptables -F SelfControl $ sudo iptables -X SelfControl

edit /etc/hosts and remove the line added for example.com

$ sudo nano /etc/hosts

How did you install SelfControl?

You probably need to use whatever package manager you use to install:

at -- a command scheduler (this undoes the blocks when they expire) iptables -- for manipulating the firewall, you may already have this iptables-persistent -- this saves the iptables during a reboot, you may already have this also.

The old-pre-github site has some more info that never made it into GitHub http://svn.jklmnop.net/projects/SelfControl.html

The duration of the blocking is controlled by the timeout: value in the .selfcontrol file. The value is in 'minutes' (because at doesn't do to the second scheduling).

An example of a self built .selfcontrol file:

$ cat ~/.selfcontrol

allow: 1 can_queue: 0 hosts:

- twitter.com
- 104.244.42.1

-

The jobs: key is mostly for the UI and helps it display which blocks are still active and how long is left until they are unblocked.

The basic idea is ...

If you run SelfControl as non-root/non-sudo, it opens the UI and lets you add/remove hosts from the list (which is stored in the host: key). The UI also looks up the IP address for you.

When you click the 'Block' button it writes the list to the .selfcontrol config file much like the example above. Then it does sudo SelfControl.

When SelfControl is run as root/sudo, it reads the .selfcontrol file and does the blocking.

So, you can just craft a .selfcontrol file as above and sudo SelfControl and bypass the whole UI step.

You can also specify a different config file if you like. sudo SelfControl /home/user/block-social-sites.conf. (.selfcontrol is just the default config file if none is specified)

The doc from the old site shows some more examples of how to check that it's really working, and at the very bottom has a link to a page that sorta shows you how to delete blocks yourself....

If you really want to try using SelfControl, you should probably read back through previous GitHub issues, I think I've explained in more detail many times before.

hope this helps a bit at least, zengargoyle

On Fri, Jun 30, 2017 at 9:23 AM, brandon notifications@github.com wrote:

awesome, thanks @zengargoyle https://github.com/zengargoyle

I installed it, noticed it doesn't come with a default ~/.selfcontrol, and ran sudo SelfControl ~/.selfcontrol, which threw this:

$ sudo SelfControl ~/.selfcontrol Use of uninitialized value $job in hash element at /usr/share/perl5/SelfControl/Root.pm line 158.

It looks like it created a ~/.selfcontrol, though:

$ cat ~/.selfcontrol

allow: 1 can_queue: 0 hosts:

- example.com
- 192.0.32.10

jobs: '':

  • 1498839480
  • -

    • example.com
    • 192.0.32.10 timeout: 5 version: 2

It also looks like example.com is successfully blocked (even from within VMs, which is great)

A few questions:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zengargoyle/selfcontrol/issues/7#issuecomment-312312155, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYOsI2WYuv9YchJSHnbMlWQxf9j2Yn9ks5sJSEJgaJpZM4KrCOp .

brandonmp commented 7 years ago

thanks @zengargoyle ! been looking for a replacement for something like FocusMe on win/mac, this is the closest iv'e found so far so will continue giving it a shot

"How did you install SelfControl?"

I ran sudo dpkg --install /home/bmp/Downloads/selfcontrol_0.9-1_all.deb. I guess at isn't a default util in ubuntu these days--simple enough to fix, glad it wasn't a showstopper.

miheerdew commented 6 years ago

Hi, this is a shameless plug, but my delayed-admin is a fundamental way to ensure self-control that can't be worked around. Could we simplify self-control using this mechanism.