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.
Another take on infrastructure as code.
When the task file is read, transforms get replaced by values depending on their type. Transforms are resolved recursively.
The decrypt transform decrypts an encrypted value using the salt, initialization vector, and cipher and hash algorithms given.
Options
{
"transform":"decrypt",
"salt":"3748a5b3f1",
"iv":"3748a5b3f1",
"cipherAlgorithm":"AES-256-CFB",
"hashAlgorithm":"sha256",
"value":"3748a5b3f1"
}
To make it easier to obtain the appropriate JSON string, InfCo can be run with the command "encrypt" and the value to be encrypted. It will prompt for a password and then output the serialized JSON.
infco encrypt someValue
This transformation provides the contents of a local file as string or buffer.
Options
{"transform": "fileContents", "path": "/tmp/myFile.txt", "format": "buffer"}
Template transforms accept a Mustache template and fill the template with the registered variables.
Options
{"transform": "template", "template": "VAR={{var1}}"}
The UTC timestamp transform provides a timestamp.
Options
{"transform": "utcTimestamp", "part": "date"}
Executes a command or a series of commands.
config
{
"type": "exec",
"title": "create a directory",
"config": {
"command": [
"mkdir /tmp/test",
"touch /tmp/test/test.txt"
]
}
}
This task executes a network request. In the current implementation all options understood by axios should work.
config
Either "host" and "port", or "socketPath" have to be specified.
{
"type": "request",
"title": "get page",
"config": {
"protocol": "http",
"host": "127.0.0.1",
"port": 80,
"method": "get",
"url": "/",
}
}
Creates a file from with the contents of a string.
config
{
"type": "fileFromString",
"title": "create a file from a string",
"config": {
"filename": "/tmp/test.txt",
"string": "test string"
}
}
This task checks whether a line is in a file. If the line is not in the file, it is added as the last line.
config
{
"type": "lineInFile",
"title": "put a line of text in a file",
"config": {
"filename": "/tmp/test.txt",
"line": "test string"
}
}
This task creates a CouchDb on an existing database instance. It also adds the security configuration and the "_users" tables.
config
Either "host" and "port", "socketPath", or "dockerContainer" and "dockerNetwork" need to be specified. If they are not specified, "127.0.0.1" is used as the default host and 5984 as the default port. If "dockerContainer" and "dockerNetwork" are specified, the ip address of the container "dockerContainer" in the network "dockerNetwork" is set as the host. Docker is contacted using the socket "/var/run/docker.sock".
{
"type": "couchDb",
"title": "creating couchDb",
"config": {
"urlPrefix": "/bookmark_couchdb",
"name": "bookmark",
"auth": {
"username": "couchDbUser",
"password": "couchDbPass"
},
"security": {
"admins": { "names": [], "roles": [ "bookmark_admin" ] },
"members": { "names": [], "roles": [ "bookmark_read", "bookmark_write" ] }
}
}
}
This task checks a document in a CouchDb and updated it, if necessary. Most options are the same as for CouchDb task. Instead of the "name", "security", and "urlPrefix" options, there is a "url" and a "content" option.
config
{
"type": "couchDbDocument",
"title": "checking CouchDb document",
"config": {
"method": "get",
"url": "/url",
"content": "{\"doc\": \"doc\"}",
"auth": {
"username": "couchDbUser",
"password": "couchDbPass"
}
}
}
This task transfers a file from the local host to a remote host.
config
{
"type": "transfer",
"title": "transferring file",
"config": {
"direction": "put",
"localPath": "/tmp/test.txt",
"remotePath": "/tmp/test2.txt"
}
}
This task reviews a directory with backup files and deletes the ones that are no longer needed. The task expects a directory with files that start with the date in the format "YYYY-MM-DD" and end with the configured suffix. It then takes the configured dates and sorts the backups into buckets by days past the current date (i.e. bucket 1: today - days[0], days[1] - days[2], days[2] - days[length - 1]). From each bucket the oldest file is kept. If "0" is configured, the backup from the current days will be kept. If the numbers configured in "days" are multiples of the preceding number the number of backups will be equal to the length of the "days" array. Otherwise, the number of backups can be one less.
config
{
"type": "reviewBackups",
"title": "reviewing backups",
"config": {
"path": "/backup/",
"days": [0,1,7,28],
"suffix": "_mydata.zip"
}
}
This task can be used to process Docker Composter configurations.
config
Either "host" and "port", or "socketPath" need to be provided. If neither is provided, the default value for "socketPath" is used. "data" only needs to be provided for the "create" action. Allowed values for actions are:
{
"type": "dockerComposter",
"title": "create containers, networks, and volumes",
"config": {
"data": {
"networks": {"test1_net": {}},
"volumes": {},
"containers": {
"test1_cont": {
"config": {
"Image": "nginx:alpine",
"NetworkingConfig": {"EndpointsConfig": {"test1_net": {}}}
}
}
}
},
"actions": ["up"]
}
}
This task can be used to administrate docker container.
config
Either "host" and "port", or "socketPath" need to be provided. If neither is provided, the default value for "socketPath" is used. "data" only needs to be provided for the "create" action. Allowed values for actions are:
{
"type": "dockerContainer",
"title": "create and start container",
"config": {
"name": "test",
"data": {
"Image": "couchdb",
"Env": [
{"transform": "template", "template": "COUCHDB_USER={{user}}"}
],
"HostConfig": {
"RestartPolicy": {"Name": "on-failure", "MaximumRetryCount": 10},
"Binds": [
"/opt/bookmark/couchdb/data:/opt/couchdb/data:z",
"/opt/bookmark/couchdb/config:/opt/couchdb/etc/local.d:z"
]
}
},
"actions": [
"create"
"start"
]
}
}
This task can be used to administrate Docker Images. Currently, only the action "prune" is supported.
config
Either "host" and "port", or "socketPath" need to be provided. If neither is provided, the default value for "socketPath" is used. Allowed values for actions are:
{
"type": "dockerImage",
"title": "prune images",
"config": {
"actions": [
"prune"
]
}
}
This task can be used to administrate Docker Networks.
config
Either "host" and "port", or "socketPath" need to be provided. If neither is provided, the default value for "socketPath" is used. "containers" is only used for the actions "connect", "update", and "disconnect". Allowed values for actions are:
{
"type": "dockerNetwork",
"title": "confirm network",
"config": {
"networkName": "couch_test_network",
"containers": [
"couch_test"
],
"actions": [
"create",
"connect"
]
}
}
This tasks can be used to administrate Docker volumes.
config
Either "host" and "port", or "socketPath" need to be provided. If neither is provided, the default value for "socketPath" is used. Allowed values for actions are:
{
"type": "dockerVolume",
"title": "create volume",
"config": {
"volumeName": "couch_test_volume",
"actions": [
"create"
]
}
}
This task can be used to wait for a fixed amount of time.
config
{
"type": "wait",
"title": "wait for some time",
"config": {
"ms": 200
}
}
Host configuration
{
"hosts": [
{
"title": "Droplet",
"tags": ["test"],
"context": {
"type": "contextSsh",
"config": {
"host": "167.71.45.63",
"port": 22,
"username": "root",
"privateKey": { "transform": "fileContents", "format": "buffer", "path": "/home/user/.ssh/id_rsa"}
}
}
}
]
}
Task configuration
{
"tags": ["test"],
"vars": {
"value": "testValue"
},
"tasks": [
{
"type": "fileFromString",
"title": "create file",
"config": {
"filename": "/tmp/templ.txt",
"string": {
"transform": "template",
"template": {"transform": "fileContents", "format": "string", "path": "exampleFiles/test.tmpl"}
}
}
}
]
}
Command
infco process -h hostConfig.json -t taskConfig.json
FAQs
Another take on infrastructure as code.
The npm package infco receives a total of 1 weekly downloads. As such, infco popularity was classified as not popular.
We found that infco demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.