SecGen function: add directory (creates directory + any parent directories using mkdir -p)

This commit is contained in:
ts
2018-08-02 12:48:50 +01:00
parent f346267a6b
commit 2c6e06bea5
5 changed files with 14 additions and 12 deletions

View File

@@ -0,0 +1,6 @@
define secgen_functions::create_directory($path){
exec { "secgen_create_directory_$path":
path => '/bin:/sbin:/usr/bin:/usr/sbin',
command => "mkdir -p $path"
}
}

View File

@@ -41,9 +41,9 @@ define secgen_functions::install_setgid_binary (
}
# Create challenge directory
file { "create_$challenge_directory":
::secgen_functions::create_directory { "create_$challenge_directory":
path => $challenge_directory,
ensure => directory,
notify => File["create_$compile_directory"],
}
# Move contents of the module's files directory into compile directory
@@ -58,7 +58,7 @@ define secgen_functions::install_setgid_binary (
exec { "gcc_$challenge_name-$compile_directory":
cwd => $compile_directory,
command => "/usr/bin/make",
require => File["create_$challenge_directory", "create_$compile_directory"]
require => File["create_$compile_directory"]
}
# Move the compiled binary into the challenge directory

View File

@@ -39,9 +39,9 @@ define secgen_functions::install_setuid_root_binary (
$modules_source = "puppet:///modules/$source_module_name"
# Create challenge directory
file { "create_$challenge_directory":
::secgen_functions::create_directory { "create_$challenge_directory":
path => $challenge_directory,
ensure => directory,
notify => File["create_$compile_directory"],
}
# Move contents of the module's files directory into compile directory
@@ -56,7 +56,7 @@ define secgen_functions::install_setuid_root_binary (
exec { "gcc_$challenge_name-$compile_directory":
cwd => $compile_directory,
command => "/usr/bin/make",
require => [File["create_$challenge_directory", "create_$compile_directory"], Package['build-essential', 'gcc-multilib']]
require => [File["create_$compile_directory"], Package['build-essential', 'gcc-multilib']]
}
# Move the compiled binary into the challenge directory

View File

@@ -9,8 +9,6 @@
<system_name>group_challenges</system_name>
<base platform="linux" type="server"/>
<!--TODO: use same pattern for all type=".*pwnable_binary" -->
<!-- 1) Default uses an account and drops the binary in the users home directory -->
<vulnerability type="pwnable_binary">
<input into="group">
@@ -27,7 +25,7 @@
<!--<value/>-->
<!--</input>-->
<!--<input into="storage_directory">-->
<!--<value>/home</value>-->
<!--<value>/test/hidden/challenges</value>-->
<!--</input>-->
<!--</vulnerability>-->

View File

@@ -9,8 +9,6 @@
<system_name>reverse_me</system_name>
<base platform="linux" type="server"/>
<!--TODO: use same pattern for all type=".*pwnable_binary" -->
<!-- 1) Default uses an account and drops the binary in the users home directory
(username/pw: challenges/password) -->
<vulnerability type="pwnable_binary"/>
@@ -21,7 +19,7 @@
<!--<value/>-->
<!--</input>-->
<!--<input into="storage_directory">-->
<!--<value>/home</value>-->
<!--<value>/test/hidden/challenges</value>-->
<!--</input>-->
<!--</vulnerability>-->