Skip to content

Commit

Permalink
Adding level 8. Requires re-importing the base image
Browse files Browse the repository at this point in the history
  • Loading branch information
e28eta committed Feb 14, 2013
1 parent bb14488 commit a367439
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Vagrantfile
Expand Up @@ -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
3 changes: 3 additions & 0 deletions building-stripe-ctf-base.txt
Expand Up @@ -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
2 changes: 1 addition & 1 deletion puppet/modules/stripectf2/manifests/level05.pp
Expand Up @@ -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':
Expand Down
54 changes: 54 additions & 0 deletions puppet/modules/stripectf2/manifests/level08.pp
@@ -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'],
}
}
8 changes: 6 additions & 2 deletions puppet/modules/stripectf2/manifests/random_password.pp
@@ -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}",
}
}
7 changes: 7 additions & 0 deletions puppet/nodes/level08.pp
@@ -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.