Commit Graph

4572 Commits

Author SHA1 Message Date
Vincent Li
18ec4f2b87 udev: sync update from ipfire
commit d19b71301d08db94341eae1d62500a928a8f6712
Author: Arne Fitzenreiter <arne_f@ipfire.org>
Date:   Thu Dec 26 10:19:20 2024 +0100

    udev: patch to handle pidfs and bcachefs

    this is needed to build udev with kernel 6.12 headers

    Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>

fix: https://github.com/vincentmli/BPFire/issues/89
Reported-by: Harvey Li <lhw365@gmail.com>
Signd-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-05-21 15:53:03 +00:00
Vincent Li
bad31e01b9 xdp-tools: xdpsni/xdpdns init bpf path argument
now x86 and loongarch64 share same user space
xdp_sni xdp_dns program with path argument to
bpf map, change xdpsni and xdpdns init script
with bpf path argument.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-01-12 03:42:49 +00:00
Vincent Li
92324f8cbd ddos: set net.ipv4.tcp_syncookies to 1
set tcp_syncookies to 1 alone with iptables
SYNPROXY module reduce latency, this improves
situation when XDP acceleration is not enabled
and just let iptables SYNPROXY handles SYN flood
attack, see [0]

[0]: https://bugzilla.kernel.org/show_bug.cgi?id=219500

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-11-14 18:30:29 +00:00
Vincent Li
eac34c4210 ddos: disable XDP SYNACK window scale option
disable window scaling for XDP generated
SYNACK in ddos script by default

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-11-12 02:12:35 +00:00
Vincent Li
d94f83d1bf haproxy: add safe call to haproxy init script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-30 16:52:28 +00:00
Vincent Li
0a726a99ac haproxy: move haproxy to core package
move haproxy to core package

prepare /var/ipfire/haproxy for haproxy UI, use
/var/ipfire/haproxy/haproxy.cfg

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-28 02:44:48 +00:00
Vincent Li
8d6014683f xdp-geoip: safe call to xdpgeoip init script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-13 20:59:48 +00:00
Vincent Li
9c28bd419d xdp-geoip: Add XDP GeoIP location init
Add XDP GeoIP country/region location block init script

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-13 20:35:44 +00:00
Vincent Li
e6ac495dfb xdp-sni: safe call wrapper program to xdpsni init
safe call wrapper program to xdpsni init script
for UI to call

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-08 17:41:17 +00:00
Vincent Li
34f9da85dd xdp-sni: add XDP TLS SNI init script xdpsni
add xdpsni init script and enable XDP TLS SNI by default
on first boot and reboot.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-08 02:21:17 +00:00
Vincent Li
4d6f8d68a3 xdp-dns UI: change running state check
Status relies on checking if xdp_dns_log is running,
but xdp_dns_log could mysteriously disappear at some point,
which result in XDP DNS Blocklist shows Stopped,
let /etc/rc.d/init.d/xdpdns status relies on if the
xdp_dns_denylist XDP program is still attached
to green0 interface.

two related issues

https://github.com/vincentmli/BPFire/issues/50
https://github.com/vincentmli/BPFire/issues/49

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-05 23:17:26 +00:00
Vincent Li
2f4174b560 xdp-dns: xdpdns init script to populate denylist
run xdp_dns in xdpdns init script to populate
domain_denylist from domainfile saved from UI.
either xdpdns restart or bpfire reboot, the domain_denylist
is restored with domain blocklist

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-04 17:31:12 +00:00
Vincent Li
a165595116 xdp-dns: allow UI to run xdp_dns to update map
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-04 04:06:00 +00:00
Vincent Li
f9c8259050 Add xdpdnsctrl program for safe execution
add xdpdnsctrl to start/stop/status XDP
program from xdpdns.cgi safely.

permission of xdpdnsctrl

chown root.nobody /usr/local/bin/xdpdnsctrl
chmod u+s /usr/local/bin/xdpdnsctrl

result:

-rwsr-x--- 1 root nobody 14672 Mar 19 09:58 /usr/local/bin/xdpdnsctrl
2024-10-02 18:31:21 +00:00
Vincent Li
d30a7b2318 xdp-dns: add start/stop init script and settings
add xdpdns init script to load/unload xdp_dns_denylist
program and run xdp_dns_log to log dns query to system log

rm log/configroot log/initscripts to build image

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-10-02 18:23:44 +00:00
Vincent Li
3579fd95a1 xdp-dns: attach xdp-dns prog to green0 interface
To block or rate limit DNS query from green
network client, the xdp-dns program should
be attached to green0 interface to scan the
DNS query. attach to red0 interface only get
the DNS response packet from red0(WAN), not
matching the DNS query we want.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-09-09 00:32:30 +00:00
Vincent Li
aa7d243558 langs: installer/setup Chinese translation
complete the chinese translation referenced below
https://git.ipfire.org/?p=people/ummeegge/ipfire-2.x.git;a=commit;h=ca149dc8e2e24f3cfcf7bbc1e2333b2b6d43e0e4

Asked ChatGPT to translate English in msgid to msgstr in Chinese and
ChatGPT did the translation automatically with correct format.  copied
from ChatGPT and pasted in po.zh

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-07-09 01:47:46 +00:00
Vincent Li
02724e7427 LoxiLB: enable firewall SNAT for green network
when loxilb is enabled and started, enable the
firewall SNAT for green network so green network
could have initiate outgoing traffic like internet
access.

we can achieve this by restoring firewall SNAT setting
from default /var/ipfire/loxilb/FWconfig.txt when loxilb
start up with --config-path=/var/ipfire/loxilb thanks
to the enhancement addressed in issue:

https://github.com/loxilb-io/loxilb/issues/706

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-07-09 01:47:46 +00:00
Vincent Li
0f54cfef92 keepalived/ipvs: move ipvsadm to core package
prepare keepalived with ipvs for layer 4
load balancer

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-07-02 20:52:49 +00:00
Vincent Li
e7e1e67fc7 initscripts: start loxilb keepalived after reboot
When loxilb and keepalived are enabled, after BPFire
rebooted, loxilb and keepalived failed to start and
shows as "STOPPED" from UI, this is not expected since
we want to loxilb and keepalived to continue to be enabled
after reboot based on the enabled state of loxilb and
keepalived before reboot.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-07-01 17:30:54 +00:00
Vincent Li
2cddcb14f6 keepalived: add keepalivedctrl program
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-06-29 20:57:01 +00:00
Vincent Li
8f4062f4da LoxiLB UI: show loxilb server running status
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-06-15 20:52:48 +00:00
Vincent Li
280869f883 Do not attach loxilb TC to ethX devices
see [0] loxilb attach TC program to all devices
by default.

[0]:https://github.com/vincentmli/BPFire/issues/22

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-05-28 18:12:51 +00:00
Vincent Li
61caf1c5eb Add loxilb safe call program
when rebuild image: do

rm log/misc-progs

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-05-27 18:23:17 +00:00
Vincent Li
0c2b510130 add loxilb start/stop init script and settings
when rebuid the image, do:

rm log/configroot
rm log/initscripts

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-05-27 18:23:09 +00:00
Vincent Li
8031d30ad2 ddos init: add ratelimit 2024-04-24 00:48:04 +00:00
Vincent Li
a925c32ecb Revert "ddos.cgi add ratelimit UI"
This reverts commit e3ea91ca5898f0d32cd2733efcd3297d30ffa80e.
2024-04-24 00:48:04 +00:00
Vincent Li
6accd9056f ddos.cgi add ratelimit UI
add ratelimit UI for xdp dns and udp program

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-24 00:48:04 +00:00
Vincent Li
fcdc42ea40 ddos.cgi add DNS DDoS UI
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-18 02:29:27 +00:00
Vincent Li
0bece3c17a Workaround ddos init script to xdp skb mode
if interface does not support native mode
re-run xdp-loader with skb mode, got error

Attaching XDP program in native mode not supported - try SKB mode.
TCP Native mode not supported, try SKB
Replacing allowed ports
Added port 80
Added port 8090
 libxdp: Retried more than 11 times, giving up
Couldn't attach XDP program on iface 'lo': Device or resource busy(-16)
UDP Native mode not supported, try SKB
Replacing allowed udp ports
Added port 10408

but it looks loaded ok

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-17 00:18:34 +00:00
Vincent Li
9924b85773 ddos init script to load/unload TCP/UDP XDP prog
make ddos init script to load/unload TCP/UDP
XDP program according to TCP/UDP setting

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-17 00:18:34 +00:00
Vincent Li
9a53289a23 ddos.cgi add UDP DDoS WebUI
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-17 00:17:41 +00:00
Vincent Li
33cc594e39 mount bpffs for xdp-tools for ISO build
xdp-loader will only load the XDP program without
xdp dispatcher if bpffs is not mounted, flash image
has bpffs mounted already, add bpffs mount for ISO image

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-07 22:15:12 +00:00
Vincent Li
8f4b665fb3 populate ddos port map in ddos init script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-20 17:42:31 +00:00
Vincent Li
9353496864 Add ddosctrl program for safe execution
add ddosctrl to start/stop/status XDP
program from ddos.cgi safely.

permission of ddosctrl

chown root.nobody /usr/local/bin/ddosctrl
chmod u+s /usr/local/bin/ddosctrl

result:

-rwsr-x--- 1 root nobody 14672 Mar 19 09:58 /usr/local/bin/ddosctrl

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-20 17:42:30 +00:00
Vincent Li
936c1a4fa0 Add XDP program load/unload script
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-20 17:42:30 +00:00
Vincent Li
1f16691715 Add custom XDP SYNPROXY chain
XDP SYNPROXY rules needs to be first in filter table
INPUT user defined chain and raw table PREROUTING
user defined chain.

To list the custom chain evaluation order for example:

iptables -L INPUT --line-numbers
Chain INPUT (policy DROP)
num  target     prot opt source               destination
1    INSYNPROXY  all  --  anywhere             anywhere
2    IPSBYPASS  all  --  anywhere             anywhere             mark match 0xc0000000/0xc0000000
3    BADTCP     tcp  --  anywhere             anywhere
4    CUSTOMINPUT  all  --  anywhere             anywhere
5    HOSTILE    all  --  anywhere             anywhere
6    BLOCKLISTIN !icmp --  anywhere             anywhere
7    GUARDIAN   all  --  anywhere             anywhere
8    OVPNBLOCK  all  --  anywhere             anywhere
9    IPS_INPUT  all  --  anywhere             anywhere             mark match 0x0/0xc0000000
10   IPTVINPUT  all  --  anywhere             anywhere
11   ICMPINPUT  all  --  anywhere             anywhere
12   LOOPBACK   all  --  anywhere             anywhere
13   CAPTIVE_PORTAL  all  --  anywhere             anywhere
14   CONNTRACK  all  --  anywhere             anywhere
15   DHCPGREENINPUT  all  --  anywhere             anywhere
16   TOR_INPUT  all  --  anywhere             anywhere
17   LOCATIONBLOCK  all  --  anywhere             anywhere
18   IPSECINPUT  all  --  anywhere             anywhere
19   GUIINPUT   all  --  anywhere             anywhere
20   WIRELESSINPUT  all  --  anywhere             anywhere             ctstate NEW
21   OVPNINPUT  all  --  anywhere             anywhere
22   INPUTFW    all  --  anywhere             anywhere
23   REDINPUT   all  --  anywhere             anywhere
24   POLICYIN   all  --  anywhere             anywhere

iptables -t raw -L PREROUTING --line-numbers

Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination
1    RAWSYNPROXY  all  --  anywhere             anywhere

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-15 02:56:41 +00:00
Arne Fitzenreiter
6d501c0558 cpufrequtils: hide output on disabled cores.
We disable cores if the are affected by some cpu vulnerabilities
this cores report errors if you try to change the settings.
So only print the output for core0 and hide it for all cores.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2024-02-18 11:41:20 +01:00
Arne Fitzenreiter
51fd73ea2b cpufrequtils: fix initskript for amd-pstate
the initskript loads a test-modul for amd-pstate (which traces on intel)
and off course reports errors if firmware settings are missing.

this also fix the error at start because also amd-pstate doesn't support
ondemand mode.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2024-02-17 19:57:42 +01:00
Michael Tremer
4c68bcb588 installer: Fail if the bootloader could not be installed
If GRUB could not be installed during installation, the installer
continued without reporting the error to the user.

This change will make the installer fail.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-02-09 12:02:28 +00:00
Adolf Belka
37c5b4b62e firewall: Fixes bug12981 - add if loop to log or not log dropped hostile traffic
- This v3 version now has two if loops allowing logging of incoming drop hostile or
   outgoing drop hostile or both or neither.
- Dependent on the choice in optionsfw.cgi this loop will either log or not log the
   dropped hostile traffic.

Fixes: bug12981
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-02-07 11:02:17 +00:00
Arne Fitzenreiter
88b6ad8112 mympd: create/check config before first start
this create missing folders for webradio and state.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2024-01-31 21:09:14 +01:00
Adolf Belka
e9ba050b69 readline: Update patches to patch 1 to patch 10
- Update from version 8.2 with patch 1 to 8.2 with patches 1 to 10
- Update of rootfile not required
- Changelog
    Patch 10
	Fix the case where text to be completed from the line buffer (quoted) is
	compared to the common prefix of the possible matches (unquoted) and the
	quoting makes the former appear to be longer than the latter. Readline
	assumes the match doesn't add any characters to the word and doesn't display
	multiple matches.
    Patch 9
	Fix issue where the directory name portion of the word to be completed (the
	part that is passed to opendir()) requires both tilde expansion and dequoting.
	Readline only performed tilde expansion in this case, so filename completion
	would fail.
    Patch 8
	Add missing prototypes for several function declarations.
    Patch 7
	If readline is called with no prompt, it should display a newline if return
	is typed on an empty line. It should still suppress the final newline if
	return is typed on the last (empty) line of a multi-line command.
    Patch 6
	This is a variant of the same issue as the one fixed by patch 5. In this
	case, the signal arrives and is pending before readline calls rl_getc().
	When this happens, the pending signal will be handled by the loop, but may
	alter or destroy some state that the callback uses. Readline needs to treat
	this case the same way it would if a signal interrupts pselect/select, so
	compound operations like searches and reading numeric arguments get cleaned
	up properly.
    Patch 5
	If an application is using readline in callback mode, and a signal arrives
	after readline checks for it in rl_callback_read_char() but before it
	restores the application's signal handlers, it won't get processed until the
	next time the application calls rl_callback_read_char(). Readline needs to
	check for and resend any pending signals after restoring the application's
	signal handlers.
    Patch 4
	There are systems that supply one of select or pselect, but not both.
    Patch 3
	The custom color prefix that readline uses to color possible completions
	must have a leading `.'.
    Patch 2
	It's possible for readline to try to zero out a line that's not null-
	terminated, leading to a memory fault.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-31 17:06:19 +00:00
Michael Tremer
a61a21ef75 glibc: Import latest patches from upstream
These include (amongst others) fixes for:

GLIBC-SA-2024-0001:
===================
syslog: Heap buffer overflow in __vsyslog_internal (CVE-2023-6246)

__vsyslog_internal did not handle a case where printing a SYSLOG_HEADER
containing a long program name failed to update the required buffer
size, leading to the allocation and overflow of a too-small buffer on
the heap.

GLIBC-SA-2024-0002:
===================
syslog: Heap buffer overflow in __vsyslog_internal (CVE-2023-6779)

__vsyslog_internal used the return value of snprintf/vsnprintf to
calculate buffer sizes for memory allocation.  If these functions (for
any reason) failed and returned -1, the resulting buffer would be too
small to hold output.

GLIBC-SA-2024-0003:
===================
syslog: Integer overflow in __vsyslog_internal (CVE-2023-6780)

__vsyslog_internal calculated a buffer size by adding two integers, but
did not first check if the addition would overflow.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-31 11:09:41 +00:00
Michael Tremer
500b6311b4 collectd: Do not sync
Calling a global sync operation manually is generally a bad idea as it
can block for forever. If people have storage that does not retain
anything that is being written to it, they need to fix their hardware.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-31 10:30:27 +00:00
Adolf Belka
85db98e919 bash: Update to include patches 22 to 26
- Update from version 5.2 with patches 1 to 21 to 5.2 with patches 1 to 26
- Update of rootfile not required
- Changelog
    Patch 26
	The custom color prefix that readline uses to color possible completions
	 must have a leading `.'.
    Patch 25
	Make sure a subshell checks for and handles any terminating signals before
	 exiting (which might have arrived after the command completed) so the parent
	 and any EXIT trap will see the correct value for $?.
    Patch 24
	Fix bug where associative array compound assignment would not expand tildes
	 in values.
    Patch 23
	Running `local -' multiple times in a shell function would overwrite the
	 original saved set of options.
    Patch 22
	It's possible for readline to try to zero out a line that's not null-
	 terminated, leading to a memory fault.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-31 10:27:43 +00:00
Arne Fitzenreiter
9786225a9b mympd: new addon to control mpd via WebGUI
myMPD is written in C and has a nice WebGUI to play
local music and also a WebRadio browser.
This is to replace the removec client175.

After install it can reached via
https://IP_OF_THE_IPFIRE:8800

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-29 16:02:42 +00:00
Arne Fitzenreiter
c4b233ddf7 mpfire: fix initskript uninstall
the uninstall with rm /etc/rc*.d/*mpd remove not only the mpd initlinks.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-29 16:02:18 +00:00
Adolf Belka
0839a78a90 shadow: Updated to version 4.14.3
- Updated from version 4.14.2 to 4.14.3
- Update of rootfile not required
- Patch renamed to new version number
- Changelog
    4.14.3
	libshadow:
	    Avoid null pointer dereference.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-23 14:01:46 +00:00
Adolf Belka
64f9606302 pam: Update to version 1.6.0
- Update from version 1.5.3 to 1.6.0
- Update of rootfile
- A build bug was found with 1.6.0 if --enable-read-both-confs was set in the configure.
   A commit fixing this has been released and converted into a patch for IPFire. This
   will end up in the next pam release version and the IPFire patch can then be removed.
- Changelog
    1.6.0
	* Added support of configuration files with arbitrarily long lines.
	* build: fixed build outside of the source tree.
	* libpam: added use of getrandom(2) as a source of randomness if available.
	* libpam: fixed calculation of fail delay with very long delays.
	* libpam: fixed potential infinite recursion with includes.
	* libpam: implemented string to number conversions validation when parsing
	  controls in configuration.
	* pam_access: added quiet_log option.
	* pam_access: fixed truncation of very long group names.
	* pam_canonicalize_user: new module to canonicalize user name.
	* pam_echo: fixed file handling to prevent overflows and short reads.
	* pam_env: added support of '\' character in environment variable values.
	* pam_exec: allowed expose_authtok for password PAM_TYPE.
	* pam_exec: fixed stack overflow with binary output of programs.
	* pam_faildelay: implemented parameter ranges validation.
	* pam_listfile: changed to treat \r and \n exactly the same in configuration.
	* pam_mkhomedir: hardened directory creation against timing attacks.
	  Please note that using *at functions leads to more open file handles
	  during creation.
	* pam_namespace: fixed potential local DoS (CVE-2024-22365).
	* pam_nologin: fixed file handling to prevent short reads.
	* pam_pwhistory: helper binary is now built only if SELinux support is enabled.
	* pam_pwhistory: implemented reliable usernames handling when remembering
	  passwords.
	* pam_shells: changed to allow shell entries with absolute paths only.
	* pam_succeed_if: fixed treating empty strings as numerical value 0.
	* pam_unix: added support of disabled password aging.
	* pam_unix: synchronized password aging with shadow.
	* pam_unix: implemented string to number conversions validation.
	* pam_unix: fixed truncation of very long user names.
	* pam_unix: corrected rounds retrieval for configured encryption method.
	* pam_unix: implemented reliable usernames handling when remembering passwords.
	* pam_unix: changed to always run the helper to obtain shadow password entries.
	* pam_unix: unix_update helper binary is now built only if SELinux support
	  is enabled.
	* pam_unix: added audit support to unix_update helper.
	* pam_userdb: added gdbm support.
	* Multiple minor bug fixes, portability fixes, documentation improvements,
	  and translation updates.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2024-01-23 14:01:09 +00:00