forked from stripe-ctf/stripe-ctf-2.0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding level 8. Requires re-importing the base image
- Loading branch information
Showing
6 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node 'level08-1.stripe-ctf.com' { | ||
class {'stripectf2::level08': | ||
destination => '/levels/08', | ||
source => '/vagrant/levels/8', | ||
require => File['/levels'], | ||
} | ||
} |