diff options
author | irregulator <irregulator@riseup.net> | 2014-05-21 01:36:30 +0300 |
---|---|---|
committer | irregulator <irregulator@riseup.net> | 2014-05-21 01:47:32 +0300 |
commit | f59706a4b1a309f6c3e614ded7cbd359335e7960 (patch) | |
tree | 873cfe987f6f0c69fac20b149f5b8c6c2be8e3ec | |
parent | 1161c65b23c218726d4aba85d777193af1ea4aae (diff) | |
download | leap_cli-f59706a4b1a309f6c3e614ded7cbd359335e7960.tar.gz leap_cli-f59706a4b1a309f6c3e614ded7cbd359335e7960.tar.bz2 |
Add two macros, base32_secret and obfs_port, used in obfsproxy
-rw-r--r-- | lib/leap_cli/config/macros.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb index c6938fe..241a2a4 100644 --- a/lib/leap_cli/config/macros.rb +++ b/lib/leap_cli/config/macros.rb @@ -6,6 +6,8 @@ # This module is included in Config::Object # +require 'base32' + module LeapCli; module Config module Macros ## @@ -130,6 +132,16 @@ module LeapCli; module Config @manager.secrets.set(name, Util::Secret.generate(length), @node[:environment]) end + # inserts a base32 encoded secret + def base32_secret(name, length=20) + @manager.secrets.set(name, Base32.encode(Util::Secret.generate(length)), @node[:environment]) + end + + # Picks a random obfsproxy port from given range + def obfs_port(name, range) + @manager.secrets.set(name, rand(range), @node[:environment]) + end + # # inserts an hexidecimal secret string, generating it if needed. # |