Hello,
To do this I need to be able to run a ssh pre boot command during vagrant up.
Workflow:
- power on machine
- Optionally verify ssh fingerprint
- ssh to port 222 providing passphrase via stdin
- wait
- perform normal ssh on port 22
However the ssh daemon uses a different user and password. Also I need to provide the passphrase via stdin.
I played with Vagrant::Util::SSH.exec() and use it like this:
luks_ssh_info = env[:machine].ssh_info.dup
luks_ssh_info[:port] = 222
luks_ssh_info[:username] = 'root'
luks_ssh_info[:private_key_path] = [ '/path/to/keyfile' ]
luks_ssh_info[:keys_only] = true
...
Vagrant::Util::SSH.exec(luks_ssh_info, { :subprocess => true, :extra_args => [ 'unlock' ])
However I need to run vagrant with stdin redirect now:
vagrant up machine < /path/to/passphrase_file
I'd rather wan't to provide the luks unlock passphrase via Vagrantfile + Environment variable. However I did not find any helper / proper way how to do this.
Any hints how to do this ??
Regard,
Robert