Commit Graph

1369 Commits

Author SHA1 Message Date
Michael Tremer
8d09028b69 network: Force dhcpcd to ask for an IP address
So since all this static nonsense wasn't feeling right, I opened a
ticket upstream and got a lead how to actually get some proper DHCP
working.

  https://github.com/NetworkConfiguration/dhcpcd/issues/129

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
86ba5ce316 dhcpcd.exe: Add a safety net to make sure we always have a route
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
ece96c6f56 dhcpcd.exe: Ignore some events
We don't want any log messages printed.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
e3da491238 dhcpcd.exe: Reformat the reason dispatcher
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
1f568cc0ed network: dhcpcd fails to check link state for QMI interfaces
When acquiring an IP address, dhcpcd seems to think that the interface
is down or does not work properly for some reason. It will
subsequentially decide to exit which is not what we want here.

Therefore this patch tells dhcpcd to ignore the link state and keep
happily running.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
cb4b6f433e dhcpcd.exe: Fix typo in configuring DNS server
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
c2e2c2824a dhcpcd.exe: Run everything no matter how RED is configured
This could potentially create problems when we abuse these functions to
launch the DHCP client on IPTV interfaces. This would have to be tested
and confirmed or potentially we would need some more changes to keep
supporting that use-case, too.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
7a67f77f10 dhcpcd.exe: Only touch /var/ipfire/red/active once
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
4ffd18a774 dhcpcd.exe: Do not overwrite the default gateway when empty
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
ccf36e9e8c dhcpcd.exe: Use DNS servers from QMI
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
261727435d dhcpcd.exe: Store the default gateway when in QMI mode
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
36914cce70 dhcpcd.exe: Only set gateway when we have received one
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
11f6226f65 dhcpcd.exe: Actually use the received MTU
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
a22e3c8ec7 dhcpcd.exe: Flush any configured IP addresses on shutdown
This allows us to start with a fresh interface every time dhcpcd is
being restarted.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
f28d5fa8cc network: Remove --debug switch for dhcpcd in QMI mode
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:46 +00:00
Michael Tremer
957863f754 network: Add support for QMI modems
QMI is a proprietary interface from Qualcomm which are absolute pioneers
when it comes to interfacing with modems. I don't think there would be
any way to make this any more complicated and bloated.

So, bascially we will put the modem into a raw IP mode which changes the
interface into Point-to-Point mode.

We then configure the provider settings using qmicli. After that, the
modem will try to connect to the provider and obtain an IP address.

We will then start a DHCP client which does not do any DHCP-ing because
implementing that would be too complicated. Instead we do something even
*more* complicated where we would launch a custom script which asks the
modem for the allocated IP address and will configure it into the
device. The DHCP client then reads that IP address from the device and
pretends it came up with it by itself. Such an easy way to do this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:45 +00:00
Michael Tremer
c6551e73c2 network: Allow passing custom options to dhcpcd
This is useful for debugging.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:45 +00:00
Michael Tremer
33d2aa6d02 dhcpcd.exe: Allow using the DHCP setup scripts when RED is not configured as DHCP
This is useful for dial-up methods that use DHCP, but when RED_TYPE is
configured as PPP.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:45 +00:00
Michael Tremer
177ec16705 dhcpcd: Log any unhandled client events
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-12-17 17:20:45 +00:00
Mathew McBride
9745a212d4 initscripts: load RTC module (RX8025) for Ten64 board
For reasons I have not been able to determine, the RTC
module for the Ten64 board (rtc-rx8025) is not automatically
loaded at startup, despite every other relevant modules being
loaded.

modprobe it manually if we are on a Ten64 board.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-10-04 14:45:19 +00:00
Peter Müller
532c31c529 dbus: Fix "statusproc" call in initscript
Fixes: #12916
Tested-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-09-01 20:36:18 +00:00
Michael Tremer
c4fc6eb017 nqptp: New package
This is a PTP clock synchronisation daemon.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-08-10 10:44:31 +00:00
Tim FitzGeorge
733267f35a firewall: Add ipblocklist related chains.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Michael Tremer
255873a5f9 random: Drop busy-loop script
This is no longer required because the kernel will now try to
generate some randomness in an easier way when needed.

This has been added in: b923dd3de0

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-06-29 20:11:34 +00:00
Peter Müller
54bd60b67b Explicitly harden mount options of sensitive file systems
These were found to got lost after upgrading to Core Update 169, so we
set them explicitly to avoid accidential security downgrades.

https://lists.ipfire.org/pipermail/development/2022-June/013714.html

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-06-22 12:23:10 +00:00
Jon Murphy
2234e8aaca Ship NTP changes
- Device time more accurate.  (e.g., +/- 10 seconds per day to < 100 ms on some devices)
   ( I know we don't need the perfect time server )
 - NTP and time will be accurate in manual mode (setting on Time Server > NTP Configuration WebGUI)
 - Change NTP "prefer" server:
    - The current preferred NTP server in an Undisciplined Local Clock.
    - This is intended when no outside source of synchronized time is available.
    - Change the "prefer" server from 127.127.1.0 to the Primary NTP server specified on
      the Time Server > NTP Configuration WebGUI page.
 - Change allows the drift file (located at /etc/ntp/drift) to be populated by ntpd.
    - The drift file is updated about once per hour which helps correct the device time.

Signed-off-by: Jon Murphy <jon.murphy@ipfire.org>
2022-06-20 20:43:34 +00:00
Peter Müller
cf7f5004ac localnet: Add "edns0" to /etc/resolv.conf options for RFC 2671 support
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-06-13 15:47:34 +00:00
Michael Tremer
9e41373213 cloud: Execute user-data scripts at the end of initialization
This is useful when the user-data needs to reboot an instance.
Previously, some initialization did not happen which is now being done
first before the user-data script is being executed.

This gives users more flexibility about what they are doing in those
scripts.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-05-30 19:21:59 +00:00
Peter Müller
c74f7aa6d9 Merge branch 'next' into temp-c168-development 2022-04-18 16:38:47 +00:00
Peter Müller
c5b091fb10 Silence STDERR when calling 'sensors-detect' in collectd initscript
https://lists.ipfire.org/pipermail/development/2022-April/013189.html

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-04-13 09:22:58 +00:00
Peter Müller
cad2ce78dd Core Update 167: Replace /etc/mtab by symlink to /proc/self/mounts
mount, as updated via util-linux, no longer writes /etc/mtab, causing
programs to rely on this file's content (such as the check_disk Nagios
plugin) to stop working.

/proc/self/mounts contains all the necessary information, so it is fine
to replace /etc/mtab by a symlink to it.

Fixes: #12843

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-04-12 14:10:08 +00:00
Matthias Fischer
5806ff0cc5 Deleted 'vnstat' calls in initscripts - those options were removed and we're using 'vnstatd', not 'vnstat'.
Fixes: 12831

Jonatan Schlag reported that the command line options of 'vnstat' had changed
"...and seemed to be broken a long time".
=> https://bugzilla.ipfire.org/show_bug.cgi?id=12831#c0

Several command line switches used in networking initscripts were obviously removed.

Affected commands in '.../networking/any' and '.../networking/red'):

...
/usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
...
/usr/bin/vnstat -u -i ${DEVICE} -r --disable > /dev/null 2>&1
...

and
...
/usr/bin/vnstat -u -i ppp0 -r --disable > /dev/null 2>&1
...

Adolf Belka tested this, "looked through the changelogs" and found - besides that
the switch '--enable' had been removed "in version 2.0 in 2018" - that '--enable', '--update'
and '--reset' switches are either not needed or not supported anymore.
"The old man page indicates that none of those options are used when the vnstat daemon
is running."

Since we only start and run 'vnstatd' in IPFire it was decided to remove these commands.

Reported-by: jonatan.schlag <jonatan.schlag@ipfire.org>
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
2022-04-10 09:53:49 +00:00
Peter Müller
247e97800d firewall: Fix placement of HOSTILE chains
They were mistakenly placed after the IPS chains in commit
7b529f5417, but should be placed after the
connection tracking and before the IPS.

Fixes: #12815

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-23 16:07:36 +00:00
Peter Müller
90f03efea5 Core Update 166: Introduce new 2022 Pakfire key
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-03-22 17:34:30 +00:00
Peter Müller
219a998412 Core Update 166: Drop old 2007 Pakfire key, and remove it from existing installations
It is not necessary to have this key present on IPFire systems anymore,
since it has not been in use for years, and we can expect systems to be
sufficiently up-to-date, so they no longer need to rely on old updates
or add-ons signed with this key.

Also, given the current key was generated in 2018, we should consider a
Pakfire key rollover soon.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-21 11:46:36 +00:00
Michael Tremer
e77d960bac firewall: Make blocking all traffic impossible on HOSTILE
The current setup can fail and block all traffic on RED if the RETURN
rules could not be created.

This can happen when the kernel fails to load the ipset module, as it is
the case after upgrading to a new kernel. Restarting the firewall will
cause that the system is being cut off the internet.

This design now changes that if those rules cannot be created, the
DROP_HOSTILE feature is just inactive, but it would not disrupt any
traffic.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-14 15:19:12 +00:00
Stefan Schantl
7b529f5417 firewall: Move dropping hostile networks to rules.pl.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-05 14:31:55 +00:00
Michael Tremer
5d0d1144fb dhcpcd: Force setting MTU through dhcpcd
The DHCP server can instruct clients to configure a certain MTU.

This used to be done by setting the MTU of the interface. However,
dhcpcd has changed this behaviour using routes to.

We used to have a modified version of the old mechanism which no longer
works well with the new system and is therefore to be dropped.

This is the first commit in the series implementing the new behaviour
and telling dhcpcd to use the configured MTU.

Fixes: #12563
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-23 15:46:44 +00:00
Michael Tremer
d5538121d7 oci: user-data: Try to decode base64 content
Terraform only supports sending any shell scripts encoded in base64
which is however not required by Oracle. Therefore we have to test if
the script is encoded or not.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-21 21:35:03 +00:00
Arne Fitzenreiter
a74bf13cbb Merge branch 'master' into next 2022-02-19 16:02:28 +00:00
Arne Fitzenreiter
2ecb278462 unbound: fix dns working check
pool.ipfire.org cannot resolved. Now try both default dns
servers. If one works dns is working.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-19 15:53:14 +00:00
Peter Müller
926d840fae firewall: Make logging of conntrack INVALIDs configureable
In theory, logging of dropped packets classified by conntrack as being
INVALID should never be disabled, since one wants to have a paper trail
of what his/her firewall is doing.

However, conntrack seems to drop a lot of (at the first glance
legitimate) packets, hence bloating the logs, making spotting the
important firewall hits more difficult.

This patch therefore adds the option to disable logging of packets being
dropped by conntrack due to INVALID state.

Please note:
- This patch does not add this category to the firewall hits graph.
- The variables in this patch ("LOGDROPCTINVALID") should make it clear
  that it is about toggling _logging_, not the actual _dropping_. Other
  variables are still in need of being renamed to clarify this, which
  will be done in a dedicated patch.
- Also, the changes made to update.sh need to take place in
  config/rootfiles/core/164/update.sh for "master", since this patch has
  been developed against "next". Kindly cherry-pick the necessary
  changes.

Partially fixes: #12778

Reported-by: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-19 15:37:16 +00:00
Peter Müller
5c1af49c83 firewall: Add proper logging prefix for conntrack INVALID hits
Fixes: #12778

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-19 08:06:36 +00:00
Peter Müller
66c3619872 Early spring clean: Remove trailing whitespaces, and correct licence headers
Bumping across one of our scripts with very long trailing whitespaces, I
thought it might be a good idea to clean these up. Doing so, some
missing or inconsistent licence headers were fixed.

There is no need in shipping all these files en bloc, as their
functionality won't change.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-18 23:54:57 +00:00
Peter Müller
8269c8319c firewall: Make logging of conntrack INVALIDs configureable
In theory, logging of dropped packets classified by conntrack as being
INVALID should never be disabled, since one wants to have a paper trail
of what his/her firewall is doing.

However, conntrack seems to drop a lot of (at the first glance
legitimate) packets, hence bloating the logs, making spotting the
important firewall hits more difficult.

This patch therefore adds the option to disable logging of packets being
dropped by conntrack due to INVALID state.

Please note:
- This patch does not add this category to the firewall hits graph.
- The variables in this patch ("LOGDROPCTINVALID") should make it clear
  that it is about toggling _logging_, not the actual _dropping_. Other
  variables are still in need of being renamed to clarify this, which
  will be done in a dedicated patch.
- Also, the changes made to update.sh need to take place in
  config/rootfiles/core/164/update.sh for "master", since this patch has
  been developed against "next". Kindly cherry-pick the necessary
  changes.

Partially fixes: #12778

Reported-by: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-18 22:40:55 +00:00
Peter Müller
5ca74566b3 firewall: Add proper logging prefix for conntrack INVALID hits
Fixes: #12778

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-18 22:30:10 +00:00
Stefan Schantl
83085ae97c firewall: Load ipset list before creating rules for DROP_HOSTILE.
Otherwise there is no ipset list use-able and the feature will not work.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
2022-02-18 09:28:30 +00:00
Peter Müller
7987879e21 firewall: Get rid of xt_geoip for DROP_HOSTILE
This is required to drop xtables-addons altogether.

Cc: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-15 18:18:31 +00:00
Stefan Schantl
8796d41a4d firewall: Drop P2P chains from initscript.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-15 18:13:27 +00:00
Arne Fitzenreiter
4b94860d07 firewall: Revert strict martian check on loopback interface
If the firewall is talking to itself using one of its private IP
addresses (e.g. the primary green interface IP address), it will use the
loopback interface.

This is due to the local routing table which will be looked up first:

  [root@ipfire ~]# ip rule
  0:      from all lookup local
  128:    from all lookup 220
  220:    from all lookup 220
  32765:  from all lookup static
  32766:  from all lookup main
  32767:  from all lookup default

It contains:

  [root@ipfire ~]# ip route show table local
  local 8x.1x.1x.1x dev ppp0 proto kernel scope host src 8x.1x.1x.1x
  local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
  local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
  broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
  local 192.168.x.1 dev green0 proto kernel scope host src 192.168.x.1
  broadcast 192.168.x.255 dev green0 proto kernel scope link src 192.168.x.1

Any lookup for the green IP address will show this:

  local 192.168.x.1 dev lo table local src 192.168.x.1 uid 0
      cache <local>

A test ping shows this in tcpdump:

  [root@ipfire ~]# tcpdump -i any icmp -nn
  tcpdump: data link type LINUX_SLL2
  tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
  listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
  17:24:22.864293 lo    In  IP 127.0.0.1 > 127.0.0.1: ICMP echo request, id 10420, seq 1, length 64
  17:24:22.864422 lo    In  IP 127.0.0.1 > 127.0.0.1: ICMP echo reply, id 10420, seq 1, length 64
  17:24:29.162021 lo    In  IP 192.168.x.1 > 192.168.x.1: ICMP echo request, id 1555, seq 1, length 64
  17:24:29.162201 lo    In  IP 192.168.x.1 > 192.168.x.1: ICMP echo reply, id 1555, seq 1, length 64

For this reason, we will have to accept any source and destination IP
address on the loopback interface, which is what this patch does.

We can however, continue to check whether we received any packets with
the loopback address on any other interface.

This regression was introduced in commit a36cd34e.

Fixes: #12776 - New spoofed or martian filter block
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2022-02-14 19:47:37 +00:00