generated from falcosecurity/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kapil Sharma <[email protected]>
- Loading branch information
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
} |