Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoIP selection of countries #1860

Closed
gertfriend opened this issue Oct 3, 2017 · 34 comments
Closed

GeoIP selection of countries #1860

gertfriend opened this issue Oct 3, 2017 · 34 comments
Assignees
Labels
feature Adding new functionality
Milestone

Comments

@gertfriend
Copy link

Maybe it will be possible to change the GeoIP country selection from Dropdown to multiple-selection list box sorted by continent and then by country which would be more comfortable.

@fichtner fichtner added the help wanted Contributor missing / timeout label Oct 3, 2017
@mimugmail
Copy link
Member

This really need some attention.

The sort order in Aliases is by Country Codes. Normally this should make sense, but the CC of Germany is DE. Now this is how it looks like:

image

CC of Algeria id DZ, that's why it's there.

First of all there should be a new sort order by country_name.

Also the CSV from the script /usr/local/opnsense/scripts/filter/download_geoip.py includes continent_code and continent_name

I havent digged to much in this script yet, but there could be an optimized sort order for continent_name and inside this by country_name

What do you think @AdSchellevis and @fichtner ?

@AdSchellevis
Copy link
Member

@mimugmail I agree about the sorting, but not the continent data. we use /usr/local/opnsense/contrib/tzdata/iso3166.tab for country codes, which is always available on the machine and doesn't require a download first. Unfortunately there is no continent in there.

I will prepare a fix for the sorting, and add some JS magic to replace the select for a searchable one, but that's as far as I will take this.

@fichtner
Copy link
Member

I agree that it's difficult to conjure a nice UX here for selecting whole Continents, managing exceptions within, etc...

The zone.tab file has all the info. I'll try to look at implementing it after Ad's changes.

https://github.com/Distrotech/tzdata/blob/master/zone.tab

@mimugmail
Copy link
Member

Yep, really tricky with a dropdown list. Sophos does this besides the rules, just to give you an idea:

image

@AdSchellevis
Copy link
Member

with the continent info available, optgroups (https://silviomoreto.github.io/bootstrap-select/examples/#select-boxes-with-optgroups) could be used. but selecting more items in the same row also requires changes to the filter.

@fichtner
Copy link
Member

fichtner commented Oct 15, 2017 via email

@fichtner fichtner self-assigned this Oct 15, 2017
@fichtner fichtner added feature Adding new functionality and removed help wanted Contributor missing / timeout labels Oct 15, 2017
@fichtner fichtner added this to the 18.1 milestone Oct 15, 2017
@fichtner
Copy link
Member

I think the Sophos example is good, the boxes should be multi-select and we have a fixed data so adding more fields doesn't help...

I would:

  1. Add javascript section headers checkbox to toggle whole region.
  2. Add checkboxes in each region for each country.

That way "search" can be done via browser.

Ok?

@mimugmail
Copy link
Member

And probably a checkbox of the country rules should be before or after the user ruleset

@fichtner
Copy link
Member

I don't understand that last part?

@fichtner
Copy link
Member

Like this, only pretty...

screen shot 2017-10-15 at 5 14 44 pm

@AdSchellevis
Copy link
Member

I would advise to keep it simple, within the features selectpicker kan handle by default..... The amount of work needed could grow rapidly.
This
image

can easily be combined with
image

Only challenge is to map the codes back to something comma separated and push it back to the input.

@mimugmail
Copy link
Member

With Sophos this is an own tab besides fw rules. Country rules are processed before normal rules. So if you plan to so it the same way it would be cool to decide

@fichtner
Copy link
Member

@AdSchellevis but still the dataset is fixed and a bit too big to handle from a single select picker. if we unfold to checkboxes and create CSV from there that's easy. we also don't need the multi-row approach... it's like apples and oranges. If we can render by region, we don't have to change it again. can't get more UX than what Sophos already has in terms of edit speed and field of view.

@mimugmail aliases can be used as destination or source in filter rules. they are not blocked by default and should not, so we don't need any "ordering".

@mimugmail
Copy link
Member

This would be winner against Sophos, always good to beat the commercials 👍

@AdSchellevis
Copy link
Member

@fichtner you're certainly right about the usability aspect, fitting it in just takes more time then improving what we have now.

@fichtner
Copy link
Member

Works for me, saves ok, added new validation... please test

screen shot 2017-10-15 at 8 31 03 pm

@mimugmail
Copy link
Member

987afe8 is enough or also the first one?

@fichtner
Copy link
Member

# opnsense-code core
# cd /usr/core
# make upgrade

if upgrade refuses:

# opnsense-update -t opnsense-devel

@mimugmail
Copy link
Member

I love it :)
Is this so memory hungry? I created a "europe" alias with toggle all and get:

Oct 16 10:46:10 OPNsense opnsense: /usr/local/etc/rc.filter_configure: New alert found: There were error(s) loading the rules: /tmp/rules.debug:21: cannot define table europe: Cannot allocate memory - The line in question reads [21]: table <europe> persist file "/var/db/aliastables/europe.txt"

@fichtner
Copy link
Member

how big is the file? I would say yes... /var/db/aliastables/europe.txt

@AdSchellevis
Copy link
Member

@mimugmail how is "Firewall Maximum Table Entries" set in firewall -> settings -> advanced?

@mimugmail
Copy link
Member

Since I cloned a fresh installation it was default. Bumped to 2000000 and now it's good.
I like this new approach, thank you guys 👍

@fichtner
Copy link
Member

Maybe it's time we increase the default of that value somewhere?

@AdSchellevis
Copy link
Member

could be a good idea, but chances are people still need to extend when having larger rulesets (which isn't an issue when there's enough memory available)

@L1ghtn1ng
Copy link

L1ghtn1ng commented Oct 16, 2017 via email

@AdSchellevis
Copy link
Member

no

@gertfriend
Copy link
Author

Great work and also very fast implementation. With this view GeoIP would be very much more usable. Thank you very much.

@mimugmail
Copy link
Member

Perhaps some kind of div alert when changing alias type to Geo?

@fichtner
Copy link
Member

I was thinking help text as well, or added to the docs... FAE ... frequently asked errors :D

@mimugmail
Copy link
Member

Yep, but the latest experiences showed that most people do a trial and error before posting to gh, before looking at the docs :( Perhaps a blue colored div ..

@fichtner
Copy link
Member

in 17.7.7 :)

@algato
Copy link

algato commented Oct 3, 2018

Hello,
I would like to ask for your help:

  1. "Firewall Maximum Table Entries" how can i check how many entries my table allready has (does my table allready reached the limit)

  2. which settings the WAN firewall rule should have to use the alias with the selected (blocked) countries.
    interface WAN
    Protocol any
    Source (prepared alias) blocked_countries
    Destination any

Is that correct, are that all parameters for that rule?

Should i check the checkboxes for:

  • Disable hardware checksum offload
  • Disable hardware TCP segmentation offload
  • Disable hardware large receive offload

like described in the obsolete tutorial for Geo-IP blocking using intrusion detection

Kind regard
Alex

@warnerbryce
Copy link

@algato i have the same question as you, do you have news about this ?

@mimugmail
Copy link
Member

Just reread the official docs, should all be clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality
Development

No branches or pull requests

7 participants