Permalink
Browse files

Fix level 3.

Need to create data directory, and then call generate_data.py with a randomly generated password.

Also need a local_settings.py file that sets url_root to nothing (in real contest it was
the user's personal directory)
  • Loading branch information...
1 parent 0d38079 commit 0566aa1740174ed930e5e50f99bcfdc86a4c3afc @e28eta committed Mar 13, 2013
Showing with 25 additions and 1 deletion.
  1. +25 −1 puppet/modules/stripectf2/manifests/level03.pp
@@ -6,7 +6,7 @@
ensure => 'running',
start => "cd ${destination} && python secretvault.py &",
provider => 'base',
- require => File[$destination]
+ require => Exec['generate_data.py'],
}
file {$destination:
@@ -23,4 +23,28 @@
stripectf2::apache2 {'level03':
proxy_url => "http://127.0.0.1:5000/"
}
+
+ file {"${destination}/data":
+ ensure => 'directory',
+ require => File[$destination],
+ }
+
+ stripectf2::random_password {"${destination}/data/password.txt":
+ require => File["${destination}/data"],
+ }
+
+ exec {'generate_data.py':
+ creates => ["${destination}/data/users.db", "${destination}/data/secrets.json", "${destination}/data/entropy.dat"],
+ command => "${destination}/generate_data.py \"${destination}/data\" `cat ${destination}/data/password.txt` \"P = NP because I said so\" \"Perpetual motion is a myth\"",
+ require => Stripectf2::Random_password["${destination}/data/password.txt"],
+ subscribe => Stripectf2::Random_password["${destination}/data/password.txt"],
+ notify => Service['secretvault.py'],
+ }
+
+ file {"${destination}/local_settings.py":
+ content => "url_root = ''",
+ mode => '0755',
+ owner=> 'vagrant',
+ group=> 'vagrant',
+ }
}

0 comments on commit 0566aa1

Please sign in to comment.