Skip to content

Error: Operation not permitted while using raw-socket for net-ping module #29762

@nr-mjuvvadi

Description

@nr-mjuvvadi

I am using net-ping module in my container which runs on openshift environment as non root user.

I am getting below error when running script in my pod

var ping = require('net-ping')
ping.createSession({
  retries: 2,
  timeout: 1000
});

Error:

Error: Operation not permitted
at new Socket (/app/api-runtime/.yarn/unplugged/raw-socket-npm-1.7.0-8205b5d49b/node_modules/raw-socket/index.js:47:14)
at Object.exports.createSocket (/app/api-runtime/.yarn/unplugged/raw-socket-npm-1.7.0-8205b5d49b/node_modules/raw-socket/index.js:202:9)

I have NET_RAW and NET_ADMIN capabilities added to my custom SCC which I have defined for the user and this is getting reflected in my pod yaml as well as shown. Any way I can fix this.

I have tried adding setcap CAP_NET_RAW+eip /usr/bin/node but it didnt help

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions