mrash / fwknop

Single Packet Authorization > Port Knocking
http://www.cipherdyne.org/fwknop/
GNU General Public License v2.0
1.11k stars 230 forks source link

Support for pf on FreeBSD? #269

Open stilez opened 6 years ago

stilez commented 6 years ago

The docs state that fwknop supports pf on OpenBSD, and ipfw on FreeBSD.

But popular FreeBSD setups often use pf not ipfw. (eg, pfSense for which issue #130 is logged).

Can fwknop be made to also support pf on FreeBSD as well, or, if it does already, can the docs be updated to say so?

Notes:
1) This issue probably blocks #130. 2) If fwknop is compatible with pf on FreeBSD, or becomes compatible, I'm a keen pfSense developer and if not too busy at the time, I'd be happy to help out on making this available.

mrash commented 6 years ago

Sorry for the delayed response. Indeed, fwknop is compatible with pf on FreeBSD. That is, fwknop doesn't really care about whether it is running on FreeBSD or OpenBSD - it just looks for the existence of the pfctl binary in the configure script. The check for ipfw is done first, but this can be overridden with './configure --with-pf=/path/to/pfctl'.

If you are interested in helping with adding pfSense support, this would be fantastic. This has been requested many times, and the fwknop project could certainly use your help in this area.

stilez commented 6 years ago

I'd be very glad to help.

Thinking about this, we need to first pin down how fwknop should work with pfSense - the features to implement and ways to integrate them. Like most sw, fwknop is quite flexible and one has to choose what is neded/desirable to expose in the GUI, how to expose them, and the key + other desirable use-cases it needs to handle. (A freeform box for "other config" is useful but the basic uses should be accessible via dedicated UI fields).

Initially, I think we should get wider input from fwknop users/devs, what they want to see. For example, if there's a fwknop mailing list/channel/forum (devs or users) it might be a good starting point to pose the questions there, and see what devs/users think is needed and what fwknop on pfSense should do.

(I can handle a lot of it - how it integrates, UI, etc. But what functionality should be exposed or is desirable, and what needs to happen in the background to make it so. As one simple example, fkwnop handles certs, but this adds complexity if needed, and if possible I'd like to skip it in a 1st try. But how necessary is this? Avoidable? Only fwknop users can say..... Ditto for whether it's important to be able t knock on one device to open ports on a second device, and how that works if needed. Stuff like that.... and it'll be the same for quite a few other use cases/capabilities. Bear in mind I like the concept of fwknop but haven't yet used it myself "live", so I need to understand enough real-world use to code what's needed :) )

Once some outline ideas emerge, we can set up a temp chat (IRC/IM) to talk around how it'll be implemented/integrated into pfSense, so I can check any specifics, and I'll have a go.

Two other thoughts:

Look forward to hearing back.

mrash commented 6 years ago

I think a good guide for what to implement is Jonathan's work to integrate fwknop into the OpenWRT project. I'm not sure of the latest status of this, but I know it worked quite well a while ago and probably still does. My guess is that we would just need relatively basic support in pfSense to create and manage encryption and HMAC keys, add any qualifiers for ports/protocols to open, etc. Also, the command cycle support could be a nice way of allowing the user to do something more complicated with pf or other things upon receiving a valid SPA packet. We can certainly ask the fwknop mailing list as well for feedback. I'll get the website/FAQ updated as you suggest. Thanks.

stilez commented 6 years ago

I've had a go at figuring a maximal set of options, meaning "unlikely to require beyond these". Obviously not all are necessarily implemented, but it gives me some idea of what might be needed which is helpful. The aim is to avoid a setup where the user gets a bare "enter fwknopd config here:" box, and allow rules to be provided and managed more intuitively. But it could well be overcomplicated or completely off track!! I get a list like this:

Global daemon options:

List of individual rules. Each rule comprises:

Unsure stuff:

Just some quick thoughts. Obviously the less that's needed, the simpler it is to write, but this is my impressions from the docs - and could be sensible or could be way off-base!!

greenmoss commented 4 years ago

Hey, I just added a thumbs-up of encouragement for this idea. With new VPN vulnerabilities being found all the time, I'd really love to add this extra protection!

Source: https://media.defense.gov/2019/Oct/07/2002191601/-1/-1/0/CSA-MITIGATING-RECENT-VPN-VULNERABILITIES.PDF

@stilez Anything I can do to help?