Showing posts with label Linux Mint. Show all posts
Showing posts with label Linux Mint. Show all posts

Thursday, March 12, 2020

Securing DNS Queries using Stubby (DNS over TLS) and DNSMASQ (DNS cache)

stubby installation and setup


By default DNS traffic is insecure and runs unencrypted over port 53. Here you'll find detailed instructions about how to configure your Linux system with Stubby DNS resolver in the DNS over TLS mode and also how to configure dnsmasq as a caching DNS server.
It's relevant for Linux Mint Cinnamon, XFCE and Mate 19 and later, Xubuntu, Ubuntu 18.04 and later, Debian 10 (Buster) and later, and other distributions with Stubby in its repositories. Otherwise you need to compile Stubby from source.

[1]
Enter in the terminal:

sudo apt install stubby

[2]
Verify the status of the installed service:

systemctl status stubby


[3]
Verify that stubby is listening on TCP and UDP ports both on IPv4 and IPv6:

sudo netstat -lnptu | grep stubby


If the netstat command is not found in your system, install net-tools:

sudo apt install net-tools

[4]
Do NOT edit /etc/resolve.conf file to change the name server - leave it in its original state.
Note: /etc/resolve.conf may be a symbolic link to the file /run/NetworkManager/resolv.conf, generated by NetworkManager.

[5]
Click the Network Manager icon on the upper-right corner and select Network settings. Then click Wired settings icon (i.e. your current network).
Select IPv4 tab.
To prevent the system from getting DNS server address from your router, switch DNS Automatic button to OFF.
Enter 127.0.0.1 in the DNS field and click Apply button.

Repeat the same for all working Wi-Fi connections.

Note for Linux Mint XFCE and MATE : On the IPv4 tab set DHCP Method: to Automatic (DHCP) addresses only

[6]

Restart NetworkManager

sudo systemctl restart NetworkManager

[7]
Check Network Settings. You'd see that DNS is 127.0.0.1


Stubby should spread the DNS queries among several DNS Privacy test servers, dnsovertls.sinodun.com, dnsovertls1.sinodun.com and getdnsapi.net, provided in the the default configuration file stubby.yml. Note that this file contains both IPv4 and IPv6 addresses. For the sake of this post, IPv6 was set to OFF in the NetworkManger settings.

[8]
Edit the stubby.yml configuration file to add the DNS server that you want to use. 

sudo nano /etc/stubby/stubby.yml

Go to the line upstream_recursive_servers: and add the following after this line and above other DNS servers:

For Cloudflare DNS over TLS server:

#CloudFlare servers
- address_data: 1.1.1.1
tls_auth_name: "cloudflare-dns.com"
- address_data: 1.0.0.1
tls_auth_name: "cloudflare-dns.com"
#

For Google DNS over TLS server:

# Google
- address_data: 8.8.8.8
tls_auth_name: "dns.google"
- address_data: 8.8.4.4
tls_auth_name: "dns.google"
#

Note: The code copied from Blogspot pages can be corrupted (in spite of the code tag). Double-check copy-paste result. Anyway you can find these Cloudflare and Google lines further down in the stubby.yml commented out. Just move them up and remove the #.

Then change the line:
round_robin_upstreams: 1
to
round_robin_upstreams: 0

Save the file stubby.yml.
If round_robin_upstreams option set to '1' the servers are loadbalanced, if round_robin_upstreams set to '0' only the first DNS server is used.

[9]
Restart stubby:

sudo systemctl restart stubby

Cloudflare test page:
https://www.cloudflare.com/ssl/encrypted-sni/

[10]
To be sure we are using port 853 and DNS server 1.1.1.1 install Wireshark

sudo apt install wireshark
sudo adduser your_user_name wireshark


Log out and log in to apply the changes.
Start Wireshark, select curent network interface, enter "port 853" in the filter field and click the left icon on the toolbar to start the capture.
A quick test can be done by using dig. Enter in the terminal:

dig A linuxmint.com

You can see in the Wireshark main window that request and answer are encrypted and we are using server 1.1.1.1 and port 853:



[11]
All is working now and you can set up the DNS cache by installing and configuring a separate dns cacher, if any.


dnsmasq installation and setup


[1]
sudo apt install dnsmasq

[2]
sudo nano /etc/default/dnsmasq

Verify these two lines and save the file:

ENABLED=1
IGNORE_RESOLVCONF=yes

[3]
sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.orig

sudo nano /etc/dnsmasq.conf

Delete the content of  dnsmasq.conf and insert in it these lines:

#
# Configuration file for dnsmasq acting as a caching nameserver.
#
# no-hosts = to ignore /etc/hosts
#
no-hosts
#
# no-resolv = not to use /etc/resolv.conf
# no-resolv
server=127.0.0.1#53000
listen-address=127.0.0.1
interface=lo
bind-interfaces

[4]
sudo nano /etc/stubby/stubby.yml

Change two lines under listen_addressesand save the file:

before:
listen_addresses:
  - 127.0.0.1
  -  0::1

after:
listen_addresses:
- 127.0.0.1@53000
- 0::1@53000

[5]
sudo systemctl restart stubby.service

[6]
sudo systemctl restart dnsmasq.service


[TEST]
Enter the command:

dig A wireshark.com


Repeat the command:

dig A wireshark.com


Note Query times: 12 msec and 0 msec

Sunday, September 23, 2018

Firefox ESR 52 : End of Support Life and Legacy Extensions

By closing support to Firefox 52.9 ESR this September, Mozilla finally abandoned all XUL overlay, bootstrap and jetpack extensions. Firefox ESR 52 is the final release that is compatible with legacy add-ons. Simultaneously Mozilla will start to disable legacy add-ons on addons.mozilla.org. All classical (legacy) add-on versions will be disabled in October, 2018 and won't be available anymore. Once this happens, users will no longer be able to download their extensions. That's because Mozilla folks are disabling add-ons' versions.


https://blog.mozilla.org/addons/2018/08/21/timeline-for-disabling-legacy-firefox-add-ons/

To restore Firefox 52.9 ESR after its automatic update to Firefox 60.x

1. Download
Windows
https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/win64/en-US/Firefox%20Setup%2052.9.0esr.exe
https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/win32/en-US/Firefox%20Setup%2052.9.0esr.exe
Linux:
https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/linux-x86_64/en-US/firefox-52.9.0esr.tar.bz2
https://ftp.mozilla.org/pub/firefox/releases/52.9.0esr/linux-i686/en-US/firefox-52.9.0esr.tar.bz2
https://www.mozilla.org/en-US/firefox/organizations/

2. Installation and Profiles
Set the update preferences to "Never check for updates to prevent autoupdate to Firefox 60 and later.

This method works in Linux Mint Cinnamon and with slight variations in many Ubuntu and Debian based systems:

a.)
Extracting tarball
If directory /opt doesn't exist:
sudo mkdir /opt
Open terminal in the Download directory and extract archive to /opt:
sudo tar -xvjf firefox-52.9.0esr.tar.bz2 -C /opt
(Replace firefox-52.9.0esr.tar.bz2 file name for your version)

b.)
Linking the new Firefox ESR
sudo ln -s /opt/firefox/firefox /usr/bin/firefox-esr52

c.)
Creating a shortcut
Right-click on the Desktop and choose Create a new launcher here...
(or edit your system menu directly )
In the Launcher Properties window browse from the Command field to /usr/bin/firefox-esr52
In the Name field enter Firefox-ESR52
Click on the generic icon on the left and browse to /opt/firefox/browser/icons/mozicon128.png and select it, then click OK.
Press OK to Would you like to add this launcher to the menu also?

This will create a copy of Firefox ESR alongside your current Firefox browser. You may add the Firefox ESR launcher to the Panel.

d.)
Profile
To use Firefox ESR 52.x and Firefox Quantum intermittently you need to create separate profiles directories and edit your profiles.ini accordingly:

/home/user/.mozilla/firefox/profiles.ini

To start both versions simulateously use --no-remote switch:
ESR52
--no-remote -p ESR52
Quantum
--no-remote -p Quantum
(You need to edit Firefox Quantum menu launcher)

Sample of ini file:

[General]
StartWithLastProfile=0

[Profile0]
Name=ESR52
IsRelative=1
Path=ESR52
Default=0

[Profile1]
Name=Quantum
IsRelative=1
Path=Quantum
Default=0


3. Save compatible extensions (ADD-ONs) locally for future use to install your add-ons later from file.
All legacy add-on versions will be disabled on addons.mozilla.org in October 2018.


Example:

Search for noscript at https://addons.mozilla.org/en-US/firefox/

https://addons.mozilla.org/en-US/firefox/addon/noscript/

Scroll down to Version History
Click See all versions
Go back to the compatible version (look for the green button)
Click to install or save link as the *.xpi file

Some popular or useful extensions:

https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/
https://addons.mozilla.org/en-US/firefox/addon/blank-your-monitor-easy-readin/
https://addons.mozilla.org/en-US/firefox/addon/classicthemerestorer/
https://addons.mozilla.org/en-US/firefox/addon/colt/
https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/
https://addons.mozilla.org/en-US/firefox/addon/ghostery/
https://addons.mozilla.org/en-US/firefox/addon/lastpass-password-manager/
https://addons.mozilla.org/en-US/firefox/addon/noscript/
https://addons.mozilla.org/en-US/firefox/addon/privacy-badger17/
https://addons.mozilla.org/en-US/firefox/addon/quickproxy/
https://addons.mozilla.org/en-US/firefox/addon/refcontrol/
https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/
https://addons.mozilla.org/en-US/firefox/addon/a-cookie-manager/
https://addons.mozilla.org/en-US/firefox/addon/add-to-search-bar/
https://addons.mozilla.org/en-US/firefox/addon/clear-flash-cookies/
https://addons.mozilla.org/en-US/firefox/addon/context-search/
https://addons.mozilla.org/en-US/firefox/addon/cookie-autodelete/
https://addons.mozilla.org/en-US/firefox/addon/cookie-quick-manager/
https://addons.mozilla.org/en-US/firefox/addon/cookies-manager-plus/
https://addons.mozilla.org/en-US/firefox/addon/edit-cookie/
https://addons.mozilla.org/en-US/firefox/addon/find-replace-for-text-editing/
https://addons.mozilla.org/en-US/firefox/addon/its-all-text/
https://addons.mozilla.org/en-US/firefox/addon/pinger/
https://addons.mozilla.org/en-US/firefox/addon/save-text-to-file/
https://addons.mozilla.org/en-US/firefox/addon/session-manager/
https://addons.mozilla.org/en-US/firefox/addon/tab-mix-plus/
https://addons.mozilla.org/en-US/firefox/addon/tab-session-manager/
https://addons.mozilla.org/en-US/firefox/addon/transliterator/
Autofill Forms
Certificate Patrol
ChatZilla
Clear Fields
deduplicate-tabs
Disable Ctrl-Q and Cmd-Q – Add-ons for Firefox
DownThemAll!
Form History Control
https://formhistory.blogspot.com/
FoxyProxy Basic
FoxyProxy Standard
Greasemonkey
HTTP Header Live
Image Zoom
infoRSS
Pale Moon: infoRSS Reloaded
Keybinder
Keybinder (github)
Live HTTP Headers
Lock The Text
New Tab in Tab Context Menu
Private Tab
Session Resurrection
SQLite Manager
Stylus
Tabboo - Session Manager
Tab Mix Plus
Torrent Status Tool


4. Alternative browsers that supports legacy Add-Ons
So, you can either use Firefox 52 ESR or/and several other browsers that support the XUL add-on interface:


Pale Moon
https://www.palemoon.org/
Basilisk
https://www.basilisk-browser.org/ 
WaterFox
https://www.waterfoxproject.org/
SeaMonkey
https://www.palemoon.org/

Wednesday, March 8, 2017

Installing Pale Moon and Firefox ESR browsers in Linux Mint and Windows





1.

Introduction (Windows and Linux related)


March, 2017

The NPAPI plug-in support has been removed from Firefox 52 (with the exception of Adobe Flash). Some of the plugins that will no longer load include Java, Microsoft Silverlight, Adobe Acrobat etc. In case you’re not yet ready for this to happen and require NPAPI plug-ins, Firefox Extended Support Release (Firefox ESR) will keep those plug-ins support enabled until May 2018.

As an alternative, you may install the Pale Moon browser. Pale Moon is an open-source browser forked from Firefox. It has the fully customizable interface similar to Firefox 28. Pale Moon uses Goanna engine, which is a fork of Firefox’s Gecko. A good number of Firefox extensions will work in Pale Moon thanks to its Firefox extension compatibility mode, though the two browsers are not the same, and sometimes you will have to check the list of add-ons with known compatibility issues and possible workarounds here: https://addons.palemoon.org/incompatible/ (Pale Moon will continue to support XUL and XPCOM based add-ons, contrary to Mozilla’s plan to deprecate them in Firefox 57.)

In the standard Firefox versions 52, 53 and 54 the user can turn on NPAPI plugin support using about:config (Nevertheless, please note that in Firefox 55 and later the ability to restore NPAPI plugin support has been removed completely.)  

Here is how it can be done:

1.
Open a new tab in Firefox and enter the following text in the address bar:

about:config

Confirm that you will be careful if a warning message appears for you.

2.
Create a new boolean option and name it plugin.load_flash_only

3.
Set the plugin.load_flash_only option to false.

4.
Restart Firefox.
 

Background  information

Most of add-ons will cease working with Firefox:
https://blog.mozilla.org/addons/2016/11/23/add-ons-in-2017/


The Road to Firefox 57 – Compatibility Milestones(post and comments):
https://blog.mozilla.org/addons/2017/02/16/the-road-to-firefox-57-compatibility-milestones/



2.

Installing Firefox ESR in Windows


Just download and run Firefox ESR setup file for your system and language from this page:
https://www.mozilla.org/en-US/firefox/organizations/all/


3.

Installing Firefox ESR in Linux Mint


1. 
Download
Please download the latest Firefox ESR from here:
https://www.mozilla.org/firefox/organizations/all.html

For the US English ESR installer these urls could be pasted into the location bar of a browser:

Linux (64bit)
https://download.mozilla.org/?product=firefox-esr-latest&os=linux64&lang=en-US
Linux (32bit)
https://download.mozilla.org/?product=firefox-esr-latest&os=linux&lang=en-US
Windows (64bit)
https://download.mozilla.org/?product=firefox-esr-latest&os=win64&lang=en-US
Windows (32bit)
https://download.mozilla.org/?product=firefox-esr-latest&os=win&lang=en-US
OS X
https://download.mozilla.org/?product=firefox-esr-latest&os=osx&lang=en-US

Current Firefox ESR release with non-flash plugins re-enabled (they are disabled in the regular 52.0 and later releases) :

firefox-52.7.3esr.tar.bz2 (February 2018)

FTP link:
https://ftp.mozilla.org/pub/firefox/releases/52.7.3esr/

Expected end-of-life Firefox 52.x ESR branch: 2Q 2018


Please be sure to download the appropriate archive that matches the architecture of your OS and language. So, use linux-x86_64 (64-bit OS) or linux-i686 (32-bit OS) directory.

2.
Extracting tarball

If directory /opt doesn't exist:
sudo mkdir /opt

Open terminal in the download directory and extract archive to /opt:
sudo tar -xvjf firefox-52.7.3esr.tar.bz2 -C /opt

Just replace firefox-52.7.3esr.tar.bz2 file name if newer version is available

3.
Linking the new Firefox ESR

sudo ln -s /opt/firefox/firefox /usr/bin/firefox-esr

4.
Creating a shortcut

Right-click on the Desktop and choose Create a new launcher here...
In the Launcher Properties window browse from the Command field to /usr/bin/firefox-esr
In the name field enter Firefox-ESR
Click on the generic icon on the  left and browse to /usr/share/pixmaps/ and select the firefox.png icon, then click OK.
Press OK to Would you like to add this launcher to the menu also?


This will create a copy of Firefox ESR alongside your current Firefox browser. You may add the Firefox ESR launcher to the Panel and remove from the Panel a standard Firefox launcher.  

5.
Profile
Please note that till version 56.x there is no need to export add-ons and bookmarks, as both versions may use the same profile, located in /home/user/.mozilla/firefox/ , named something like xyz0xyz.default

There are substantial changes in Firefox 57 profile. To use Firefox ESR 52.x and Firefox 57 Quantum intermittently you need to create separate profiles directories and edit your profiles.ini accordingly: 

/home/user/.mozilla/firefox/profiles.ini
StartWithLastProfile=0
 
To start both versions simulateously use --no-remote switch:
Firefox --ProfileManager --no-remote

If Firefox Quantum messed up with your old add-ons, to bring them back, set in about:config to false the preference extensions.blocklist.enabled and, if neccesary, reinstall old versions of add-ons.



 


Sample of ini file
[General]
StartWithLastProfile=0

[Profile0]
Name=ESR
IsRelative=1
Path=ESR
Default=1
[Profile1]
Name=Quantum
IsRelative=1
Path=Quantum


Shortcut command for Firefox Quantum
firefox --no-remote -P "Quantum"

Shortcut command for Firefox ESR 52.x
/usr/bin/firefox-esr.52 --no-remote -P "ESR"


4.

Installing Pale Moon browser in Windows


Just download and execute a file from these pages:
Pale Moon - portable
http://www.palemoon.org/palemoon-portable.shtml
Pale Moon Windows 32-bit
http://www.palemoon.org/palemoon-win32.shtml
Pale Moon Windows 64-bit
http://www.palemoon.org/palemoon-win64.shtml

Installing Pale Moon browser in Linux Mint


1.
Download a tar.bz2 tarball from here:

http://linux.palemoon.org/download/mainline/
 

Please be sure to download the appropriate archive that matches the architecture of your OS. Current Pale Moon for Linux version is 27.9.0 (March 2018).

2.
Extract the tarball anywhere you like and execute the "palemoon" file inside it. Or follow the instructions below if you want to install manually.


If directory /opt doesn't exist:
sudo mkdir /opt 

For 64-bit OS:


Open terminal in download directory and extract the archive into /opt:

sudo tar -xvf palemoon-27.9.0.en-US.linux-x86_64.tar.bz2 -C /opt

Just replace
palemoon-27.9.0.en-US.linux-x86_64.tar.bz2 file name if a newer version is available


For 32-bit OS:

Open terminal in download directory and extract the archive into /opt:

sudo tar -xvf palemoon-27.9.0.en-US.linux-x86_64.tar.bz2 -C /opt

Just replace
palemoon-27.9.0.en-US.linux-x86_64.tar.bz2 file name if a newer version is available


3.
Create a symbolic link /usr/bin/palemoon that points to /opt/palemoon/palemoon:

sudo ln -s /opt/palemoon/palemoon /usr/bin/palemoon

Icons:

sudo ln -s /opt/palemoon/browser/chrome/icons/default/default16.png /usr/share/icons/hicolor/16x16/apps/palemoon.png
sudo ln -s /opt/palemoon/browser/chrome/icons/default/default32.png /usr/share/icons/hicolor/32x32/apps/palemoon.png
sudo ln -s /opt/palemoon/browser/chrome/icons/default/default48.png /usr/share/icons/hicolor/48x48/apps/palemoon.png
sudo ln -s /opt/palemoon/browser/icons/mozicon128.png /usr/share/icons/hicolor/128x128/apps/palemoon.png

4.
Creating a shortcut:

Right-click on the Desktop and choose Create a new launcher here...
In the Launcher Properties window browse from the Command field to /usr/bin/palemoon
In the name field enter Pale Moon
Click on the generic icon on the left and browse to /usr/share/icons/hicolor/48x48/apps/ and choose the palemoon.png icon, then click OK.
Press OK to Would you like to add this launcher to the menu also?

That's it. 



About copying existing Firefox profile to Pale Moon
It is recommended you export your bookmarks in Firefox and import them in Pale Moon, and otherwise start fresh.
Extensions are best re-installed on Pale Moon anew.
Recomended extensions:
uBlock Origin
NoScript