Block site on linux

Chomper — Command Line Tool to Block Websites on Linux

Chomper is an open-source tool used to create a list of websites to be blacklisted or whitelisted during a user’s browsing session. Chomper is terminal-driven tool written in Python. This means it is fully operated from the terminal. The motive behind its design is to help people avoid internet distraction and focus on visiting productive websites during work hours and also helps to temporarily block websites on your Linux Desktop. Chomper can also be used as a parental control tool — e.g to limit the sites visited by kids.

How Chomper works

Unlike other blockers which use the Linux hosts file for filtering IP addresses and domain names, Chomper instead filters outgoing requests through a transparent proxy. This makes Chomper ideal for filtering web content at the URL level. What you have to do is just populate the list of what to block and what to whitelist, Chomper will do the rest for you.

Installing Chomper on Linux

The only way to install Chomper at the moment is by building it from source code. One prerequisite for this is the installation of git, make and cmake. Since this setup is done on Ubuntu 16.04, all deps installed are specific to Ubuntu.

When this is done, proceed to install pyenv. For this, we’ll avoid manual installation and use an installer instead.

Load pyenv automatically by modifying

To load the env manually, source the file in your current session.

Clone Chomper from git.

The make init command will download chomper specific packages and get the environment ready. If you choose to install CPython 3.6, it may take some few minutes to finish setting up. You should then see:

Now start shell:

Once the mitmdump begins for the first time, exit it using a key combination — [ Ctrl+C Ctrl+C ]. A number of certificates files will be generated.

You need to import mitmproxy-ca.pem certificate to your browser.

Chrome : Go to Settings > Advanced Settings > Manage Certificates > Authorities. Click Import, select mitmproxy-ca.pem, tick all three boxes, and click OK

Firefox: Go Preferences > Privacy and Security > Certificates > View Certificates > Authorities. Click Import, select mitmproxy-ca.pem, tick all three boxes, and click OK.

The next thing to do is enable IP forwarding.

Save and then run:

Using Chomper

Chomper is configured using YAML syntax files with three levels.

  • The first level defines the names of the rules.
  • The second level defines whether a rule is a blacklist or whitelist.
  • The third level defines the addresses involved in a rule.

Below is a simple configuration file with few blacklists and whitelists

When running chomper application located under bin directory, two arguments are required.

  • The rule name
  • The block time in minutes
Читайте также:  Для установки агента обновления u2u1 под linux необходимо

For example to run work_block rule for 20 minutes. I’ll execute

This rules blocks specified websites. Try accessing any of the listed sites. You should get a banner message saying «Website has been blocked by Chomper!».

Conclusion

We have covered all the key things you need to start using Chomper. This tool look interesting. It is still fresh but under active development. The current version only work for Linux systems but the Developer is aiming at delivering version for MacOS and GUI for it. Enjoy using Chomper.

Источник

How to Block Websites on Chromebooks and Linux Devices

Freedom now supports website blocking on devices running Chrome OS (Chromebooks) and Linux operating systems. We do this with the new Freedom Chrome extension, available through the Chrome Store.

What does this mean?

Chromebooks and Linux devices now are devices in the Freedom “ecosystem,” just like Mac, Windows, iOS or Android devices. This ecosystem (or platform) is unique to Freedom, giving you the ability to block distracting apps and websites simultaneously across as many devices as you choose.

That’s important because distractions aren’t limited to just one device. Think about it – when was the last time you sat down at the computer to work and didn’t have your phone or tablet at your side, tempting you to check Instagram or respond to a notification?

Running a single Freedom blocking session in sync across your devices ensures that your focus stays where you want it to be – on your work or studies.

And don’t forget, there’s no limit to the number of devices on which you can install and run Freedom.

Install Freedom on Your Chromebook or Linux device

To install Freedom on your Chromebook or Linux computer, get the Freedom Chrome extension from the Chrome Store here:

On the Chrome Store page, click “Add to Chrome” and the extension will be installed.

Log in to Freedom

Once you add the extension to Chrome, click on the Freedom butterfly icon in the extensions bar to bring up the login screen. Enter your email and password and click “log in”. If you don’t have a Freedom account, enter email and password and click “sign up”.

After you log in to the Chrome extension, it will sync with your account.

Running Freedom Across Devices

With the addition of Chrome OS and Linux to the Freedom family, you can be in control of distractions in practically every situation.

Imagine a scenario like this. You have a Chromebook, an iPhone, and an Android tablet. You know each device offers its own set of tempting distractions.

Add those distractions to a blocklist on the Freedom dashboard, choose your devices, and with a single click of the “Start” button, all the selected devices are actively blocking the selected distractions.

Here’s an example of what could be blocked in the session:

  • Chromebook: all News, Sports, and Social Media sites + Email
  • iPhone: Instagram and Snapchat apps
  • Android tablet: Fortnite and YouTube

More Freedom Chrome Extensions for Additional Control

Here are three additional (free) Freedom Chrome extensions that will further help you manage distractions:

Pause: pause distracting websites before they open. Be mindful and intentional with your browsing using this simple extension.

Limit: limit your time spent on distracting sites. Limit is an extension that allows you to set time limits for distracting websites.

Читайте также:  Темы для nexus dock mac os

Insight: know how you spend your time online. Insight tracks the time you spend on websites, so you can improve your habits.

Need Help?

If you’re having any difficulty, please feel free to send us an email at [email protected] or go to Freedom Support and chat with us via the green chat bubble in the bottom right corner of the page. We’re happy to help!

Источник

How to block websites temporarily?

Is there a way to temporarily block websites in Ubuntu?

For example let’s say . Facebook (or any other website) is just available from 8pm or just for five minutes within e.g. two hours?

5 Answers 5

The tool I’d recommend is Get-Shit-Done. It edits your host file so that you cannot access blocked domains using any browser. However, it does not have a scheduler (although you could use cron for that).

Stay Focusd is Chrome Extension that does something similar.

I personally use a secondary profile in Chrome, with the Whitelist extension, so that it blocks all websites, other than absolutely necessary ones

Open Terminal ( CTRL + ALT + T ).

Type sudo -i in the input field. Check the Run in terminal option. Finally click Run button.

Type your password if necessary and press enter. Then do the following command.

You will get gedit Text Editor window.

For example, if we need to block Facebook just add the following lines just after 127.0.0.1 localhost .

By doing this, it will block the site in all browsers including Google Chrome, Chromium, Mozilla etc. In fact, you can’t access the website at all by any means.

That’s it. When you now open www.facebook.com or facebook.com, you cannot access it. To enable back Facebook, remove the lines we added from the file /etc/hosts or as Eliah Kagan said you can add a # character before the 0.0.0.1 text we added in /etc/hosts to make it a comment and to block it again just remove # character from the beginning of the line.

Example

Enabling It Back by making the line a comment :

Источник

How to Block the Access to Certain Websites on Linux

Distractions usually occurs when you are connected to the Internet.

The reason for this is social media sites such as Facebook.com and Twitter.com.

If you spend too much time on this, it will reduce your productivity.

How to block these websites to improve productivity.

This is a great way to prevent children from accessing adult content on the Internet.

In this article, we will show you how to block a website to prevent access.

This can be done in some ways and the details are below.

Method-1: How to Block a Website Access on Linux Using the /etc/hosts File

The “/etc/hosts” file is a simple text file used by all operating systems to map hostnames to IP addresses.

The file contains one line per IP address with the following information.

It is a local DNS server that is used primarily to avoid DNS resolution.

For example, a match found in the “/etc/hosts” file will be used before any DNS resolution.

In other words, the DNS resolution is not performed if the given match is found in the “/etc/hosts” file.

For example, to block “facebook.com” and “twitter.com”, it is sufficient to add the following lines to your host file.

Most of you can already use the 127.0.0.1, loopback address. It is used to establish an IP connection with the local computer.

Читайте также:  Яндекс диск 2019 для windows

So, I advise you to use 0.0.0.0, which is defined as an non-routable meta-address that can be used to refer to an invalid or unknown target.

Using 0.0.0.0 is empirically quick as there is no wait for a timeout resolution.

When you block them, it is good to restart network service and flush the DNS cache on Linux.

Now, we are going to check both websites in the browser to verify this.

Facebook.com

Twitter.com

Yes, we got the expected results as we did not access them.

Method-2: How to Block a Website Access on Linux Using iptables

Iptables is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel.

Use the following commands to block “facebook.com” using iptables on Linux.

Use the following commands to block “twitter.com” using iptables on Linux.

Method-3: How to Block Website Access on Linux Using Chomper

Chomper is a Python command-line that allows user to create a list of webistes to be blocklisted or whitelisted for specified periods of time.

This tool is especially developed to improve the user productivity on working hours by saving them from Internet distractions.

This allows you to block particular URLs as well.

Method-4: How to Block Website Access on Linux Using CTparental

CTparental is a parental control tool used to control how others can use a Linux computer.

Источник

How to block https website with iptables

I want to block some https website like youtube.com, facebook.com.

I know that we can’t block that using url rules. since the url is encrypted.

So I tried to block all DNS queries which contain the domain I want to filter. So I added the following rule:

But the youtube keep running. But after some time of inactivity (about 15 min) youtube is blocked.

Are there some explanation?

How I can force youtube to be blocked immediately?

4 Answers 4

What you are doing will have an effect, but there are several problems:

Browsers and operating systems cache DNS lookups. They don’t necessarily cause a full DNS lookup each time a site is loaded.

Some browsers may try alternate things if DNS appears blocked (such as contact its own DNS server), because they think there is a network issue. Google Chrome may do this.

Google Chrome and other browsers may soon implement «DNS over HTTPS» which means doing anything to port 53 would not have any effect, as it wouldn’t be using that for DNS at all.

Blocking by IP address will work for awhile until Youtube’s IP address changes for some reason.

Savvy users may change DNS servers unless you’ve blocked that ability administratively on your systems.

How I can force youtube to be blocked immediately?

The «right» way to do what you want is to institute a «Man-In-The-Middle» transparent HTTPS interception proxy that can filter HTTPS traffic. You then tell the proxy to block any URL with youtube.com in it.

You can’t just simply look for youtube.com on 443 as it’s encrypted, as you probably figured out.

One you can play with on a local machine to see how it works is Burp Proxy — it’s meant for testing, not managing the traffic of many users though. But will enable you to learn the concepts.

You will have to install the proxy’s SSL certificate on every machine that uses the proxy to avoid security warnings.

Источник

Оцените статью