Skip to content

Repository files navigation

CTFd Helm chart

This Helm charts provides a straightforward way to deploy a CTFd instance on Kubernetes. CTFd is a capture the flag framework with theming and plugin support. CTFd is developed on GitHub under the Apache2 license.

This Helm chart was originally developed by HackademINT for internal use and was first used in production for the 2023 edition of the 404 CTF.

This chart is inspired by Bitnami's high quality charts, and uses Bitnami packages for its dependencies.

By default, the chart will deploy everything needed to operate CTFd in a high availability deployment, including Redis, MariaDB and MinIO. However, you might want to use external services instead when running in production.

State of this project

While this chart can, and has been used in production successfully, it is still an ongoing project and all configuration haven't been thoroughly tested.

TL;DR

helm install my-release oci://registry-1.docker.io/hackademint/ctfd

Parameters

CTFd configuration parameters

NameDescriptionValue
security.sessionCookie.httpOnlyValue of the HttpOnly flag for session cookiestrue
security.sessionCookie.sameSiteValue of the SameSite parameter of session cookiesLax
security.permanentSessionLifetimeThe Flask session lifetime, in seconds604800
mail.addressFromA source address for sent emailsnoreply@example.com
mail.smtp.enabledEnable to send emails through an SMTP serverfalse
mail.smtp.serverAddress of the SMTP server""
mail.smtp.portPort of the SMTP465
mail.smtp.useAuthWhether CTFd should authenticate to the SMTP serverfalse
mail.smtp.usernameSMTP username for authentication""
mail.smtp.passwordSMTP password for authentication""
mail.smtp.tlsUse TLS to communicate with the SMTP servertrue
mail.smtp.sslUse SSL to communicate with the SMTP serverfalse
mail.smtp.addressSenderSMTP SENDER field value""
mail.smtp.existingSecretName of an existing secret with smtpUsername and smtpPassword keys""
mail.mailgun.enabledEnable to send emails through a mailgun APIfalse
mail.mailgun.apiKeyA mailgun API key""
mail.mailgun.baseUrlBase url for the mailgun API""
mail.mailgun.existingSecretName of an existing secret with a mailgunApiKey key""
logFolderA folder where CTFd should store logs for submissions, registrations and logins""
optional.reverseProxyWhether CTFd should trust X-Forwarded headers. Checkout the CTFd documentation for more details on the possible values.true
optional.themeFallbackWhether CTFd should fallback to the core theme for missing resourcestrue
optional.swaggerUiWhether to enable the swagger endpoint at /api/v1false
optional.updateCheckWhether to check for updatestrue
optional.serverSentEventsWhether to use server sent event notificationstrue
optional.htmlSanitizationWhether CTFd should sanitize html contentfalse
optional.sqlAlchemy.trackModificationsLeave disabled to save memoryfalse
optional.sqlAlchemy.maxOverflowSqlAlchemy max overflow engine setting""
optional.sqlAlchemy.poolPrePingSqlAlchemy pool pre ping engine setting""
optional.safeModeIf enabled, CTFd will not load any pluginsfalse
oauth.enabledWhether to enable MajorLeagueCyber integrationfalse
oauth.clientIdMajorLeagueCyber oauth client ID""
oauth.clientSecretMajorLeagueCyber oauth client secret""

CTFd deployment basic parameters

NameDescriptionValue
image.imageFull container image path for the CTFd deploymentghcr.io/ctfd/ctfd:3.5.3
image.pullSecretA pull secret name for the CTFd image""
image.pullPolicyCTFd image pull policyIfNotPresent
httpPortThe http port the CTFd container listens on8000
replicaCountNumber of replicas for the CTFd deployment1
commandOverride default container command (useful when using custom images)[]
argsOverride default container args (useful when using custom images)[]
extraEnvVarsArray with extra environment variables to add to the CTFd container[]
extraEnvVarsCMName of existing ConfigMap containing extra env vars""
extraEnvVarsSecretName of existing Secret containing extra env vars""

CTFd deployment security contexts

NameDescriptionValue
podSecurityContext.enabledEnabled CTFd pods' Security Contexttrue
podSecurityContext.fsGroupSet CTFd pod's Security Context fsGroup1001
podSecurityContext.seccompProfile.typeSet CTFd container's Security Context seccomp profileRuntimeDefault
containerSecurityContext.enabledEnabled CTFd containers' Security Contexttrue
containerSecurityContext.runAsUserSet CTFd container's Security Context runAsUser1001
containerSecurityContext.runAsNonRootSet CTFd container's Security Context runAsNonRoottrue
containerSecurityContext.allowPrivilegeEscalationSet CTFd container's privilege escalationfalse
containerSecurityContext.capabilities.dropSet CTFd container's Security Context runAsNonRoot["ALL"]

CTFd deployment probes parameters

NameDescriptionValue
startupProbea template for the startup probe
startupProbe.enabledWhether to enable the probefalse
startupProbea template for the startup probe
readinessProbe.enabledWhether to enable the probetrue
livenessProbea template for the startup probe
livenessProbe.enabledWhether to enable the probetrue

CTFd deployment resource requests and limits

NameDescriptionValue
resourcesA container resource template
resources.requests.memoryRequested amount of RAM for CTFd containers200Mi
resources.requests.cpuRequested amount of CPU for CTFd containers400m
resources.limitsMaximum resources for CTFd containers before they get restarted or killed{}

CTFd service parameters

NameDescriptionValue
service.typeKubernetes service typeClusterIP
service.portService port80

CTFd ingress parameters

NameDescriptionValue
ingress.enabledWhether to enable the CTFd ingresstrue
ingress.hostnameIngress hostnameexample.com
ingress.annotationsannotation to add to the ingress resource{}

CTFd deployment autoscaling parameters

NameDescriptionValue
autoscaling.enabledSet this to true to deploy a horizontal pod autoscaler for CTFdfalse
autoscaling.minReplicasMinimum number of CTFd pods1
autoscaling.maxReplicasMaximum number of CTFd pods25
autoscaling.targetCPUTarget CPU usage for CTFd pods (in % of requested). Set to 0 to disable.65
autoscaling.targetMemoryTarget RAM usage for CTFd pods (in % of requested). Set to 0 to disable.0
autoscaling.scaleDown.stabilizationWindowSecondsScale down stabilization window300
autoscaling.scaleDown.periodSecondsScale down period15
autoscaling.scaleDown.percentMaximum percent of pods to remove in the given period100
autoscaling.scaleDown.podsMaximum number of pods to remove in the given period5
autoscaling.scaleUp.stabilizationWindowSecondsScale up stabilization window0
autoscaling.scaleUp.periodSecondsScale up period15
autoscaling.scaleUp.percentMaximum percent of pods to add in the given period100
autoscaling.scaleUp.podsMaximum number of pods to add in the given period10

Database Parameters

NameDescriptionValue
mariadb.enabledDeploy a MariaDB server to satisfy the applications database requirementstrue
mariadb.architectureMariaDB architecture. Allowed values: standalone or replicationstandalone
mariadb.auth.databaseMariaDB custom databasectfd
mariadb.auth.usernameMariaDB custom usernamectfd
mariadb.primary.persistence.enabledEnable persistence on MariaDB using PVC(s)true
mariadb.primary.persistence.storageClassPersistent Volume storage class""
mariadb.primary.persistence.accessModesPersistent Volume access modes[]
mariadb.primary.persistence.sizePersistent Volume size8Gi
externalDatabase.enabledWhether to use an external databasefalse
externalDatabase.protocolProtocol schema to use when connecting to the external databasemysql+pymysql
externalDatabase.hostExternal Database server hostlocalhost
externalDatabase.portExternal Database server port3306
externalDatabase.userExternal Database usernamectfd
externalDatabase.passwordExternal Database user password""
externalDatabase.databaseExternal Database database namectfd
externalDatabase.existingSecretThe name of an existing secret with database credentials. Evaluated as a template""

Redis cache parameters

NameDescriptionValue
redis.enabledDeploy a Redis server to satisfy the applications caching requirementstrue
redis.architectureRedis chart architecture optionstandalone
externalRedis.enabledWhether to use an external redis instancefalse
externalRedis.protocolRedis protocol scheme to useredis
externalRedis.hostExternal Redis server hostlocalhost
externalRedis.portExternal Redis server port6379
externalRedis.userExternal Redis user""
externalRedis.indexExternal Redis index (database)""
externalRedis.passwordExternal Redis password""
externalRedis.existingSecretName of an existing secret containing a redis-password key""

MinIO S3 parameters

NameDescriptionValue
minio.enabledDeploy a MinIO server to provide an upload providertrue
minio.modeMinIO® server mode (standalone or distributed)standalone
minio.defaultBucketsBucket name to use for CTFdctfd
minio.auth.rootUserMinIO® root usernameadmin
minio.auth.rootPasswordPassword for MinIO® root user""
minio.auth.existingSecretUse existing secret for credentials details (minio.auth.rootUser and minio.auth.rootPassword will be ignored and picked up from this secret). The secret has to contain the keys root-user and root-password)""
minio.externalEndpointthe external HTTP(S) S3 API endpoint MinIO will be accessible from (e.g. https://s3.my-ctf.com). This endpoint needs to be reachable by users. If this value is not set, MinIO's API ingress configuration will be used. If this is not set either, CTFd will use the API service name.""

S3 parameters

NameDescriptionValue
externalS3.enabledWhether to use an external S3 endpoint to store uploadsfalse
externalS3.endpointExternal S3 API endpoint URLhttps://s3.amazonaws.com
externalS3.regionExternal S3 API regionus-east-1
externalS3.bucketExternal S3 bucket namectfd
externalS3.accessKeyExternal S3 API access key""
externalS3.secretKeyExternal S3 API secret key""
externalS3.existingSecretName of an existing secret containing a accessKey and secretKey keys""

About

A Helm chart for CTFd

Resources

Stars

4 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages