thsq-agent
Advanced tools
Comparing version 1.0.27 to 1.0.28
{ | ||
"name": "thsq-agent", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "Thingsquare agent for Linux gateways", | ||
@@ -5,0 +5,0 @@ "main": "thsq-agent.js", |
29
PPP.js
@@ -11,2 +11,4 @@ /*jslint nomen: true, node: true */ | ||
var dnsserver = '8.8.8.8'; | ||
function cmd(c, options, cb) { | ||
@@ -27,2 +29,26 @@ if (typeof options === 'function') { | ||
/* Try to replace default dns server 8.8.8.8 with one found in /etc/resolv.conf */ | ||
try { | ||
if (process.env.THSQ_AGENT_DNS) { | ||
dnsserver = process.env.THSQ_AGENT_DNS; | ||
console.log('read DNS server configuration env THSQ_AGENT_DNS:', dnsserver); | ||
} else if (fs.existsSync('/etc/resolv.conf')) { | ||
var data = fs.readFileSync('/etc/resolv.conf', 'utf8'); | ||
if (data) { | ||
data.split('\n').map(function(line) { | ||
if (line.indexOf('nameserver ') == 0) { | ||
var newdnsserver = line.split(' ')[1]; | ||
if (newdnsserver !== dnsserver) { | ||
dnsserver = newdnsserver; | ||
console.log('read DNS server configuration from /etc/resolv.conf:', dnsserver); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} catch(e) { | ||
console.log('error reading DNS server configuration:', e); | ||
} | ||
console.log('DNS server configuration:', dnsserver); | ||
var active = {}; /* active ppp sessions */ | ||
@@ -83,3 +109,4 @@ setInterval(function() { | ||
var netid = getIpNetworkId(file); | ||
var c = 'stty -F ' + file + ' 115200 raw; ' + PPPD_PATH + ' ' + file + ' 115200 ' + netid + '.1:' + netid + '.2 nodefaultroute local nodetach noauth ms-dns 8.8.8.8'; | ||
var c = 'stty -F ' + file + ' 115200 raw; ' + PPPD_PATH + ' ' + file + ' 115200 ' + netid + '.1:' + netid + '.2 nodefaultroute local nodetach noauth ms-dns ' + dnsserver; | ||
console.log('starting pppd for ' + file + ' on subnet ' + netid + '.0...'); | ||
@@ -86,0 +113,0 @@ active[file] = file + ':' + netid + '.0'; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
46363
1092
5