Back to articles
Security & Anti-DDoS

Docker Security: Deploying Seccomp Profiles to Limit Dangerous System Calls on VPS Production

Guide to deploying Seccomp profiles in Docker to restrict dangerous system calls, enhancing security for VPS production environments.

DPTCloud Engineering4 min read
Docker Security: Deploying Seccomp Profiles to Limit Dangerous System Calls on VPS Production

Image credit: analogicus · Pixabay Content License

Docker Security: Deploying Seccomp Profiles to Limit Dangerous System Calls on VPS Production

In VPS production environments, deploying strong security measures for containerized systems like Docker is essential to reduce risks from dangerous system calls. One of the most effective tools for this is Seccomp (Secure Computing Mode). Seccomp allows you to restrict which system calls a process can make, significantly reducing the attack surface.

Why Seccomp Is Important

Seccomp operates at the kernel level, enabling Docker to limit system calls that containers can execute. Commands such as ptrace, kill, setuid, and syslog can be exploited for malicious behavior. By using Seccomp profiles, you can block these commands, improving container security.

Deploying Seccomp Profiles in Docker

Seccomp profiles are defined using JSON files. Docker provides a default profile, but you can customize or create new ones to match your application’s needs.

1. Create a Custom Seccomp Profile

Here is an example of a basic Seccomp profile to block dangerous system calls:

{
  "defaultAction": "SCMP_ACT_ERRNO",
  "syscalls": [
    {
      "names": ["ptrace"],
      "action": "SCMP_ACT_ALLOW"
    },
    {
      "names": ["kill", "setuid", "setgid", "syslog"],
      "action": "SCMP_ACT_ERRNO"
    }
  ]
}

In this example:

  • defaultAction: "SCMP_ACT_ERRNO" – All unlisted calls are denied.
  • SCMP_ACT_ALLOW – Allows the ptrace call.
  • SCMP_ACT_ERRNO – Blocks calls like kill, setuid, etc., returning an error.

2. Apply the Seccomp Profile When Running a Container

To use the profile, specify the JSON file when starting the container:

docker run --security-opt seccomp=/path/to/seccomp-profile.json your-image

Or, if using Docker Compose, add it to the docker-compose.yml file:

version: '3.8'
services:
  app:
    image: your-image
    security_opt:
      - seccomp:./seccomp-profile.json

Verification and Testing

To ensure the profile is applied correctly, check using the following command:

docker inspect --format='{{.HostConfig.SecurityOpt}}' container-name

If enabled, you’ll see Seccomp-related information in the output.

Troubleshooting

In some cases, blocking system calls may cause the application to fail. If you encounter errors, check:

  • Whether essential system calls for your application are being blocked.
  • If the Seccomp profile is correctly formatted as JSON.
  • If the file path to the profile is accurate.

To diagnose specific issues, use:

docker logs container-name

Review the error messages to adjust the profile accordingly.

References

Deploying Seccomp profiles is a critical step in enhancing security for Docker systems on VPS production environments. With these tools, you can tightly control system calls and reduce the risk of security vulnerabilities.

DPTCloud Tier III Infrastructure

Recommended NVMe Cloud VPS Plans to Deploy This Setup

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02

VPS-2E

94.600 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 2 GB
  • SSD: 30 GB NVMe
ECO · vn-02Recommended

VPS-3E

170.500 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 4 GB
  • SSD: 50 GB NVMe
BASIC · vn-01Recommended

VPS-05

457.600 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478