timesketch

by Open Source DFIR

Helm chartv1.0.8App 20240828Apache-2.0Verified publisher

A Helm chart for Timesketch Kubernetes deployments.

About this chart

Timesketch Helm Chart

Timesketch is an open-source tool for collaborative forensic timeline analysis.

Overview of Timesketch

Chart Source Code

TL;DR

helm repo add osdfir-charts https://google.github.io/osdfir-infrastructure/
helm install my-release osdfir-charts/timesketch

Note: By default, Timesketch is not externally accessible and can be reached via kubectl port-forward within the cluster.

Introduction

This chart bootstraps a Timesketch deployment on a Kubernetes cluster using the Helm package manager.

For a quick start with a local Kubernetes cluster on your desktop, check out the getting started with Minikube guide.

Prerequisites

  • Kubernetes 1.23+
  • Helm 3.8.0+
  • PV provisioner support in the underlying infrastructure
  • Shared storage for clusters larger then one machine.

Installing the Chart

The first step is to add and update the repo:

helm repo add osdfir-charts https://google.github.io/osdfir-infrastructure/
helm repo update

Then to install the chart, specify any release name of your choice. For example, using my-release as the release name, run:

helm install my-release osdfir-charts/timesketch

The command deploys Timesketch on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: See the Managing and updating Timesketch configs section for more details on managing the Timesketch configs.

Configuration and installation details

Use a different Timesketch version

The Timesketch Helm chart utilizes the latest container release tags by default. OSDFIR Infrastructure actively monitors for new versions of the main containers and releases updated charts accordingly.

To modify the application version used in Timesketch, specify a different version of the image using the image.tag parameter and/or a different repository using the image.repository parameter. For example, to use the most recent development version instead, set image.tag to latest.

Upgrading the Helm chart

Helm chart updates can be retrieved by running helm repo update.

To explore available charts and versions, use helm search repo osdfir-charts/. Install a specific chart version with helm install my-release osdfir-charts/timesketch --version <version>.

A major Helm chart version change (like v1.0.0 -> v2.0.0) indicates that there is an incompatible breaking change needing manual actions.

Managing and updating Timesketch configs

This section outlines how to deploy and manage Timesketch configuration files within OSDFIR infrastructure.

There are two primary methods:

Using Default Configurations

If you don't provide your own Timesketch config files during deployment, the Timesketch deployment will automatically retrieve the latest default configs from the Timesketch Github repository. This method requires no further action from you.

NOTE: When using the default method, you cannot update the Timesketch config files directly.

Managing Timesketch configs externally

For more advanced configuration management, you can manage Timesketch config files independently of the Helm chart:

  1. Prepare your Config Files:

    Organize all the Timesketch configuration files in a directory with your desired customizations.

  2. Create a ConfigMap:

    kubectl create configmap timesketch-configs --from-file=./timesketch-configs/
    

    Replace ./timesketch-configs/ with the actual path to your configuration files.

  3. Install or Upgrade the Helm Chart:

    helm install my-release osdfir-charts/timesketch --set config.existingConfigMap="timesketch-configs"
    

    This command instructs the Helm chart to use the timesketch-configs ConfigMap for Timesketch's config files.

To update the config changes using this method:

  1. Update the ConfigMap:

    kubectl create configmap timesketch-configs --from-file=./my-configs/ --dry-run -o yaml | kubectl replace -f -
    
  2. Restart the Timesketch deployment to apply the new configs

    kubectl rollout restart deployment -l app.kubernetes.io/name=timesketch
    

Upgrading the Timesketch Database Schema

From time to time, a Timesketch release requires a manual database upgrade if the schema has changed. The Timesketch release page will indicate if a database upgrade is required.

Follow these steps to upgrade the database on your Kubernetes deployment:

  1. Upgrade Timesketch (if not already done):

    • Upgrade your Timesketch deployment to the desired release version:

      helm upgrade my-release osdfir-charts/timesketch --set image.tag=<VERSION> --set image.pullPolicy=Always
      
  2. Connect to Timesketch Pod:

    • Once the upgraded pods are ready, shell into the Timesketch pod:

      kubectl exec -it my-release-timesketch-<RANDOM> -- /bin/bash
      
      • Find your pod name using kubectl get pods.
  3. Perform Database Upgrade:

  4. Restart Timesketch (Recommended):

    • After a successful database upgrade, it is recommended to restart your Timesketch deployment for the changes to take full effect:

      kubectl rollout restart deployment my-release-timesketch-web
      

Metrics and monitoring

The chart starts a metrics exporter for prometheus. The metrics endpoint (port 8080) is exposed in the service. Metrics can be scraped from within the cluster by either a Prometheus server running in your cluster or a cloud-based Prometheus service. Currently, the available metrics is limited to system metrics.

Resource requests and limits

OSDFIR Infrastructure charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources value (check parameter table). Setting requests is essential for production workloads and these should be adapted to your specific use case.

To maximize deployment success across different environments, resources are minimally defined by default.

Persistence

By default, the chart mounts a Persistent Volume at the /mnt/timesketchvolume path. The volume is created using dynamic volume provisioning.

Configuration files can be found at the /etc/timesketch path of the container while logs can be found at /var/log/timesketch.

For clusters running more than one nodes or machines, the Persistent Volume will need to have the ability to be mounted by multiple machines, such as NFS, GCP Filestore, AWS EFS, and other shared file storage equivalents.

Enabling GKE Ingress and OIDC Authentication

Follow these steps to externally expose Timesketch and enable Google Cloud OIDC to control user access to Timesketch.

  1. Create a global static IP address:

    gcloud compute addresses create timesketch-webapps --global
    
  2. Register a new domain or use an existing one, ensuring a DNS entry points to the IP created earlier.

  3. Create OAuth web client credentials following the Google Support guide. If using the CLI client, also create a Desktop/Native OAuth client.

    • Fill in Authorized JavaScript origins with your domain as https://<DOMAIN_NAME>.com
    • Fill in Authorized redirect URIs with https://<DOMAIN_NAME>.com/google_openid_connect/
  4. Store your new OAuth credentials in a K8s secret:

    kubectl create secret generic oauth-secrets \
        --from-literal=client-id=<WEB_CLIENT_ID> \
        --from-literal=client-secret=<WEB_CLIENT_SECRET> \
        --from-literal=client-id-native=<NATIVE_CLIENT_ID>
    
  5. Make a list of allowed emails in a text file, one per line:

    touch authenticated-emails.txt
    
  6. Apply the authenticated email list as a K8s secret:

    kubectl create secret generic authenticated-emails --from-file=authenticated-emails-list=authenticated-emails.txt
    
  7. Then to upgrade an existing release with production values, externally expose Timesketch through a loadbalancer, add SSL through GCP managed certificates, and enable OIDC for authentication, run:

    helm upgrade my-release ../timesketch \
        -f values-production.yaml \
        --set ingress.enabled=true \
        --set ingress.className="gce" \
        --set ingress.host=<DOMAIN_NAME> \
        --set ingress.gcp.staticIPName=<STATIC_IP_NAME> \
        --set ingress.gcp.managedCertificates=true \
        --set config.oidc.enabled=true \
        --set config.oidc.existingSecret=<OAUTH_SECRET_NAME> \
        --set config.oidc.authenticatedEmailsFile.existingSecret=<AUTHENTICATED_EMAILS_SECRET_NAME>
    

Uninstalling the Chart

To uninstall/delete a Helm deployment with a release name of my-release:

helm uninstall my-release

Tip: Please update based on the release name chosen. You can list all releases using helm list

The command removes all the Kubernetes components but Persistent Volumes (PVC) associated with the chart and deletes the release.

To delete the PVC's associated with a release name of my-release:

kubectl delete pvc -l release=my-release

Note: Deleting the PVC's will delete Timesketch data as well. Please be cautious before doing it.

Parameters

Global parameters

NameDescriptionValue
global.timesketch.enabledEnables the Timesketch deployment (only used in the main OSDFIR Infrastructure Helm chart)false
global.timesketch.servicePortTimesketch service port (overrides timesketch.service.port)nil
global.turbinia.enabledEnables the Turbinia deployment (only used within the main OSDFIR Infrastructure Helm chart)false
global.turbinia.servicePortTurbinia API service port (overrides turbinia.service.port)nil
global.yeti.enabledEnables the Yeti deployment (only used in the main OSDFIR Infrastructure Helm chart)false
global.yeti.servicePortYeti API service port (overrides yeti.api.service.port)nil
global.ingress.enabledEnable the global loadbalancer for external access (only used in the main OSDFIR Infrastructure Helm chart)false
global.existingPVCExisting claim for Timesketch persistent volume (overrides persistent.name)""
global.storageClassStorageClass for the Timesketch persistent volume (overrides persistent.storageClass)""

Timesketch image configuration

NameDescriptionValue
image.repositoryTimesketch image repositoryus-docker.pkg.dev/osdfir-registry/timesketch/timesketch
image.pullPolicyTimesketch image pull policyIfNotPresent
image.tagOverrides the image tag whose default is the chart appVersion20240828
image.imagePullSecretsSpecify secrets if pulling from a private repository[]

Timesketch Configuration Parameters

NameDescriptionValue
config.existingConfigMapUse an existing ConfigMap as the default Timesketch config.""
config.createUserCreates a default Timesketch user that can be used to login to Timesketch after deploymenttrue
config.oidc.enabledEnables Timesketch OIDC authentication (currently only supports Google OIDC)false
config.oidc.existingSecretExisting secret with the client ID, secret and cookie secret""
config.oidc.authenticatedEmailsFile.enabledEnables email authenticationtrue
config.oidc.authenticatedEmailsFile.existingSecretExisting secret with a list of emails

Deploy timesketch with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has timesketch on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttimesketch is pinned at v1.0.8 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply