$ export BORG_PASSCOMMAND="security find-generic-password -a $USER -s borg-passphrase -w"
$ export BORG_RSH="ssh -i ~/.ssh/borg"
$ borg init --encryption=keyfile-blake2 "borg@1.2.3.4:backup"

By default repositories initialized with this version will produce security
errors if written to with an older version (up to and including Borg 1.0.8).

If you want to use these older versions, you can disable the check by running:
borg upgrade --disable-tam ssh://borg@1.2.3.4/./backup

See https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-manifest-spoofing-vulnerability for details about the security implications.

IMPORTANT: you will need both KEY AND PASSPHRASE to access this repo!
Use "borg key export" to export the key, optionally in printable format.
Write down the passphrase. Store both at safe place(s).

---

----------------------------------------------------

[
	["command", [
		["shell-symbol", "$"],
		["bash", [
			["builtin", "export"],
			["assign-left", ["BORG_PASSCOMMAND"]],
			["operator", ["="]],
			["string", [
				"\"security find-generic-password -a ",
				["environment", "$USER"],
				" -s borg-passphrase -w\""
			]]
		]]
	]],
	["command", [
		["shell-symbol", "$"],
		["bash", [
			["builtin", "export"],
			["assign-left", ["BORG_RSH"]],
			["operator", ["="]],
			["string", ["\"ssh -i ~/.ssh/borg\""]]
		]]
	]],
	["command", [
		["shell-symbol", "$"],
		["bash", [
			"borg init ",
			["parameter", "--encryption"],
			["operator", ["="]],
			"keyfile-blake2 ",
			["string", ["\"borg@1.2.3.4:backup\""]]
		]]
	]],

	["output", "By default repositories initialized with this version will produce security\r\nerrors if written to with an older version (up to and including Borg 1.0.8).\r\n\r\nIf you want to use these older versions, you can disable the check by running:\r\nborg upgrade --disable-tam ssh://borg@1.2.3.4/./backup\r\n\r\nSee https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-manifest-spoofing-vulnerability for details about the security implications.\r\n\r\nIMPORTANT: you will need both KEY AND PASSPHRASE to access this repo!\r\nUse \"borg key export\" to export the key, optionally in printable format.\r\nWrite down the passphrase. Store both at safe place(s).\r\n\r\n---"]
]
