firehol / blocklist-ipsets

ipsets dynamically updated with firehol's update-ipsets.sh script
https://iplists.firehol.org
3.16k stars 383 forks source link

Failed to extract geolite2_country on Alpine (busybox) #28

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi folks, I'm looking to deploy Alpine Linux as a firewall/filter and it this issue while running update-ipsets.sh:

                                  |
                   geolite2_country| Enabling due to --enable-all option.
                                   | 9049639/10090 mins passed, downloading...
                                   | fetch: 'http://geolite.maxmind.com/download/geoip/database ... '
                                   | HTTP/200 OK
                                   | downloaded successfully
                                   | saving downloaded file
                                   | extracting country and continent netsets...
/usr/bin/unzip: unrecognized option: j
BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.

Usage: unzip [-lnopq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]

Extract FILEs from ZIP archive

        -l      List contents (with -q for short form)
        -n      Never overwrite files (default: ask)
        -o      Overwrite
        -p      Print to stdout
        -q      Quiet
        -x FILE Exclude FILEs
        -d DIR  Extract into DIR
                                   | grouping country and continent netsets...
/usr/bin/unzip: unrecognized option: j
BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.

Usage: unzip [-lnopq] FILE[.zip] [FILE]... [-x FILE...] [-d DIR]

Extract FILEs from ZIP archive

        -l      List contents (with -q for short form)
        -n      Never overwrite files (default: ask)
        -o      Overwrite
        -p      Print to stdout
        -q      Quiet
        -x FILE Exclude FILEs
        -d DIR  Extract into DIR
                                   | aggregating country and continent netsets...
cat: can't open '*.source.tmp': No such file or directory
rm: can't remove '*.source.tmp': No such file or directory
cat: can't open '*.source.tmp.info': No such file or directory
                                   |
                                  *|  ERROR  processed file has no valid entries (zero unique IPs)
                                   |

Clearly the processor/config for geolite2_country is using a special option. I haven't yet looked into what unzip -j does. Is it realistic to see if it can be replaced with something more compatible?

Alpine Linux is built for smaller installs and focusses on security, speed and simplicity, the perfect distro for a router. It's got some things in common with OpenWRT, another platform that I guess may also hit this error as it also runs off busybox.

ghost commented 7 years ago

Just looked on my Arch machine; my unzip package on there has -j junk paths (do not make directories) (UnZip 6.00 of 20 April 2009, by Info-ZIP). There might be an easy way using sed or basename to similarly strip out paths of files being extracted?

ktsaou commented 7 years ago

I suggest to install the unzip package on alpine: https://pkgs.alpinelinux.org/contents?branch=edge&name=unzip&arch=x86_64&repo=main

update-ipsets needs also funzip which is not offered by busybox.