Skip to content

Instantly share code, notes, and snippets.

@roktas
Last active June 18, 2018 08:23
Show Gist options
  • Save roktas/aece03797a6e9fdc042026696a912d58 to your computer and use it in GitHub Desktop.
Save roktas/aece03797a6e9fdc042026696a912d58 to your computer and use it in GitHub Desktop.
bcyrpt
#!/usr/bin/env ruby
require 'bcrypt'
PASSWORD = ARGV[0] || 'boşluk_içermeyen_türkçe_karakterler_ı_ve_İ_dahil'
if BCrypt::Password.new(
`/usr/sbin/slappasswd -h '{BCRYPT}' -o module-load=/usr/local/lib/ldap/pw-bcrypt.so -n -s #{PASSWORD}`.sub(/{BCRYPT}[$]2b[$]/, '$2a$')
) == PASSWORD
puts 'OK'
end
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/bionic64'
config.vm.provision 'shell', privileged: false, inline: <<-SHELL
DEBIAN_FRONTEND=noninteractive sudo -E apt-get -y update
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y slapd
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y --no-install-recommends ruby-full build-essential
sudo gem install bcrypt
sudo tar -xf /vagrant/*.tar.gz -C /
/vagrant/bcrypt
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment