FreeBSD support
We want to provide crowdsecurity/crowdsec to FreeBSD users.
This issue will help tracking the on-going FreeBSD effort needed.
TODO:
- [x] Source packaging
- [x] Packaging repository packaging-freebsd
- [x] rc.d init script files/crowdsec.in
- [x] Upstream release
- [x] Category security/crowdsec in freebsd/freebsd-ports
- [x] Upgrade
- [x] Testing
Following the same intention, is this possible to provide an FreeNAS/TrueNAS plugin deployment ?
Obviously not the bouncer deployment buy the CrowdSec "server".
Seems that replacing make by gmake allow tu build CS on BSD, also, since Docker is brocken on FreeBSD the cscli dashboard wont work.
Following the same intention, is this possible to provide an FreeNAS/TrueNAS plugin deployment ?
Obviously not the bouncer deployment buy the CrowdSec "server".
Hi @zorglube , thanks, it could be indeed a nice addition to provide, as well for the others FreeBSD derivatives such as pfSense but it's secondary for now. I like the overall idea 🤝
Seems that replacing
makebygmakeallow tu build CS onBSD, also, sinceDockeris brocken onFreeBSDthecscli dashboardwont work.
Yes, it does but there are other things to take care such as wizard, init services, prefix, etc. So far, it builds fine and it is on its way to be added upstream. You're correct for the dashboard, as it use a metabase docker image.
Following the same intention, is this possible to provide an FreeNAS/TrueNAS plugin deployment ?
Obviously not the bouncer deployment buy the CrowdSec "server".
Hi @zorglube , thanks, it could be indeed a nice addition to provide, as well for the others FreeBSD derivatives such as pfSense but it's secondary for now. I like the overall idea 🤝
I'm currently working on making an TrueNAS plugin.
Seems that replacing
makebygmakeallow tu build CS onBSD, also, sinceDockeris brocken onFreeBSDthecscli dashboardwont work.Yes, it does but there are other things to take care such as
wizard,init services, prefix, etc. So far, it builds fine and it is on its way to be added upstream. You're correct for the dashboard, as it use a metabase docker image.
I found the CrowdSec documentation on how to use the dashboard without Docker, that imply installing Java.
Hello,
I installed the package successfully But I encountered some problems launching the agent To make it work, I had to:
- import the conf files from another linux server to '/usr/local/etc/crowdsec/'
- update hub (with update hub)
- register to central api (with capi register)
- register to local api (with add machines --auto)
and now it works! So I guess it's planned to have postinstall and rc scripts :)
I'm working on that, however any help is appreciate.
Hello,
I installed the package successfully But I encountered some problems launching the agent To make it work, I had to:
- import the conf files from another linux server to '/usr/local/etc/crowdsec/'
- update hub (with update hub)
- register to central api (with capi register)
- register to local api (with add machines --auto)
and now it works! So I guess it's planned to have postinstall and rc scripts :)
Hi @farfaaa, thanks for the feedbacks.
Currently, the "import of configuration" step is wanted, ultimately such configurations could either live inside the package or be deployed using configuration management systems. As it needs to have multiple files in /usr/local/etc/crowdsec/ directory, it's debatable if we should include them in the package or not.
It seems the agent update and register steps are done through the wizard currently, hub update here and register here.
Nothing prevent us from adding these steps into a rc script. I'll add a rc script for handling the service anyway.
In order to summarize for users, after installing the latest package, you will need the following commands and steps to bootstrap the agent on FreeBSD:
- import the configuration into config directory
/usr/local/etc/crowdsec - update hub
sudo crowdsec-cli -c /usr/local/etc/crowdsec/config.yaml hub update
- add your machine
sudo crowdsec-cli -c /usr/local/etc/crowdsec/config.yaml machines add --auto
sudo crowdsec-cli -c /usr/local/etc/crowdsec/config.yaml machines list
- register to central API
sudo crowdsec-cli -c /usr/local/etc/crowdsec/config.yaml capi register
- Validate configuration
sudo service crowdsec configtest
- Add the following
/etc/rc.confentries (only mandatory is really required)
crowdsec_enable="YES" # mandatory
crowdsec_config="/usr/local/etc/crowdsec/config.yaml" # optional
crowdsec_flags="-info" # optional
- Start the agent
sudo service crowdsec start
sudo service crowdsec status
@sbz do you have any clue about the Metabase deployment ?
@zorglube Nope, I didn't look at it yet
I recently managed to use a full container image as a simpler install on FreeBSD for the HomeAutomation project using vm-bhyve Not sure if something similar could be done for the Metabase deployment but if so it might make it simpler. Quite how it could be incorporated into the install process I'm not sure.
https://blog.david-reid.com/home-assistant-on-freebsd/
I was coming for update about BSD deployment and I just see @zathras777 post. Thank man !
@zorglube we made good progress and updates, we were focused on having the crowdsec firewall bouncer ready and working with FreeBSD packet filter pf.
The new package for that should be available soon 🤝 .
@sbz just out of curiosity, how do you ban IPs using pf? do you add/remove IPs from pf tables? I'm looking forward to replacing fail2ban with this project on my FreeBSD server, if it becomes mature enough for FreeBSD.
@sbz I want to thank you to support FreeBSD. I followed steps described above, and Crowdsec seems to works : I added a rule in pf.conf to block everything in tables crowdsec-blacklists and crowdsec6-blacklists. I notice that my Crowdsec agent downloads banned IPs list from CAPI and add them to pf tables, but the agent LAPI doesn't block anything by itself. I can try to connect via SSH using a fake account for 20 times and the IP is not blocked. I know that work is in progress, but is it "normal" (it will be solved when work will be finished), or is it a bug (I can open another thread with more information)?
$ sudo crowdsec-cli -c /usr/local/etc/crowdsec/config.yaml hub list
INFO[16-06-2021 02:25:15 PM] Loaded 19 collecs, 24 parsers, 27 scenarios, 3 post-overflow parsers
INFO[16-06-2021 02:25:15 PM] PARSERS:
-----------------------------------------------------------------------------------------------------------------------
NAME 📦 STATUS VERSION LOCAL PATH`
-----------------------------------------------------------------------------------------------------------------------
crowdsecurity/geoip-enrich ✔️ enabled 0.2 /usr/local/etc/crowdsec/parsers/s02-enrich/geoip-enrich.yaml
crowdsecurity/sshd-logs ✔️ enabled 0.5 /usr/local/etc/crowdsec/parsers/s01-parse/sshd-logs.yaml
crowdsecurity/vsftpd-logs ✔️ enabled 0.1 /usr/local/etc/crowdsec/parsers/s01-parse/vsftpd-logs.yaml
crowdsecurity/dateparse-enrich ✔️ enabled 0.1 /usr/local/etc/crowdsec/parsers/s02-enrich/dateparse-enrich.yaml
-----------------------------------------------------------------------------------------------------------------------
INFO[16-06-2021 02:25:15 PM] SCENARIOS:
------------------------------------------------------------------------------------------------
NAME 📦 STATUS VERSION LOCAL PATH
------------------------------------------------------------------------------------------------
crowdsecurity/vsftpd-bf ✔️ enabled 0.1 /usr/local/etc/crowdsec/scenarios/vsftpd-bf.yaml
crowdsecurity/ssh-bf ✔️ enabled 0.1 /usr/local/etc/crowdsec/scenarios/ssh-bf.yaml
------------------------------------------------------------------------------------------------
INFO[16-06-2021 02:25:15 PM] COLLECTIONS:
--------------------------------------------------------------------------------------------
NAME 📦 STATUS VERSION LOCAL PATH
--------------------------------------------------------------------------------------------
crowdsecurity/vsftpd ✔️ enabled 0.1 /usr/local/etc/crowdsec/collections/vsftpd.yaml
crowdsecurity/sshd ✔️ enabled 0.1 /usr/local/etc/crowdsec/collections/sshd.yaml
--------------------------------------------------------------------------------------------
INFO[16-06-2021 02:25:15 PM] POSTOVERFLOWS:
--------------------------------------
NAME 📦 STATUS VERSION LOCAL PATH
--------------------------------------
--------------------------------------
Hi @alelaba, thanks for you comment.
Would you please share your /etc/pf.conf configuration and the output of the bouncer logs? The bouncer role does not block anything, it just updates the pf(4) tables IPs, then pf(4) should act according the decision and the config. Would you mind to run the following command?
sudo pfctl -sr
@sbz just out of curiosity, how do you ban IPs using pf? do you add/remove IPs from pf tables? I'm looking forward to replacing fail2ban with this project on my FreeBSD server, if it becomes mature enough for FreeBSD.
Hi @karolyi, exactly this is what it should do, dynamically add/remove IPs from pf tables. You can verify the current IPs on a given table using the following command:
sudo pfctl -t <table> -T show
FreeBSD Support is completed. I'm closing the issue.
You could refer the following to get started and setup Crowdsec on FreeBSD
Feel free to report any issues you encountered 🤝