-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
213 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,20 +5,42 @@ | |
:license: Apache, see LICENSE for more details. | ||
.. moduleauthor:: Kevin Glisson <[email protected]> | ||
""" | ||
from marshmallow import fields | ||
from marshmallow import fields, post_dump | ||
|
||
from lemur.common.schema import LemurOutputSchema | ||
from lemur.certificates.schemas import CertificateNestedOutputSchema | ||
|
||
|
||
BAD_CIPHERS = [ | ||
'Protocol-SSLv3', | ||
'Protocol-SSLv2' | ||
'Protocol-TLSv1' | ||
] | ||
|
||
|
||
class PolicyNestedOutputSchema(LemurOutputSchema): | ||
id = fields.Integer() | ||
name = fields.String() | ||
ciphers = fields.Dict() | ||
|
||
@post_dump | ||
def add_warnings(self, data): | ||
for cipher in data['ciphers']: | ||
if cipher['name'] in BAD_CIPHERS: | ||
cipher['deprecated'] = True | ||
return data | ||
|
||
|
||
class EndpointOutputSchema(LemurOutputSchema): | ||
id = fields.Integer() | ||
description = fields.String() | ||
name = fields.String() | ||
dnsname = fields.String() | ||
owner = fields.Email() | ||
type = fields.String() | ||
active = fields.Boolean() | ||
certificate = fields.Nested(CertificateNestedOutputSchema) | ||
policy = fields.Nested(PolicyNestedOutputSchema) | ||
|
||
|
||
endpoint_output_schema = EndpointOutputSchema() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
angular.module('lemur') | ||
.service('EndpointApi', function (LemurRestangular) { | ||
return LemurRestangular.all('endpoints'); | ||
}) | ||
.service('EndpointService', function ($location, EndpointApi) { | ||
var EndpointService = this; | ||
EndpointService.findEndpointsByName = function (filterValue) { | ||
return EndpointApi.getList({'filter[label]': filterValue}) | ||
.then(function (endpoints) { | ||
return endpoints; | ||
}); | ||
}; | ||
|
||
EndpointService.getCertificates = function (endpoint) { | ||
endpoint.getList('certificates').then(function (certificates) { | ||
endpoint.certificates = certificates; | ||
}); | ||
}; | ||
return EndpointService; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
angular.module('lemur') | ||
|
||
.config(function config($stateProvider) { | ||
$stateProvider.state('endpoints', { | ||
url: '/endpoints', | ||
templateUrl: '/angular/endpoints/view/view.tpl.html', | ||
controller: 'EndpointsViewController' | ||
}); | ||
}) | ||
|
||
.controller('EndpointsViewController', function ($q, $scope, $uibModal, EndpointApi, EndpointService, MomentService, ngTableParams, toaster) { | ||
$scope.filter = {}; | ||
$scope.endpointsTable = new ngTableParams({ | ||
page: 1, // show first page | ||
count: 10, // count per page | ||
sorting: { | ||
id: 'desc' // initial sorting | ||
}, | ||
filter: $scope.filter | ||
}, { | ||
total: 0, // length of data | ||
getData: function ($defer, params) { | ||
EndpointApi.getList(params.url()).then( | ||
function (data) { | ||
params.total(data.total); | ||
$defer.resolve(data); | ||
} | ||
); | ||
} | ||
}); | ||
|
||
$scope.toggleFilter = function (params) { | ||
params.settings().$scope.show_filter = !params.settings().$scope.show_filter; | ||
}; | ||
|
||
$scope.momentService = MomentService; | ||
|
||
$scope.endpointService = EndpointService; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h2 class="featurette-heading">Endpoints | ||
<span class="text-muted"><small>443 or bust</small></span></h2> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<div class="btn-group"> | ||
<button ng-click="toggleFilter(endpointsTable)" class="btn btn-default">Filter</button> | ||
</div> | ||
<div class="clearfix"></div> | ||
</div> | ||
<div class="table-responsive"> | ||
<table ng-table="endpointsTable" class="table table-striped" show-filter="false" template-pagination="angular/pager.html" > | ||
<tbody> | ||
<tr ng-repeat-start="endpoint in $data track by $index"> | ||
<td data-title="'Name'" sortable="'name'" filter="{ 'name': 'text' }"> | ||
<ul class="list-unstyled"> | ||
<li>{{ endpoint.name }}</li> | ||
<li><span class="text-muted">{{ endpoint.dnsname }}</span></li> | ||
</ul> | ||
</td> | ||
<td data-title="'Type'"> | ||
<ul class="list-unstyled"> | ||
<li><label class="label label-default text-uppercase">{{ endpoint.type }}</label></li> | ||
</ul> | ||
</td> | ||
<td data-title="''"> | ||
<div class="btn-group-vertical pull-right"> | ||
<button ng-model="endpoint.toggle" class="btn btn-sm btn-info" uib-btn-checkbox | ||
btn-checkbox-true="1" | ||
btn-checkbox-false="0">More | ||
</button> | ||
</div> | ||
</td> | ||
</tr> | ||
<tr class="warning" ng-if="endpoint.toggle" ng-repeat-end> | ||
<td colspan="12"> | ||
<uib-tabset justified="true" class="col-md-6"> | ||
<uib-tab> | ||
<uib-tab-heading>Certificate</uib-tab-heading> | ||
<ul class="list-group"> | ||
<li class="list-group-item"> | ||
<strong>Name</strong> | ||
<span class="pull-right"> | ||
{{ endpoint.certificate.name }} | ||
</span> | ||
</li> | ||
<li class="list-group-item"> | ||
<strong>Not Before</strong> | ||
<span class="pull-right" uib-tooltip="{{ endpoint.certificate.notBefore }}"> | ||
{{ momentService.createMoment(endpoint.certificate.notBefore) }} | ||
</span> | ||
</li> | ||
<li class="list-group-item"> | ||
<strong>Not After</strong> | ||
<span class="pull-right" uib-tooltip="{{ endpoint.certificate.notAfter }}"> | ||
{{ momentService.createMoment(endpoint.certificate.notAfter) }} | ||
</span> | ||
</li> | ||
<li class="list-group-item"> | ||
<strong>Description</strong> | ||
<p>{{ endpoint.certificate.description }}</p> | ||
</li> | ||
</ul> | ||
</uib-tab> | ||
</uib-tabset> | ||
<uib-tabset justified="true" class="col-md-6"> | ||
<uib-tab> | ||
<uib-tab-heading> | ||
Ciphers | ||
</uib-tab-heading> | ||
<ul class="list-group"> | ||
<li class="list-group-item" ng-repeat="cipher in endpoint.policy.ciphers"> | ||
<strong ng-class="{'text-danger': cipher.deprecated}">{{ cipher.name }}</strong> | ||
<span class="pull-right"> | ||
<i ng-if=cipher.value ng-class="{'text-danger': cipher.deprecated}" class="fa fa-check" aria-hidden="true"></i> | ||
<i ng-if="!cipher.value" ng-class="{'text-danger': cipher.deprecated}" class="fa fa-times" aria-hidden="true"></i> | ||
</span> | ||
</li> | ||
</ul> | ||
</uib-tab> | ||
</uib-tabset> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters