Code Monkey home page Code Monkey logo

iprange's Introduction

FireHOL

http://firehol.org/

FireHOL, an iptables stateful packet filtering firewall for humans!
FireQOS, a TC based bandwidth shaper for humans!

Git

These instructions are for people who are working with the git repository. There are more general instructions starting with Upgrade Notes.

Cloning Git Repository

The github firehol repository page lists URLs which can be used to clone the repository.

After cloning you should copy the git hooks, for style checking and more:

cp hooks/* .git/hooks

Building Git Repository

You need GNU autoconf and GNU automake to be able to run:

./autogen.sh
./configure --enable-maintainer-mode
make
make install

If you don't want to have to install pandoc you can instead choose to build without documentation or manpages:

./autogen.sh
./configure --disable-doc --disable-man
make
make install

Re-run autogen.sh whenever you change configure.ac or a Makefile.am

You can run the sbin/* scripts in-situ provided you have done the configure and make steps.

Upgrade Notes

From version 2.0.0-pre6, FireHOL adds combined IPv4/IPv6 support within a single configuration.

If you are upgrading FireHOL from a version earlier than 2.0.0-pre6, please read the upgrade notes.

Installation

If you are installing the package from a tar-files release, FireHOL uses the GNU Autotools so you can just do:

./configure
make
make install

To not have files appear under /usr/local, try something like:

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make install

If your O/S does not usually have a /usr/libexec, you may want to add --libexecdir=/usr/lib to the configure.

You can get help on the options available (including disabling unwanted components) by running:

./configure --help

From version 3.0.0 it is no longer recommended to install firehol by copying files, since a function library is now used, in addition to the scripts.

Getting Started

Configuration for FireHOL goes in /etc/firehol/firehol.conf Configuration for FireQOS goes in /etc/firehol/fireqos.conf

In the examples directory, you can find examples for both programs.

To start the programs:

firehol start
fireqos start

For more details on the command-line options, see the man-pages:

man firehol
man fireqos

Read the tutorials on the website for more information and to learn how to configure the programs.

For detailed information on the configuration files, read the manual online, or start with these the man-pages:

man firehol.conf
man fireqos.conf

You may want to ensure that FireHOL and FireQOS run at boot-time. If you installed from an distribution package this will be configured in the usual way.

For a tar-file installation, the binaries can often be linked directly into /etc/init.d, since their options are SysVInit compatible. Some example systemd service files can be found in the contrib folder.

Support and documentation

The main website is http://firehol.org/.

To ask questions please sign up to the mailing list

Man pages, PDF and HTML documentation are provided as part of the package and can be found in the tarball or in your distribution's standard locations (e.g. /usr/share/doc). The latest manual is also online.

The site has a list of all services supported by FireHOL "out of the box" as well as information on adding new services.

License

Copyright (C) 2012-2017 Phil Whineray <[email protected]>
Copyright (C) 2002-2017 Costa Tsaousis <[email protected]>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

iprange's People

Contributors

alonbl avatar ktsaou avatar philwhineray 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

iprange's Issues

Max entries for ipsets

I was wondering if you could help me in understanding the wiki page for iprange.
I've been trying to understand how to best reduce my ip sets. From what I can tell an ipset can be millions of entries long and there will be no appreciable loss in speed. The only trade off is in ram usage. The larger the set the greater the ram. Do you know if that is really the case?

I have a raw country.list that is 19193 entries long, with 19 CIDRs, and takes up .48MB or ram by running
ipset list country.list
If I run iprange like this:
iprange -v --ipset-reduce 0 --ipset-reduce-entries 100000 country.list >/dev/null
I get a set that contains:
3 CIDR prefixes
64012 entries
Ram now nearing 1.5MB

I have other sets using as much as 23MB of ram, 26 CIDR prefixes, and over 90000 entries. I could reduce them further but they are going to get tremendously huge.
Do you have any thoughts on if this will slow the network down or if the only adverse effect is ram consumption?
Is there an amount of ram I should be trying to keep my sets under?

Thanks for creating such a great tool.

Specify DNS server

Hi there, question, is it possible to somehow specify the DNS server which iprange should use to resolve hostnames to IPs? I'd like it to use a DNS server different from the one configured in the host if possible...

Thanks.

Problem installing iprange

I have downloaded the tar file file from github.
Then after unzipping it, I am facing problem in make && make install

Here is the error,

make all-am
make[1]: Entering directory /home/luvpreet/Downloads/iprange-1.0.3' make[1]: Leaving directory /home/luvpreet/Downloads/iprange-1.0.3'
make[1]: Entering directory /home/luvpreet/Downloads/iprange-1.0.3' /bin/mkdir -p '/usr/local/bin' /usr/bin/install -c iprange '/usr/local/bin' /bin/mkdir -p '/usr/local/share/man/man1' /usr/bin/install -c -m 644 iprange.1 '/usr/local/share/man/man1' make[1]: Leaving directory /home/luvpreet/Downloads/iprange-1.0.3'

iprange will read integer/numeric!

This isn't directly mentioned on the wiki page, but I had a hunch and after experimenting I found out that iprange will read numeric notation directly! So something like:

iprange 18279424 -> 1.22.236.0
iprange 18279424/24 -> 1.22.236.0/24
iprange 18279424-18279679 -> 1.22.236.0/24

Pretty nifty! That's less conversion back & forth when storing IPs in numeric / integer form.

Reduce on unsorted ips generate warrning

When I use reduce with unsorted ip list, I get strange errors. (Data for example.list are bellow.)

iprange --reduce-factor 20 example.list
iprange: WARNING: invalid range reversed start=x.x.x.80 end=0.0.x.x
iprange: WARNING: invalid range reversed start=x.x.x.96 end=0.0.x.x
iprange: WARNING: invalid range reversed start=255.255.255.255 end=0.0.0.0
iprange: WARNING: invalid range reversed start=x.x.x.160 end=0.0.127.x

x seems random.

But when I provide same data into stdin, it works without error:

cat example.list | iprange --reduce-factor 20

It also works if I optimize data first:

iprange -J example.list > example2.list
iprange --reduce-factor 20 example2.list

I'm using version 1.0.3+ds-1 from debian stretch, but i'm on debian jessie, so it's possible it is somehow related.

cat > example.list <<EOF
216.144.250.150
69.162.124.226
69.162.124.227
69.162.124.228
69.162.124.229
69.162.124.230
69.162.124.231
69.162.124.232
69.162.124.233
69.162.124.234
69.162.124.235
69.162.124.236
69.162.124.237
63.143.42.242
63.143.42.243
63.143.42.244
63.143.42.245
63.143.42.246
63.143.42.247
63.143.42.248
63.143.42.249
63.143.42.250
63.143.42.251
63.143.42.252
63.143.42.253
46.137.190.132
122.248.234.23
188.226.183.141
178.62.52.237
54.79.28.129
54.94.142.218
104.131.107.63
54.67.10.127
54.64.67.106
159.203.30.41
46.101.250.135
18.221.56.27
EOF

firehol warning about iprange

I am getting this error below when I use an IP set in my firehol.conf.
I have iprange, firehol, and netdata all installed.
I am do not have "update-ipsets" installed.
I am using only the firehol_level1.netset.

ipset4 create firehol_level1 hash:net
ipset4 addfile firehol_level1 ipsets/firehol_level1.netset
blacklist4 full ipset:firehol_level1

WARNING 16@/etc/firehol/firehol.conf: blacklist4:: iprange command is not installed - ipsets will not be optimal.

I have iprange installed:

[root@host]# which iprange
/usr/sbin/iprange

It works fine on the command line.

As a workaround, I run the ipset-apply.sh script on the firehol_level1 netset, after I run "firehol start"

The way I understand it, it is best to run iprange on the raw firehol_level.netset file to optimize it?
Is that what it is trying to do when I run "firehol start" and I have an ipset in the config?

Should I manually optimize it to a new file for firehol.conf to use?
Is there a path I can specify in firehol.conf so it can find iprange?

Thanks in advance.
It's all working great, I just want to make sure I am using it most efficiently for production servers.

Output of domain resolution

Please add an option to configure the output of DNS resolution.
For example, I'd like to see which domains can't be resolved (e.g. don't exist):

github.com           140.82.118.4
dead-domain.net

By default, the program only writes A records of selected domains.

iprange "--ipset-reduce" conflicting documentation

The man page of iprage says the option --ipset-reduce has "the internal default PERCENT is 20". Yet, when you don't use a number after the option strange things happen.

For instance:

iprange -v --ipset-reduce input.set > output.set

Will sit there and wait saying:

iprange: Loading from stdin

If you move the -v after the reduce:

iprange --ipset-reduce -v input.set > output.set

It appears to work, but it does NOT output any of the verbose content that it should.

Only way to get it to work as expected is to include the percentage amount, i.e.:

iprange -v --ipset-reduce 20 input.set > output.set

If you run without the -v or percent, it just sits there (presumably waiting for stdin).

iprange --ipset-reduce input.set > output.set

So I'm not sure if it's just the documentation not being real specific (what would be point be of saying what an internal default is if you must explicitly always specify it?) or an actual bug.

cannot set CFLAGS

@alonbl if the user does:

make CFLAGS="-O3"

then it does not compile. You have to remember to do:

make CFLAGS="-O3 -pthreads"

Can we move -pthreads off the CFLAGS to allow the user overwrite optimizations?

Bug: Gives warning and ends up with duplicate IPs in output...

This is probably an edge case, but I figured still worth reporting...

I'm attaching a file combined.txt

which is a concatenation of the cymru full bogons & cidr-report bogons lists.

When you run the command iprange -v combined.txt > combined.ipset.txt

It gives the warning: iprange: WARNING: invalid range reversed start=224.0.0.0 end=0.255.255.255

.. and the end file combined.ipset.txt has loads of duplicate IPs (CIDRs) in it. If you also look at line 3073 you will see it wrote 224.0.0.0 with no CIDR. So I'm guessing the bug is something to do with the next few entries in the original file that bork the processing and it just dumps the rest of the input to output. (There was already a 0.0.0.0/8 at the beginning of the file, the one in the sample below would be the start of the 2nd concatenated file).

224.0.0.0/4
240.0.0.0/4
0.0.0.0/8

If you process them as individual files then it works just fine, ex: iprange -v cymru_full.netset cidr-report.netset > this_works.ipset

Hopefully it's an easy fix... lol

Question: How to apply ipsets

Let's say I have this example configuration, and I am using my own test ipset file, test1.netset.

ipv4 ipset create test1 hash:net
ipv4 ipset addfile test1 ipsets/test1.netset

ipv4 blacklist full ipset:test1

Let's say I have now added a new ip subnet to the file test1.netset.
What is the appropriate command to "reload" that ipset?

Is there a command to only reload the ipset?
Should I also optimize the ip set after changing it?

using --reduce-factor disables --except

This is from iprange 1.0.5_master.

First, set up two test files:

    $ cat <<EOF >in
    1.2.3.4
    1.2.3.5
    1.2.3.6
    9.9.9.6
    9.9.9.7
    9.9.9.8
    9.9.9.9
    EOF

    $ cat <<EOF >except
    1.2.3.4
    1.2.3.5
    1.2.3.6
    EOF

Without using --reduce-factor I get the expected output:

    $ iprange in --except except >out
    $ iprange in --diff out
    1.2.3.4/31
    1.2.3.6

Using any value of --reduce-factor causes the --except to be ignored:

    $ iprange in --except except --reduce-factor 0 >out
    $ iprange in --diff out
    $ iprange in --except except --reduce-factor 10 >out
    $ iprange in --diff out
    $ iprange in --except except --reduce-factor 90 >out
    $ iprange in --diff out
    $ diff in out
    $

configure error: docs not built

I'm trying to update iprange on FreeBSD ports tree from 1.0.3 to 1.0.4 and I'm getting this error on configure. Looks like the iprange.1 file is missing but I couldn't find any reference about how to create it or where to get it from.

garga@x230 ~/f/p/h/n/i/w/iprange-1.0.4 ❯❯❯ sh autogen.sh
autoreconf-2.69: Entering directory `.'
autoreconf-2.69: configure.ac: not using Gettext
autoreconf-2.69: running: aclocal --force -I m4
autoreconf-2.69: configure.ac: tracing
autoreconf-2.69: configure.ac: not using Libtool
autoreconf-2.69: running: /usr/local/bin/autoconf-2.69 --force
autoreconf-2.69: running: /usr/local/bin/autoheader-2.69 --force
autoreconf-2.69: running: automake --add-missing --copy --force-missing
configure.ac:47: installing './compile'
configure.ac:46: installing './config.guess'
configure.ac:46: installing './config.sub'
configure.ac:45: installing './install-sh'
configure.ac:45: installing './missing'
Makefile.am: installing './depcomp'
autoreconf-2.69: Leaving directory `.'
garga@x230 ~/f/p/h/n/i/w/iprange-1.0.4 ❯❯❯ ./configure
checking whether to enable maintainer-specific portions of Makefiles... no
configure: error: docs not built, use '--disable-man' or --enable-maintainer-mode

I'm using a tarball obtained from https://github.com/firehol/iprange/releases

IPv6?

I was experimenting to see what happened if I fed iprange IPv6 addresses, somewhat predictably it failed like so:

::/8
iprange: Ignoring text after hostname '' on line 1: '::/8
'
iprange: DNS: '' failed permanently: Invalid value for hints
2001:ddd:1::/48
iprange: Ignoring text after hostname '2001' on line 2: ':ddd:1::/48
'
iprange: DNS: '2001' failed permanently: Invalid value for hints

Is there any long-term plan for some level of IPv6 support? For my personal use I'm not in any hurry but I can see how it might be useful to others. Obviously the problem space is exponentially larger, so I could also understand if the answer's "never" - useful to have in the issue list nonetheless for future searchers.

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.