Your rating: None Average: 5 (21 votes)

Defender - a privacy guard for SailfishOS.

As an alternative/replacement to the Hosts Adblock, Defender uses the /etc/hosts approach  - a proven way of blocking ads, banners, 3rd party cookies, 3rd party page counters etc. by adding blocking rules to the /etc/hosts system file. Bundled with a simple cookie manager, it allows to choose from multiple sources, either from a safe GUI (which does not require root access), or by editing the configuration files.



  • Blocker entry sanitization - all entries from remote sources are sanitized in a way that should minimize the risk of their compromisation (all entries point to
  • Add more sources by editing the /etc/defender.conf file.
  • Whitelist capability - add favorite hosts to whitelist by editing the /etc/defender.conf Settings section (separate by commas)
  • Graphical interface to choose hosts sources
  • Option to update only if the device is connected to WLAN - to minimize data costs
  • Your own rules are preserved and you can still edit them and add new ones by editing /etc/hosts.editable file. Mind that for your changes to come to effect, you need to choose Update in the app itself.
  • Ability to easily disable the functionality without removing the app.
  • Simple Cookie Manager with ability to specify blacklist/whitelist of cookies to delete and to lock the cookies altogether.
  • Source code available here

Why the mixed .config + GUI approach?

This allows to easily enable and disable different sources, while still keeping your system in non-root environment.


  • Better documentation
  • More stats and logging
  • Easier command line interface
  • Cleaner code (the current one is atrocious)
  • Automated cookie removal and/or blocking
  • Split /etc/defender.conf and default sources, so the config doesn't get flushed on update


This app uses a modified version of the python-hosts library.

Sources of ad/spyware blocking rules and their websites are to be found in the application itself. Do not forget to thank/donate to their creators.


Mind that the app is still in an early version, so use with caution, as damage may occur. You have been warned. Please let me know if you experience any problems.

Data costs may apply, so check the WLAN only option to be safe from the data cost from your provider. Updating may take a long time, depending on the size of the sources.

Also, it is unlikely that the third party sources available in the app may compromise your device, but it may happen (that is why none are enabled by default). Enable only sources you trust - I am not responsible for their contents.


If you like this app, please consider a small donation:

Donate in EUR

Donate in USD

Application versions: 
File harbour-defender-0.1-2.armv7hl.rpm82.54 KB01/02/2017 - 01:38
File harbour-defender-0.1-2.i486.rpm82.56 KB01/02/2017 - 01:38
File harbour-defender-0.2-1.i486.rpm82.61 KB01/02/2017 - 01:49
File harbour-defender-0.2-1.armv7hl.rpm82.55 KB01/02/2017 - 01:49
File harbour-defender-0.3-1.armv7hl.rpm73.08 KB02/02/2017 - 01:23
File harbour-defender-0.3-1.i486.rpm73.06 KB02/02/2017 - 01:23
File harbour-defender-0.4.0-1.i486.rpm73.41 KB03/02/2017 - 01:45
File harbour-defender-0.4.0-1.armv7hl.rpm73.4 KB03/02/2017 - 01:45


  • Fix for devices without AlienDalvik
  • The ability to have different .editable files for native hosts and AlienDalvik hosts is brought back
  • Different formats of source files now supported (the support for list of addresses to block in a text file was added



  • Important fixes to packacking. Update to get the app working.
  • Landscape mode improvements



  • Fixes


  • Initial version


eson's picture

Can't make it work. App says "Updating", but nothing more happens. No hosts generated and "Updating" is stuck on screen. Tried reinstall but it did not help. Can't even find a way to kill the "Updating".

SFOS @ Jolla C



| SailfishOS (Haapajoki) (armv7hl)
[nemo@Sailfish ~]$ harbour-defender
[D] QWaylandEglClientBufferIntegration::QWaylandEglClientBufferIntegration:62 - Using Wayland-EGL
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:24: TypeError: Cannot read property 'cookies_count' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/CookiesMenuItem.qml:29: TypeError: Cannot read property 'domains_count' of undefined
[W] unknown:24 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:24: TypeError: Cannot read property 'hosts_lines' of undefined
[W] unknown:29 - file:///usr/share/harbour-defender/qml/pages/components/SourcesMenuItem.qml:29: TypeError: Cannot read property 'sources_enabled_count' of undefined
[D] :49 - Working directory: /home/nemo


nodevel's picture


thanks for the feedback. First, there's nothing wrong with the output you attached, just a normally working app.

Second, which version do you have installed? Is it 0.3?

Finally, updating can take a long time to finish, depending on the number of sources you have enabled. You cannot kill the update from the app and that is by design, as it would require root privileges and could compromise your device.

If you want to check if the update is running, you can launch top from the terminal and see if there's a python3 process with high CPU usage, if there is, then that's probably it. You can kill it from there, but you need to make sure to remove the following files afterwards:

  • /tmp/hosts
  • /home/nemo/.config/harbour-defender/update

If there is no such process, then try selecting Update now from the app again and see if it appears.

I will consider adding an option to Settings to delete these two files in case the update has failed without deleting them.

eson's picture

Yes, it's v0.3. No python3 process and I can start it again. Had it running for a moment, but it seemed to kill it self.

I'll clean up and start it all over again. Hope this time it goes better. I missed the /tmp/hosts last time.



Seems like update went ok, because there is a full /tmp/hosts, but the app gui still says "Updating", and the /etc/hosts is still empty. I only have one list so far (MVPS Hosts).


giskard's picture

I can confirm the exact same issue. SF 2.0.5 on Jolla 1.

/tmp/hosts is created, but not copied to /etc/hosts

No python process listed on top

nodevel's picture

Thanks for feedback! I will try to investigate the issue, as it works fine here.

I already have some ideas - do you have AlienDalvik installed and if you do, are the following directories present in the filesystem?

  • /system/etc
  • /opt/alien/system/etc
eson's picture

No AlienDalvik here. Never used it.

nodevel's picture

Funny thing is that I almost never used it, but have it installed just in case, so this problem escaped me.

It should be fixed in the 0.4 version. Thanks for your patience.

eson's picture

Yes, thanks! Loading lists in 0.4 is working. All this testing caused other errors, however.

Defender frontpage doesn't show blocked, lists, cookies or domains anymore. Also my cookie handeling is gone. Cookies seem to be locked, no matter what settings. Browser don't save cookies no more. Problem resist also when I remove Defender.

I locked cookies ones in Defender 0.3, but unlocked it again almost immediately. That's when this issue appeared.

My scenario was:

  1. Whitelist 4 cookies
  2. Delete all not whitelisted
  3. Lock cookies
  4. Close Defender and launch Jolla browser to check whitelisted domains (working)
  5. Reboot phone

...and this issue was a fact.

babba22's picture

Same for me, I followed exactly the same steps as eson and now defender can't access cookies database anymore

giskard's picture

No aliendalvik in my case (but I installed and removed it some time ago). I have also restored the default /etc/hosts which was manually substituted by a version with the MPV blocklist.

/etc/hosts permissions are -rw-r--r-- and is owned by root:root

I have /system/etc but not /opt/alien/system/etc

nodevel's picture

Thanks! It was the problem I suspected - I did not test it without AlienDalvik, which I should have. Version 0.4 should be up with a fix for your scenario, together with other fixes.

Thanks for the patience.

giskard's picture

I don't know why, but it looks like it's happening again. Defender can't update my hosts file. Last time it was changed was 2017-02-08. I can't even disable it and meke it restore my previous hosts file.


EDIT: Apparently resolved by reinstalling Defender.

giskard's picture

I can confirm that now it can download lists and update /etc/hosts :)

lkdhf's picture

Wonderful, thank you!

bomo's picture

Maybe a stupid question, but how to enable a certain hosts provider ? Normal and long press just open their info page.

nodevel's picture

That's not a stupid question at all, thanks for asking!

You need to tap the indicator on the left. I thought about bringing another indicator to the info page, so I can consider it for a future update.

Either way, please update to 0.3 which fixes the main functionality (generating /etc/hosts file).

eson's picture

Thanks! Great app.

nodevel's picture

I'm glad you like it!

PS: Please update to 0.3 which brings an important fix to the functionality.

DarkTuring's picture

Fantastic app, one question, how do you whitlist a cookie, when long pressing a cookie i can only remove or lock it from pulley menu, but the white listing selection is missing.

SFOS Intex Aquafish.

Alternatively in documentation could you provide a simple example of whitelisting two hosts?

nodevel's picture

Thanks for the feedback.

Currently you can only whitelist/blacklist a whole domain (by pressing the section header). Whitelisting/blacklisting individual cookies may come in a future update if there's enough demand for it.

I'll try to improve the documentation, thanks for the suggestion.


By the way, please update to 0.3 which fixes the main functionality (generating /etc/hosts file).

DarkTuring's picture

Thanks for the clarification, i upgraded.

Inidvidual cookie blooking could be interesting! Not sure this has ever been attempted, but i love the idea and your app gives great visibility of them.