Git Product home page Git Product logo

Comments (3)

SISheogorath avatar SISheogorath commented on August 17, 2024

You can run blocky with PSS restrict. PSS restricted allows to add NET_BIND_SERVICE.

This is how I run blocky in a Namespace with PSS restricted version v1.26: https://git.shivering-isles.com/shivering-isles/infrastructure-gitops/-/blob/37b991bc0f7f4955773bce1df3ef5a0b6ce6cd0f/apps/k8s01/dns/dns.yaml

from blocky.

zc-devs avatar zc-devs commented on August 17, 2024

It requires to drop all capabilities, except NET_BIND_SERVICE

I supposed, that config below should work

          securityContext:
            capabilities:
              drop:
                - ALL
              add:
                - NET_BIND_SERVICE

However, the point is I do not need privileged ports and want to run without NET_BIND_SERVICE capability. But as this capability is set on executable, I have to add NET_BIND_SERVICE in K8s or rebuild image.
The propose is to have an image without capabilities set on executable (tagged like v0.23-unprivileged).

Perhaps, I should have renamed the issue...

from blocky.

zc-devs avatar zc-devs commented on August 17, 2024

ghcr.io/0xerr0r/blocky:v0.24

While I confirm, that configuration below works in my cluster

apiVersion: apps/v1
kind: Deployment
metadata:
  name: blocky
spec:
...
      containers:
        - name: blocky
          image: ghcr.io/0xerr0r/blocky:v0.24
          ports:
            - name: dns-udp
              containerPort: 1053
              protocol: UDP
            - name: dns-tcp
              containerPort: 1053
              protocol: TCP
            - name: http
              containerPort: 4000
              protocol: TCP
          securityContext:
            capabilities:
              drop:
                - ALL
              add:
                - NET_BIND_SERVICE
            readOnlyRootFilesystem: true
            allowPrivilegeEscalation: false
      securityContext:
        runAsUser: 100
        runAsGroup: 100
        runAsNonRoot: true
        fsGroup: 100
        fsGroupChangePolicy: OnRootMismatch
        seccompProfile:
          type: RuntimeDefault

there might be clusters (old versions?) which do not set ambient capabilities and this configuration/workaround won't work.

Linux Capabilities in OpenShift
Running a container with runAsNonRoot and add capabilities

That said, the dedicated unprivileged image is still preferable solution, I think.

Edit: seems, add NET_BIND_SERVICE works because it was set up on file.

from blocky.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.