Odi's astoundingly incomplete notes
New Entries
On Gentoo sshd crashes after gcc update
I have updated from gcc-7.3 to gcc-8.2. On most of my Gentoo boxes this lead to continous crashing of sshd. The crashes don't actually look like crashes (not sefault or anything) but rather look like normal process exit or sigkill. Sshd would crash at connection attempts and also when I run grub-install (which is really freaking weird). The problem persists across reboots.
After I rebuilt ssh openssl and pam with the new compiler the problem went away:
After I rebuilt ssh openssl and pam with the new compiler the problem went away:
emerge -1av openssh openssl pam
Add comment
Relaying UDP broadcasts
iptables -t mangle -A INPUT -i eth0 -d 255.255.255.255 -j TEE --gateway 10.1.1.255The above
iptables rule copies broadcast traffic received on the eth0 network interface to another network interface (the one whose broadcast address is 10.1.1.255). Note that this is one-way only. We can't add a second rule for the other direction without creating an infinite packet loop. We need to play tricks with the TTL for that!Incoming broadcast packets typically have a TTL of 64 or 128. TEE uses the kernel function
nf_dup_ipv4() to copy the packet, which already decrements the TTL if the rule is in INPUT or PREROUTING. Note that a packet with TTL=0 will still be accepted by the destination, but will no longer be routed. But TEE itself does not check for TTL=0 and happily copies such packets. So we need to prevent that too, since what we do is effectively routing.The improved rule adds TTL sanity check:
iptables -t mangle -A INPUT -i eth0 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TEE --gateway 10.1.1.255If we want to add a rule for the other direction as well...
iptables -t mangle -A INPUT -i eth1 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TEE --gateway 10.1.0.255then we easily create a packet loop, since the copy of a packet on
eth0 will now also match the rule on eth1. To prevent that we need to ensure that the copied packet has TTL=0. We can do that by simply setting the TTL=1 of all incoming broadcasts before passing them to TEE. Then no more loops should occur. The complete rule set for merging a broadcast domain across networks is then:iptables -t mangle -A INPUT -i eth0 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TTL --ttl-set 1 iptables -t mangle -A INPUT -i eth1 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TTL --ttl-set 1 iptables -t mangle -A INPUT -i eth0 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TEE --gateway 10.1.1.255 iptables -t mangle -A INPUT -i eth1 -d 255.255.255.255 -m ttl --ttl-gt 0 -j TEE --gateway 10.1.0.255Make sure to monitor your broadcast traffic to detect any misconfiguration after that change:
tcpdump -vnpi eth0 ip broadcast
preventing CUPS password prompt
Add Unix groups to CUPS:
Add your user to that group:
/etc/cups/cups-files:
SystemGroup lpadmin rootSet permissions to access the local secret:
chgrp -R lpadmin /run/cups/certsThis directory contains a secret that is read by CUPS utilities like
cupsenable. They pass that secret in HTTP Authorization headers to the local HTTP socket when sending command.Add your user to that group:
usermod -a -G lpadmin myuser
Be bloody careful with CNAME records
Be careful when doing something stupid!
CNAME records are useful. Especially together with external hosting services.
You run your domain and control DNS yourself but you host a website on an external service. They manage the IP of that site and give you a name that may look like
Never create a CNAME record for the zone name!
Also when caches start picking up the SOA information of the wrong zone, they apply the TTL values of that zone. So getting control of your zone back may not be easy and is not under your control anymore.
Also any secondary DNS server will pickup the zone redirect and may completely stop updating the zone from your authorative server. You need to manually fix that on the secondary DNS!
CNAME records are useful. Especially together with external hosting services.
You run your domain and control DNS yourself but you host a website on an external service. They manage the IP of that site and give you a name that may look like
examplesite383.hostingprovider.biz and already points to the correct IP. You want to map it into your DNS zone with a nice name like www.fancyproduct.com so creating a CNAME that points tha name www to your hosting provider's name is a practical way to go. You also want to do the same without the www prefix, but mind you! Creating a CNAME for fancyproduct.com would redirect the complete zone to a different one!Never create a CNAME record for the zone name!
Also when caches start picking up the SOA information of the wrong zone, they apply the TTL values of that zone. So getting control of your zone back may not be easy and is not under your control anymore.
Also any secondary DNS server will pickup the zone redirect and may completely stop updating the zone from your authorative server. You need to manually fix that on the secondary DNS!
When Oracle does not register with the listener
If your Oracle database does not register with the listener, you get ORA-12505. Normally the DB registeres automatically after a while. But you can force it to do that.
As SYS:
Check the listener status:
Check which listener the DB wants to register with:
As SYS:
ALTER SYSTEM REGISTER;However, if it did not register automatically, chances are that this does not help either.
Check the listener status:
lsnrctl statusCheck the listener's log file (filename is in the status output).
Check which listener the DB wants to register with:
select name, value from v$parameter where name in ('local_listener', 'remote_listener');
This gives you a TNS name. Check that this TNS name is defined in $ORACLE_HOME/network/admin/tnsnames.ora Such an entry looks like:
LISTENER_SID = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle.example.com)(PORT = 1521))
ORDImage leaks files in /tmp
In Oracle 12.2.0.1 the following call leaks an imageio file in /tmp. Not nice.
ORDImage.processCopy(pImageBlob, 'maxscale='100 100', destBlob);GUI code is prone to memory leaks
Synology load
Are they sure they want to run all sorts of crap as root without any limits?
top - 15:12:11 up 12 min, 1 user, load average: 98.10, 40.27, 17.04 Tasks: 271 total, 112 running, 159 sleeping, 0 stopped, 0 zombie %Cpu(s): 17.0 us, 81.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.7 hi, 0.6 si, 0.0 st GiB Mem : 0.113 total, 0.008 free, 0.066 used, 0.039 buff/cache GiB Swap: 2.000 total, 1.801 free, 0.199 used. 0.006 avail Mem PID USER PR NI VIRT RES %CPU %MEM TIME+ S COMMAND 8000 root 20 0 61.2m 4.8m 1.1 4.2 0:00.79 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 8014 root 20 0 61.2m 4.8m 1.1 4.2 0:00.79 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 8020 root 20 0 61.2m 4.8m 1.1 4.2 0:00.80 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 8022 root 20 0 61.2m 4.8m 1.1 4.2 0:00.78 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 8024 root 20 0 61.2m 4.8m 1.1 4.2 0:00.78 R synoscgi_SYNO.Core.Package.Server_1_get_timestamp 8025 root 20 0 61.2m 4.8m 1.1 4.2 0:00.85 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 7994 root 20 0 61.2m 4.8m 1.1 4.2 0:00.74 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get 7995 root 20 0 61.2m 4.8m 1.1 4.2 0:00.85 R synoscgi_SYNO.Core.Package.Thumb.Server_1_get
.. well, as far as they do (sometimes?) not really know what they are doing, it seems so.
This is why synology nas no longer are my favourites and I am not willing to recommend them.
This is why synology nas no longer are my favourites and I am not willing to recommend them.
Gentoo intel-microcode reorg
Gentoo has given more love to its
The new USE flag
sys-firmware/intel-microcode package. It's now easier than ever to update microcode automatically early on boot. This is a valuable alternative to shipping microcode within the BIOS. I mean honestly, who regularly checks for BIOS updates? Much easier by doing that through an ebuild.The new USE flag
initramfs now builds a cpio archive at /boot/intel-uc.img ready to be used by grub. In /boot/grub/grub.cfg:
menuentry 'Gentoo Linux 4.14' {
root=hd0,1
linux /boot/linux-4.14.12 root=LABEL=ROOT ro rootfstype=ext4 net.ifnames=0
initrd /boot/intel-uc.img /boot/initrd.img
}
Note how the microcode intitramfs is simply prepended to the boot initramfs (initrd). A kernel that has microcode laoding support enabled will find it there, upload the microcode into the cpu and then discard the initramfs blob, and continue booting with the initrd.img. The first line in your dmesg output will show:
microcode: microcode updated early to revision 0x80, date = 2018-01-04
Gentoo enables PIE
Gentoo has new profiles that require you to "recompile everything". That is technically not really necessary. Only static libraries really need recompiling.
Here is why:
A static library is just an archive of .o files (similar to tar), nothing more, and linking against a static library is roughly the same as just adding more .o files to the linker line. You can also link a static library into a shared library - the code in the static library is then just copied into the shared library (but the code then must be compiled with -fPIC, as with all other code that is used in shared libraries).
You can find static libs like so:
Here is why:
A static library is just an archive of .o files (similar to tar), nothing more, and linking against a static library is roughly the same as just adding more .o files to the linker line. You can also link a static library into a shared library - the code in the static library is then just copied into the shared library (but the code then must be compiled with -fPIC, as with all other code that is used in shared libraries).
You can find static libs like so:
equery b $(find /usr/lib/ /lib/ -name *.a) | awk '{ print $1; }' | sort | uniq
Typically this yields packages like elfutils, libbsd, nss, iproute2, keyutils, texinfo, flex, db, numactl.