Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
olowe.co/icinga
package icinga provides a client to the Icinga2 HTTP API.
Send patches, questions or a friendly "hello" to the mailing list: ~otl/public-inbox@lists.sr.ht Or, read the archives.
See the package overview godoc for getting started examples.
Some code is automatically generated. Ensure it's up-to-date before starting work:
go generate
Make some changes, then run the tests:
go test
Please send any patches to the mailing list:
git send-email --to="~otl/public-inbox@lists.sr.ht" HEAD^
For those unfamiliar with this workflow, see git-send-email.io.
Some tests use a fake, in-process Icinga server. Not all features of
the API are implemented, but on any unsupported request it should
report an error. The fake server uses an in-memory map to store
Icinga2 objects, which maps object's path in the API request (e.g.
"objects/hosts/text.example.com") to the object's attributes (e.g.
check_command
and display_name
).
Some tests dial an instance of Icinga2 running on the loopback address
and the standard Icinga2 port 5665 (::1:5665
). If this fails, those
tests are skipped. To run these tests, create the following API user:
object ApiUser "icinga" {
password = name
permissions = [ "*" ]
}
Getting data from the loopback interface to an Icinga server is left as an exercise to the reader!
Personally, I run an Alpine Linux virtual machine using qemu. You could also use the official Icinga2 container image.
Source code for the basic lookup, create and delete operations of some Icinga2 object types, such as Host and Service, are generated automatically.
To generate the code, ensure the following tools are available:
The shell script crud.sh writes Go source code by reading a template file and doing some text substitution. It loops through object types, piping the template file crud.skel into the awk script crud.awk for each.
crud.sh writes code to the standard output by default:
./crud.sh
If the flag -o
is set, code will be written to the file
specified instead of to standard output:
./crud.sh -o crud.go
Code generation is used because the functions are trivial and call the exact same underlying methods on Client anyway. The only thing that differs is the type. Perhaps when Go gets type parameters then this will go away?
The icinga2 terraform provider uses the package github.com/lrsmith/go-icinga2-api/iapi.
As I read the source code I felt I wasn't reading idiomatic Go as detailed in documents like Effective Go.
Other properties of iapi
felt unusual to me:
server
.HostStruct
instead of just Host
.err
.If I was being paid, I'd create a fork and contribute patches upstream to carefully avoid breaking functionality of existing users of iapi
.
But I'm not being paid ;)
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.