-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
135 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
gocapng | ||
======= | ||
|
||
The following code | ||
------------------- | ||
|
||
The following code provides a (C)Go binding for libcap-ng by Red-Hat using | ||
__static__ linking. | ||
|
||
The aim of the binding is to provide a Go'ish approach on using libcap-ng's API. | ||
The code is only for Linux without a support for any additional OSes. | ||
|
||
What is it all about | ||
-------------------- | ||
|
||
The aim of POSIX's libcap and libcap-ng is to provide elevated permissions for | ||
specific type of actions without becoming root, and only open it when required | ||
and turn it off after performing the call itself. | ||
|
||
In order to bind low port number (bellow 1024) you need to become root, or use | ||
CAP_NET_BIND_SERVICE with libcap or libcap-ng. | ||
|
||
The difference between libcap and libcap-ng is that libcap-ng is a library that | ||
provides helps for taking care of POSIX libcap in simpler manner. | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
output_name:=echo-server | ||
|
||
build: | ||
@rm "${output_name}" 2> /dev/null && echo "${output_name} cleaned" || true | ||
@go build -o "${output_name}" *.go && echo "built ${output_name}" | ||
sudo setcap CAP_NET_RAW,CAP_NET_BIND_SERVICE+ep "${output_name}" | ||
|
||
clean: | ||
@rm "${output_name}" 2> /dev/null && echo "${output_name} cleaned" || echo "nothing to clean" |
Binary file not shown.
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