Skip to content

Instantly share code, notes, and snippets.

View julian-klode's full-sized avatar

Julian Andres Klode julian-klode

View GitHub Profile

APT 2.0

After brewing in experimental for a while, and getting a first outing in the Ubuntu 19.10 release; both as 1.9, APT 2.0 is now releasing to unstable.

Compared to the 1.8 series, the APT 2.0 series features several new features, as well as improvements in performance, hardening. A lot of code has been removed as well, reducing the size of the library.

Changes Since 1.8

#!/bin/sh
write() {
file="$1"
shift
echo "$@" | sudo tee "$file"
}
case "$1" in
#!/usr/bin/python3
import json
import requests
import os
import sys
import time
from collections import OrderedDict
from typing import Any, Dict, Iterator
///bin/true; exec /usr/bin/env go run "$0" "$@"
package main
import (
"flag"
"log"
"os"
"regexp"
"runtime/pprof"
"strings"
config:
user.user-data: |
#cloud-config
apt:
proxy: http://_gateway:8000
apt_pipelining: unchanged
description: Default LXD profile
devices:
eth0:
name: eth0
#!/usr/bin/env python3
"""Encrypt/Decrypt GPG/MIME messages"""
import os
import sys
import email.mime.application
import email.mime.multipart
import email.mime.message
import errno
@julian-klode
julian-klode / README.md
Last active June 8, 2019 18:58
Setting up a server-side encrypted maildir

This describes the idea behind an encrypted maildir on the server, with multiple clients that have access to it, and store unencrypted copies.

Initial setup:

  1. Generate a gpg key like [email protected]
  2. Import the public key into the keyring on the server
  3. Import private and public keys into keyring on the clients

On the server:

  1. Create an empty Maildir
#!/usr/bin/python3
import json
import os
import socket
import sys
socketFd=int(os.environ["APT_HOOK_SOCKET"])

JSON Hooks

APT 1.6 introduces support for hooks that talk JSON-RPC 2.0. Hooks act as a server, and APT as a client.

Wire protocol

APT communicates with hooks via a UNIX domain socket in file descriptor $APT_HOOK_SOCKET. The transport is a byte stream (SOCK_STREAM).

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system