Skip to content

Hook cheat sheet: Erlang and Elixir ​

How to add a vulnboxd runtime hook to a Erlang and Elixir service by hand. Find your setup in the table, then follow its block.

  • Without source access: only the compose file changes; redeploy. With source access: you change the code or Dockerfile and rebuild.
  • Hub automation says how much the hub's proposals do for you. Fully: approve the proposal in the hub; the block is the fallback when it failed. With conditions: the same, when the conditions listed hold. Partly: the hub pushes the compose part, the rest is yours. Not at all: everything is by hand.
  • /usr/local/lib/vulnboxd/trace is the hook directory vulnboxd installs on the vulnbox. Compose snippets mount it read-only at /opt/vbxtrace in the container.
  • How to check that the hook works and undo it is at the end of the page.
  • Runtime hooks explains what a hook does.

Erlang / Elixir ​

SetupUse this whenChangeHub automation
Elixir runtime hook (ERL_AFLAGS)Depends on phoenix, plug, bandit, plug_cowboy, cowboy or 1 more (in mix.exs or rebar.config)composefully
Elixir release hook (ELIXIR_ERL_OPTIONS)Depends on phoenix, bandit or plug_cowboy (in mix.exs or rebar.config)composefully
Erlang runtime hook (ERL_AFLAGS)Depends on cowboy, ranch or elli (in mix.exs or rebar.config)composefully

Without source access ​

Only the compose file changes: the image and the code stay as they are.

Elixir runtime hook (ERL_AFLAGS) ​

  • Use this when: Erlang / Elixir service that depends on phoenix, plug, bandit, plug_cowboy, cowboy or 1 more (in mix.exs or rebar.config).
  • Hub automation: fully. The hub proposes exactly this change and pushes it (one commit per container) once you approve it. Do it by hand only when the proposal failed, e.g. on an unusual compose file.
  • Check and undo: hook mounted into the container

Mounts the hook directory read-only and appends the BEAM hook's flags to ERL_AFLAGS. Phoenix, Plug, Bandit (telemetry) and Plug.Cowboy (call tracing) requests are followed without code or image changes.

Compose: merge into the service (app is its name) and redeploy:

yaml
services:
  app:
    volumes:
      - /usr/local/lib/vulnboxd/trace:/opt/vbxtrace:ro
    environment:
      ERL_AFLAGS: "-pa /opt/vbxtrace/beam/ebin -eval catch(code:load_file(vbxtrace)),catch(vbxtrace:start())."   # already set? append, separated by a space
Exact detection rules

Package E1 (Erlang / Elixir hook), proposal E1:elixir, defined in hooks/beam/e1/proposals/elixir.toml.

  • Image matches (regex): ^elixir:, ^(docker\.io/)?(library/)?elixir:, ^hexpm/elixir
  • Command matches (regex): \bmix\b, \belixir\b, \biex\b
  • Dependency on: phoenix, plug, bandit, plug_cowboy, cowboy, thousand_island
  • Files: mix.exs, mix.lock

Elixir release hook (ELIXIR_ERL_OPTIONS) ​

  • Use this when: Erlang / Elixir service that depends on phoenix, bandit or plug_cowboy (in mix.exs or rebar.config).
  • Hub automation: fully. The hub proposes exactly this change and pushes it (one commit per container) once you approve it. Do it by hand only when the proposal failed, e.g. on an unusual compose file.
  • Check and undo: hook mounted into the container

Mounts the hook directory read-only and appends the BEAM hook's flags to ELIXIR_ERL_OPTIONS for a mix release. No code or image change; requests are followed from the moment the release has booted.

Compose: merge into the service (app is its name) and redeploy:

yaml
services:
  app:
    volumes:
      - /usr/local/lib/vulnboxd/trace:/opt/vbxtrace:ro
    environment:
      ELIXIR_ERL_OPTIONS: "-pa /opt/vbxtrace/beam/ebin -eval catch(code:load_file(vbxtrace)),catch(vbxtrace:start())."   # already set? append, separated by a space
Exact detection rules

Package E1 (Erlang / Elixir hook), proposal E1:elixir-release, defined in hooks/beam/e1/proposals/elixir-release.toml.

  • Image matches (regex): ^elixir:, ^hexpm/elixir, ^hexpm/erlang, ^erlang:
  • Command matches (regex): \bbin/[A-Za-z0-9_]+\s+(start|foreground|daemon)\b, /app/bin/, \b_build/prod/rel/
  • Dependency on: phoenix, bandit, plug_cowboy
  • Files: rel/env.sh.eex, rel/vm.args.eex, rel/remote.vm.args.eex

Erlang runtime hook (ERL_AFLAGS) ​

  • Use this when: Erlang / Elixir service that depends on cowboy, ranch or elli (in mix.exs or rebar.config).
  • Hub automation: fully. The hub proposes exactly this change and pushes it (one commit per container) once you approve it. Do it by hand only when the proposal failed, e.g. on an unusual compose file.
  • Check and undo: hook mounted into the container

Mounts the hook directory read-only and appends the BEAM hook's flags to ERL_AFLAGS. Requests on Cowboy, Elli, ranch and gen_tcp servers are followed through the BEAM's own call tracing; no code or image change.

Compose: merge into the service (app is its name) and redeploy:

yaml
services:
  app:
    volumes:
      - /usr/local/lib/vulnboxd/trace:/opt/vbxtrace:ro
    environment:
      ERL_AFLAGS: "-pa /opt/vbxtrace/beam/ebin -eval catch(code:load_file(vbxtrace)),catch(vbxtrace:start())."   # already set? append, separated by a space
Exact detection rules

Package E1 (Erlang / Elixir hook), proposal E1:erlang, defined in hooks/beam/e1/proposals/erlang.toml.

  • Image matches (regex): ^erlang:, ^(docker\.io/)?(library/)?erlang:, ^hexpm/erlang
  • Command matches (regex): \berl\b, \brebar3\b, \berlexec\b
  • Dependency on: cowboy, ranch, elli
  • Files: rebar.config, rebar.lock, erlang.mk, relx.config, *.app.src

Check that it works, and undo ​

Each block links the variant it needs.

Hook mounted into the container ​

Check: After the redeploy, this lists the processes that loaded the hook (empty: it is not loaded):

sh
docker compose exec app sh -c 'grep -l vbxtrace /proc/[0-9]*/maps'

The hub's Trace tab then shows links whose method starts with hook:.

Undo: Set VBXTRACE: "0" in the service's environment and restart it, or revert the commit (the hub's proposal screen has a revert per container). Remove the mount of /opt/vbxtrace only together with what loads from it: a runtime told to preload a missing file may refuse to start.