Shellpki is a very tiny and easy PKI in command lines.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. # Load ~/.VagrantFile if exist, permit local config provider
  4. vagrantfile = File.join("#{Dir.home}", '.VagrantFile')
  5. load File.expand_path(vagrantfile) if File.exists?(vagrantfile)
  6. Vagrant.configure('2') do |config|
  7. config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__exclude: [ '.vagrant', '.git' ]
  8. config.ssh.shell="/bin/sh"
  9. $deps = <<SCRIPT
  10. mkdir -p /etc/shellpki
  11. if [ "$(uname)" = "Linux" ]; then
  12. id shellpki 2>&1 >/dev/null || useradd shellpki --system -M --home-dir /etc/shellpki --shell /usr/sbin/nologin
  13. fi
  14. if [ "$(uname)" = "OpenBSD" ]; then
  15. id _shellpki 2>&1 >/dev/null || useradd -r 1..1000 -d /etc/shellpki -s /sbin/nologin _shellpki
  16. fi
  17. ln -sf /vagrant/openssl.cnf /etc/shellpki/
  18. ln -sf /vagrant/shellpki /usr/local/sbin/shellpki
  19. SCRIPT
  20. nodes = [
  21. { :name => "debian", :box => "debian/stretch64" },
  22. { :name => "openbsd", :box => "generic/openbsd6" }
  23. ]
  24. nodes.each do |i|
  25. config.vm.define "#{i[:name]}" do |node|
  26. node.vm.hostname = "shellpki-#{i[:name]}"
  27. node.vm.box = "#{i[:box]}"
  28. config.vm.provision "deps", type: "shell", :inline => $deps
  29. end
  30. end
  31. end