Skip to content

Commit

Permalink
checking ssh present or not?
Browse files Browse the repository at this point in the history
Signed-off-by: Kapil Sharma <[email protected]>
  • Loading branch information
h4l0gen committed Apr 11, 2024
1 parent b692eef commit 9020b0c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions events/syscall/disallowed_ssh_connection_non_standard_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,25 @@ limitations under the License.
package syscall

import (
"os/exec"
"github.com/falcosecurity/event-generator/events"
"github.com/falcosecurity/event-generator/events"
"os/exec"
)

var _ = events.Register(DisallowedSSHConnectionNonStandardPort)

func DisallowedSSHConnectionNonStandardPort(h events.Helper) error {
// non_standard_port : 443
cmd := exec.Command("timeout", "1s", "ssh", "[email protected]", "-p", "443")
err := cmd.Run()
if err != nil {
return err
}
return nil
path, err := exec.LookPath("ssh")
if err != nil {
// If we don't have an SSH, just bail
return &events.ErrSkipped{
Reason: "ssh utility not found in path",
}
}
// non_standard_port : 443
cmd := exec.Command("timeout", "1s", path, "[email protected]", "-p", "443")
err = cmd.Run()
if err != nil {
return err
}
return nil
}

0 comments on commit 9020b0c

Please sign in to comment.