fixed grumbles

This commit is contained in:
Svyatoslav Nikolsky 2017-08-09 18:17:28 +03:00
parent 45087599ef
commit cc95edf4dc
5 changed files with 8 additions and 9 deletions

View File

@ -87,6 +87,7 @@ mod server {
use std::sync::Arc; use std::sync::Arc;
use ethcore_secretstore; use ethcore_secretstore;
use ethkey::KeyPair; use ethkey::KeyPair;
use ansi_term::Colour::Red;
use super::{Configuration, Dependencies, NodeSecretKey}; use super::{Configuration, Dependencies, NodeSecretKey};
/// Key server /// Key server
@ -97,6 +98,10 @@ mod server {
impl KeyServer { impl KeyServer {
/// Create new key server /// Create new key server
pub fn new(mut conf: Configuration, deps: Dependencies) -> Result<Self, String> { pub fn new(mut conf: Configuration, deps: Dependencies) -> Result<Self, String> {
if !conf.acl_check_enabled {
warn!("Running SecretStore with disabled ACL check: {}", Red.bold().paint("everyone has access to stored keys"));
}
let self_secret: Arc<ethcore_secretstore::NodeKeyPair> = match conf.self_secret.take() { let self_secret: Arc<ethcore_secretstore::NodeKeyPair> = match conf.self_secret.take() {
Some(NodeSecretKey::Plain(secret)) => Arc::new(ethcore_secretstore::PlainNodeKeyPair::new( Some(NodeSecretKey::Plain(secret)) => Arc::new(ethcore_secretstore::PlainNodeKeyPair::new(
KeyPair::from_secret(secret).map_err(|e| format!("invalid secret: {}", e))?)), KeyPair::from_secret(secret).map_err(|e| format!("invalid secret: {}", e))?)),

View File

@ -78,9 +78,6 @@ impl<T> KeyServerHttpListener<T> where T: KeyServer + 'static {
let shared_handler = Arc::new(KeyServerSharedHttpHandler { let shared_handler = Arc::new(KeyServerSharedHttpHandler {
key_server: key_server, key_server: key_server,
}); });
/*let handler = KeyServerHttpHandler {
handler: shared_handler.clone(),
};*/
let http_server = listener_address let http_server = listener_address
.map(|listener_address| format!("{}:{}", listener_address.address, listener_address.port)) .map(|listener_address| format!("{}:{}", listener_address.address, listener_address.port))
@ -89,9 +86,6 @@ impl<T> KeyServerHttpListener<T> where T: KeyServer + 'static {
handler: shared_handler.clone(), handler: shared_handler.clone(),
}).expect("cannot start HttpServer")); }).expect("cannot start HttpServer"));
/*let listener_addr: &str = &format!("{}:{}", listener_address.address, listener_address.port);
let http_server = HttpServer::http(&listener_addr).expect("cannot start HttpServer");
let http_server = http_server.handle(handler).expect("cannot start HttpServer");*/
let listener = KeyServerHttpListener { let listener = KeyServerHttpListener {
http_server: http_server, http_server: http_server,
handler: shared_handler, handler: shared_handler,

View File

@ -467,7 +467,7 @@ impl Ord for DecryptionSessionId {
mod tests { mod tests {
use std::sync::Arc; use std::sync::Arc;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use super::super::super::acl_storage::DummyAclStorage; use acl_storage::DummyAclStorage;
use ethkey::{self, KeyPair, Random, Generator, Public, Secret}; use ethkey::{self, KeyPair, Random, Generator, Public, Secret};
use key_server_cluster::{NodeId, DocumentKeyShare, SessionId, Error, EncryptedDocumentKeyShadow, SessionMeta}; use key_server_cluster::{NodeId, DocumentKeyShare, SessionId, Error, EncryptedDocumentKeyShadow, SessionMeta};
use key_server_cluster::cluster::tests::DummyCluster; use key_server_cluster::cluster::tests::DummyCluster;

View File

@ -572,7 +572,7 @@ mod tests {
use std::collections::{BTreeMap, VecDeque}; use std::collections::{BTreeMap, VecDeque};
use ethkey::{self, Random, Generator, Public}; use ethkey::{self, Random, Generator, Public};
use util::H256; use util::H256;
use super::super::super::acl_storage::DummyAclStorage; use acl_storage::DummyAclStorage;
use key_server_cluster::{NodeId, SessionId, SessionMeta, Error, KeyStorage}; use key_server_cluster::{NodeId, SessionId, SessionMeta, Error, KeyStorage};
use key_server_cluster::cluster::tests::DummyCluster; use key_server_cluster::cluster::tests::DummyCluster;
use key_server_cluster::generation_session::{Session as GenerationSession}; use key_server_cluster::generation_session::{Session as GenerationSession};

View File

@ -200,7 +200,7 @@ pub mod tests {
use devtools::RandomTempPath; use devtools::RandomTempPath;
use ethkey::{Random, Generator, Public, Secret}; use ethkey::{Random, Generator, Public, Secret};
use util::Database; use util::Database;
use super::super::types::all::{Error, NodeAddress, ServiceConfiguration, ClusterConfiguration, ServerKeyId}; use types::all::{Error, NodeAddress, ServiceConfiguration, ClusterConfiguration, ServerKeyId};
use super::{DB_META_KEY_VERSION, KeyStorage, PersistentKeyStorage, DocumentKeyShare, use super::{DB_META_KEY_VERSION, KeyStorage, PersistentKeyStorage, DocumentKeyShare,
SerializableDocumentKeyShareV0, SerializableDocumentKeyShareV1, upgrade_db}; SerializableDocumentKeyShareV0, SerializableDocumentKeyShareV1, upgrade_db};