UNPKG

@ctfer-io/pulumi-ctfdcm

Version:

The CTFd-CM provider for Pulumi, to manage its resources as code.

375 lines (374 loc) 13.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * CTFd is built around the Challenge resource, which contains all the attributes to define a part of the Capture The Flag event. * * This implementation has support of On Demand infrastructures through [Chall-Manager](https://github.com/ctfer-io/chall-manager). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as ctfd from "@pulumi/ctfd"; * import * as ctfdcm from "@ctfer-io/pulumi-ctfdcm"; * import * as fs from "fs"; * * const scenario = new ctfd.index.Ctfd_file("scenario", { * name: "scenario.zip", * contentb64: fs.readFileSync(".../scenario.zip", { encoding: "base64" }), * }); * const http = new ctfdcm.ChallengeDynamicIaC("http", { * category: "misc", * description: "...", * value: 500, * decay: 100, * minimum: 50, * state: "visible", * "function": "logarithmic", * shared: true, * destroyOnFlag: true, * manaCost: 1, * scenarioId: scenario.id, * timeout: 600, * topics: ["Misc"], * tags: [ * "misc", * "basic", * ], * }); * const httpFlag = new ctfd.index.Ctfd_flag("httpFlag", { * challengeId: http.id, * content: "CTF{some_flag}", * }); * ``` */ export declare class ChallengeDynamicIaC extends pulumi.CustomResource { /** * Get an existing ChallengeDynamicIaC resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ChallengeDynamicIaCState, opts?: pulumi.CustomResourceOptions): ChallengeDynamicIaC; /** * Returns true if the given object is an instance of ChallengeDynamicIaC. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is ChallengeDynamicIaC; /** * An optional key=value map (both strings) to pass to the scenario. */ readonly additional: pulumi.Output<{ [key: string]: string; }>; /** * Attribution to the creator(s) of the challenge. */ readonly attribution: pulumi.Output<string | undefined>; /** * Category of the challenge that CTFd groups by on the web UI. */ readonly category: pulumi.Output<string>; /** * Connection Information to connect to the challenge instance, useful for pwn, web and infrastructure pentests. */ readonly connectionInfo: pulumi.Output<string>; /** * The decay defines from each number of solves does the decay function triggers until reaching minimum. This function is defined by CTFd and could be configured through `.function`. */ readonly decay: pulumi.Output<number>; /** * Description of the challenge, consider using multiline descriptions for better style. */ readonly description: pulumi.Output<string>; /** * Whether to destroy the instance once flagged. */ readonly destroyOnFlag: pulumi.Output<boolean>; /** * Decay function to define how the challenge value evolve through solves, either linear or logarithmic. */ readonly function: pulumi.Output<string>; /** * The cost (in mana) of the challenge once an instance is deployed. */ readonly manaCost: pulumi.Output<number>; /** * The number of instances after which not to pool anymore. */ readonly max: pulumi.Output<number>; /** * Maximum amount of attempts before being unable to flag the challenge. */ readonly maxAttempts: pulumi.Output<number>; /** * The minimum number of instances to set in the pool. */ readonly min: pulumi.Output<number>; /** * The minimum points for a dynamic-score challenge to reach with the decay function. Once there, no solve could have more value. */ readonly minimum: pulumi.Output<number>; /** * Name of the challenge, displayed as it. */ readonly name: pulumi.Output<string>; /** * Suggestion for the end-user as next challenge to work on. */ readonly next: pulumi.Output<number | undefined>; /** * List of required challenges that needs to get flagged before this one being accessible. Useful for skill-trees-like strategy CTF. */ readonly requirements: pulumi.Output<outputs.ChallengeDynamicIaCRequirements | undefined>; /** * The file's ID of the scenario. */ readonly scenarioId: pulumi.Output<string>; /** * Whether the instance will be shared between all players. */ readonly shared: pulumi.Output<boolean>; /** * State of the challenge, either hidden or visible. */ readonly state: pulumi.Output<string>; /** * List of challenge tags that will be displayed to the end-user. You could use them to give some quick insights of what a challenge involves. */ readonly tags: pulumi.Output<string[]>; /** * The timeout (in seconds) after which the instance will be janitored. */ readonly timeout: pulumi.Output<number>; /** * List of challenge topics that are displayed to the administrators for maintenance and planification. */ readonly topics: pulumi.Output<string[]>; /** * The date until the instance could run before being janitored. */ readonly until: pulumi.Output<string>; /** * The value (points) of the challenge once solved. It is mapped to `initial` under the hood, but displayed as `value` for consistency with the standard challenge. */ readonly value: pulumi.Output<number>; /** * Create a ChallengeDynamicIaC resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ChallengeDynamicIaCArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ChallengeDynamicIaC resources. */ export interface ChallengeDynamicIaCState { /** * An optional key=value map (both strings) to pass to the scenario. */ additional?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Attribution to the creator(s) of the challenge. */ attribution?: pulumi.Input<string>; /** * Category of the challenge that CTFd groups by on the web UI. */ category?: pulumi.Input<string>; /** * Connection Information to connect to the challenge instance, useful for pwn, web and infrastructure pentests. */ connectionInfo?: pulumi.Input<string>; /** * The decay defines from each number of solves does the decay function triggers until reaching minimum. This function is defined by CTFd and could be configured through `.function`. */ decay?: pulumi.Input<number>; /** * Description of the challenge, consider using multiline descriptions for better style. */ description?: pulumi.Input<string>; /** * Whether to destroy the instance once flagged. */ destroyOnFlag?: pulumi.Input<boolean>; /** * Decay function to define how the challenge value evolve through solves, either linear or logarithmic. */ function?: pulumi.Input<string>; /** * The cost (in mana) of the challenge once an instance is deployed. */ manaCost?: pulumi.Input<number>; /** * The number of instances after which not to pool anymore. */ max?: pulumi.Input<number>; /** * Maximum amount of attempts before being unable to flag the challenge. */ maxAttempts?: pulumi.Input<number>; /** * The minimum number of instances to set in the pool. */ min?: pulumi.Input<number>; /** * The minimum points for a dynamic-score challenge to reach with the decay function. Once there, no solve could have more value. */ minimum?: pulumi.Input<number>; /** * Name of the challenge, displayed as it. */ name?: pulumi.Input<string>; /** * Suggestion for the end-user as next challenge to work on. */ next?: pulumi.Input<number>; /** * List of required challenges that needs to get flagged before this one being accessible. Useful for skill-trees-like strategy CTF. */ requirements?: pulumi.Input<inputs.ChallengeDynamicIaCRequirements>; /** * The file's ID of the scenario. */ scenarioId?: pulumi.Input<string>; /** * Whether the instance will be shared between all players. */ shared?: pulumi.Input<boolean>; /** * State of the challenge, either hidden or visible. */ state?: pulumi.Input<string>; /** * List of challenge tags that will be displayed to the end-user. You could use them to give some quick insights of what a challenge involves. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * The timeout (in seconds) after which the instance will be janitored. */ timeout?: pulumi.Input<number>; /** * List of challenge topics that are displayed to the administrators for maintenance and planification. */ topics?: pulumi.Input<pulumi.Input<string>[]>; /** * The date until the instance could run before being janitored. */ until?: pulumi.Input<string>; /** * The value (points) of the challenge once solved. It is mapped to `initial` under the hood, but displayed as `value` for consistency with the standard challenge. */ value?: pulumi.Input<number>; } /** * The set of arguments for constructing a ChallengeDynamicIaC resource. */ export interface ChallengeDynamicIaCArgs { /** * An optional key=value map (both strings) to pass to the scenario. */ additional?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Attribution to the creator(s) of the challenge. */ attribution?: pulumi.Input<string>; /** * Category of the challenge that CTFd groups by on the web UI. */ category: pulumi.Input<string>; /** * Connection Information to connect to the challenge instance, useful for pwn, web and infrastructure pentests. */ connectionInfo?: pulumi.Input<string>; /** * The decay defines from each number of solves does the decay function triggers until reaching minimum. This function is defined by CTFd and could be configured through `.function`. */ decay: pulumi.Input<number>; /** * Description of the challenge, consider using multiline descriptions for better style. */ description: pulumi.Input<string>; /** * Whether to destroy the instance once flagged. */ destroyOnFlag?: pulumi.Input<boolean>; /** * Decay function to define how the challenge value evolve through solves, either linear or logarithmic. */ function?: pulumi.Input<string>; /** * The cost (in mana) of the challenge once an instance is deployed. */ manaCost?: pulumi.Input<number>; /** * The number of instances after which not to pool anymore. */ max?: pulumi.Input<number>; /** * Maximum amount of attempts before being unable to flag the challenge. */ maxAttempts?: pulumi.Input<number>; /** * The minimum number of instances to set in the pool. */ min?: pulumi.Input<number>; /** * The minimum points for a dynamic-score challenge to reach with the decay function. Once there, no solve could have more value. */ minimum: pulumi.Input<number>; /** * Name of the challenge, displayed as it. */ name?: pulumi.Input<string>; /** * Suggestion for the end-user as next challenge to work on. */ next?: pulumi.Input<number>; /** * List of required challenges that needs to get flagged before this one being accessible. Useful for skill-trees-like strategy CTF. */ requirements?: pulumi.Input<inputs.ChallengeDynamicIaCRequirements>; /** * The file's ID of the scenario. */ scenarioId: pulumi.Input<string>; /** * Whether the instance will be shared between all players. */ shared?: pulumi.Input<boolean>; /** * State of the challenge, either hidden or visible. */ state?: pulumi.Input<string>; /** * List of challenge tags that will be displayed to the end-user. You could use them to give some quick insights of what a challenge involves. */ tags?: pulumi.Input<pulumi.Input<string>[]>; /** * The timeout (in seconds) after which the instance will be janitored. */ timeout?: pulumi.Input<number>; /** * List of challenge topics that are displayed to the administrators for maintenance and planification. */ topics?: pulumi.Input<pulumi.Input<string>[]>; /** * The date until the instance could run before being janitored. */ until?: pulumi.Input<string>; /** * The value (points) of the challenge once solved. It is mapped to `initial` under the hood, but displayed as `value` for consistency with the standard challenge. */ value: pulumi.Input<number>; }