Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: alertlogic/azure-collector
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.5
Choose a base ref
...
head repository: alertlogic/azure-collector
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
2 changes: 2 additions & 0 deletions .deployment
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[config]
command = deploy.cmd
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@

.idea/
node_modules/
*.swp
14 changes: 13 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{
"esversion": 6
"esversion": 6,
"shadow": "outer",
"undef": true,
"unused": "vars",
"node": true,
"predef": [
"it",
"describe",
"before",
"after",
"beforeEach",
"afterEach"
]
}
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Copyright 2019 ALERT LOGIC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

82 changes: 0 additions & 82 deletions Master/appsettings.js

This file was deleted.

67 changes: 0 additions & 67 deletions Master/azcollect.js

This file was deleted.

81 changes: 0 additions & 81 deletions Master/endpoints.js

This file was deleted.

65 changes: 65 additions & 0 deletions Master/healthchecks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* ----------------------------------------------------------------------------
* @copyright (C) 2019, Alert Logic, Inc
* @doc
*
* Various O365 collector health checks.
* The last error code is O365000002
*
* @end
* ----------------------------------------------------------------------------
*/

const async = require('async');
const m_o365mgmnt = require('../lib/o365_mgmnt');

const checkStreams = function(master, callback) {
async.waterfall([
function(asyncCallback){
m_o365mgmnt.subscriptionsList(asyncCallback);
},
function(subscriptions, httpRequest, response, asyncCallback){
_checkEnableAuditStreams(master, subscriptions, asyncCallback);
}
],
callback);
};

const _checkEnableAuditStreams = function(master, listedStreams, callback) {
try {
let o365AuditStreams = JSON.parse(process.env.O365_CONTENT_STREAMS);
// TODO: take webhook path from O365Webhook/function.json
let webhookURL = 'https://' + process.env.WEBSITE_HOSTNAME +
'/api/o365/webhook';
async.map(o365AuditStreams,
function(stream, asyncCallback) {
let currentStream = listedStreams.find(
obj => obj.contentType === stream);
if (currentStream && currentStream.status === 'enabled' &&
currentStream.webhook &&
currentStream.webhook.status === 'enabled' &&
currentStream.webhook.address === webhookURL) {
return asyncCallback(null, stream);
} else {
let webhook = { webhook : {
address : webhookURL,
expiration : ""
}};
return m_o365mgmnt.subscriptionsStart(stream, JSON.stringify(webhook),
function(err, result, httpRequest, response) {
if (err) {
return asyncCallback(master.errorStatusFmt('O365000001', `Unable to start subscription ${err}`));
} else {
return asyncCallback(null, stream);
}
});
}
},
callback);
} catch (ex) {
return callback(master.errorStatusFmt('O365000002', `Exception thrown during health check ${ex}`));
}
};

module.exports = {
checkStreams
};
Loading