Crowdsec packages for OpenWrt

Hello

Package crowdsec-firewall-bouncer is missing in menuconfig in master branch
with firewall4 and if I understand correctly there is no package called nftables?

  48 define Package/crowdsec-firewall-bouncer
  49 $(call Package/crowdsec-firewall-bouncer/Default)
  50   DEPENDS:=@(PACKAGE_iptables||PACKAGE_nftables) \
  51         $(GO_ARCH_DEPENDS)
  52 endef

Edited, sorry I read to fast, I miss the point :innocent:

There is a waiting PR...
still in review from weeks...

But I don't understand ?!
I have it on the menuconfig...
Capture d’écran du 2022-02-16 21-37-01

I will check !

Thanks for the feedback

This is a depends with no default...
You need one of the both !

nftables, when using opkg install nftables, is installed with the package nftables-json...

root@STARGATE:~# opkg info nftables-json
Package: nftables-json
Version: 0.9.6-2
Depends: libc, kmod-nft-core, libnftnl11, jansson4
Provides: nftables
Status: install user installed
Section: net
Architecture: aarch64_cortex-a53
Size: 240011
Filename: nftables-json_0.9.6-2_aarch64_cortex-a53.ipk
Description: nftables userspace utility with JSON support
Installed-Time: 1645044711


this is true.

Okay, what is true ?

What is your OpenWrt release ?

I have both shown and available on MVEBU for 21.02.x

I have personally no free time, for now, to help more on this development at soon.

I know already 22.x come soon...
May be CrowdSec will be trashed !
I can also shared with you that I am in talk with CrowSec Company to been sponsored on this upstreaming, and for now this not in them urgents need because of too few users impact !
I also feel that the problem is more simple than this, because enhancement may get more users, but the Development team have to defend this view to Financial and Managers and I completly understand this loop-lock-up AGAIN !
I am already in talk and looking for sponsorship to get more times in this upstream of CrowdSec components and more security development I have in the pipe.
It's in my TODO and I will, soon, because I need them for my own projects.

About some more of OpenWrt Pull Request tries and History.

All recent tried where stopped by OpenWrt developers because of :

  • too few users,
  • too "complete" addition

The inclusion of CrowdSec were very difficult at the first :

  • I get success in have them in 21.02.x
  • I get a little success to enhance
  • I get a lot of aggressive feedback

I already choose my own professional direction that you can look and afford on my own website, Solutions always give more than Problems, Experiment always get more than Discourse.
I can say that you can afford my own services if you need more, and more quickly, but I have also already been censored because of sharing Public articles about OpenWrt afford in a commercial magazine, so it was promotion (I get nothing from the numbers of magazines sell of my own wrote an article ! Nothing more than so few buck from a so huge work that vulgarization of technical solutions require...) Be sure that the magazine also do no more care of OpenWrt, because it is more and more publicly shown as a too complicate and obfuscate system from main stream attentions. How can we help on this ?

I use them enhancements locally, may be I will proposed them on a own forks.
LEDE strikes again on OpenWrt !? (I already ask for helps and advises...)

@OPENWRT TEAM please do not CENSORE this topic, It is not an aggressive subject in any way.
I really care about all and already proof it many times.
How can I do more and better is only the one more try reason of this out of technical answer...
Get in touch directly by email or look about all on my own website.
Thanks,
Gérald Kerma / erDoukki / Gandalf /
CyberMind

@erdoukki Firstly, I want to thank you for your time and effort for the work you have done and the same goes for everyone have put in time and effort to make OpenWRT better tool. I understand the frastruation and the needs to balance with personal life and free work. so Thank you.

Lastly.. confirming I was using using 22.02 and the packages are avaliable and working. Since upgrade to 22.03.0-RC1 the bouncer package does not appear for arm_cortex-a9_vfpv3-d16.

https://downloads.openwrt.org/releases/22.03.0-rc1/packages/arm_cortex-a9_vfpv3-d16/packages/

I've manaully download the bouncer package from 22.02 and seems to be working as expected. I believe from 22.03 onwards OpenWRT have switched from iptable to nftable.

My comment was referring to @aGentti86's post on Feb 17

Package crowdsec-firewall-bouncer is missing in menuconfig in master branch
with firewall4 and if I understand correctly there is no package called nftables?

Additionally I have not being able to install crowdsec package in the past, all it does is fill up the remaining space I have on the router and quits. I found just install crowdsec-firewall-bouncer with crowdsec installed on a different server works just fine.

Anyways.. I'll check out your website and all the best.

Cheers.

Leor

What's the deal with Firewall4 and Crowsec, shoud we use lua-cs-bouncer instead firewall-bouncer ?
For me there was an error while installing , but the crowdsec kinda managed to install and connect with app.crowdsec.net, but it dosn't respond on 192.168.1.1:8080 is shoud be happenning ?
Also i'am using Nginx-ssl 1.21.3

TP-Link Archer A7 v5
OpenWrt SNAPSHOT r19656-0ffb6deaaa / LuCI Master git-22.126.42175-8583efb
5.10.115

1: nl80211_recv_beacons->nl_recvmsgs failed: -5
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.527740] cscli invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.537689] CPU: 0 PID: 5182 Comm: cscli Not tainted 5.10.115 #0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.544059] Stack : 807e0000 806d64dc 00000000 00000000 822dfbfc 80920000 80760000 806aefb0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.552825]         824f2c20 8075fe47 809232d0 0000143e 00000000 00000001 822dfbb0 06bfcf56
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.561480]         00000000 00000000 806aefb0 822dfa50 ffffefff 00000000 00000000 ffffffea
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.570179]         000000f5 822dfa5c 000000f5 80765a68 80000000 822dfd34 824f0520 00000000
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.578889]         00000000 00000000 00100cca 00000840 00000018 8038df84 00000000 80920000
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.587764]         ...
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.590662] Call Trace:
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.593267] [<80066ea4>] show_stack+0x30/0x100
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.597895] [<80154b6c>] dump_header+0x58/0x1b8
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.602994] [<801553f8>] oom_kill_process+0x1b8/0x1c0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.608455] [<80155da4>] out_of_memory+0x20c/0x394
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.613627] [<80198a60>] __alloc_pages_nodemask+0x8e4/0xc7c
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.619395] [<80151774>] pagecache_get_page+0x148/0x438
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.624831] [<80153584>] filemap_fault+0x7a0/0x968
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.630049] [<819ad978>] ext4_filemap_fault+0x34/0xa48 [ext4]
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.636296] [<8017d6c8>] __do_fault+0x3c/0x150
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.640954] [<80182d34>] handle_mm_fault+0x828/0xdec
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.646150] [<80070384>] do_page_fault+0x104/0x4ac
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.651112] [<8007580c>] tlb_do_page_fault_0+0x10c/0x114
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.656872]
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.658468] Mem-Info:
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032] active_anon:4131 inactive_anon:12451 isolated_anon:0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032]  active_file:10 inactive_file:285 isolated_file:19
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032]  unevictable:0 dirty:0 writeback:0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032]  slab_reclaimable:358 slab_unreclaimable:2080
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032]  mapped:2 shmem:4231 pagetables:157 bounce:0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.661032]  free:4017 free_pcp:0 free_cma:0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.693775] Node 0 active_anon:16524kB inactive_anon:49804kB active_file:40kB inactive_file:1140kB unevictable:0kB isolated(anon):0kB isolated(file):76kB mapped:8kB dirty:0kB writeback:0kB shmem:16924kB writeback_tmp:0kB kernel_stack:560kB all_unreclaimable? yes
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.718358] Normal free:16036kB min:16384kB low:20480kB high:24576kB reserved_highatomic:0KB active_anon:16524kB inactive_anon:49804kB active_file:40kB inactive_file:1140kB unevictable:0kB writepending:0kB present:131072kB managed:121796kB mlocked:0kB pagetables:628kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.747914] lowmem_reserve[]: 0 0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.751354] Normal: 189*4kB (UME) 66*8kB (UME) 52*16kB (UME) 26*32kB (ME) 8*64kB (ME) 14*128kB (UME) 4*256kB (UM) 1*512kB (U) 7*1024kB (UME) 1*2048kB (U) 0*4096kB = 16004kB
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.767768] 4545 total pagecache pages
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.771649] 0 pages in swap cache
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.775101] Swap cache stats: add 0, delete 0, find 0/0
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.780882] Free swap  = 0kB
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.783898] Total swap = 0kB
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.786870] 32768 pages RAM
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.789774] 0 pages HighMem/MovableOnly
Fri May 20 19:14:09 2022 kern.warn kernel: [38705.794324] 2319 pages reserved
Fri May 20 19:14:09 2022 kern.info kernel: [38705.797578] Tasks state (memory values in pages):
Fri May 20 19:14:09 2022 kern.info kernel: [38705.802481] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Fri May 20 19:14:09 2022 kern.info kernel: [38705.811982] [    653]    81   653      333       25    20480        0             0 ubusd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.821168] [    654]     0   654      249       10    20480        0             0 askfirst
Fri May 20 19:14:09 2022 kern.info kernel: [38705.829943] [    690]     0   690      277       14    16384        0             0 urngd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.838884] [   1263]   514  1263      335       37    20480        0             0 logd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.847476] [   1317]     0  1317      582       76    20480        0             0 rpcd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.855983] [   1382]     0  1382      302       12    20480        0             0 dropbear
Fri May 20 19:14:09 2022 kern.info kernel: [38705.864763] [   1538]     0  1538      664       25    16384        0             0 hostapd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.873414] [   1539]     0  1539      664       25    16384        0             0 wpa_supplicant
Fri May 20 19:14:09 2022 kern.info kernel: [38705.882693] [   1564]   101  1564     1130       64    24576        0             0 hostapd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.891318] [   1565]   101  1565     1095       28    24576        0             0 wpa_supplicant
Fri May 20 19:14:09 2022 kern.info kernel: [38705.901033] [   1605]     0  1605      458       46    20480        0             0 netifd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.910019] [   1663]     0  1663      385       28    20480        0             0 odhcpd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.919146] [   1726]     0  1726      329       14    20480        0             0 crond
Fri May 20 19:14:09 2022 kern.info kernel: [38705.928266] [   1797]     0  1797     1031       50    20480        0             0 uhttpd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.937096] [   2228]     0  2228      327       11    16384        0             0 udhcpc
Fri May 20 19:14:09 2022 kern.info kernel: [38705.946041] [   2229]     0  2229      281       14    16384        0             0 odhcp6c
Fri May 20 19:14:09 2022 kern.info kernel: [38705.955227] [   2256]     0  2256      664       26    20480        0             0 ntpd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.964026] [   2262]   123  2262      327       11    16384        0             0 ntpd
Fri May 20 19:14:09 2022 kern.info kernel: [38705.972619] [   3671] 65536  3671     3703     1691    32768        0             0 unbound
Fri May 20 19:14:09 2022 kern.info kernel: [38705.981255] [   4898]     0  4898      307       15    16384        0             0 dropbear
Fri May 20 19:14:09 2022 kern.info kernel: [38705.990169] [   4899]     0  4899      328       12    20480        0             0 ash
Fri May 20 19:14:09 2022 kern.info kernel: [38705.998853] [   5089]     0  5089      337       21    20480        0             0 opkg-call
Fri May 20 19:14:09 2022 kern.info kernel: [38706.007886] [   5090]     0  5090      337       21    20480        0             0 opkg-call
Fri May 20 19:14:09 2022 kern.info kernel: [38706.017163] [   5092]     0  5092      527      233    16384        0             0 opkg
Fri May 20 19:14:09 2022 kern.info kernel: [38706.025589] [   5152]     0  5152      349       32    20480        0             0 crowdsec.postin
Fri May 20 19:14:09 2022 kern.info kernel: [38706.034955] [   5159]     0  5159      349       32    20480        0             0 crowdsec.postin
Fri May 20 19:14:09 2022 kern.info kernel: [38706.044660] [   5181]     0  5181   171608     9780    90112        0             0 cscli
Fri May 20 19:14:09 2022 kern.info kernel: [38706.053289] [   5189]     0  5189      327       10    16384        0             0 uname
Fri May 20 19:14:09 2022 kern.info kernel: [38706.061848] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),global_oom,task_memcg=/,task=cscli,pid=5181,uid=0
Fri May 20 19:14:09 2022 kern.err kernel: [38706.072541] Out of memory: Killed process 5181 (cscli) total-vm:686432kB, anon-rss:39116kB, file-rss:4kB, shmem-rss:0kB, UID:0 pgtables:88kB oom_score_adj:0
root@xXX:~# cscli console enroll ***************************************
INFO[20-05-2022 04:16:09 PM] custom already set to true
INFO[20-05-2022 04:16:09 PM] manual set to true
INFO[20-05-2022 04:16:09 PM] tainted already set to true
INFO[20-05-2022 04:16:09 PM] Enabled tainted&manual alerts sharing, see 'cscli console status'.
INFO[20-05-2022 04:16:09 PM] Watcher successfully enrolled. Visit https://app.crowdsec.net to acce                                              pt it.
INFO[20-05-2022 04:16:09 PM] Please restart crowdsec after accepting the enrollment.
root@xXX:~# service crowdsec restart
root@xXX:~# cscli version
2022/05/20 16:28:04 version: v1.3.0-openwrt-1.3.0-3
2022/05/20 16:28:04 Codename: alphaga
2022/05/20 16:28:04 BuildDate: 2022-05-19_14:47:46
2022/05/20 16:28:04 GoVersion:
2022/05/20 16:28:04 Constraint_parser: >= 1.0, <= 2.0
2022/05/20 16:28:04 Constraint_scenario: >= 1.0, < 3.0
2022/05/20 16:28:04 Constraint_api: v1
2022/05/20 16:28:04 Constraint_acquis: >= 1.0, < 2.0
root@xXX:~# cscli metrics
INFO[20-05-2022 04:28:22 PM] Local Api Metrics:
+--------------------+--------+------+
|       ROUTE        | METHOD | HITS |
+--------------------+--------+------+
| /v1/watchers/login | POST   |    2 |

cscli parsers list
WARN[20-05-2022 05:17:08 PM] Crowdsec is not the latest version. Current version is 'v1.3.0' and the latest stable version is 'v1.3.4'. Please update it!
WARN[20-05-2022 05:17:08 PM] As a result, you will not be able to use parsers/scenarios/collections added to Crowdsec Hub after CrowdSec v1.3.4
PARSERS

2 Likes

Hi xkpx,

I didn't install Crowsec on my router so I can't confirm it works or not. It does not work for me personally, as it just fills up my space and fails to install.
I have Crowdsec instance installed in a docker and firewall bouncer installed on the router.

hope it helps.

Cheers
Leor

Sorry about this, the problem is known and I have already proposed a lot of fixes that was refused by the developers...
It become complicate to offer free time and huge amount of works for so little code fixes !
Always "titling positive style" and "code justification" !
I am feeling very far from TECHNICAL aspects only...
And common Solutions become HUGE problems !
The unfix-able behavior is more a life style in nowadays !
Like my CAPS and ! which are "offensive way" ; Not at all, it's an accented proposal ...
Not any neutral could help a world to become better !!!
It is also a criticize about people not liking bad words but still excuse bad actions !...
I will try again to propose something !
One day ?!
May be...
Because Life is more important than Helping bad to become better...

All tips are available on my github or in the PR tried.
The data is because of GEOIP downloading which was forced by default...

Have a nice day...
Mine may be better, long far way from computers...

:mage: – Gandalf (from “The Conjurers”) © 1982-2022
@CYBERMIND.FR

1 Like

Does the openwrt bouncer block the IP's? Mine gets all IP's from my local API and adds them to the nftable table, but they are not bloqued at all.

Hi Enfermera,
I no longer use OpenWRT so I can't confirm. The way I understand the bouncer adds them into nftable and it is the firewall's responsibility to block those IP addresses. Hope that helps.
Cheers,

Leor

Hi @erdoukki
I startet to create my own crowdsec bouncer package based on what discussed here.
May I ask how far your work is with a crowdsec uci configuration and maybe luci?

My bouncer package will only support fw4 / nftables and only include a bouncer and an uci configuration file. Maybe we should share our work?

The user guide has some error:
is 'hub', not 'hup'
QQ截图20230217145348

1 Like

And I am new user, I can not install parsers:dropbear-logs:
cscli parsers install crowdsecurity/dropbear-logs
resultWARN[17-02-2023 03:31:50 AM] Crowdsec is not the latest version. Current version is 'v1.3.0' and the latest stable version is 'v1.4.6'. Please update it! WARN[17-02-2023 03:31:50 AM] As a result, you will not be able to use parsers/scenarios/collections added to Crowdsec Hub after CrowdSec v1.4.6 FATA[17-02-2023 03:31:50 AM] unable to retrieve item : crowdsecurity/dropbear-logs
Need help, please!

You have crowdsec-firewall-bouncer_0.0.25-1 on official repo.
.
Here you have the latest crowdsec version if you have an arm router:
crowdsec-1.4.6-r1.apk
.

I am run crowdsec on x86/64, and OpenWrt version is 21.02.5, so i need to compile new version with x86/64 SDK?

or I just copy binary from Manjaro(in my lan), the version is 1.4.6
QQ截图20230217145348

You can try and see if it works for you :+1:

no crowdsec-firewall-bouncer_0.0.25-1 on x86_64 official repo:
https://downloads.openwrt.org/releases/21.02.5/packages/x86_64/packages/
still crowdsec-firewall-bouncer_0.0.21-3
even no on crowdsec-firewall-bouncer
on
https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/

I think the latest version still has problems with openwrt, use banip now, and test if I can compile new version and test them on VirtualBox.

1 Like

It is here:
https://downloads.openwrt.org/snapshots/packages/x86_64/packages/

BOUNCER
crowdsec-firewall-bouncer_0.0.25-1_x86_64.ipk
CROWDSEC
crowdsec_1.3.0-3_x86_64.ipk

Good luck :slight_smile:

1 Like

A PR for updating crowdsec package to version 1.4.6 is opened. No estimate on when it will be merged.

1 Like