RSSAmplifier

Blog

notes - aflukasz

notes.aflukasz.plRSS feed ↗26 posts

Latest posts

Revisiting pg_dump data ordering

Many, MANY years ago - more than I would like to admit - I was one of the people answering this particular Stack Overflow question about the order of data in the output of pg_dump . In my answer I was pointing out then-recent patch to pg_dump that was providing the --ordered param that would cause dumping of the table data in a deterministic order, instead of reflecting the current on-disk…

Nature of Ansible's "Timeout (12s) waiting for privilege escalation prompt" error

Ansible can occasionally fail with the following error: 'Timeout (12s) waiting for privilege escalation prompt'. At some point I wanted to finally learn exactly what this 'privilege escalation prompt timeout' is, where I can change its value and where it says that it defaults to 12 seconds. Clearly it relates to sudo (or other become mechanism), but I could not find anything about it in Ansible…

Explicit emptybranches in templated configs

Examples in this entry use Jinaj2 syntax, but the topic is completely stack agnostic and does not require deep understanding of any specific templating language. Problem statement When templating config files, it's not uncommon that one ends up with some form of the following: {% if something %} some-config-statement {% endif %} It's a conditionally added statement, so not just a config param that…

Joining consecutive lines with

Short intro to paste paste is a tool defined in POSIX as follows: The paste utility shall concatenate the corresponding lines of the given input files, and write the resulting lines to standard output. The default operation of paste shall concatenate the corresponding lines of the input files. The <newline> of every line except the line from the last input file shall be replaced with a <tab>. And…

PostgreSQL does not store time zone in `timestamp with time zone` data type

PostgreSQL has two variants of a type called 'timestamp': timestamp with time zone and timestamp without time zone . At a first glance, it looks as if those two data types must differ in terms of what and how is being stored, but that's not exactly the case. In PostgreSQL, with time zone variant doesn't physically store any time zone information. This fact is a key to understand how those two…

No favicon

Web browsers really like favicons. If your site does not declare one with <link rel='icon'> , most (all?) of the mainstream ones will issue request to /favicon.ico anyway, in a hope of getting one. Favicons are a whole topic on its own. But what if we don't use one? Can we somehow nudge browsers towards actually not looking for it? For saving them from making an extra request and for making dev…

Hiding /etc/shadow from Debian psql wrapper

In the recent note titled 'Hiding /etc/shadow from psql' , I've mentioned how calling psql was causing auditd to log denied reads of /etc/shadow and have showed one way to deal with this. Here is the continuation of this story, as thanks to insights from @hillu.bsky.social , it's clear that I've missed an important detail. On Debian /usr/bin/psql is actually a distro specific wrapper over the…

Ansible and temporary dynamic hosts

Ansible has a task called add_host . It adds extra hosts to the inventory at play execution time. It has two non obvious properties, though. First, such a host is not automatically selected as execution target during current play. Only subsequent plays, that run in the same execution context, can match such new host with host selectors. The other is that such added hosts will stay in the inventory…

Hiding /etc/shadow from psql

psql Debian wrapper of psql (see this update ), at least in version 15.12, really likes /etc/shadow file. To such a degree that it tries to read it upon each invocation: $ strace psql 2>&1 | grep /etc/shadow openat(AT_FDCWD, '/etc/shadow', O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied) On this particular host, such event is logged by auditd (output edited for brevity): type=SYSCALL…

PostgreSQL direct SSL

PostgreSQL in version 17 introduced sslnegotiation connection param . Setting it to direct skips asking the server if it supports SSL connections and proceeds establishing such connection directly. This post mentions using that to save seconds (!) in connection times, but in a very specific circumstances, where additional factors greatly amplified observed performance. The post itself is…

Guessable web URLs?

Recently I've landed on a blog post from 2011 titled 'URL as UI' . One claim caught my eye in particular - 'an ideal URL is guessable': Synonyms should ideally redirect. If you have a support page at /support and a user types /help, is that really such a bad request? Don't show them a 404 — send them to the page they're looking for! Yes, in principle that looks like a great idea. You show…

Fancy tail -F

This is slightly embarrassing, but I've learned just recently that tail command has -F option. It's a CAPITAL F, not commonly used lower case -f . It's not POSIX standardized, but many implementations have it. GNU coreutils is an example closest to my daily usage, but I can see that (apparently similar) implementations are present in e.g. FreeBSD, NetBSD or Busybox (here behind a compile time flag…

Rigid file name schemes and interoperability

Some programs require that the name of the passed file has a specific scheme. For example, just now I want to start programX and it won't work, if config file has no proper extension. There are better or worse reasons to do that. But the cons include, at a minimum, reduced interoperability. For example, 'process substitution' is a convenient way to pass file-like objects constructed on the fly…

AWS Reachability Analyzer

Motivated by one of those 'why can't A access B on AWS' questions I just saw, a short reminder - AWS has this thing called... Reachability Analyzer. The name is straight to the point, and such is the tool itself. It allows you to create a set of named paths between points in your infrastructure, and test if they can be traversed end to end or not. Apart from yes/no answer, you also get a nice…

Pushing a single flexbox item to the flexbox-end and wrapping

When using CSS flexbox, I have this tendency to use margin: auto whenever I want to push single item to the flex-end. For example (assuming ltr mode here and for the rest of this note), inside display:flex; flex-direction: column I would put margin-left: auto on the last item, to make it stick to the right edge, while keeping rest of them to the left. Fine, you can do that, but it's probably not…

nftables syntax peculiarities

nftables has some peculiarities in its syntax. One of my 'favorites' is the fact that you can't define an empty set while using elements keyword and contents literal. For example, let's create a table: nft add table test_tbl Now we can add a set: nft add set test_tbl test_set { type inet_service\; } This set is empty - that works just fine. We could also initialize it with some values from the get…

pgBackRest with backup uploads to S3 behind HTTP proxy

pgBackRest does not support HTTP proxies (in its S3 client). This was raised on Github couple of times ( [1] , [2] , [3] , [4] ). Suggested workaround is to use ProxyChains . Discovering you need to slap some extra component into a critical path of a critical workflow is exciting... Exciting as in need-to-go-to-a-dentist kind of exciting. But happy to confirm that it just works! With Squid on the…

Monitoring for data corruption in PostgreSQL

Latest episode of Postges FM podcast does interesting overview of top things to be aware of when operating PostgreSQL deployments. All are important, obviously, but if I were to chose one, corruption case is the worst. Let's say we have page checksums on, do regular backups and run test restoration as mandatory step for each of them: run full am check, run pg_checksums, read whole db via…

PBKDF2 default iterations count history in Django

History of the default PBKDF2 iterations count in Django hasher module used for hashing user passwords: 2013-09-19 12000 2014-07-11 20000 2015-01-16 24000 2015-09-19 30000 2016-05-20 36000 2017-01-17 100000 2018-05-13 120000 2018-05-17 150000 2018-12-27 180000 2019-09-12 216000 2020-05-04 260000 2021-01-14 320000 2021-09-16 390000 2022-05-10 480000 2023-01-13 580000 2023-02-04 720000 2023-09-15…

Don't confuse <b> element with <strong>, <em> or <mark>

'Do not confuse the <b> element with the <strong> , <em> , or <mark> elements', says MDN page on <b> : https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/b . But why, exactly? What kinds of daemons will we summon otherwise? Well, don't do it because 'the <strong> element represents text of certain importance, <em> puts some emphasis on the text and the <mark> element represents…

PostgreSQL 18 favourites

@winand.at noted on Bluesky : New PostgreSQL tag: REL_18_BETA1 So many features to check out… My personal favorites are: generated columns - trading compute for space, defined in single place and once, uuidv7() - time-sortable UUIDs, idle_replication_slot_timeout - automatic cleanup of unused replication slots, gin_index_check() - more consistency checks, e.g when test-restoring backups.

gpg agent and run-time hidden config?

Apparently no way to get config of currently running instance of gpg-agent? There is gpgconf --list-options gpg-agent , but it only operates on what gpg-agent (would have) read from config file and does not take into account params passed to the agent cli. At least in gpg 2.2.40.

Upcloud free credits

UpCloud offers €5000 for European Businesses . You need VAT-ID and have three months to use these up. But still, could be useful.

Quick look at Scaleway pricing

Funny how most of the cost of the smallest VM on scaleway.com (1 shared vCPU, 1GB RAM) is actually... IPv4 address. Yes, you can drop it, in which case cost calculator estimates monthly bill of... 0.97€ + VAT (so for me that would be 1.19€). There are caveats, though: 'Limited availability and no SLA' disclaimer, presence only in two out of nine availability zones, only 10GB of storage (with…

Ansible casting None to bool

Who would have though that Ansible behvior when casting null to bool will be closer to SQL than to Python: $ python -c 'print(bool(None))' False $ psql -tA -c 'select null::bool is null' t $ ansible -o -m raw -a 'echo -n {{ None | bool | type_debug }}' localhost localhost | CHANGED | rc=0 | (stdout) NoneType

Data ordering in pg_dump output

Question littlek notes on Stackoverflow: I am finding that pg_dump will not always dump the database in the same way. It will dump things in a different order every time. Therefore, when I do a diff on the two database dumps, the comparison will result in the two files being different, when they are actually the same, just in a different order. And then they ask : Is there a different way I can go…