Merge branch 'master' into child-ca

This commit is contained in:
Tim Bruijnzeels
2019-07-05 15:51:55 +02:00
8 changed files with 185 additions and 151 deletions
+14 -13
View File
@@ -333,7 +333,7 @@ impl TrustAnchorLocator {
/// Creates a new TAL, panics when the provided Cert is not a TA cert.
pub fn new(uris: Vec<uri::Https>, cert: &Cert) -> Self {
if cert.authority_key_identifier().is_some() {
panic!("Trying to create TrustAnchorLocator for a non-TA certificate.")
panic!("Trying to create TAL for a non-TA certificate.")
}
let encoded_ski = cert.subject_public_key_info().to_info_bytes();
TrustAnchorLocator { uris, encoded_ski }
@@ -385,7 +385,7 @@ impl RepoInfo {
pub fn ca_repository(&self, name_space: &str) -> uri::Rsync {
match name_space {
"" => self.base_uri.clone(),
_ => uri::Rsync::from_string(format!("{}{}/", self.base_uri.to_string(), name_space)).unwrap()
_ => self.base_uri.join(name_space.as_ref()).join(b"/")
}
}
@@ -420,7 +420,8 @@ impl RepoInfo {
impl PartialEq for RepoInfo {
fn eq(&self, other: &RepoInfo) -> bool {
self.base_uri == other.base_uri && self.rpki_notify.as_str() == other.rpki_notify.as_str()
self.base_uri == other.base_uri &&
self.rpki_notify.as_str() == other.rpki_notify.as_str()
}
}
@@ -955,10 +956,10 @@ pub struct ResourceSet {
}
impl ResourceSet {
pub fn from_strs(asns: &str, ipv4: &str, ipv6: &str) -> Result<Self, ResourceSetError> {
let asn = AsResources::from_str(asns).map_err(|_| ResourceSetError::AsnParsing)?;
let v4 = Ipv4Resources::from_str(ipv4).map_err(|_| ResourceSetError::Ipv4Parsing)?;
let v6 = Ipv6Resources::from_str(ipv6).map_err(|_| ResourceSetError::Ipv6Parsing)?;
pub fn from_strs(asn: &str, v4: &str, v6: &str) -> Result<Self, ResSetErr> {
let asn = AsResources::from_str(asn).map_err(|_| ResSetErr::Asn)?;
let v4 = Ipv4Resources::from_str(v4).map_err(|_| ResSetErr::V4)?;
let v6 = Ipv6Resources::from_str(v6).map_err(|_| ResSetErr::V6)?;
Ok(ResourceSet { asn , v4, v6 })
}
@@ -1115,21 +1116,21 @@ impl TrustAnchorInfo {
}
}
//------------ ResourceSetError ----------------------------------------------
//------------ ResSetErr -----------------------------------------------------
#[derive(Clone, Debug, Display, Eq, PartialEq)]
pub enum ResourceSetError {
pub enum ResSetErr {
#[display(fmt="Cannot parse ASN resources")]
AsnParsing,
Asn,
#[display(fmt="Cannot parse IPv4 resources")]
Ipv4Parsing,
V4,
#[display(fmt="Cannot parse IPv6 resources")]
Ipv6Parsing,
V6,
#[display(fmt="Mixed Address Families in configured resource set")]
MixedFamilies,
Mix,
}
+1 -1
View File
@@ -6,7 +6,7 @@ build = "build-ui.rs"
[dependencies]
actix-identity = "0.1.0"
actix-web = { version = "1.0.0", features = ["ssl"] }
actix-web = { version = "1.0.3", features = ["ssl"] }
actix-session = "0.1.0"
actix-service = "0.4.0"
base64 = "^0.9"
+38 -2
View File
@@ -10,7 +10,25 @@
</div>
</router-link>
</el-col>
<el-col :span="20">
<el-col :span="14">
<el-menu
v-if="user"
:router="true"
:default-active="activeIndex"
mode="horizontal"
background-color="#f63107"
text-color="#fff"
active-text-color="#fff">
<el-menu-item index="1" :route="{ name: 'publishers'}">
{{ $t("publishers.publishers") }}
</el-menu-item>
<el-menu-item index="2" :route="{ name: 'trustanchor'}">
{{ $t("trustanchor.ta") }}
</el-menu-item>
</el-menu>
&nbsp;
</el-col>
<el-col :span="6">
<div class="toolbar">
<el-select v-model="$i18n.locale" placeholder="Language" size="small">
<el-option v-for="lang in langs" :key="lang.iso" :value="lang.iso" :label="lang.label"></el-option>
@@ -44,6 +62,12 @@ body {
color: #ffffff;
z-index: 3;
}
.el-menu-item a {
text-decoration: none;
}
.logo {
line-height: 10px;
}
.logo img {
width: 146px;
margin-left: -14px;
@@ -69,13 +93,25 @@ export default {
langs: [
{iso: "it", label: "Italiano"},
{iso: "en", label: "English"}
]
],
activeIndex: null
};
},
watch: {
$route (to, from) {
this.activeIndex = this.getActiveIndex(to.name);
}
},
mounted: function(){
this.activeIndex = this.getActiveIndex(this.$route.name);
},
created() {
this.loadUser();
},
methods: {
getActiveIndex(path) {
return ''+ (['publishers', 'trustanchor'].indexOf(path) + 1);
},
loadUser() {
this.user = JSON.parse(localStorage.getItem("user"));
},
+1
View File
@@ -27,6 +27,7 @@
"nopublisherdata": "No published data found."
},
"trustanchor": {
"ta": "Trust Anchor",
"absent": "There is no embedded Trust Anchor configured",
"sure" : "Are you sure? You typically only need this in test and development situations.",
"present": "Embedded Trust Anchor Details",
+1 -2
View File
@@ -1,7 +1,6 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Login from './views/Login.vue'
import Publishers from './views/Publishers.vue'
import PublisherDetails from './views/PublisherDetails.vue'
@@ -15,7 +14,7 @@ const router = new Router({
{
path: '/',
name: 'home',
component: Home
redirect: { name: 'publishers' }
},
{
path: '/publishers',
-18
View File
@@ -1,18 +0,0 @@
<template>
<div>
<router-link :to="{ name: 'publishers'}">
<div class="text item">
<span>Publishers</span>
</div>
</router-link>
<router-link :to="{ name: 'trustanchor'}">
<div class="text item">
<span>Trust Anchor</span>
</div>
</router-link>
</div>
</template>
+129 -114
View File
@@ -1,127 +1,142 @@
<template>
<div>
<span v-show="hasTa">
{{ $t("trustanchor.present") }}
<div>
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/' }">{{ $t("trustanchor.ta") }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="text item">
<div v-if="hasTa">
<div class="message">{{ $t("trustanchor.present") }}</div>
<el-table :data="[taData]" style="width: 100%">
<el-table-column prop="resources.asn.Blocks" label="ASNs"></el-table-column>
<el-table-column prop="resources.v4" label="IPv4"></el-table-column>
<el-table-column prop="resources.v6" label="IPv6"></el-table-column>
<el-table-column prop="repo_info.base_uri" label="Base URI"></el-table-column>
<el-table-column prop="repo_info.rpki_notify" label="RPKI notify"></el-table-column>
</el-table>
<el-table :data="[taData]" style="width: 100%">
<el-table-column prop="resources.asn.Blocks" label="ASNs"></el-table-column>
<el-table-column prop="resources.v4" label="IPv4"></el-table-column>
<el-table-column prop="resources.v6" label="IPv6"></el-table-column>
<el-table-column prop="repo_info.base_uri" label="Base URI"></el-table-column>
<el-table-column prop="repo_info.rpki_notify" label="RPKI notify"></el-table-column>
</el-table>
<el-form :inline="true" class="download-anchor">
<el-form-item>
<a href="/ta/ta.tal">{{ $t("trustanchor.downloadTal")}}</a>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-upload"
type="primary"
round
size="mini"
@click="publishTrustAnchor()"
>{{ $t("trustanchor.publish") }}</el-button>
</el-form-item>
</el-form>
</div>
<div v-else>
<div class="message">{{ $t("trustanchor.absent") }}</div>
<el-form :inline="true">
<el-form-item>
<el-button
icon="el-icon-plus"
type="primary"
round
size="mini"
@click="dialogFormVisible = true"
>{{ $t("trustanchor.add") }}</el-button>
</el-form-item>
</el-form>
</div>
</div>
</el-card>
<a href="/ta/ta.tal">{{ $t("trustanchor.downloadTal")}}</a>
<el-form :inline="true">
<el-form-item>
<el-button
class="retire"
icon="el-icon-pencil"
type="primary"
round
size="mini"
@click="publishTrustAnchor()"
>{{ $t("trustanchor.publish") }}</el-button>
</el-form-item>
</el-form>
</span>
<span v-show="noTa">
{{ $t("trustanchor.absent") }}
<el-form :inline="true">
<el-form-item>
<el-button
class="retire"
icon="el-icon-plus"
type="primary"
round
size="mini"
@click="dialogFormVisible = true"
>{{ $t("trustanchor.add") }}</el-button>
</el-form-item>
</el-form>
</span>
<el-dialog :title="$t('trustanchor.add')"
:visible.sync="dialogFormVisible"
:close-on-click-modal="false">
{{ $t("trustanchor.sure") }}
<div style="height: 20px"></div>
<el-form :inline="true">
<el-row type="flex" class="modal-footer" justify="end">
<el-form-item>
<el-button @click="hideInitForm()">{{ $t('form.cancel')
}}</el-button>
<el-button
type="primary"
@click="initTrustAnchor()"
>{{ $t('form.confirm') }}</el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
</div>
<el-dialog
:title="$t('trustanchor.add')"
:visible.sync="dialogFormVisible"
:close-on-click-modal="false"
>
{{ $t("trustanchor.sure") }}
<div style="height: 20px"></div>
<el-form :inline="true">
<el-row type="flex" class="modal-footer" justify="end">
<el-form-item>
<el-button @click="hideInitForm()">
{{ $t('form.cancel')
}}
</el-button>
<el-button type="primary" @click="initTrustAnchor()">{{ $t('form.confirm') }}</el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
// import router from "@/router";
import APIService from "@/services/APIService.js";
import APIService from "@/services/APIService.js";
export default {
export default {
data() {
return {
hasTa: null,
dialogFormVisible: false,
taData: {}
};
},
created() {
this.loadTa();
},
methods: {
loadTa: function() {
const self = this;
APIService.getTrustAnchor()
.then(response => {
self.hasTa = true;
self.taData = response.data;
response.toString();
})
.catch(() => {
self.hasTa = false;
});
},
data() {
hideInitForm: function() {
this.dialogFormVisible = false;
},
return {
hasTa: false,
noTa: false,
dialogFormVisible: false,
taData: {}
};
},
created() {
this.load_ta();
},
methods: {
load_ta: function() {
const self = this;
APIService.getTrustAnchor().then(response => {
self.hasTa = true;
self.noTa = false;
self.taData = response.data;
response.toString()
}).catch( () => {
self.hasTa = false;
self.noTa = true;
});
},
hideInitForm: function () {
this.dialogFormVisible = false;
},
initTrustAnchor: function () {
APIService.initTrustAnchor();
this.load_ta();
this.dialogFormVisible = false;
},
publishTrustAnchor: function () {
APIService.publishTrustAnchor()
}
}
initTrustAnchor: function() {
APIService.initTrustAnchor();
this.loadTa();
this.dialogFormVisible = false;
},
publishTrustAnchor: function() {
APIService.publishTrustAnchor();
}
}
};
</script>
</script>
<style lang="scss" scoped>
a {
color: #f63107;
font-size: 14px;
text-decoration: none;
&:hover {
color: #f85a39;
}
}
.box-card {
margin: 2rem;
}
.message {
font-size: 14px;
margin-top: 1rem;
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid #f9eadd;
}
.download-anchor {
margin-top: 2rem;
}
</style>
+1 -1
View File
@@ -2,7 +2,7 @@ const webpack = require('webpack')
module.exports = {
devServer: {
proxy: 'http://localhost:3000'
proxy: 'https://localhost:3000'
},
publicPath: '/ui',