Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - deajan

#31
So, I've got a couple of OPNSenses running with Zenarmor (23.7 to 24.1.2).
I've installed the qemu-guest-agent plugin into OPNSense.

When I try to make a snapshot with quiescing eg `virsh snapshot-create myvm.local --disky-only --atomic --quiesce`, I get the following error:

Quoteerror: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': failed to freeze /usr/local/zenarmor/output/active/temp: Resource deadlock avoided

As far as I understand, the qemu-agent freeze / thaw scripts would need to exclude that path, which is basically a RAM disk.

I've searched for the freeze / thaw scripts in OPNsense but couldn't find them.
Any idea where to configure this exception perhaps ?

Best regards.
#32
Many distros because some applications only work on RHEL, others on SLES, others on Debian...
Would love to reduce too, but here I am ;)
#33
Quote from: CJ on January 26, 2024, 06:13:01 PM
Yes, but depending on the requirements it might not to be limited as heavily.  And it provides a centralized place of management.

To be fair, I played with the idea of making local repo mirrors too, but setting those up for various RHEL flavors, Debian an Suse is quite a maintenance burden. Especially when I still need 3rd party remote repositories (epel, grafana...). I am not managing enough VMs to make this scenario happen.

Anyway, since I can find the mirror lists, I now need to find a way to create aliases via api / cli.
#34
@netnut Now that's something I can deal with. Thank you. ^^

Didn't find the JSON file on the link you provided, but at least there is a list of YAML files in https://github.com/AlmaLinux/mirrors/tree/master/mirrors.d which I can download and parse

I'll create a quick python parser that downloads the mirrors git zip file, and parses all .yml files in mirrors.d. Shouln't be too horrible ^^

Next step would be to import aliases into OPNSense...
Any idea how to create / update aliases via CLI ?
I've checked the forum but only found https://forum.opnsense.org/index.php?topic=5581.0 and https://forum.opnsense.org/index.php?topic=20653.0

I've seen this post (https://forum.opnsense.org/index.php?topic=36683.msg179305#msg179305) where franco suggests a way to tamper the config.xml file and re-import it via cli... I'm sure this works, but isn't there an API do handle this scenario ?

PS: I've also found the EPEL mirror list at https://mirrors.fedoraproject.org/mirrorlist?repo=epel-9&arch=x86_64
Toghether will the almalinux mirror list, this should suffice for most updates, in a resilient and automatic way.

I'll probably have to add some other repos (grafana for example), but since most of them don't use mirrors, it's just adding one alias and monitoring that updates work an a reliable fashion (basically a sh script that creates a text file for prometheus' node_exporter to pickup).
#35
After more digging, it looks like this is the actual culprit:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165059

Unless some dev guru at FreeBSD can fix hardware offloading with virtio... I'd never advise virtio drivers.
PCI Passthrough is the way (when possible).
#36
Hmm... Can't achieve resiliency when I have to enter only one mirror as the repo url, but resiliency is icing on the cake, as long as I monitor that updates work.

Writing a HTML scrapper... I've not played with beautifulsoup for long, and don't intent to ^^
That's way to hackish IMO.

Thanks for your time.
#37
You're probably right ^^
I just thought maybe someone maintains IP lists for such services, which would be convenient.

Thanks.
#38
I've also tried setting the virtio net driver queue number, eg:
```
<interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
      <driver name='vhost' queues='N'/>
</interface>
```
This gives me roughly a x2 boost, so we're definitly dealing with a virtio performance issue.

I also read somewhere that without hardware offloading, we're stuck with host CPU performance for network, which should be quite bad.
This computes since if I change the cpu power profile, I squeeze another percentage of speed improvement out as I said earlier.
#39
Thanks, but that's more or less the point.
Using Almalinux for instance, it will connect to mirrors.almalinux.org and from there, select a random mirror of currently 342 mirrors, which I obviously don't want to enter manually.

I can setup a couple of those, but then updating will be painfully slow until a "good" mirror is found.
Not even speaking of other repos (epel, grafana...).

I could also force the package manager to select a particular mirror, but then I don't have resiliency anymore.

I thought maybe there was a "automagic" solution like lists of IPs one can download that have "all the nice mirror IPs" or something alike ;)

Or any other solution I didn't think about, other than a regex that allows anything containing "mirror" ^^
#40
Hello,

I have a couple of linux VM (Almalinux/CentOS/Debian/SLES) behind an OPNSense and would like to limit internet acces from those VMs for security reasons.
The problem is that I'd still need those machines to fetch their security updates from various mirrors.

If I setup firewall rules to allow things like mirrors.distro.tld, nothing works great since mirrors.distro.tld will redirect to some mirror, and I cannot just add all various mirrors to fqdn aliases.

So far I've investigated:
- Using squid proxy with whitelists (doesn't work well because for the same reasons above)
- Setting up local repositories... Way too much work and space used
- Making maintenance windows where internet is available via schedules (doesn't right right in terms of security)

Has anyone ever found an elegant solution for this scenario ?
Thanks.
#41
Never really found the solution.
All I can say is that the other OPNSense KVM instances I have use PCI passthrough and don't suffer the suricata performance impact, so the problem is definitly KVM virtio related.

I've rechecked with current OPNsense 23.7.11-amd64 and qemu-kvm-8.0.0-16.el9_3.1.alma.1.x86_64 and the results are still the same.
Enable suricata and upload speeds are divided by an order of magnitude.
#42
I've seen that latest OPNense version upates suricata from 6.0.9_1 to 6.0.11_1.
Applied the upgrade, but still got the same performance issue.

What puzzles me is that another AlmaLinux 8.x server with a KVM virtualized OPNSense keeps good outgoing performance, regardless of the IPS setting.

Any guidance would be appreciated ;)
#43
Other things I tried without success:

- Setting echo 10000 > /sys/module/kvm/parameters/halt_poll_ns on KVM host, like described in https://forum.suricata.io/t/cpu-usage-of-version-6-0-0/706/22
- Tuning KVM to near realtime, like described in https://libvirt.org/kbase/kvm-realtime.html
- Reading https://forum.opnsense.org/index.php?topic=6190.15 - no I don't have a proxy on my OPNSense. It's a vanilla setup with only Qemu agent and suricata configured
- Reducing ruleset, got down from 140k rules to just ET telemetry, 22k rules, no noticeable difference
- Read the pinned topic at https://forum.opnsense.org/index.php?topic=6590.0 - Since I don't have physical NICs, most hacks don't apply to me
- Tried to apply various parameters from https://forum.opnsense.org/index.php?topic=6590.msg110020#msg110020 - No improvements

One thing, if I happen to disable IPS, but keeping IDS enabled, I get good speeds again, so the problem can't be blamed on the capture driver I guess.
#44
Probably not the problem here, but it's worth a shot.
I've installed IDS PT Research ruleset by mistake.
This prevented me from downloading ET Telemetry rules. Once I disabled the ruleset, I could update telemetry rules again.
#45
Hello,

I'm running anOPNsense 23.1.6 virtualized via KVM on AlmaLinux 9.1, on a Xeon Gold 6312U.
All nics are virtio, all hardware accelerations are disabled in OPNsense.
So far so good, without using Suricata, I get about 850Mbits in/out speeds:

Quote[root@virtual_guest_client ~]# ./speedtest -s 20411

   Speedtest by Ookla

      Server: Quantcom, a.s. - Prague (id: 20411)
         ISP: Ouiheberg Sarl
Idle Latency:    29.01 ms   (jitter: 0.12ms, low: 28.84ms, high: 29.11ms)
    Download:   849.25 Mbps (data used: 1.2 GB)
                 28.96 ms   (jitter: 1.31ms, low: 27.73ms, high: 38.89ms)
      Upload:   903.78 Mbps (data used: 1.3 GB)
                 29.80 ms   (jitter: 0.86ms, low: 28.38ms, high: 36.39ms)
Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/29c7f928-abc2-41c8-ba13-59359d3b18c7

If I happen to enable suricata, using ET Telemetry ruleset, IPS mode with Hyperscan engine, upload speed are terrible:

Quote[root@virtual_guest_client ~]# ./speedtest -s 20411

   Speedtest by Ookla

      Server: Quantcom, a.s. - Prague (id: 20411)
         ISP: Ouiheberg Sarl
Idle Latency:    29.72 ms   (jitter: 0.17ms, low: 29.45ms, high: 29.85ms)
    Download:   875.42 Mbps (data used: 1.6 GB)
                 28.11 ms   (jitter: 3.05ms, low: 27.52ms, high: 291.24ms)
      Upload:    67.82 Mbps (data used: 55.4 MB)
                 29.38 ms   (jitter: 0.48ms, low: 28.12ms, high: 30.38ms)
Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/9f80a999-38de-4e4e-bf5d-31d3352d0726

I've played with various things in order to find what the culprit could be:

- Using E1000 nics was disastrous, got 700% cpu usage on host when OPNsense was idle, instead of roughly 5%, also got some packet loss
- Using a Q35 machine instead of a 440fx with qemu: Did not change alot
- Playing with tuned profiles: Got 30% better upload speed when using performance cpu governor instead of conservative
- Isolated CPUs from host and made the OPNsense cpu affinity use those cpus: Did not change alot

So it looks indeed that my problem is CPU bound, since using a better cpu governor helps getting better speeds.
Nevertheless, my host has a 2.4Ghz Xeon CPU, with 3.6Ghz turbo frequency.
The CPU cores were indeed clocked at 3.6Ghz while performing the tests.

I cannot imagine Suricata being so hungry that 8 x 3.6Ghz CPUs won't suffice for having 1GB throughput.

Can someone confirm if this has something todo with KVM ?
If so, any advices perhaps ?

Best regards.