fix: a configuration that names no HTTPS certificate source gets the first setup's choice, and the development VM of lm-dev-vm.py is named by --fqdn, so its HTTPS sites answer a name that resolves to it.
Release / release (push) Successful in 19s

This commit is contained in:
slawek committed 2026-11-24 18:23:42 +01:00
1 parent 0cec95c19b
commit 7efacfa3bb
8 files changed
+43 -12

No files matched your search

+8 -3
View File
@@ -11,7 +11,9 @@ engine made from the file's otp_url, unless --no-otp is given; lm-dev-otp-code.p
otp_url the file lacks, or all of them when there is no file, is generated and kept in the file, so a VM made again
has the same password and token until they are deleted from the file.
The VM gets a configuration from tests/remote/configs/ (--config, dev.json by default), whose @ETH0@ is the
interface of its default route, @CIDR0@ its network and @PSK@ a generated key. The VM gets an AppRole of its own in the project's Vault
interface of its default route, @CIDR0@ its network, @FQDN@ --fqdn (LXD_DEV_FQDN, lm-dev.test by default), and @PSK@ a
generated key; the Manager and the status web service answer HTTPS for that name, which has to resolve to the
listen address. The VM gets an AppRole of its own in the project's Vault
(lm_dev.enrol_instance), with which it reads the debconf preseed with the admin's password and the
configuration with its key, kept there as VM/preseed and VM/config, and its TOTP key, generated or from otp_url; no
secret is an argument or on standard input, so create needs a project with a Vault
@@ -60,6 +62,8 @@ def main():
parser.add_argument('--listen', default=setting('LXD_LISTEN', None),
help="outside a test project, the LXD host address the proxies listen on (LXD_LISTEN, "
"default the IPv4 address of the remote URL's host)")
parser.add_argument('--fqdn', default=setting('LXD_DEV_FQDN', 'lm-dev.test'),
help='the name of the VM in its configuration, @FQDN@ (LXD_DEV_FQDN, default lm-dev.test)')
parser.add_argument('--forward-address', default=setting('LXD_FORWARD_ADDRESS', None),
help="with create in a test project, the forward's listen address, one of the uplink's routes "
"(LXD_FORWARD_ADDRESS); without it one is allocated")
@@ -229,7 +233,8 @@ def main():
sys.exit(f'the package did not install; see {log}')
# Apply the configuration twice, as the server's certificates follow the first run.
text = config.read_text(encoding='utf-8').replace('@ETH0@', nic).replace('@CIDR0@', str(interface.network))
text = config.read_text(encoding='utf-8').replace('@ETH0@', nic).replace('@CIDR0@', str(interface.network))\
.replace('@FQDN@', args.fqdn)
problem = hand_over(args.remote, args.project, args.vm, vault, 'config', text.replace('@PSK@', psk),
'/etc/linux-manager/linux-manager.json', '0600')
if problem:
@@ -248,7 +253,7 @@ def main():
if not args.no_otp:
print(f'administrator TOTP: otp_url in {credentials}; codes: bin/lm-dev-otp-code.py --project {args.project} '
f'--vm {args.vm}')
print(f'manager: https://{args.listen}:7443/ status: https://{args.listen}:7444/ and http://{args.listen}:7081/ '
print(f'manager: https://{args.fqdn}:7443/ status: https://{args.fqdn}:7444/ and http://{args.listen}:7081/ '
f'ssh: {args.listen} port 2222')
print(f'shell: lxc exec {args.remote}:{args.vm} --project {args.project} -- su -l')
print(f'remove: {sys.argv[0]} remove --remote {args.remote} --project {args.project} --vm {args.vm}')