vagrant: initial implementation

This feature adds initial vagrant-compatible box
build support as outlined in #28553.
This commit is contained in:
Michael Shigorin 2014-09-15 13:09:45 +04:00
parent 5542415e19
commit 451d7c012d
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,11 @@
Эта фича обеспечивает специфичную для vagrant предварительную
настройку образа файловой системы виртуальной машины.
Обратите внимание, что специфика включает широко известные:
- пароли root и пользователя vagrant с беспарольным sudo;
- "секретный" ключ от публичной части у пользователя vagrant.
См. тж.:
http://bugzilla.altlinux.org/28553
http://docs.vagrantup.com/v2/boxes/base.html
http://williamwalker.me/blog/creating-a-custom-vagrant-box.html

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

View File

@ -0,0 +1,6 @@
use/vagrant: use/vmguest/vbox use/deflogin use/net-ssh use/control
@$(call add_feature)
@$(call add,THE_PACKAGES,sudo)
@$(call add,CONTROL,sudo:public)
@$(call add,USERS,vagrant:vagrant:1:) # NB: custom sudoers
@$(call set,ROOTPW,vagrant)

View File

@ -0,0 +1,19 @@
#!/bin/sh
# NB: 50-vargant > 50-users (so homedir exists already)
echo "UseDNS no" >> /etc/openssh/sshd_config
# https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
pubkey="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
sshkeys=~vagrant/.ssh/authorized_keys
install -pDm400 -o vagrant -g vagrant /dev/null "$sshkeys"
echo "$pubkey" > "$sshkeys"
sudocfg=/etc/sudoers.d/vagrant
install -pDm400 /dev/null "$sudocfg"
cat > "$sudocfg" << EOF
Defaults:vagrant !requiretty
vagrant ALL=(ALL) NOPASSWD:ALL
EOF
mkdir -p /vagrant