Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-sg-container

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-sg-container - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

42

lib/sg.js

@@ -18,4 +18,2 @@ /*

var _ = require('lodash');
var fs = require('fs');
var executor = require('nscale-util').executor();
var _ec2;

@@ -25,35 +23,4 @@ var _config;

var GROUP_ID = '__GROUP_ID__';
var PROTOCOL = '__PROTOCOL__';
var PORT = '__PORT__';
var CIDR = '__CIDR__';
/**
* the aws function ec2.authorizeSecurityGroupIngress appears to just not work...
* this temporary hack creates a set of AWS command line instructions in a single
* bash script and executes them to set ingress rules on a given security group
*/
var hackIngress = function(groupId, ipPermissions, out, cb) {
var ingress = 'aws ec2 authorize-security-group-ingress --group-id __GROUP_ID__ --protocol __PROTOCOL__ --port __PORT__ --cidr __CIDR__\n';
var script = '';
var rule = '';
script = 'export AWS_ACCESS_KEY_ID=' + _config.accessKeyId + '\n';
script += 'export AWS_SECRET_ACCESS_KEY=' + _config.secretAccessKey + '\n';
script += 'export AWS_DEFAULT_REGION=' + _config.region + '\n';
_.each(ipPermissions, function(perm) {
rule = ingress.replace(GROUP_ID, groupId);
rule = rule.replace(PROTOCOL, perm.IpProtocol);
rule = rule.replace(PORT, perm.FromPort);
rule = rule.replace(CIDR, perm.IpRanges[0].CidrIp);
script += rule;
});
fs.writeFileSync('/tmp/_hackingress.sh', script, 'utf8');
executor.exec(_mode, 'sh /tmp/_hackingress.sh', '/tmp', out, cb);
};
var handleGroup = function(system, container, out, cb) {

@@ -90,7 +57,6 @@ var sg = container.specific;

if (sg.IpPermissions) {
setTimeout(function() {
hackIngress(resp.GroupId, sg.IpPermissions, out, function() {
cb(err, system);
});
}, 10000);
var params = {GroupId : resp.GroupId, IpPermissions : sg.IpPermissions};
_ec2.authorizeSecurityGroupIngress(params, function(err) {
cb(err, system);
});
}

@@ -97,0 +63,0 @@ });

2

package.json

@@ -14,3 +14,3 @@ {

],
"version": "0.14.0",
"version": "0.14.1",
"license": "Artistic License 2.0",

@@ -17,0 +17,0 @@ "author": "Peter Elger (http://nearform.com/)",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc