Permalink
Browse files

Adding level 8. Requires re-importing the base image

  • Loading branch information...
e28eta committed Feb 14, 2013
1 parent bb14488 commit a367439358b2c7a9fe1e64e84eaa202346b3fa98
View
@@ -23,4 +23,8 @@ Vagrant::Config.run do |config|
config.vm.define :level5 do |box_config|
configure(box_config, "5")
end
+
+ config.vm.define :level8 do |box_config|
+ configure(box_config, "8")
+ end
end
@@ -23,3 +23,6 @@ wget https://github.com/n1k0/casperjs/tarball/1.0.2
tar zxf 1.0.2
sudo ln -s /home/vagrant/n1k0-casperjs-bc0da16/bin/casperjs /usr/local/bin
+# Level 8
+sudo apt-get install -y python2.6-dev
+sudo pip install -U Twisted==11.1.0 argparse==1.2.1 distribute==0.6.24 wsgiref==0.1.2 zope.interface==4.0.1
@@ -26,7 +26,7 @@
ensure => 'running',
start => "cd ${destination} && bundle install && ./srv.rb &",
provider => 'base',
- require => File[$destination]
+ require => [File[$destination], Stripectf2::Random_password["${destination}/password.txt"]],
}
service {'apache2':
@@ -0,0 +1,54 @@
+class stripectf2::level08 (
+ $destination,
+ $source,
+) {
+ file {$destination:
+ ensure => 'directory',
+ recurse => true,
+ mode => '0755',
+ owner => 'vagrant',
+ group => 'vagrant',
+ source => $source,
+ }
+
+ stripectf2::random_password {"${destination}/password.txt":
+ validchars => '0-9',
+ numchars => '12',
+ require => File[$destination],
+ }
+
+ service {'password_db_launcher':
+ ensure => 'running',
+ start => "cd ${destination} && ./password_db_launcher `cat password.txt` 127.0.0.1:3000 &",
+ provider => 'base',
+ require => [File[$destination],
+ Service['apache2'],
+ Stripectf2::Random_password["${destination}/password.txt"]],
+ }
+
+ service {'apache2':
+ ensure => 'running',
+ enable => true,
+ hasrestart => true,
+ }
+
+ # Disable the default apache2 site
+ stripectf2::apache2_site {'000-default':
+ ensure => 'absent',
+ }
+
+ stripectf2::apache2_module {['proxy', 'proxy_http']:
+ ensure => 'present',
+ }
+
+ $proxy_url = "http://127.0.0.1:3000/"
+ file {'/etc/apache2/sites-available/level08':
+ content => template('stripectf2/apache2_site_config.erb'),
+ notify => Service['apache2'],
+ }
+
+ stripectf2::apache2_site {'level08':
+ ensure => 'present',
+ require => File['/etc/apache2/sites-available/level08'],
+ }
+}
@@ -1,6 +1,10 @@
-define stripectf2::random_password( $filename = $title ) {
+define stripectf2::random_password(
+ $filename = $title,
+ $validchars = '_A-Z-a-z-0-9',
+ $numchars = '32',
+) {
exec {"random_password_${filename}":
- command => "date +%s | sha256sum | base64 | head -c 32 > ${filename}",
+ command => "tr -dc ${validchars} < /dev/urandom | head -c${numchars} > ${filename}",
creates => "${filename}",
}
}
View
@@ -0,0 +1,7 @@
+node 'level08-1.stripe-ctf.com' {
+ class {'stripectf2::level08':
+ destination => '/levels/08',
+ source => '/vagrant/levels/8',
+ require => File['/levels'],
+ }
+}

0 comments on commit a367439

Please sign in to comment.