aboutsummaryrefslogtreecommitdiff
path: root/tests
ModeNameSize
-rw-r--r--accounts.scm14488logplainabout
-rw-r--r--base16.scm1274logplainabout
-rw-r--r--base32.scm2459logplainabout
-rw-r--r--base64.scm1506logplainabout
-rw-r--r--boot-parameters.scm12917logplainabout
-rw-r--r--bournish.scm1919logplainabout
-rw-r--r--build-emacs-utils.scm2580logplainabout
-rw-r--r--build-utils.scm12151logplainabout
-rw-r--r--builders.scm8224logplainabout
-rw-r--r--cache.scm3540logplainabout
-rw-r--r--challenge.scm10708logplainabout
-rw-r--r--channels.scm33938logplainabout
-rw-r--r--combinators.scm3045logplainabout
-rw-r--r--composer.scm2912logplainabout
-rw-r--r--containers.scm11539logplainabout
-rw-r--r--cpan.scm4593logplainabout
-rw-r--r--cpio.scm3346logplainabout
-rw-r--r--cran.scm4894logplainabout
-rw-r--r--crate.scm39868logplainabout
-rw-r--r--cve-sample.json46447logplainabout
-rw-r--r--cve.scm3672logplainabout
-rw-r--r--debug-link.scm6709logplainabout
-rw-r--r--derivations.scm71713logplainabout
-rw-r--r--discovery.scm2540logplainabout
-rw-r--r--egg.scm4098logplainabout
-rw-r--r--elm.scm10342logplainabout
-rw-r--r--elpa.scm5034logplainabout
-rw-r--r--file-systems.scm4717logplainabout
-rw-r--r--gem.scm10907logplainabout
-rw-r--r--gexp.scm82793logplainabout
-rw-r--r--git-authenticate.scm23620logplainabout
-rw-r--r--git.scm10481logplainabout
-rw-r--r--glob.scm2551logplainabout
-rw-r--r--gnu-maintenance.scm7724logplainabout
-rw-r--r--go.scm20085logplainabout
-rw-r--r--grafts.scm27923logplainabout
-rw-r--r--graph.scm24511logplainabout
-rw-r--r--gremlin.scm8006logplainabout
-rw-r--r--guix-archive.sh2841logplainabout
-rw-r--r--guix-authenticate.sh3055logplainabout
-rw-r--r--guix-build-branch.sh2222logplainabout
-rw-r--r--guix-build.sh12887logplainabout
-rw-r--r--guix-daemon.sh8289logplainabout
-rw-r--r--guix-describe.sh1412logplainabout
-rw-r--r--guix-download.sh2883logplainabout
-rw-r--r--guix-environment-container.sh10380logplainabout
-rw-r--r--guix-environment.sh9321logplainabout
-rw-r--r--guix-gc.sh2714logplainabout
-rw-r--r--guix-git-authenticate.sh2736logplainabout
-rw-r--r--guix-graph.sh2922logplainabout
-rw-r--r--guix-hash.sh3705logplainabout
-rw-r--r--guix-home.sh8089logplainabout
-rw-r--r--guix-lint.sh3213logplainabout
-rwxr-xr-xguix-locate.sh2545logplainabout
-rw-r--r--guix-pack-localstatedir.sh2565logplainabout
-rw-r--r--guix-pack-relocatable.sh9367logplainabout
-rw-r--r--guix-pack.sh5333logplainabout
-rw-r--r--guix-package-aliases.sh2180logplainabout
-rw-r--r--guix-package-net.sh8114logplainabout
-rw-r--r--guix-package.sh17728logplainabout
-rw-r--r--guix-refresh.sh4204logplainabout
-rw-r--r--guix-repl.sh2376logplainabout
-rw-r--r--guix-shell-export-manifest.sh3290logplainabout
-rw-r--r--guix-shell.sh5760logplainabout
-rw-r--r--guix-style.sh2007logplainabout
-rw-r--r--guix-system.sh11394logplainabout
-rw-r--r--guix-time-machine.sh1551logplainabout
-rw-r--r--hackage.scm17774logplainabout
-rw-r--r--hexpm.scm9287logplainabout
-rw-r--r--home-import.scm7168logplainabout
-rw-r--r--home-services.scm1678logplainabout
-rw-r--r--http-client.scm2869logplainabout
-rw-r--r--import-git.scm9248logplainabout
-rw-r--r--import-github.scm5165logplainabout
-rw-r--r--import-utils.scm11047logplainabout
-rw-r--r--inferior.scm15074logplainabout
-rw-r--r--ipfs.scm2021logplainabout
d---------keys437logplain
-rw-r--r--lint.scm62308logplainabout
-rw-r--r--minetest.scm19409logplainabout
-rw-r--r--modules.scm2591logplainabout
-rw-r--r--monads.scm9589logplainabout
-rw-r--r--nar.scm22167logplainabout
-rw-r--r--networking.scm3660logplainabout
-rw-r--r--offload.scm2683logplainabout
-rw-r--r--opam.scm7343logplainabout
-rw-r--r--openpgp.scm10524logplainabout
-rw-r--r--pack.scm21941logplainabout
-rw-r--r--packages.scm92298logplainabout
-rw-r--r--pki.scm5361logplainabout
-rw-r--r--print.scm6642logplainabout
-rw-r--r--processes.scm4691logplainabout
-rw-r--r--profiles.scm40027logplainabout
-rw-r--r--publish.scm32334logplainabout
-rw-r--r--pypi.scm17735logplainabout
-rw-r--r--read-print.scm10090logplainabout
-rw-r--r--records.scm19563logplainabout
-rw-r--r--rpm.scm3084logplainabout
-rw-r--r--scripts.scm2034logplainabout
-rw-r--r--search-paths.scm1768logplainabout
-rw-r--r--services.scm18643logplainabout
d---------services282logplain
-rw-r--r--sets.scm1507logplainabout
-rw-r--r--size.scm4576logplainabout
-rw-r--r--status.scm12718logplainabout
-rw-r--r--store-database.scm5421logplainabout
-rw-r--r--store-deduplication.scm7193logplainabout
-rw-r--r--store-roots.scm2144logplainabout
-rw-r--r--store.scm69680logplainabout
-rw-r--r--style.scm20023logplainabout
-rw-r--r--substitute.scm35928logplainabout
-rw-r--r--swh.scm8498logplainabout
-rw-r--r--syscalls.scm22687logplainabout
-rw-r--r--system.scm5932logplainabout
-rw-r--r--test.drv5922logplainabout
-rw-r--r--texlive.scm34100logplainabout
-rw-r--r--transformations.scm26116logplainabout
-rw-r--r--ui.scm12065logplainabout
-rw-r--r--union.scm9714logplainabout
-rw-r--r--upstream.scm2396logplainabout
-rw-r--r--utils.scm14357logplainabout
-rw-r--r--uuid.scm2755logplainabout
-rw-r--r--workers.scm2172logplainabout
'#$peers))))))) (file-append config "/" config-file)))) (define (wireguard-activation config) (match-record config <wireguard-configuration> (private-key wireguard) #~(begin (use-modules (guix build utils) (ice-9 popen) (ice-9 rdelim)) (mkdir-p (dirname #$private-key)) (unless (file-exists? #$private-key) (let* ((pipe (open-input-pipe (string-append #$(file-append wireguard "/bin/wg") " genkey"))) (key (read-line pipe))) (call-with-output-file #$private-key (lambda (port) (display key port))) (chmod #$private-key #o400) (close-pipe pipe)))))) ;;; XXX: Copied from (guix scripts pack), changing define to define*. (define-syntax-rule (define-with-source (variable args ...) body body* ...) "Bind VARIABLE to a procedure accepting ARGS defined as BODY, also setting its source property." (begin (define* (variable args ...) body body* ...) (eval-when (load eval) (set-procedure-property! variable 'source '(define* (variable args ...) body body* ...))))) (define (wireguard-service-name interface) "Return the WireGuard service name (a symbol) configured to use INTERFACE." (symbol-append 'wireguard- (string->symbol interface))) (define-with-source (strip-port/maybe endpoint #:key ipv6?) "Strip the colon and port, if present in ENDPOINT, a string." (if ipv6? (if (string-prefix? "[" endpoint) (first (string-split (string-drop endpoint 1) #\])) ;ipv6 endpoint) (first (string-split endpoint #\:)))) ;ipv4 (define* (ipv4-address? address) "Predicate to check whether ADDRESS is a valid IPv4 address." (let ((address (strip-port/maybe address))) (false-if-exception (->bool (getaddrinfo address #f AI_NUMERICHOST AF_INET))))) (define* (ipv6-address? address) "Predicate to check whether ADDRESS is a valid IPv6 address." (let ((address (strip-port/maybe address #:ipv6? #t))) (false-if-exception (->bool (getaddrinfo address #f AI_NUMERICHOST AF_INET6))))) (define (host-name? name) "Predicate to check whether NAME is a host name, i.e. not an IP address." (not (or (ipv6-address? name) (ipv4-address? name)))) (define (endpoint-host-names peers) "Return an association list of endpoint host names keyed by their peer public key, if any." (reverse (fold (lambda (peer host-names) (let ((public-key (wireguard-peer-public-key peer)) (endpoint (wireguard-peer-endpoint peer))) (if (and endpoint (host-name? endpoint)) (cons (cons public-key endpoint) host-names) host-names))) '() peers))) (define (wireguard-shepherd-service config) (match-record config <wireguard-configuration> (wireguard interface) (let ((wg-quick (file-append wireguard "/bin/wg-quick")) (config (wireguard-configuration-file config))) (list (shepherd-service (requirement '(networking)) (provision (list (wireguard-service-name interface))) (start #~(lambda _ (invoke #$wg-quick "up" #$config))) (stop #~(lambda _ (invoke #$wg-quick "down" #$config) #f)) ;stopped! (actions (list (shepherd-configuration-action config))) (documentation "Run the Wireguard VPN tunnel")))))) (define (wireguard-monitoring-jobs config) ;; Loosely based on WireGuard's own 'reresolve-dns.sh' shell script (see: ;; https://raw.githubusercontent.com/WireGuard/wireguard-tools/ ;; master/contrib/reresolve-dns/reresolve-dns.sh). (match-record config <wireguard-configuration> (interface monitor-ips? monitor-ips-interval peers) (let ((host-names (endpoint-host-names peers))) (if monitor-ips? (if (null? host-names) (begin (warn "monitor-ips? is #t but no host name to monitor") '()) ;; The mcron monitor job may be a string or a list; ungexp strips ;; one quote level, which must be added back when a list is ;; provided. (list #~(job (if (string? #$monitor-ips-interval) #$monitor-ips-interval '#$monitor-ips-interval) #$(program-file (format #f "wireguard-~a-monitoring" interface) (with-imported-modules (source-module-closure '((gnu services herd) (guix build utils))) #~(begin (use-modules (gnu services herd) (guix build utils) (ice-9 popen) (ice-9 match) (ice-9 textual-ports) (srfi srfi-1) (srfi srfi-26)) (define (resolve-host name) "Return the IP address resolved from NAME." (let* ((ai (car (getaddrinfo name))) (sa (addrinfo:addr ai))) (inet-ntop (sockaddr:fam sa) (sockaddr:addr sa)))) (define wg #$(file-append wireguard-tools "/bin/wg")) #$(procedure-source strip-port/maybe) (define service-name '#$(wireguard-service-name interface)) (when (live-service-running (current-service service-name)) (let* ((pipe (open-pipe* OPEN_READ wg "show" #$interface "endpoints")) (lines (string-split (get-string-all pipe) #\newline)) ;; IPS is an association list mapping ;; public keys to IP addresses. (ips (map (match-lambda ((public-key ip) (cons public-key (strip-port/maybe ip)))) (map (cut string-split <> #\tab) (remove string-null? lines))))) (close-pipe pipe) (for-each (match-lambda ((key . host-name) (let ((resolved-ip (resolve-host (strip-port/maybe host-name))) (current-ip (assoc-ref ips key))) (unless (string=? resolved-ip current-ip) (format #t "resetting `~a' peer \ endpoint to `~a' due to stale IP (`~a' instead of `~a')~%" key host-name current-ip resolved-ip) (invoke wg "set" #$interface "peer" key "endpoint" host-name))))) '#$host-names))))))))) '())))) ;monitor-ips? is #f (define wireguard-service-type (service-type (name 'wireguard) (extensions (list (service-extension shepherd-root-service-type wireguard-shepherd-service) (service-extension activation-service-type wireguard-activation) (service-extension profile-service-type (compose list wireguard-configuration-wireguard)) (service-extension mcron-service-type wireguard-monitoring-jobs))) (description "Set up Wireguard @acronym{VPN, Virtual Private Network} tunnels.")))