Code Monkey home page Code Monkey logo

freenews's Introduction

FreeNews ๐Ÿ”จ๐Ÿ’ต๐Ÿงฑ

build status

Reverse Proxy & DNS based solution to bypass paywalls written in go

Features

  • Pull from Google Cache Bypass (shoutout to 12ft.io)
  • HTTP Header based bypasses
    • AdsBot-Google User Agent
    • X-Forwarded-For Google Datacenter IP
    • Twitter t.co Referer
    • Drop Cookie & Set-Cookie
  • HTTP Body patches
    • Disable JS. Removes <script> tags
    • Inject custom html/js
  • DNS/Hosts based AdBlock
  • DNS server supports UDP & TLS (DoT)

Usage

  1. Tell your devices to use your own DNS server
  2. Go to free.news
  3. Download and install CA file (apps not Wi-Fi)
  4. Profit

How?

  • ./freenews spawns a DNS and a HTTP server (and TLS versions of it ofc)
  • You install a custom CA on your device
  • Your device sends DNS querys to your own DNS. If the site is on your bypass whitelist the server will respond with its own public IP, otherwise it will forward to an upstream DNS like 1.1.1.1
  • Your phone then connects to the HTTP reverse proxy mirror that you own
  • Freenews HTTP server returns the unpaywalled version

How to install ?

  • Host should have port 53/UDP, 80,443,853/UDP open (DNS ports can be changed)
  • If port 53 is blocked try to disable your local DNS server ex: systemctl stop systemd-resolved

Docker

Requirements:

  • Docker & docker-compose
  1. mkdir freenews && cd freenews
  2. Get our docker-compose
    curl -O https://raw.githubusercontent.com/fipso/freenews/main/docker-compose.yml
  3. Run it sudo docker-compose up -d
  • Check logs sudo docker-compose logs --follow
  • Update sudo docker-compose pull && sudo docker-compose up -d
  • Add hosts: edit config.toml and sudo docker-compose restart

Build it yourself

Requirements:

  • Go 1.18+
  • Currently only Linux is tested (Windows, macOS, etc... should work)
  1. git clone https://github.com/fipso/freenews.git
  2. cd freenews
  3. go build . && chmod +x freenews
  4. sudo setcap CAP_NET_BIND_SERVICE=+eip freenews (Optional. Allows binding low ports as normal user.)
  5. ./freenews

Auto Start (systemd):
If you choose docker you obviously dont need this.
Create freenews.service at /lib/systemd/system/.
Example Service:

[Unit]
Description=FreeNews DNS & Reverse Proxy

[Service]
User=<some non root user>
WorkingDirectory=/home/<user>/...
ExecStart=/home/<user>/.../freenews
# DoT & AdBlock example:
#ExecStart=/home/<user>/.../freenews -dotDomain <your domain> -blockList <blocklist file>
Restart=always

[Install]
WantedBy=multi-user.target

How to use DNS over TLS ?

DNS over TLS (DoT) is a new privacy focused way to use normal DNS using a TLS socket. To make this work with this project, you have to get yourself a domain and SSL cert. Place the cert (Copy fullchain.pem instead of cert.pem to dot_cert.pem if you are using Let's Encrypt) file and its private key at cert/dot_cert.pem and cert/dot_key.pem. Start freenews with the -dotDomain <your domain> flag to enable DoT. Make sure to open port 853/UDP.

How do I change the DNS on mobile ?

Android: Use one of the following:

  • Recommended: Use private DNS option (requires DoT)
  • Wi-Fi Settings > Use static IP > DNS 1
  • Use a 3rd party app to use DNS or DoT

IOS:

  • Recommended: Generate a DNS profile (requires DoT)

How to add hosts to the unpaywall list ?

You can add new hosts to the list by appending a [[host]] block to the config.toml file.

How do I enable AdBlock ?

  1. Download a DNS blocklist
    ex: curl -O https://raw.githubusercontent.com/hagezi/dns-blocklists/main/domains/light.txt
  2. Start with -blockList param
    ex: ./freenews -blockList light.txt

We currently redirect all blocked domains to 127.0.0.1

TODO

  • Fix DNS over TLS
  • Add docker image & instructions
  • Add DNS based AdBlock
  • Add non root running instructions
  • Allow TCP connections
  • Improve code quality and comments
  • Provide better usage instructions
  • More config options
  • Make flags overridable by TOML config

Credits

Star History

Star History Chart

freenews's People

Contributors

anacrolix avatar fipso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

freenews's Issues

Idea: Replace DNS feature with CoreDNS

The current DNS implementation lacks:

  • Automatic Let's Encrypt ACME
  • Stability

Because I want to keep stuff simple and dont reinvent the wheel I am thinking about dropping the DNS feature from freenews and instead do one of the following:

  • Build a CoreDNS plugin
  • Generate a CoreDNS Corefile from code
  • Use some other DNS lib
  • (Fix my own DNS code and add features I want)

... add more reasons to switch to coreDNS

Core DNS Features:

  • Plugin API
  • DoT
  • DoH
  • DNS over Quic
  • DNS over gRPC
  • dns forwarding

I also think integrating other DNS MITM based services like PiHole/AdGuard is way easier with CoreDNS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.