-
hunter0one
Hi I'm trying to use the new service jails but they don't seem to start at all
-
hunter0one
Is it only specific services that work with it?
-
hunter0one
Ohh I see, you have to actually enable the service as usual before too. I just assumed if you had <servicename>_svcj="YES" it would enable the service to run it in the jail
-
SponiX
Anyone have experience lumping mixed sized disks together into a single large ZFS zpool (raidz2 of similar) ?
-
mason
SponiX: Yeah. You just build the ZFS into partitions sized for the smallest disk.
-
mason
It wastes a little space but it works well.
-
SponiX
Is there a better way, like grouping a handful to a dozen of the same sized disks as one like vdev, and then lumping the vdevs together from there?
-
SponiX
My smallest disks are 3TB, and my largest are like 16-20TB
-
ivy
you could probably do that with ccd(4), but you wouldn't be able to boot from it, and i dislike that sort of complexity in my storage, personally
-
SponiX
Yeah, I have a couple of 2TB NVME drives to do the OS/boot itself. These array(s) would be specifically for data/Media only
-
SponiX
ivy: I didn't know this ccd existed. It might be helpful
-
SponiX
I would rather do it all within ZFS, but mixing it with ccd could actually give me better solutions
-
nimaje
afaik, diffrent sizes for root vdevs don't matter, but you don't have redundancy between those root vdevs, only inside a vdev (and only if it isn't just a single disk)
-
mason
SponiX: riffing off of what nimaje noted, you might string together things that are at least mirrors, and that might use more of your available space while still protecting your data.
-
hmjsp
heya. i can't for the life of me figure out pf. i'm trying to set up my rules so that i block all traffic except explicitly a few ports, and then i block all traffic for one user, and reroute its traffic to a wireguard vpn. however... the line `block user <user>` seems to screw up the rest of the config, stopping me from doing basic stuff like ping (permission denied), etc. what's up?
-
hmjsp
-
mason
hmjsp: Hm, I didn't know you could tie rules to users. That's kind of interesting.
-
mason
Neat.
-
hmjsp
it's not working tho ToT
-
mason
hmjsp: Is it just that user who's impacted for the rest of the rules? Or everyone?
-
hmjsp
everyone is impacted for some reason, that's what's puzzling me
-
hmjsp
if i uncomment the last two lines, ping works. if i uncomment "block user transmission"... then even as root i can no longer ping
-
hmjsp
which doesn't make sense, as man page example is similar: block out proto { tcp, udp } all
-
hmjsp
pass out proto { tcp, udp } all user { < 1000, dhartmei }
-
mason
yeah, just looking at that now
-
mason
Is it your syntax? You don't match the man page there.
-
mason
I'm just getting into pf, although it's a lot like the ipf I used to use.
-
hmjsp
im not sure, dont think so
-
hmjsp
block all user { transmission }
-
hmjsp
doesn't change anything
-
hmjsp
it's weird, i copied a simple ruleset (not this one) from an openbsd box and it did not work the same
-
hmjsp
not sure why
-
mason
OpenBSD is a different, sometimes newer PF. But that syntax is still not quite the same. Try exactly what they show maybe. At a guess, block out proto { tcp, udp } all user { transmission }
-
mason
Although maybe {} is just a list syntax and you don't need it for a single entry? Dunno.
-
hmjsp
that's what i thought too
-
hmjsp
that's how it usually is
-
mason
grep -r user . shows nothing un /usr/share/examples/pf on 14, looking on 15
-
hmjsp
oh!
-
hmjsp
it works?
-
hmjsp
with proto...
-
mason
Does it?
-
hmjsp
yeah... mysterious O_o
-
hmjsp
hold on lemme double check
-
mason
Good idea.
-
mason
But yeah, when in doubt, slavishly adhere to the examples and only deviate from there once you have something that works.
-
mason
Also, I wonder if what you really want is a block if what you really want is to redirect/twist/whatever.
-
hmjsp
ok so transmission is blocked and my user can ping fine... now i need to check vpn config
-
hmjsp
i want to block all trafic that isnt redirected through the vpn interface
-
mason
That was anglolinguicide, but I wonder if maybe what you want is a modification if you catch packets from the user, not a block and then later something else.
-
mason
hmjsp: tcpdump might help here, seeing what packets make it where
-
hmjsp
oops my client pooped itself
-
mason
(I forget if it's last-rule-wins and you have to specify "quick" of if that's some other syntax.)
-
hmjsp
it's last rule wins
-
hmjsp
so block by default
-
hmjsp
and then pass through vpn
-
hmjsp
quick can be used to override last rule wins
-
mason
ah, so this *is* a system where you want "quick" if you need to apply immediately?
-
mason
right
-
mason
good
-
hmjsp
yeah
-
mason
I'm playing around with some simple PF this weekend. I've been mucking about with ipfw but it doesn't really make me happy.
-
ivy
if the idea is to force all your torrent traffic through a vpn, you may want to consider running transmission in a different fib, rather than trying to do it with a firewall
-
mason
ivy++ even better idea
-
hmjsp
a different what now
-
mason
FWIW, I found this the other day and was blown away by now minimal it was:
blog.frankleonhardt.com/2020/networking-freebsd-jails
-
hmjsp
im new to freebsd :')
-
mason
hmjsp: routing table == fib
-
ivy
fib = routing table... let me find an example
-
mason
-
hmjsp
i mean it's sunken cost atp i just want this to work lol
-
mason
hmjsp: I think ivy is right - you want to impose a routing table for this.
-
hmjsp
probably the best approach but... i may as well learn why my current pf approach is not working while im at it
-
mason
hmjsp: FWIW, at a fairly recent job, I was able to do something with setfib in seven lines that was way more complex with other options. I was compelled to do it on Ubuntu despite it being way more effort for no additional functionality, despite my showing a lovely demo using FreeBSD.
-
ivy
-
hmjsp
ivy: can i do <any process>_fib=<number>?
-
hmjsp
is that how this works?
-
ivy
it needs to be a service that exists in rc.d, so anything that you do foo_enable=YES, you can set foo_fib
-
hmjsp
waow, neat
-
hmjsp
so simple
-
ivy
see rc.conf(5), there's a bunch of service-specific options
-
hmjsp
suppose it's not a service tho (not my scenario atm, but im curious), what would i do?
-
ivy
setfib 1 <command>
-
hmjsp
waow
-
hmjsp
okay, thanks!
-
hmjsp
i'll try what you just showed me and see if it works
-
mason
hmjsp: Here's some random thrashing I was doing during the process mentioned. Basically, I needed different default routes for different things listening on the same /24. Look how easy it was with FreeBSD:
termbin.com/i94r
-
ivy
note, if you're using wg-quick, you'll need to do it a different way... probably using 'ifconfig <interface> fib 1' as a post-up command. i prefer not to use wg-quick as i find it simpler to configure that in rc.conf
-
hmjsp
mason: the sheer reduction xD
-
hmjsp
ivy: yeah i avoided wg-quick because it routes the whole network to the vpn
-
hmjsp
which is not what i want at all
-
mason
hmjsp: I made it work in Ubuntu, but it wasn't the right call.
-
hmjsp
wait ivy im still confused. i got rerouting to wg0 correctly now with fib, but im a bit lost on where to put the peer's ip now...? since it's not in the wireguard config itself...
-
ivy
hmjsp: the wireguard config doesn't change, you're just putting the local ip address in rc.conf. (that's the address you'd put in Address= if you were using wg-quick)
-
hmjsp
in place of this? "ifconfig_wg_vpn="inet 1.2.3.4/32 fib 1""?
-
ivy
yes, replace 1.2.3.4/32 with the local ip address for inside the tunnel (not your public address)
-
hmjsp
ivy: still doesn't work. tcpdump on wg0 shows sending, but no receiving
-
hmjsp
-
ivy
is the tunnel actually working? 'wg show wg0' should show traffic in both directions
-
hmjsp
yeah it does. in the kbs, but it does
-
hmjsp
transfer: 2.61 KiB received, 110.67 KiB sent
-
ivy
if you run tcpdump on the internet interface, do you see traffic for the vpn endpoint in both directions or only outgoing?
-
hmjsp
when i run ping, only outputting. tho previously there was SOME input, presumably the server checking if im alive?
-
hmjsp
but with ping it's 100% packet loss
-
mason
hmjsp: ICMP can be funny - also try netcat/telnet to various ports
-
mason
in both directions
-
ivy
is it possible pf is blocking traffic? you may want to add a pass rule for the wg interface and remove any user-specific rules just for testing
-
hmjsp
perhaps
-
hmjsp
lemme disable pf and see
-
hmjsp
ok it's definitely pf xD
-
mason
hmjsp: Did you leave in the user block rule?
-
hmjsp
nop
-
hmjsp
not sure what it is
-
hmjsp
pass on $vpn_if proto tcp from any to any port $tcp_services
-
hmjsp
i added this at the end, and it still doesn't work
-
hmjsp
im not sure what's blocking it in the first place
-
ivy
well, 'proto tcp' won't allow ping
-
mason
hmjsp: Are you testing with more than just ping? Try telnet too, to various ports. From both directions.
-
hmjsp
pass on $vpn_if proto { tcp, udp } from any to any port $tcp_services doesn't work either
-
hmjsp
mason: im trying curl and ssh also
-
hmjsp
non vpn traffic works
-
mason
hmjsp: Always simplify. Those aren't bad ideas, but plain telnet is simplest. It'll send a SYN wherever.
-
hmjsp
okok
-
hmjsp
just not too familiar
-
mason
telnet foo 1234
-
mason
or nc foo 1234 I guess
-
ivy
this probably isn't related to the current issue, but you can't really do port-specific outbound filtering for BT because peers can use any port they want... so that pass rule probably wants to be a pass in rule, with a blanket pass out
-
hmjsp
ah ok thank you
-
hmjsp
oh!
-
hmjsp
doing a blanket pass out made everything work
-
mason
\o/
-
hmjsp
tcpdump got a... dump of inbound traffic
-
hmjsp
xD
-
hmjsp
okay this is good. thanks a lot yall :)
-
hmjsp
fib is neat
-
mason
yes indeed it is
-
hmjsp
is it only freebsd with it?
-
hmjsp
or other bsds?
-
mason
-
mason
same on OpenBSD
-
ivy
Linux has a similar feature but it works in a strange, harder-to-use way for no apparent reason
-
hmjsp
mason: neato
-
mason
Hm, trying to figure out how to specify different tables with that NetBSD thing.
-
hmjsp
linux is very silly
-
hmjsp
oh well im way overdue on sleeping
-
ivy
mason: i'm not sure routed(8) is the right manpage? that's the RIP daemon
-
mason
hmjsp: You can do similar with Linux using namespaces.
-
hmjsp
but i can rest easy with this solved
-
hmjsp
gn :)
-
mason
ivy: Yeah, I saw "tables" and it seemed like it might be the right thing, but I'm thinking it's not.
-
mason
hmjsp: enjoy
-
hmjsp
o/
-
ivy
we have routed too, although if i have my way, it'll be gone before 16.0 :-)
-
mason
I'm not immediately seeing how to go about it in NetBSd.
-
mason
MultiProtocol Label Switching seems interesting, but isn't quite right.
-
ivy
mpls is for the other sort of vpn :-) (virtual wires)
-
mason
Well. I have and like setfib, so I won't worry about it too much I guess. :)
-
ivy
incidentally, one of this year's GSoC projects is an MPLS implementation for freebsd
-
mason
Oh, neat.
-
mason
Port of NetBSD, or ground up?
-
ivy
i'm not sure, the project idea mentions the openbsd and netbsd implementations but doesn't directly suggest porting those. although it would seem silly not to take at least some code
-
mason
mm