> For the complete documentation index, see [llms.txt](https://vida03.gitbook.io/redteam/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vida03.gitbook.io/redteam/docker/defenses/seccomp.md).

# SecComp

## Apresentação

**seccomp** é um módulo de segurança do linux que permite restringir as **syscalls** que podem ser executadas

{% hint style="info" %}
SecComp pode ser usado para o host linux também, assim como podemos implementar ele no nosso contêiner
{% endhint %}

## Implementation

O **seccomp** é similar ao [**apparmor**](/redteam/docker/defenses/apparmor.md), porém ele restringe certas syscalls de serem executadas, você pode ver como os arquivos de configuração são criados [**aqui**](https://itnext.io/seccomp-in-kubernetes-part-2-crafting-custom-seccomp-profiles-for-your-applications-c28c658f676e)

```
{
        "defaultAction": "SCMP_ACT_ALLOW",
        "architectures": [
                "SCMP_ARCH_X86_64",
                "SCMP_ARCH_X86",
                "SCMP_ARCH_X32"
        ],
        "syscalls": [
                {
                        "name": "chmod",
                        "action": "SCMP_ACT_ERRNO",
                        "args": []
                }

        ]
}
```

Esse arquivo que usei para exemplo não permite a chamada da syscall chmod, podemos executar o contêiner com o seccomp usando o seguinte comando

```
docker run --rm -it --security-opt seccomp=<SECCOMP_PROFILE.json> <IMAGE_NAME> sh
```

<figure><img src="/files/cp6TQ7pdcjbiEoFEmal6" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Se usarmos a opção **--privileged** a flag **security-opt será ignorada**, ignorando assim as regras aplicadas
{% endhint %}

<figure><img src="/files/hmI9DdlyzRJrBpaHmmRl" alt=""><figcaption></figcaption></figure>

## Conclusão

Conseguimos com o auxilío de módulos de segurança do kernel do linux implementar mais segurança para o nosso contêiner, utilizando regras para permitir certas execuções no contêiner.

**Mas de nada adianta se usarmos a flag --privileged**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://vida03.gitbook.io/redteam/docker/defenses/seccomp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
