fs.com s5850 and s8050 series type switches have a secret mode which
lets you enter a regular shell from the switch cli, like so:
hostname# start shell
Password:
The command and password are not documented by the manufacturer,
i wondered wether if its possible to extract that password from
the firmware. After all: its my device, and i want to have access
to all the features!
Download the latest firmware image for those switch types and let binwalk do
its magic:
Sometimes I have remote meetings with Google Meet. Unlike the other
video-conferencing services that I use (Bluejeans, Zoom), my video
was stretched out of proportion under Google Meet with Firefox.
I haven't found out why this was happening, but I did figure out a
work-around.
Thanks to Daniel Silverstone, Rob Kendrick, Gregor Herrmann and Ben Allen for
pointing me in the right direction!
Hardware
The lovely Sony RX-100 mk3 that I bought in 2015 has
spent most of its life languishing unused. During the Pandemic, once
I was working from home all the time, I decided to press-gang it into
service as a better-quality webcam. Newer models of this camera
the mark 4 onwards have support for a USB mode called "PC Remote",
which effectively makes them into webcams. Unfortunately my mark 3
does not support this, but it does have HDMI out, so I picked up a
cheap "HDMI to USB Video Capture Card" from eBay.
Video modes
Before: wrong aspect ratio
This device offers a selection of different video modes over a webcam
interface. I used qv4l2 to
explore the different modes. It became clear that the camera was
outputting a signal at 16:9, but the modes on offer from the dongle
were for a range of different aspect ratios. The picture for these
other ratios was not letter or pillar-boxed, but stretched to fit.
I also noticed that the modes which had the correct aspect ratio were
at very low framerates: 1920x1080@5fps, 1360x768@8fps, 1280x720@10fps.
It felt to me that I would look unnatural at such a low framerate. The
most promising mode was close to the right ratio, 720x480 and 30 fps.
Software
After: corrected aspect ratio
My initial solution is to use the v4l2loopback
kernel module, which provides a virtual loop-back webcam interface. I
can write video data to it from one process, and read it back from
another. Loading it as follows:
modprobe v4l2loopback exclusive_caps=1
The option exclusive_caps configures the module into a mode where it
initially presents a write-only interface, but once a process has opened
a file handle, it then switches to read-only for subsequent processes.
Assuming there are no other camera devices connected at the time of
loading the module, it will create /dev/video0.1
I experimented briefly with OBS Studio, the
very versatile and feature-full streaming tool, which confirmed that I
could use filters on the source video to fix the aspect ratio, and emit
the result to the virtual device. I don't otherwise use OBS, though, so
I achieve the same result using ffmpeg:
The source options are to select the source video mode I want. The
codec and pixel formats are to match what is being emitted (I determined
that using ffprobe on the camera device). The resizing is triggered by
supplying a different size to the -s parameter. I think that is equivalent
to explicitly selecting a "scale" filter, and there might be other filters
that could be used instead (to add pillar boxes for example).
This worked just as well. In Google Meet, I select the Virtual Camera,
and Google Meet is presented with only one video mode, in the correct aspect
ratio, and no configurable options for it, so it can't misbehave.
Future
I'm planning to automate the loading (and unloading) of the module and starting
the ffmpeg process in response to the real camera device being plugged or
unplugged, using systemd events and services. (I don't leave the camera plugged
in all the time due to some bad USB behaviour I've experienced if I do so.)
If I get that working, I will write a follow-up.
you can request a specific device name/number with another module option.
A new major release of RcppRedis arrived on CRAN today. RcppRedis is one of several packages connecting R to the fabulous Redis in-memory datastructure store (and much more). RcppRedis does not pretend to be feature complete, but it may do some things faster than the other interfaces, and also offers an optional coupling with MessagePack binary (de)serialization via RcppMsgPack. The package has carried production loads for several years now.
This release integrates support for pub/sub, a popular messaging pattern in which one or more clients can subscribe to one or more channels . Whenever a client instances publishes, the Redis server immediately updates all clients listening on the given channel. This pattern is fairly common to transmit data to listeners. A there is a bit more to explain about this, I also added a brand-new vignette describing pub/sub with RcppRedis, along with another introductory vignette about Redis itself. We blogged about this exciting new feature and its particular use for market monitoring in R4 #36 recently too.
The pub/sub feature was available in package rredis by Bryan Lewis and has now been ported over by Bryan in a truly elegant yet compact implementation. We placed the code for the pub/sub examples, both for a single symbol (SP 500) as well as for a set of (futures) symbols, into a new examples/ subdirectory.
Other changes in this release are the removal of the build-dependency on Boost (or, rather, my BH package), an update to the included hiredis library (used if no system-wide version is found), and an updated to the UCRT build for R. That last one is a bit of a sore spot and nobody at CRAN deemed it necessary to tell me they were waiting for me to make this change; communication with the CRAN team can still be challenging (and I am being generous here). Anyway, the package is now on CRAN so all is well now, at long last.
The detailed changes list follows.
Changes in version 0.2.0 (2022-03-08)
Two simple C++11 features remove needs for BH and lexical_cast() (Dirk in #45 addressing #44).
Redis pub/sub is now supported (Dirk in #43, Bryan in #46).
Bryan Lewis is now a coauthor.
Added pub/sub examples for single and multiple Globex symbols.
The included hiredis sources have been updated to release 1.0.2.
Two vignettes have been added to introduce Redis and to described a live market-monitoring application included in directory pubsub/.
The UCRT build was updated per a suggestion by Tomas.
After upgrading my MythTV machine to Debian
Bullseye and MythTV
31, my Streamzap remote
control stopped working correctly: the up and down buttons were
working, but the OK button wasn't.
Here's the complete solution that made it work with the built-in kernel
support (i.e. without LIRC).
Button re-mapping
Since some of the buttons were working, but not others, I figured that the
buttons were probably not mapped to the right keys.
Inspired by these old v4l-utils-based
instructions,
I made my own custom keymap by by copying the original keymap:
Note that the keycodes can be found in the kernel source
code.
With my own keymap in place at /etc/rc_keymaps/streamzap.toml, I changed
/etc/rc_maps.cfg to have the kernel driver automatically use it:
Button repeat delay
To adjust the delay before button presses are repeated, I followed these
old out-of-date
instructions
on the MythTV wiki and put the following in
/etc/udev/rules.d/streamzap.rules:
Note that the -d option has been replaced with -s in the latest version
of ir-keytable.
To check that the Streamzap is indeed detected as rc0 on your system, use
this command:
$ ir-keytable
Found /sys/class/rc/rc0/ with:
Name: Streamzap PC Remote Infrared Receiver (0e9c:0000)
Driver: streamzap
Default keymap: rc-streamzap
...
Make sure you don't pass the -c to ir-keytable or else it will clear the
keymap set via /etc/rc_maps.cfg, removing all of the button mappings.
Wait! Just like yesterday when I was accepted as an Outreachy intern and the first half of the internship is finished . How time flies when you are having a good time
As part of the requirements for the final application during the contribution period for the Outreachy internship, I needed to provide a timeline to achieve our goal on my outreachy task which is transitioning of dependencies in node16 and webpack5. Having consulted my mentors who implied that the packages depending on webpack and nodejs combined are so numerous that its impossible to finish all within a space of three months but we have steps to guide us through the entire process to achieve most of our goals which are
Find a list of packages(failing rebuild and testing with autopkgtest, of reverse dependencies of webpack and nodejs) to fix.
See if new upstream versions are available that support nodejs16 and webpack5 respectively.
See if the new upstream version works and doesn't fail while rebuilding or testing with autopkgtest.
Report bug in Debian if any fails to rebuild or test with autopkgtest.
Forward bugs upstream if needed.
Fix packages and forward patches.
As of this writing(though a little late ) we have successfully rebuilt all reverse dependencies of webpack5 and split them equally each for I and my co-intern for all Javascript modules as ruby packages also depend on webpack which is a total of 44 packages. Filed a bug report on Debian bug tracking system for failing packages, also the original maintainer or uploader of the package to the Debian archive mostly Debian developers also get a mail in references to the package bug report. Sometimes the uploader who also receives the bug report decides to help out to fix the package and forward the patch upstream if need be. We have also filed an issue to upstream repo mostly via github where some respond and create PR to solve those errors and others are plain aversive to the whole idea. PR from the upstream developer is cherry-picked and a patch is created by us to incorporate the code into our own working repository. some package upstream maintainer rejects such issues or doesn't respond, we take it upon ourselves to fix the package. The total number of packages that are successfully updated and ready to be merged is 10 packages while 12 packages remain on my own end to be updated.
One of the most challenging packages to update so far was prop-type as its runs its large test suite using jest of a lower version 19.0.2 compared to that of Debian OS which is version 27.5.1 updating and migrating its API's and methods to use the Debian updated version is so challenging after several googling, testing out the solution from StackOverflow, trials, and errors, reading documentations we eventually made progress with the help of my mentor, co-intern and the whole community member. It's so crazy that when I got it working I said to myself. phew it's not rocket science why can I figure it out sooner than expected
I initially proposed that I would be halfway done with the project by now, I guess the reason am not able to achieve some of our goals which are finishing up with the packages for webpack and moving to transition some of the nodejs packages at all is DEBUGGING. Yes DEBUGGING! where you never can predict what the solution is. is the problem coming from Debian? or dependencies of the package you are working on, upstream bug, or dependencies of dependencies of the package you are working on, so many questions to answer. You can't easily find a solution to a bug as it takes time to try out so many guesses more of an educated guess, or even try out all the solutions from stack overflow and still no viable progress. Obviously, you cannot really know about something to set up a plan for unless you get right into it.
One way of doing this, if I have to start again is the truly understand how the javascript package work under the hood, how its handles different interaction between packages, some of its dos and don't of transpiling, bundling, testing, e.t.c
I guess my unrealistic goals need to be modified because some drawback that was not envisaged popped up and I underestimated the complexity of the tasks, which will be reducing the number of packages to update in transitioning of nodejs from what I planned
My major focus for the second half of the internship is to fix bugs and errors I discover, file bug reports for future bugs to seek help from co-maintainer or developers, file issues upstream and close those whose bugs are already resolved for the remaining 12 packages, and ultimately successfully uploading all reverse dependencies. Also diving into transitioning of nodejs16.
Thanks for stopping by
Leonardo and I are pleased to another update to our nanotime package bringing it to version 0.3.6 which landed on CRAN earlier today.
nanotime relies on the RcppCCTZ package (as well as the RcppDate package for additional C++ operations) and offers efficient high(er) resolution time parsing and formatting up to nanosecond resolution, and the bit64 package for the actual integer64 arithmetic. Initially implemented using the S3 system, it has benefitted greatly from a rigorous refactoring by Leonardo who not only rejigged nanotime internals in S4 but also added new S4 types for periods, intervals and durations.
This release corrects subsetting with %in% operator, integrates it better fit in the mixed S3/S4 setup, fixes a negative period parse, and updates class comparisons to rely on inherits(). The NEWS snippet has the full more details.
Changes in version 0.3.6 (2022-03-06)
Fix incorrect subsetting with operator %in% (Leonardo in #100 fixing #99).
Fix incorrect parsing for negative nanoperiod (Leonardo in #100 fixing #96).
FTP master
This month I accepted 484 and rejected 73 packages. The overall number of packages that got accepted was 495.
The overall number of rejected packages was 76, which is about 15% of the uploads to NEW. While most of the maintainers do a great job when creating their debian/copyright, others are a bit lax. Unfortunately those people seem to be more enthusiastic when fighting for changes in NEW processing or even removing NEW.
One argument in discussions about NEW is that the copyright verification of packages can be done by the community after accepting the packages in the archive.
Last month I did not get any hint that such checks have been done by anybody. As the past already showed several times, this community based checks simply do not exist.
So in the end poorly maintained copyright information will rot in the archive and I am not sure that this really corresponds with the Debian Social Contract.
Debian LTS
This was my ninety-second month that I did some work for the Debian LTS initiative, started by Raphael Hertzog at Freexian.
This month my all in all workload has been 40h. During that time I did LTS and normal security uploads of:
[DLA 2928-1] htmldoc security update for three CVEs
[#1004049] buster-pu: zziplib debdiff was approved and package uploaded
[#1004050] bullseye-pu: zziplib debdiff was approved and package uploaded
[#1004055] buster-pu: debdiff was approved and package uploaded
Unfortunately salsa went down at the end of the month, so several planned uploads did not happen and have to be delayed to March.
I also continued to work on security support for golang packages. Further I worked on packages in NEW on security-master and injected missing sources. Last but not least I did some days of frontdesk duties.
Debian ELTS
This month was the forty-fourth ELTS month.
During my allocated time I uploaded:
ELA-567-1 for apache2
ELA-567-2 for apache2
ELA-568-1 for ksh
ELA-569-1 for tiff
ELA-570-1 for htmldoc
Further I worked on cyrus-sasl but did not do an upload yet.
Last but not least I did some days of frontdesk duties.
Debian Printing
As announced last month I uploaded a new version of cups.
Altogether I uploaded new upstream versions or improved packaging of:
Welcome to the February 2022 report from the Reproducible Builds project. In these reports, we try to round-up the important things we and others have been up to over the past month. As ever, if you are interested in contributing to the project, please visit our Contribute page on our website.
Jiawen Xiong, Yong Shi, Boyuan Chen, Filipe R. Cogo and Zhen Ming Jiang have published a new paper titled Towards Build Verifiability for Java-based Systems (PDF). The abstract of the paper contains the following:
Various efforts towards build verifiability have been made to C/C++-based systems, yet the techniques for Java-based systems are not systematic and are often specific to a particular build tool (eg. Maven). In this study, we present a systematic approach towards build verifiability on Java-based systems.
We first define the problem, and then provide insight into the challenges of making real-world software build in a reproducible manner-this is, when every build generates bit-for-bit identical results. Through the experience of the Reproducible Builds project making the Debian Linux distribution reproducible, we also describe the affinity between reproducibility and quality assurance (QA).
In openSUSE, Bernhard M. Wiedemann posted his monthly reproducible builds status report.
On our mailing list this month, Thomas Schmitt started a thread around the SOURCE_DATE_EPOCH specification related to formats that cannot help embedding potentially timezone-specific timestamp. (Full thread index.)
The Yocto Project is pleased to report that it s core metadata (OpenEmbedded-Core) is now reproducible for all recipes (100% coverage) after issues with newer languages such as Golang were resolved. This was announced in their recent Year in Review publication. It is of particular interest for security updates so that systems can have specific components updated but reducing the risk of other unintended changes and making the sections of the system changing very clear for audit.
The project is now also making heavy use of equivalence of build output to determine whether further items in builds need to be rebuilt or whether cached previously built items can be used. As mentioned in the article above, there are now public servers sharing this equivalence information. Reproducibility is key in making this possible and effective to reduce build times/costs/resource usage.
diffoscopediffoscope is our in-depth and content-aware diff utility. Not only can it locate and diagnose reproducibility issues, it can provide human-readable diffs from many kinds of binary formats. This month, Chris Lamb prepared and uploaded versions 203, 204, 205 and 206 to Debian unstable, as well as made the following changes to the code itself:
Bug fixes:
Fix a file(1)-related regression where Debian .changes files that contained non-ASCII text were not identified as such, therefore resulting in seemingly arbitrary packages not actually comparing the nested files themselves. The non-ASCII parts were typically in the Maintainer or in the changelog text. [][]
Fix a regression when comparing directories against non-directories. [][]
If we fail to scan using binwalk, return False from BinwalkFile.recognizes. []
If we fail to import binwalk, don t report that we are missing the Python rpm module! []
Testsuite improvements:
Add a test for recent file(1) issue regarding .changes files. []
Use our assert_diff utility where we can within the test_directory.py set of tests. []
Don t run our binwalk-related tests as root or fakeroot. The latest version of binwalk has some new security protection against this. []
Codebase improvements:
Drop the _PATH suffix from module-level globals that are not paths. []
Tidy some control flow in Difference._reverse_self. []
Don t print a warning to the console regarding NT_GNU_BUILD_ID changes. []
In addition, Mattia Rizzolo updated the Debian packaging to ensure that diffoscope and diffoscope-minimal packages have the same version. []
Move the contributors.sh Bash/shell script into a Python script. [][][]
Daniel Shahaf:
Try a different Markdown footnote content syntax to work around a rendering issue. [][][]
Holger Levsen:
Make a huge number of changes to the Who is involved? page, including pre-populating a large number of contributors who cannot be identified from the metadata of the website itself. [][][][][]
Improve linking to sponsors in sidebar navigation. []
drop sponsors paragraph as the navigation is clearer now. []
Upstream patches
The Reproducible Builds project attempts to fix as many currently-unreproducible packages as possible. February s patches included the following:
Testing framework
The Reproducible Builds project runs a significant testing framework at tests.reproducible-builds.org, to check packages and other artifacts for reproducibility. This month, the following changes were made:
Daniel Golle:
Update the OpenWrt configuration to not depend on the host LLVM, adding lines to the .config seed to build LLVM for eBPF from source. []
Preserve more OpenWrt-related build artifacts. []
Holger Levsen:
Temporary use a different Git tree when building OpenWrt as our tests had been broken since September 2020. This was reverted after the patch in question was accepted by Paul Spooren into the canonical openwrt.git repository the next day.
Various improvements to debugging OpenWrt reproducibility. [][][][][]
Ignore useradd warnings when building packages. []
Update the script to powercycle armhf architecture nodes to add a hint to where nodes named virt-*. []
Update the node health check to also fix failed logrotate and man-db services. []
Mattia Rizzolo:
Update the website job after contributors.sh script was rewritten in Python. []
Make sure to set the DIFFOSCOPE environment variable when available. []
Vagrant Cascadian:
Various updates to the diffoscope timeouts. [][][]
Node maintenance was also performed by Holger Levsen [] and Vagrant Cascadian [].
Finally
If you are interested in contributing to the Reproducible Builds project, please visit our Contribute page on our website. However, you can get in touch with us via:
About the project
Debci exist to make sure packages work currently after an update, How it does this is by testing all of the packages that have tests written in them to make sure it works and nothing is broken
This project entails making improvements to the platform to make it easier to use and maintain.
Deliverables of the project:
Package landing page displaying pending jobs
web frontend: centralize job listings in a single template
self-service: request test form forgets values when validation fails
Improvement to status
Work done
Package landing page displaying pending jobs
Previously, Jobs that were pending were not displayed on the package page. Working on this added a feature to display pending jobs on package landing.
Working on this task made it known that the same block of codes was repeated in different files which led to the next task
Merge request
web frontend: centralize job listings in a single template
Jobs are listed in various landings such as status packages, Status alerts, status failing, History, and so on. The same Code was repeated in these pages to list the jobs, I worked on refactoring it and created a single template for job listing so it can be used anywhere it s needed.
I also wrote a test for the feature I added. Merge request
self service: request test form forgets values when validation fails
When one tries to request for a test and it fails with an error, originally the form does not remember the values that were typed in the package name, suite field et. c. This fix ensures the form remembers the values inputted even when it throws an error.
N/B: The form checks all architecture on the load of the page merge request
Improvement to status
Originally the Status pages were rendered as static HTML pages but I converted these pages to be generated dynamically, I wrote endpoints for each page.
Since most of the status pages have a list of jobs I modified it to use the template I created for job-listing.
Previously, the status pages had a mechanism to filter such as All, Latest 50 et.c which wasn t paginated. I removed this mechanism added a filter by architecture and suites to these pages and also add pagination.
Last but not the least, I wrote tests for these implementations carried out on the status page.
merge request: first task second task
Major take-aways
I learnt a lot during my internship but most importantly I learnt how to:
write Tests in Ruby and how writing tests is an important aspect of software development
maintain good coding practice, Paying attending to commit messages, Indentation et.c are good areas I developed in writing code.
make contributions in Ruby Programming Language.
Acknowledgement
I can not end this without saying thank you to my mentors Antonio Terceiro, Paul Gevers, and Pavit Kaur for their constant support and guidance throughout the entire duration of this Internship. It has been a pleasure Interacting and learning from everyone.
Review
Outreachy has helped me feel more confident about open-source, especially during the application phase. I had to reach out to the community I was interested in and ask questions on how to get started.
The informal chats week was awesome I was able to build my network and have interesting conversations with amazing individuals in open-source.
To round up, Always ask questions and do not be afraid of making a mistake, as one of the outreachy blog post topics says Everyone struggles!, but never give up!
The diffoscope maintainers are pleased to announce the release of diffoscope
version 207. This version includes the following changes:
* Fix a gnarly regression when comparing directories against non-directories.
(Closes: reproducible-builds/diffoscope#292)
* Use our assert_diff utility where we can within test_directory.py
SSH private key scanner (keys without passphrase)
So for policy reasons, customer wanted to ensure that every SSH
private key in use by a human on their systems has a passphrase set.
And asked us to make sure this is the case.
There is no way in SSH to check this during connection, so client side
needs to be looked at. Which means looking at actual files on the
system.
Turns out there are multiple formats for the private keys - and I
really do not want to implement something able to deal with that on my
own.
OpenSSH to the rescue, it ships a little tool ssh-keygen, most
commonly known for its ability to generate SSH keys. But it can do
much more with keys. One action is interesting here for our case: The
ability to print out the public key to a given private key. For a key
that is unprotected, this will just work. A key with a passphrase
instead leads to it asking you for one.
So we have our way to check if a key is protected by a passphrase. Now
we only need to find all possible keys (note, the requirement is not
keys in .ssh/ , but all possible, so we need to scan for them.
But we do not want to run ssh-keygen on just any file, we would like
to do it when we are halfway sure, that it is actually a key. Well,
turns out, even though SSH has multiple formats, they all appear to
have the string PRIVATE KEY somewhere very early (usually first
line). And they are tiny - even a 16384bit RSA key is just above 12000
bytes long.
Lets find every file thats less then 13000 bytes and has the magic
string in it, and throw it at ssh-keygen - if we get a public key
back, flag it. Also, we supply a random (ohwell, hardcoded)
passphrase, to avoid it prompting for any.
Scanning the whole system, one will find quite a surprising number of
unprotected SSH keys. Well, better description possibly Unprotected
RSA private keys , so the output does need to be checked by a human.
This, of course, can be done in shell, quite simple. So i wrote some
Rust code instead, as I am still on my task to try and learn more of
it. If you are interested, you can find sshprivscanner and play with
it, patches/fixes/whatever
welcome.
I bought myself a new keyboard last November, a Logitech G213. True keyboard fans will tell me it s not a real mechanical keyboard, but it was a lot cheaper and met my requirements of having some backlighting and a few media keys (really all I use are the volume control keys). Oh, and being a proper UK layout.
While the G213 isn t fully independent RGB per key it does have a set of zones that can be controlled. Also this has been reverse engineered, so there are tools to do this under Linux. All I really wanted was some basic backlighting to make things a bit nicer in the evenings, but with the ability to control colour I felt I should put it to good use.
As previously mentioned I have a personal desktop / work laptop setup combined with a UGREEN USB 3.0 Sharing Switch Box, so the keyboard is shared between both machines. So I configured up both machines to set the keyboard colour when the USB device is plugged in, and told them to use different colours. Instant visual indication of which machine I m currently typing on!
Running the script on USB detection is easy, a file in /etc/udev/rules.d/. I called it 99-keyboard-colour.rules:
# Change the keyboard colour when we see it
ACTION=="add", SUBSYSTEM=="usb", ATTR idVendor =="046d", ATTR idProduct =="c336", \
RUN+="/usr/local/sbin/g213-set"
g213-set is a simple bit of Python:
#!/usr/bin/python3
import sys
found = False
devnum = 0
while not found:
try:
with open("/sys/class/hidraw/hidraw" + str(devnum) + "/device/uevent") as f:
for line in f:
line = line.rstrip()
if line == 'HID_NAME=Logitech Gaming Keyboard G213':
found = True
except:
break
if not found:
devnum += 1
if not found:
print("Could not find keyboard device")
sys.exit(1)
eventfile = "/dev/hidraw" + str(devnum)
# z r g b
command = [ 0x11, 0xff, 0x0c, 0x3a, 0, 1, 0xff, 0xff, 0x00, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
with open(eventfile, "wb") as f:
f.write(bytes(command))
I did wonder about trying to make it turn red when I m in a root terminal, but that gets a bit more complicated (I m guessing I need to hook into GNOME Terminal some how?) and this simple hack gives me a significant win anyway.
doveconf to dump dovecot's
configuration to see if what it understands matches what I mean
sieve-test
parses sieve scripts: sieve-test file.sieve /dev/null is a quick and dirty
syntax check
Backup of all mails processed
One thing I did with procmail was to generate a monthly mailbox with all
incoming email, with something like this:
BACKUP="/srv/backupts/test- date +%Y-%m-d .mbox"
:0c
$BACKUP
I did not find an obvious way in sieve to create montly mailboxes, so I
redesigned that system using Postfix's
always_bcc
feature, piping everything to an archive user.
I'll then recreate the monthly archiving using a
chewmail script that I can simply run
via cron.
Configure dovecot
apt install dovecot-sieve dovecot-lmtpd
I added this to the local dovecot configuration:
service lmtp
unix_listener /var/spool/postfix/private/dovecot-lmtp
user = postfix
group = postfix
mode = 0666
protocol lmtp
mail_plugins = $mail_plugins sieve
plugin
sieve = file:~/.sieve;active=~/.dovecot.sieve
This makes Dovecot ready to receive mail from Postfix via a lmtp unix socket
created in Postfix's private chroot.
It also activates the sieve plugin, and uses ~/.sieve as a sieve script.
The script can be a file or a directory; if it is a directory,
~/.dovecot.sieve will be a symlink pointing to the .sieve file to run.
This is a feature I'm not yet using, but if one day I want to try enabling UIs
to edit sieve scripts,
that part is ready.
Delegate to procmail
To make sieve scripts that delegate to procmail, I enabled the
sieve_extprograms plugin:
Without auth_username_format = %Ln dovecot won't be able to understand
usernames sent by postfix in my specific setup.
Moving rules over to sieve
This is mostly straightforward, with the luxury of being able to do it a bit at
a time.
The last tricky bit was how to call spamc from sieve, as in some situations I
reduce system load by running the spamfilter only on a prefiltered selection of
incoming emails.
For this I enabled the filter directive in sieve:
Updates
Ansgar mentioned that it's possible to replicate the monthly mailbox using the
variables and
date
extensions, with a hacky trick from the extensions' RFC:
require"date"require"variables"ifcurrentdate:matches"month""*"set"month""$ 1 ";ifcurrentdate:matches"year""*"set"year""$ 1 ";fileinto:create"$ month -$ year ";
By far the biggest LVM Cache surprise is just how well it works.
Between 2010 and 2020, my single, biggest and most consistent headache managing
servers at May First has been disk i/o. We run a
number of physical hosts with encrypted disks, with each providing a dozen or
so sundry KVM guests. And they consume a lot of disk i/o.
This problem kept me awake at night and made me want to put my head on the
table and cry during the day as I monitored the output of vmstat 1 and
watched each disk i/o death spiral unfold.
We tried everything. Turned off fsck s, turned off RAID monthly checks.
Switched to less intensive backup systems. Added solid state drives and tried
to stragically distribute them to our database partitions and other read/write
heavy services. Added tmpfs file systems where it was possible.
But, the sad truth was: we simply did not have the resources to pay for the
infrastructure that could support the disk i/o our services demanded.
Then, we discovered LVM caching (cue Hallelujah). We starting provisioning SSD
partitions to back up our busiest spinning disk logical volumes and presto. Ten
years of agony gone like a poof of smoke!
I don t know which individuals are responsible for writing the LVM caching code
but if you see this: THANK YOU! Your contributions to the world are noticed,
appreciated and have had an enormous impact on at least one individual.
Some surprises
Filters
For the last two years, with the exception of one little heart
attack, LVM caches have gone very smoothly.
Then, last week we upgraded 13 physical servers straight through from stretch
to bullseye.
It went relatively smoothly for the first half of our servers (the old ones
hosting fewer resources). But, after rebooting our first server with lvm
caching going on, we noticed that the cached disk wasn t accessible.
No problem, we reasoned. We ll just uncache it. Except that didn t work either.
We tried every argument we could find on the Internet but lvm insisted that
the block device from the SSD volume group (that provides the caching device)
was not available. Running pvs showed an unknown device and vgs reported
similar errors. Now I started to panic a bit. There was a clean shutdown of the
server, so surely all the data had been flushed to the disk. But, how can we
get that data? We started a restore from backup process because we really
thought that data was gone for ever.
Then we had a really great theory: the caching logical volume comes from the
SSD volume group, which gets decrypted after the spinning disk volume group.
Maybe there s a timing issue? When the spinning disk volume group comes online,
the caching logical volume is not yet available.
So, we booted into busybox, and manually decrypted the SSD volume first,
followed by the spinning disk volume. Alas, no dice.
Now that we were fully desperate, we decided to restore the lvm configuration
file for the entire spinning disk volume group. This felt kinda risky since we
might be damaging all the currently working logical volumes, but it seemed like
the only option we had.
The main problem was that busybox didn t seem to have the lvm config tool we
needed to restore the configuration from our backup (I think it might be there
but it was late and we couldn t figure it out). And, our only readily available
live install media was a Debian stretch disk via
debirf.
Debian stretch is pretty old and we really would have preferred to have the
most modern tools available, but we decided to go with what we had.
And, that was a good thing, because as soon as we booted into stretch and
decrypted the disks, the lvm volume suddenly appeared, happy as ever. We
uncached it and booted into the host system and there it was.
We went to bed confused but relieved.
The next morning my co-worker figured it out: filtering.
During the stretch days we occassionally ran into an annoying problem: the
logical volumes from guests would suddenly pop up on the host. This was mostly
annoying but also it made possible some serious mistakes if you accidentally
took a volume from a guest and used it on the host.
The LVM folks seemed to have noticed this problem and introduced a new default
filter that tries to only show you the devices that you should be seeing.
Unfortunately for us, this new filter removed logical volumes from the list of
available physical volumes. That does make sense for most people. But, not for
us. It sounds a bit weird, but our setup looks like this:
One volume group derived from the spinning disks
One volume group derived from the SSD disks
Then we carve out logical volumes from each for each guest.
Once we discovered LVM caching, we carved out SSD logical volumes to be used as
caches for the spinning logical volumes.
In restrospect, if we could start over, we would probably do it differently.
In any event, once we discovered the problem, we used the handy configuration
options in lvm.conf to tweak the filters to include our cache disks and once
again, everything is back to working.
Saturated SSDs
The other surprise seems unrelated to the upgrade. We have a phsyical server
that has been suffering from disk i/o problems despite our use of LVM caching.
Our answer, of course, was to add more LVM caches to the spinning logical
volumes that seemed to be suffering.
But somehow this was making things even worse.
Then, we finally just removed the LVM caches from all the spinning disks and
presto, disk i/o problems seemed to go away. What? Isn t that the opposite of
what s supposed to happen?
We re still trying to figure this one out, but it seems that our SSDs are
saturated, in which case adding them as a caching volume really is going to
make things worse.
We re still not sure why they are saturated when none of the SSDs on our other
hosts are saturated, but a few theories include:
They are doing more writing and/or it s a different kind of writing. I m
still not sure I quite have the right tool to compare this host with other
hosts. And, this host is our only MySQL network database server, hosting
hundreds of GBs of database - all writing/reading direclty onto the SSDs.
They are broken or substanard SSDs (smartctl doesn t uncover any problems
but maybe it s a bad model?)
I ll update this post as we learn more but welcome any suggestions in the
comments.
Update: 2022-03-07
Two more possible causes:
Our use of the write back feature: LVM cache has a nice feature that caches
writes to smooth out writes to the underlying disk. Maybe our disks are
simply writing more then can be handled and not using write back is our
solution. This server supports a guest with an unusually large disk.
Maybe we haven t allocated a big enough LVM cache for the given volume so
the contents are constantly being ejected?
Note: this post is also available on my website, where it will be updated periodically.
When things are difficult maybe there s been a disaster, or an invasion (this page is being written in 2022 just after Russia invaded Ukraine), or maybe you re just backpacking off the grid there are tools that can help you keep in touch, or move your data around. This page aims to survey some of them, roughly in order from easiest to more complex.
Simple radios
Handheld radios shouldn t be forgotten. They are cheap, small, and easy to operate. Their range isn t huge maybe a couple of miles in rural areas, much less in cities but they can be a useful place to start. They tend to have no actual encryption features (the privacy features really aren t.) In the USA, options are FRS/GMRS and CB.
Briar
Briar is an instant messaging service based around Android. It s IM with a twist: it can use a mesh of Bluetooh devices. Or, if Internet is available, Tor. It has even been extended to support the use of SD cards and USB sticks to carry your messages.
Like some others here, it can relay messages for third parties as well.
Homepage: https://briarproject.org/
Manyverse and Scuttlebutt
Manyverse is a client for Scuttlebutt, which is a sort of asynchronous, offline-friendly social network. You can use it to keep in touch with your family and friends, and it supports syncing over Bluetooth and Wifi even in the absence of Internet.
Homepages: https://www.manyver.se/ and https://scuttlebutt.nz/
Ad-Hoc Wifi
Few people know about the ad-hoc wifi mode. Ad-hoc wifi lets devices in range talk to each other without an access point. You just all set your devices to the same network name and password and there you go. However, there often isn t DHCP, so IP configuration can be a bit of a challenge. Yggdrasil helps here.
NNCP
Moving now to more advanced tools, NNCP lets you assemble a network of peers that can use Asynchronous Communication over sneakernet, USB drives, radios, CD-Rs, Internet, tor, NNCP over Yggdrasil, Syncthing, Dropbox, S3, you name it . NNCP supports multi-hop file transfer and remote execution. It is fully end-to-end encrypted. Think of it as the offline version of ssh.
Homepage: https://nncp.mirrors.quux.org/
Meshtastic
Meshtastic uses long-range, low-power LoRa radios to build a long-distance, encrypted, instant messaging system that is a Mesh Network. It requires specialized hardware, about $30, but will tend to get much better range than simple radios, and with very little power.
Homepages: https://meshtastic.org/ and https://meshtastic.letstalkthis.com/
Portable Satellite Communicators
You can get portable satellite communicators that can send SMS from anywhere on earth with a clear view of the sky. The Garmin InReach mini and Zoleo are two credible options. Subscriptions range from about $10 to $40 per month depending on usage. They also have global SOS features.
Telephone Lines
If you have a phone line and a modem, UUCP can get through just about anything. It s an older protocol that lacks modern security, but will deal with slow and noisy serial lines well. XBee SX radios also have a serial mode that can work well with UUCP.
Additional Suggestions
It is probably useful to have a Linux live USB stick with whatever software you want to use handy. Debian can be installed from the live environment, or you could use a security-focused distribution such as Tails or Qubes.
References
This page originated in my Mastodon thread and incorporates some suggestions I received there.
It also formed a post on my blog.
TL;DR: procmail is a security liability and has been abandoned
upstream for the last two decades. If you are still using it, you
should probably drop everything and at least remove its SUID
flag. There are plenty of alternatives to chose from, and conversion
is a one-time, acceptable trade-off.
Procmail is unmaintained
procmail is unmaintained. The "Final release", according to
Wikipedia, dates back to September 10, 2001 (3.22). That release
was shipped in Debian since then, all the way back from Debian 3.0
"woody", twenty years ago.
Debian also ships 25 uploads on top of this, with 3.22-21 shipping the
"3.23pre" release that has been rumored since at least the November
2001, according to debian/changelog at least:
procmail (3.22-1) unstable; urgency=low
* New upstream release, which uses the standard' format for Maildir
filenames and retries on name collision. It also contains some
bug fixes from the 3.23pre snapshot dated 2001-09-13.
* Removed sendmail' from the Recommends field, since we already
have exim' (the default Debian MTA) and mail-transport-agent'.
* Removed suidmanager support. Conflicts: suidmanager (<< 0.50).
* Added support for DEB_BUILD_OPTIONS in the source package.
* README.Maildir: Do not use locking on the example recipe,
since it's wrong to do so in this case.
-- Santiago Vila <sanvila@debian.org> Wed, 21 Nov 2001 09:40:20 +0100
All Debian suites from buster onwards ship the 3.22-26 release,
although the maintainer just pushed a 3.22-27 release to fix a seven
year old null pointer dereference, after this article was drafted.
Procmail is also shipped in all major distributions: Fedora
and its derivatives, Debian derivatives, Gentoo, Arch,
FreeBSD, OpenBSD. We all seem to be ignoring this problem.
The upstream website (http://procmail.org/) has been down since
about 2015, according to Debian bug #805864, with no change
since.
In effect, every distribution is currently maintaining its fork of
this dead program.
Note that, after filing a bug to keep Debian from shipping
procmail in a stable release again, I was told that the
Debian maintainer is apparently in contact with the upstream. And,
surprise! they still plan to release that fabled 3.23 release, which
has been now in "pre-release" for all those twenty years.
In fact, it turns out that 3.23 is considered released already, and
that the procmail author actually pushed a 3.24 release, codenamed
"Two decades of fixes". That amounts to 25 commits since 3.23pre
some of which address serious security issues, but none of which
address fundamental issues with the code base.
Procmail is insecure
By default, procmail is installed SUIDroot:mail in
Debian. There's no debconf or pre-seed setting that can change
this. There has been two bug reports against the Debian to make this
configurable (298058, 264011), but both were closed to say
that, basically, you should use dpkg-statoverride to change the
permissions on the binary.
So if anything, you should immediately run this command on any host
that you have procmail installed on:
Note that this might break email delivery. It might also not work at
all, thanks to usrmerge. Not sure. Yes, everything is on
fire. This is fine.
In my opinion, even assuming we keep procmail in Debian, that default
should be reversed. It should be up to people installing procmail to
assign it those dangerous permissions, after careful consideration of
the risk involved.
The last maintainer of procmail explicitly advised us (in that null
pointer dereference bug) and other projects (e.g. OpenBSD, in [2])
to stop shipping it, back in 2014. Quote:
Executive summary: delete the procmail port; the code is not safe
and should not be used as a basis for any further work.
I just read some of the code again this morning, after the original
author claimed that procmail was active again. It's still littered
with bizarre macros like:
... from regexp.c, line 66 (yes, that's a custom regex
engine). Or this one:
#define jj (aleps.au.sopc)
It uses insecure functions like strcpyextensively. malloc()
is thrown around gotos like it's 1984 all over again. (To be fair,
it has been feeling like 1984 a lot lately, but that's another matter
entirely.)
That null pointer deref bug? It's fixed upstream now, in this
commit merged a few hours ago, which I presume might be in response
to my request to remove procmail from Debian.
So while that's nice, this is the just tip of the iceberg. I speculate
that one could easily find an exploitable crash in procmail if only by
running it through a fuzzer. But I don't need to speculate: procmail
had, for years, serious security issues that could possibly lead to
root privilege escalation, remotely exploitable if procmail is (as
it's designed to do) exposed to the network.
Maybe I'm overreacting. Maybe the procmail author will go through the
code base and do a proper rewrite. But I don't think that's what is in
the cards right now. What I expect will happen next is that people
will start fuzzing procmail, throw an uncountable number of bug
reports at it which will get fixed in a trickle while never fixing the
underlying, serious design flaws behind procmail.
Procmail has better alternatives
The reason this is so frustrating is that there are plenty of modern
alternatives to procmail which do not suffer from those problems.
Alternatives to procmail(1) itself are typically part of mail
servers. For example, Dovecot has its own LDA which implements
the standard Sieve language (RFC 5228). (Interestingly, Sieve
was published as RFC 3028 in 2001, before procmail was formally
abandoned.)
Courier also has "maildrop" which has its own filtering mechanism,
and there is fdm (2007) which is a fetchmail and procmail
replacement. Update: there's also mailprocessing, which is not
an LDA, but processing an existing folder. It was, however,
specifically designed to replace complex Procmail rules.
But procmail, of course, doesn't just ship procmail; that would just
be too easy. It ships mailstat(1) which we could probably ignore
because it only parses procmail log files. But more importantly, it
also ships:
lockfile(1) - conditional semaphore-file creator
formail(1) - mail (re)formatter
lockfile(1) already has a somewhat acceptable replacement in the form of
flock(1), part of util-linux (which is Essential, so installed on
any normal Debian system). It might not be a direct drop-in
replacement, but it should be close enough.
formail(1) is similar: the courier maildrop package ships
reformail(1) which is, presumably, a rewrite of formail. It's
unclear if it's a drop-in replacement, but it should probably possible
to port uses of formail to it easily.
Update: the maildrop package ships a SUID root binary (two,
even). So if you want only reformail(1), you might want to disable
that with:
It would be perhaps better to have reformail(1) as a separate
package, see bug 1006903 for that discussion.
The real challenge is, of course, migrating those old .procmailrc
recipes to Sieve (basically). I added a few examples in the appendix
below. You might notice the Sieve examples are easier to read, which
is a nice added bonus.
Conclusion
There is really, absolutely, no reason to keep procmail in Debian, nor
should it be used anywhere at this point.
It's a great part of our computing history. May it be kept forever in
our museums and historical archives, but not in Debian, and certainly not
in actual release.
It's just a bomb waiting to go off. It is irresponsible for
distributions to keep shipping obsolete and insecure software like
this for unsuspecting users.
Note that I am grateful to the author, I really am: I used procmail
for decades and it served me well. But now, it's time to move, not
bring it back from the dead.
Appendix
Previous work
It's really weird to have to write this blog post. Back in 2016, I
rebuilt my mail setup at home and, to
my horror, discovered that procmail had been abandoned for 15 years at
that point, thanks to that LWN article from 2010. I would have
thought that I was the only weirdo still running procmail after all
those years and felt kind of embarrassed to only "now" switch to the
more modern (and, honestly, awesome) Sieve language.
But no. Since then, Debian shipped three major releases (stretch,
buster, and bullseye), all with the same vulnerable procmail
release.
Then, in early 2022, I found that, at work, we actually had procmail
installed everywhere, possibly because userdir-ldap was using
it for lockfile until 2019. I sent a patch to fix that and scrambled
to remove get rid of procmail everywhere. That took about a day.
But many other sites are now in that situation, possibly not imagining
they have this glaring security hole in their infrastructure.
Procmail to Sieve recipes
I'll collect a few Sieve equivalents to procmail recipes here. If you
have any additions, do contact me.
All Sieve examples below assume you drop the file in ~/.dovecot.sieve.
deliver mail to "plus" extension folder
Say you want to deliver user+foo@example.com to the folder
foo. You might write something like this in procmail:
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
LOGFILE=$HOME/.procmail.log
VERBOSE=off
EXTENSION=$1 # Need to rename it - ?? does not like $1 nor 1
:0
* EXTENSION ?? [a-zA-Z0-9]+
.$EXTENSION/
That, in sieve language, would be:
require ["variables", "envelope", "fileinto", "subaddress"];
########################################################################
# wildcard +extension
# https://doc.dovecot.org/configuration_manual/sieve/examples/#plus-addressed-mail-filtering
if envelope :matches :detail "to" "*"
# Save name in $ name in all lowercase
set :lower "name" "$ 1 ";
fileinto "$ name ";
stop;
Subject into folder
This would file all mails with a Subject: line having FreshPorts
in it into the freshports folder, and mails from alternc.org
mailing lists into the alternc folder:
:0
## mailing list freshports
* ^Subject.*FreshPorts.*
.freshports/
:0
## mailing list alternc
* ^List-Post.*mailto:.*@alternc.org.*
.alternc/
Automated script
There is a procmail2sieve.pl script floating around, and
mentioned in the dovecot documentation. It didn't work very well
for me: I could use it for small things, but I mostly wrote the sieve
file from scratch.
Progressive migration
Enrico Zini has progressively migrated his procmail setup to Sieve
using a clever way: he hooked procmail inside sieve so that he could
deliver to the Dovecot LDA and progressively migrate rules one by
one, without having a "flag day".
See this explanatory blog post for the details, which also shows
how to configure Dovecot as an LMTP server with Postfix.
Other examples
The Dovecot sieve examples are numerous and also quite useful. At
the time of writing, they include virus scanning and spam filtering,
vacation auto-replies, includes, archival, and flags.
Harmful considered harmful
I am aware that the "considered harmful" title has a long and
controversial history, being considered harmful in itself (by some
people who are obviously not afraid of contradictions).
I have nevertheless deliberately chosen that title, partly to make
sure this article gets maximum visibility, but more specifically
because I do not have doubts at this moment that procmail is, clearly,
a bad idea at this moment in history.
Developing story
I must also add that, incredibly, this story has changed while writing
it. This article is derived from this bug I filed in Debian to,
quite frankly, kick procmail out of Debian. But filing the bug had the
interesting effect of pushing the upstream into action: as mentioned
above, they have apparently made a new release and merged a bunch of
patches in a new git repository.
This doesn't change much of the above, at this moment. If anything
significant comes out of this effort, I will try to update this
article to reflect the situation. I am actually happy to retract the
claims in this article if it turns out that procmail is a stellar
example of defensive programming and survives fuzzing attacks. But at
this moment, I'm pretty confident that will not happen, at least not
in scope of the next Debian release cycle.
After many months of hard work by the good people involved in
LinuxCNC, the
system was accepted Sunday
into Debian.
Once it was available from Debian, I was surprised to discover from
its
popularity-contest numbers that people have been reporting its use
since 2012. Its project site might
be a good place to check out, but sadly is not working when visiting
via Tor.
But what is LinuxCNC, you are probably wondering? Perhaps a
Wikipedia quote is in place?
"LinuxCNC is a software system for numerical control of
machines such as milling machines, lathes, plasma cutters, routers,
cutting machines, robots and hexapods. It can control up to 9 axes or
joints of a CNC machine using G-code (RS-274NGC) as input. It has
several GUIs suited to specific kinds of usage (touch screen,
interactive development)."
It can even control 3D printers. And even though the Wikipedia
page indicate that it can only work with hard real time kernel
features, it can also work with the user space soft real time features
provided by the Debian kernel.
The source code is
available from Github. The last few months I've been involved in the
translation setup for the program and documentation. Translators are
most welcome to
join the
effort using Weblate.
As usual, if you use Bitcoin and want to show your support of my
activities, please send Bitcoin donations to my address
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
After many months of hard work by the good people involved in
LinuxCNC, the
system was accepted Sunday
into Debian.
Once it was available from Debian, I was surprised to discover from
its
popularity-contest numbers that people have been reporting its use
since 2012. Its project site might
be a good place to check out, but sadly is not working when visiting
via Tor.
But what is LinuxCNC, you are probably wondering? Perhaps a
Wikipedia quote is in place?
"LinuxCNC is a software system for numerical control of
machines such as milling machines, lathes, plasma cutters, routers,
cutting machines, robots and hexapods. It can control up to 9 axes or
joints of a CNC machine using G-code (RS-274NGC) as input. It has
several GUIs suited to specific kinds of usage (touch screen,
interactive development)."
It can even control 3D printers. And even though the Wikipedia
page indicate that it can only work with hard real time kernel
features, it can also work with the user space soft real time features
provided by the Debian kernel.
The source code is
available from Github. The last few months I've been involved in the
translation setup for the program and documentation. Translators are
most welcome to
join the
effort using Weblate.
As usual, if you use Bitcoin and want to show your support of my
activities, please send Bitcoin donations to my address
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
In February I was assigned 16 hours of work by Freexian's Debian LTS
initiative and carried over 8 hours from January. I worked 16
hours, and will carry over the remaining time to March.
I spent most of my time triaging security issues for Linux, working
out which of them were fixed upstream and which actually applied to
the versions provided in Debian 9 "stretch". I also rebased the
Linux 4.9 (linux) package on the latest stable update, but did not
make an upload this month.