mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-12-22 03:33:48 +01:00
Cargo fix
This commit is contained in:
parent
2e5f343d52
commit
c0b311e14c
@ -3,20 +3,20 @@ use crate::resources::state::State;
|
||||
use crate::{Config, ResourcesHandle};
|
||||
use async_compat::CompatExt;
|
||||
use executor::pool::Executor;
|
||||
use futures_signals::signal::{MutableSignalRef, ReadOnlyMutable, Signal};
|
||||
use futures_signals::signal::{Signal};
|
||||
use futures_util::future::BoxFuture;
|
||||
use rumqttc::{AsyncClient, ConnectionError, Event, Incoming, MqttOptions};
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::ops::Deref;
|
||||
|
||||
use std::pin::Pin;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use std::task::{Context, Poll};
|
||||
use std::time::Duration;
|
||||
use anyhow::Context as _;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use rustls::{Certificate, RootCertStore};
|
||||
use rustls::{RootCertStore};
|
||||
use url::Url;
|
||||
use crate::actors::dummy::Dummy;
|
||||
use crate::actors::process::Process;
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::users::db::UserDB;
|
||||
|
||||
use crate::users::Users;
|
||||
use rsasl::error::{SASLError, SessionError};
|
||||
use rsasl::error::{SessionError};
|
||||
use rsasl::mechname::Mechname;
|
||||
use rsasl::property::{AuthId, Password};
|
||||
use rsasl::session::{Session, SessionData};
|
||||
use rsasl::validate::{validations, Validation};
|
||||
use rsasl::{Property, SASL};
|
||||
use rsasl::{SASL};
|
||||
use std::sync::Arc;
|
||||
|
||||
struct Callback {
|
||||
@ -21,7 +21,7 @@ impl rsasl::callback::Callback for Callback {
|
||||
&self,
|
||||
session: &mut SessionData,
|
||||
validation: Validation,
|
||||
mechanism: &Mechname,
|
||||
_mechanism: &Mechname,
|
||||
) -> Result<(), SessionError> {
|
||||
match validation {
|
||||
validations::SIMPLE => {
|
||||
@ -38,7 +38,7 @@ impl rsasl::callback::Callback for Callback {
|
||||
|
||||
if user
|
||||
.check_password(passwd.as_bytes())
|
||||
.map_err(|e| SessionError::AuthenticationFailure)?
|
||||
.map_err(|_e| SessionError::AuthenticationFailure)?
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
use crate::authorization::permissions::Permission;
|
||||
use crate::authorization::roles::{Role, Roles};
|
||||
|
||||
|
||||
use crate::authorization::roles::{Roles};
|
||||
use crate::Users;
|
||||
use crate::users::UserRef;
|
||||
|
||||
|
||||
pub mod permissions;
|
||||
pub mod roles;
|
||||
|
@ -2,10 +2,10 @@ use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
use capnp_rpc::pry;
|
||||
use rsasl::property::AuthId;
|
||||
use rsasl::session::{Session, Step, StepResult};
|
||||
use rsasl::session::{Session, Step};
|
||||
use std::io::Cursor;
|
||||
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
use crate::capnp::session::APISession;
|
||||
use crate::session::SessionManager;
|
||||
use api::authenticationsystem_capnp::authentication::{
|
||||
|
@ -53,7 +53,7 @@ impl bootstrap::Server for BootCap {
|
||||
|
||||
fn mechanisms(
|
||||
&mut self,
|
||||
params: bootstrap::MechanismsParams,
|
||||
_params: bootstrap::MechanismsParams,
|
||||
mut result: bootstrap::MechanismsResults,
|
||||
) -> Promise<(), ::capnp::Error> {
|
||||
let span = tracing::trace_span!("mechanisms", peer_addr=%self.peer_addr);
|
||||
@ -61,7 +61,7 @@ impl bootstrap::Server for BootCap {
|
||||
|
||||
tracing::trace!("mechanisms");
|
||||
|
||||
let mut builder = result.get();
|
||||
let builder = result.get();
|
||||
let mechs: Vec<_> = self.authentication.list_available_mechs()
|
||||
.into_iter()
|
||||
.map(|m| m.as_str())
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::resources::modules::fabaccess::{MachineState, Status};
|
||||
use crate::resources::modules::fabaccess::{Status};
|
||||
use crate::resources::Resource;
|
||||
use crate::session::SessionHandle;
|
||||
use api::machine_capnp::machine::{
|
||||
@ -17,7 +17,7 @@ pub struct Machine {
|
||||
|
||||
impl Machine {
|
||||
/// Builds a machine into the given builder. Re
|
||||
pub fn build(session: SessionHandle, resource: Resource, builder: Builder) {
|
||||
pub fn build(session: SessionHandle, resource: Resource, _builder: Builder) {
|
||||
if resource.visible(&session) {}
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ impl ManageServer for Machine {
|
||||
_: manage::ForceFreeResults,
|
||||
) -> Promise<(), ::capnp::Error> {
|
||||
let resource = self.resource.clone();
|
||||
let session = self.session.clone();
|
||||
let _session = self.session.clone();
|
||||
Promise::from_future(async move {
|
||||
resource.force_set(Status::Free).await;
|
||||
Ok(())
|
||||
@ -213,7 +213,7 @@ impl ManageServer for Machine {
|
||||
_: manage::DisabledParams,
|
||||
_: manage::DisabledResults,
|
||||
) -> Promise<(), ::capnp::Error> {
|
||||
let mut resource = self.resource.clone();
|
||||
let resource = self.resource.clone();
|
||||
Promise::from_future(async move {
|
||||
resource.force_set(Status::Disabled).await;
|
||||
Ok(())
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
use crate::session::SessionHandle;
|
||||
use api::machinesystem_capnp::machine_system::{
|
||||
info, InfoParams, InfoResults, Server as MachineSystem,
|
||||
@ -45,7 +45,7 @@ impl info::Server for Machines {
|
||||
let mut builder = result.get().init_machine_list(machine_list.len() as u32);
|
||||
for (i, m) in machine_list {
|
||||
let resource = m.clone();
|
||||
let mut mbuilder = builder.reborrow().get(i as u32);
|
||||
let mbuilder = builder.reborrow().get(i as u32);
|
||||
Machine::build(self.session.clone(), resource, mbuilder);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ impl info::Server for Machines {
|
||||
let id = pry!(params.get_id());
|
||||
|
||||
if let Some(resource) = self.resources.get_by_id(id) {
|
||||
let mut builder = result.get();
|
||||
let builder = result.get();
|
||||
Machine::build(self.session.clone(), resource.clone(), builder);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ impl info::Server for Machines {
|
||||
let urn = pry!(params.get_urn());
|
||||
|
||||
if let Some(resource) = self.resources.get_by_urn(urn) {
|
||||
let mut builder = result.get();
|
||||
let builder = result.get();
|
||||
Machine::build(self.session.clone(), resource.clone(), builder);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::config::Listen;
|
||||
use crate::{Diflouroborane, TlsConfig};
|
||||
use anyhow::Context;
|
||||
|
||||
|
||||
use async_net::TcpListener;
|
||||
use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
|
||||
|
||||
use capnp_rpc::rpc_twoparty_capnp::Side;
|
||||
use capnp_rpc::twoparty::VatNetwork;
|
||||
use capnp_rpc::RpcSystem;
|
||||
@ -12,17 +12,17 @@ use futures_rustls::server::TlsStream;
|
||||
use futures_rustls::TlsAcceptor;
|
||||
use futures_util::stream::FuturesUnordered;
|
||||
use futures_util::{stream, AsyncRead, AsyncWrite, FutureExt, StreamExt};
|
||||
use std::fs::File;
|
||||
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::io::BufReader;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use nix::sys::socket::SockAddr;
|
||||
use crate::authentication::AuthenticationHandle;
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
use crate::error::Result;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
|
||||
use crate::authentication::AuthenticationHandle;
|
||||
|
||||
|
||||
|
||||
use crate::session::SessionManager;
|
||||
|
||||
mod authenticationsystem;
|
||||
@ -69,7 +69,7 @@ impl APIServer {
|
||||
let span = tracing::info_span!("binding API listen sockets");
|
||||
let _guard = span.enter();
|
||||
|
||||
let mut sockets = FuturesUnordered::new();
|
||||
let sockets = FuturesUnordered::new();
|
||||
|
||||
listens
|
||||
.into_iter()
|
||||
|
@ -1,11 +1,11 @@
|
||||
use api::permissionsystem_capnp::permission_system::Server as PermissionSystem;
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
use crate::session::SessionHandle;
|
||||
|
||||
pub struct Permissions;
|
||||
|
||||
impl Permissions {
|
||||
pub fn new(session: SessionHandle) -> Self {
|
||||
pub fn new(_session: SessionHandle) -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
use api::authenticationsystem_capnp::response::successful::Builder;
|
||||
use capnp::capability::Promise;
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
|
||||
use crate::capnp::machinesystem::Machines;
|
||||
use crate::capnp::permissionsystem::Permissions;
|
||||
use crate::capnp::user_system::Users;
|
||||
use crate::session::{SessionHandle, SessionManager};
|
||||
use crate::users::UserRef;
|
||||
use crate::session::{SessionHandle};
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct APISession;
|
||||
@ -15,7 +15,7 @@ impl APISession {
|
||||
Self
|
||||
}
|
||||
|
||||
pub fn build(session: SessionHandle, mut builder: Builder) {
|
||||
pub fn build(session: SessionHandle, builder: Builder) {
|
||||
let mut builder = builder.init_session();
|
||||
builder.set_machine_system(capnp_rpc::new_client(Machines::new(session.clone())));
|
||||
builder.set_user_system(capnp_rpc::new_client(Users::new(session.clone())));
|
||||
|
@ -1,4 +1,4 @@
|
||||
use api::permissionsystem_capnp::permission_system::Server as PermissionSystem;
|
||||
|
||||
use api::user_capnp::user::{
|
||||
info,
|
||||
manage,
|
||||
|
@ -1,13 +1,11 @@
|
||||
use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
use capnp_rpc::pry;
|
||||
|
||||
|
||||
|
||||
|
||||
use api::usersystem_capnp::user_system::{
|
||||
Server as UserSystem,
|
||||
info, info::Server as InfoServer,
|
||||
manage, manage::Server as ManageServer,
|
||||
Server as UserSystem, info::Server as InfoServer, manage::Server as ManageServer,
|
||||
};
|
||||
use crate::authorization::AuthorizationHandle;
|
||||
|
||||
use crate::session::SessionHandle;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -2,13 +2,13 @@ use std::default::Default;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Serialize, Deserialize, Deserializer, Serializer};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use std::fmt::Formatter;
|
||||
use std::net::{SocketAddr, IpAddr, ToSocketAddrs};
|
||||
use std::str::FromStr;
|
||||
use serde::de::Error;
|
||||
use crate::authorization::permissions::{PermRule, PrivilegesBuf};
|
||||
use std::net::{ToSocketAddrs};
|
||||
|
||||
|
||||
use crate::authorization::permissions::{PrivilegesBuf};
|
||||
use crate::authorization::roles::Role;
|
||||
|
||||
type Result<T> = std::result::Result<T, serde_dhall::Error>;
|
||||
@ -153,7 +153,7 @@ impl Default for Config {
|
||||
fn default() -> Self {
|
||||
let mut actors: HashMap::<String, ModuleConfig> = HashMap::new();
|
||||
let mut initiators: HashMap::<String, ModuleConfig> = HashMap::new();
|
||||
let mut machines = HashMap::new();
|
||||
let machines = HashMap::new();
|
||||
|
||||
actors.insert("Actor".to_string(), ModuleConfig {
|
||||
module: "Shelly".to_string(),
|
||||
|
@ -1,13 +1,13 @@
|
||||
use std::{fs, io};
|
||||
use std::{fs};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::{Mutex, RwLock};
|
||||
use std::sync::{RwLock};
|
||||
use anyhow::Context;
|
||||
use lmdb::Environment;
|
||||
use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Infallible, Fallible, ArchiveUnsized, SerializeUnsized};
|
||||
|
||||
use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Fallible};
|
||||
use rkyv::de::deserializers::SharedDeserializeMap;
|
||||
use rkyv::ser::Serializer;
|
||||
use rkyv::ser::serializers::{AlignedSerializer, AllocScratch, AllocScratchError, AllocSerializer, CompositeSerializer, CompositeSerializerError, FallbackScratch, HeapScratch, ScratchTracker, SharedSerializeMap, SharedSerializeMapError};
|
||||
@ -131,7 +131,7 @@ impl<I> DbIndexManager<I>
|
||||
let mut serializer = Ser::default();
|
||||
tracing::trace!(?serializer, "serializing db index");
|
||||
let root = serializer.serialize_value(self).context("serializing database index failed")?;
|
||||
let (s, c, h) = serializer.0.into_components();
|
||||
let (s, c, _h) = serializer.0.into_components();
|
||||
let v = s.into_inner();
|
||||
tracing::trace!(%root,
|
||||
len = v.len(),
|
||||
|
@ -12,7 +12,7 @@ pub use lmdb::{
|
||||
RwTransaction,
|
||||
};
|
||||
|
||||
use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec, Archived};
|
||||
use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec};
|
||||
|
||||
mod raw;
|
||||
pub use raw::RawDB;
|
||||
@ -40,18 +40,18 @@ pub use fix::LMDBorrow;
|
||||
use lmdb::Error;
|
||||
use rkyv::Deserialize;
|
||||
use rkyv::ser::serializers::AlignedSerializer;
|
||||
use std::sync::Arc;
|
||||
use std::path::Path;
|
||||
use crate::users::db::{User, UserDB};
|
||||
|
||||
|
||||
use crate::users::db::{User};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use rkyv::Infallible;
|
||||
use crate::resources::state::{State, db::StateDB};
|
||||
use crate::resources::state::{State};
|
||||
use std::iter::FromIterator;
|
||||
use std::ops::Deref;
|
||||
use crate::resources::search::ResourcesHandle;
|
||||
use crate::utils::oid::{ArchivedObjectIdentifier, ObjectIdentifier};
|
||||
use crate::resources::state::value::SerializeValue;
|
||||
|
||||
|
||||
use crate::Users;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -148,7 +148,7 @@ impl<S: Signal<Item=ResourceSink> + Unpin, I: Initiator + Unpin> Future for Init
|
||||
// TODO: Log initiator error here
|
||||
}
|
||||
}
|
||||
} else if let Some(ref mut resource) = self.resource {
|
||||
} else if let Some(ref mut _resource) = self.resource {
|
||||
let mut s = self.update_sink.clone();
|
||||
let f = self.initiator.run(&mut s);
|
||||
self.initiator_future.replace(f);
|
||||
|
22
bffhd/lib.rs
22
bffhd/lib.rs
@ -39,24 +39,24 @@ mod logging;
|
||||
mod audit;
|
||||
mod session;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
|
||||
|
||||
use std::sync::{Arc};
|
||||
|
||||
use anyhow::Context;
|
||||
use futures_rustls::TlsAcceptor;
|
||||
|
||||
use futures_util::StreamExt;
|
||||
use once_cell::sync::OnceCell;
|
||||
use rustls::{Certificate, KeyLogFile, PrivateKey, ServerConfig};
|
||||
use rustls::server::NoClientAuth;
|
||||
|
||||
|
||||
use signal_hook::consts::signal::*;
|
||||
use executor::pool::Executor;
|
||||
use crate::authentication::AuthenticationHandle;
|
||||
use crate::authorization::roles::Roles;
|
||||
use crate::capnp::APIServer;
|
||||
use crate::config::{Config, TlsListen};
|
||||
use crate::config::{Config};
|
||||
use crate::resources::modules::fabaccess::MachineState;
|
||||
use crate::resources::Resource;
|
||||
use crate::resources::search::ResourcesHandle;
|
||||
@ -121,7 +121,7 @@ impl Diflouroborane {
|
||||
let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone());
|
||||
let authentication = AuthenticationHandle::new(self.users.clone());
|
||||
|
||||
let mut apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?;
|
||||
let apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?;
|
||||
|
||||
let (mut tx, rx) = async_oneshot::oneshot();
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use tracing_subscriber::{EnvFilter, fmt};
|
||||
use tracing_subscriber::{EnvFilter};
|
||||
use crate::Config;
|
||||
|
||||
pub fn init(config: &Config) {
|
||||
let mut builder = tracing_subscriber::fmt()
|
||||
let builder = tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::from_default_env());
|
||||
let format = config.log_format.to_lowercase();
|
||||
match format.as_str() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
use rkyv::{Archive, Serialize, Deserialize};
|
||||
|
||||
use crate::db::DB;
|
||||
use crate::db::{AlignedAdapter, AllocAdapter};
|
||||
use crate::db::RawDB;
|
||||
use std::sync::Arc;
|
||||
use crate::db::{Environment, DatabaseFlags};
|
||||
use crate::db::Result;
|
||||
use crate::resources::state::db::StateDB;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Archive, Serialize, Deserialize)]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use std::sync::Arc;
|
||||
use futures_signals::signal::{Mutable, Signal, SignalExt};
|
||||
use lmdb::RoTransaction;
|
||||
|
@ -1,14 +1,14 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::utils::oid::ObjectIdentifier;
|
||||
use once_cell::sync::Lazy;
|
||||
use rkyv::{Archive, Archived, Deserialize, Serialize, Infallible};
|
||||
use rkyv_dyn::{DynError, DynSerializer};
|
||||
use rkyv::{Archive, Archived, Deserialize, Infallible};
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::oidvalue;
|
||||
use crate::resources::state::{State};
|
||||
use crate::resources::state::value::Value;
|
||||
use crate::session::SessionHandle;
|
||||
|
||||
|
||||
use crate::users::UserRef;
|
||||
|
||||
/// Status of a Machine
|
||||
@ -66,7 +66,7 @@ impl MachineState {
|
||||
}
|
||||
|
||||
pub fn from(dbstate: &Archived<State>) -> Self {
|
||||
use std::any::TypeId;
|
||||
|
||||
let state: &Archived<MachineState> = &dbstate.inner;
|
||||
Deserialize::deserialize(state, &mut Infallible).unwrap()
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
use std::{
|
||||
collections::hash_map::DefaultHasher,
|
||||
fmt,
|
||||
hash::{
|
||||
Hash,
|
||||
Hasher
|
||||
},
|
||||
};
|
||||
@ -11,7 +9,6 @@ use std::ops::Deref;
|
||||
|
||||
use rkyv::{
|
||||
Archive,
|
||||
Archived,
|
||||
Deserialize,
|
||||
out_field,
|
||||
Serialize,
|
||||
@ -20,12 +17,12 @@ use serde::de::{Error, MapAccess, Unexpected};
|
||||
use serde::Deserializer;
|
||||
use serde::ser::SerializeMap;
|
||||
|
||||
use value::{RegisteredImpl, SerializeValue};
|
||||
|
||||
use crate::MachineState;
|
||||
use crate::resources::modules::fabaccess::OID_VALUE;
|
||||
|
||||
use crate::utils::oid::ObjectIdentifier;
|
||||
use crate::resources::state::value::{DynOwnedVal, DynVal, TypeOid, Value};
|
||||
|
||||
|
||||
pub mod value;
|
||||
pub mod db;
|
||||
|
@ -6,7 +6,7 @@ use rkyv::{
|
||||
DeserializeUnsized, Fallible, Serialize, SerializeUnsized,
|
||||
};
|
||||
use rkyv_dyn::{DynDeserializer, DynError, DynSerializer};
|
||||
use rkyv_typename::TypeName;
|
||||
|
||||
|
||||
use crate::utils::oid::ObjectIdentifier;
|
||||
use inventory;
|
||||
@ -544,7 +544,7 @@ pub mod macros {
|
||||
};
|
||||
}
|
||||
}
|
||||
use macros::*;
|
||||
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref OID_BOOL: ObjectIdentifier = {
|
||||
|
@ -1,9 +1,9 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use anyhow::Context;
|
||||
use lmdb::Environment;
|
||||
|
||||
|
||||
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
use crate::authorization::roles::{Role, Roles};
|
||||
use crate::authorization::roles::{Roles};
|
||||
use crate::resources::Resource;
|
||||
use crate::session::db::SessionCache;
|
||||
use crate::Users;
|
||||
|
10
bffhd/tls.rs
10
bffhd/tls.rs
@ -3,13 +3,13 @@ use std::io;
|
||||
use std::io::BufReader;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use anyhow::anyhow;
|
||||
|
||||
use futures_rustls::TlsAcceptor;
|
||||
use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite};
|
||||
use rustls::version::{TLS12, TLS13};
|
||||
use tracing::{Level, Span};
|
||||
use tracing::{Level};
|
||||
use crate::config;
|
||||
use crate::config::Listen;
|
||||
|
||||
use crate::keylog::KeyLogFile;
|
||||
|
||||
fn lookup_cipher_suite(name: &str) -> Option<SupportedCipherSuite> {
|
||||
@ -84,11 +84,11 @@ impl TlsConfig {
|
||||
}
|
||||
};
|
||||
|
||||
let mut tls_builder = ServerConfig::builder()
|
||||
let tls_builder = ServerConfig::builder()
|
||||
.with_safe_default_cipher_suites()
|
||||
.with_safe_default_kx_groups();
|
||||
|
||||
let mut tls_builder = if let Some(ref min) = config.tls_min_version {
|
||||
let tls_builder = if let Some(ref min) = config.tls_min_version {
|
||||
match min.as_str() {
|
||||
"tls12" => tls_builder.with_protocol_versions(&[&TLS12]),
|
||||
"tls13" => tls_builder.with_protocol_versions(&[&TLS13]),
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::db::{AllocAdapter, Environment, RawDB, Result, DB};
|
||||
use crate::db::{DatabaseFlags, LMDBorrow, RoTransaction, WriteFlags};
|
||||
use lmdb::{RwTransaction, Transaction};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::Path;
|
||||
use lmdb::{Transaction};
|
||||
use std::collections::{HashMap};
|
||||
|
||||
use std::sync::Arc;
|
||||
use anyhow::Context;
|
||||
|
||||
|
@ -25,8 +25,8 @@ use std::sync::Arc;
|
||||
|
||||
pub mod db;
|
||||
|
||||
use crate::authorization::roles::Role;
|
||||
use crate::db::LMDBorrow;
|
||||
|
||||
|
||||
use crate::users::db::UserData;
|
||||
use crate::UserDB;
|
||||
|
||||
@ -93,7 +93,7 @@ impl Users {
|
||||
|
||||
pub fn load_file<P: AsRef<Path>>(&self, path: P) -> anyhow::Result<()> {
|
||||
let f = std::fs::read(path)?;
|
||||
let mut map: HashMap<String, UserData> = toml::from_slice(&f)?;
|
||||
let map: HashMap<String, UserData> = toml::from_slice(&f)?;
|
||||
|
||||
for (uid, mut userdata) in map {
|
||||
userdata.passwd = userdata.passwd.map(|pw| {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
use capnp_rpc::pry;
|
||||
|
||||
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
struct Locales {
|
||||
|
@ -1,15 +1,15 @@
|
||||
use clap::{Arg, Command};
|
||||
use diflouroborane::db::Dump;
|
||||
use diflouroborane::{config, Diflouroborane, error::Error};
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::os::unix::prelude::AsRawFd;
|
||||
use diflouroborane::{config, Diflouroborane};
|
||||
|
||||
|
||||
use std::str::FromStr;
|
||||
use std::{env, io, io::Write, path::PathBuf};
|
||||
use std::sync::Arc;
|
||||
use anyhow::Context;
|
||||
use lmdb::{Environment, EnvironmentFlags};
|
||||
|
||||
|
||||
|
||||
use nix::NixPath;
|
||||
use diflouroborane::users::Users;
|
||||
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// Argument parsing
|
||||
|
Loading…
Reference in New Issue
Block a user