mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
sorted imports
This commit is contained in:
parent
fea02d3c8b
commit
6be92356c2
|
@ -1 +1,2 @@
|
||||||
imports_granularity = "Module"
|
imports_granularity = "Module"
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::param::Path;
|
use poem_openapi::param::Path;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{DatabaseConnection, EntityTrait, ModelTrait};
|
use sea_orm::{DatabaseConnection, EntityTrait, ModelTrait};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
pub struct Api;
|
pub struct Api;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{DatabaseConnection, EntityTrait};
|
use sea_orm::{DatabaseConnection, EntityTrait};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_db_entities::KnownHost;
|
use warpgate_db_entities::KnownHost;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, Object, OpenApi};
|
use poem_openapi::{ApiResponse, Object, OpenApi};
|
||||||
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder, QuerySelect};
|
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_db_entities::LogEntry;
|
use warpgate_db_entities::LogEntry;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures::{SinkExt, StreamExt};
|
use futures::{SinkExt, StreamExt};
|
||||||
use poem::error::{InternalServerError, NotFoundError};
|
use poem::error::{InternalServerError, NotFoundError};
|
||||||
|
@ -9,7 +11,6 @@ use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{DatabaseConnection, EntityTrait};
|
use sea_orm::{DatabaseConnection, EntityTrait};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::fs::File;
|
use tokio::fs::File;
|
||||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::param::Path;
|
use poem_openapi::param::Path;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder};
|
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_common::{SessionSnapshot, State};
|
use warpgate_common::{SessionSnapshot, State};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use super::pagination::{PaginatedResponse, PaginationParams};
|
use std::sync::Arc;
|
||||||
|
|
||||||
use futures::{SinkExt, StreamExt};
|
use futures::{SinkExt, StreamExt};
|
||||||
use poem::session::Session;
|
use poem::session::Session;
|
||||||
use poem::web::websocket::{Message, WebSocket};
|
use poem::web::websocket::{Message, WebSocket};
|
||||||
|
@ -8,10 +9,11 @@ use poem_openapi::param::Query;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder};
|
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter, QueryOrder};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_common::{SessionSnapshot, State};
|
use warpgate_common::{SessionSnapshot, State};
|
||||||
|
|
||||||
|
use super::pagination::{PaginatedResponse, PaginationParams};
|
||||||
|
|
||||||
pub struct Api;
|
pub struct Api;
|
||||||
|
|
||||||
#[derive(ApiResponse)]
|
#[derive(ApiResponse)]
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, Object, OpenApi};
|
use poem_openapi::{ApiResponse, Object, OpenApi};
|
||||||
use russh_keys::PublicKeyBase64;
|
use russh_keys::PublicKeyBase64;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_common::WarpgateConfig;
|
use warpgate_common::WarpgateConfig;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_common::{ConfigProvider, Target};
|
use warpgate_common::{ConfigProvider, Target};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::param::Path;
|
use poem_openapi::param::Path;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use sea_orm::{DatabaseConnection, EntityTrait, ModelTrait};
|
use sea_orm::{DatabaseConnection, EntityTrait, ModelTrait};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, Object, OpenApi};
|
use poem_openapi::{ApiResponse, Object, OpenApi};
|
||||||
use sea_orm::ActiveValue::Set;
|
use sea_orm::ActiveValue::Set;
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_common::helpers::hash::generate_ticket_secret;
|
use warpgate_common::helpers::hash::generate_ticket_secret;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use poem::web::Data;
|
use poem::web::Data;
|
||||||
use poem_openapi::payload::Json;
|
use poem_openapi::payload::Json;
|
||||||
use poem_openapi::{ApiResponse, OpenApi};
|
use poem_openapi::{ApiResponse, OpenApi};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_common::{ConfigProvider, UserSnapshot};
|
use warpgate_common::{ConfigProvider, UserSnapshot};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use crate::consts::TICKET_SELECTOR_PREFIX;
|
use crate::consts::TICKET_SELECTOR_PREFIX;
|
||||||
use crate::Secret;
|
use crate::Secret;
|
||||||
use std::fmt::Debug;
|
|
||||||
|
|
||||||
pub enum AuthSelector {
|
pub enum AuthSelector {
|
||||||
User {
|
User {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use poem_openapi::{Object, Union};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use poem_openapi::{Object, Union};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::helpers::otp::OtpSecretKey;
|
use crate::helpers::otp::OtpSecretKey;
|
||||||
use crate::Secret;
|
use crate::Secret;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use data_encoding::BASE64_MIME;
|
||||||
|
use sea_orm::ActiveValue::Set;
|
||||||
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
||||||
|
use tokio::sync::Mutex;
|
||||||
|
use tracing::*;
|
||||||
|
use uuid::Uuid;
|
||||||
|
use warpgate_db_entities::Ticket;
|
||||||
|
|
||||||
use super::ConfigProvider;
|
use super::ConfigProvider;
|
||||||
use crate::helpers::hash::verify_password_hash;
|
use crate::helpers::hash::verify_password_hash;
|
||||||
use crate::helpers::otp::verify_totp;
|
use crate::helpers::otp::verify_totp;
|
||||||
|
@ -5,17 +18,6 @@ use crate::{
|
||||||
AuthCredential, AuthResult, ProtocolName, Target, User, UserAuthCredential, UserSnapshot,
|
AuthCredential, AuthResult, ProtocolName, Target, User, UserAuthCredential, UserSnapshot,
|
||||||
WarpgateConfig,
|
WarpgateConfig,
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use data_encoding::BASE64_MIME;
|
|
||||||
use sea_orm::ActiveValue::Set;
|
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
|
||||||
use tracing::*;
|
|
||||||
use uuid::Uuid;
|
|
||||||
use warpgate_db_entities::Ticket;
|
|
||||||
|
|
||||||
pub struct FileConfigProvider {
|
pub struct FileConfigProvider {
|
||||||
db: Arc<Mutex<DatabaseConnection>>,
|
db: Arc<Mutex<DatabaseConnection>>,
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
mod file;
|
mod file;
|
||||||
use crate::{ProtocolName, Secret, Target, UserSnapshot};
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
pub use file::FileConfigProvider;
|
pub use file::FileConfigProvider;
|
||||||
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
|
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_db_entities::Ticket;
|
use warpgate_db_entities::Ticket;
|
||||||
|
|
||||||
|
use crate::{ProtocolName, Secret, Target, UserSnapshot};
|
||||||
|
|
||||||
pub enum AuthResult {
|
pub enum AuthResult {
|
||||||
Accepted { username: String },
|
Accepted { username: String },
|
||||||
OtpNeeded,
|
OtpNeeded,
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
use crate::helpers::fs::secure_file;
|
use std::time::Duration;
|
||||||
use crate::WarpgateConfig;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use sea_orm::sea_query::Expr;
|
use sea_orm::sea_query::Expr;
|
||||||
use sea_orm::{
|
use sea_orm::{
|
||||||
ConnectOptions, Database, DatabaseConnection, EntityTrait, QueryFilter, TransactionTrait,
|
ConnectOptions, Database, DatabaseConnection, EntityTrait, QueryFilter, TransactionTrait,
|
||||||
};
|
};
|
||||||
use std::time::Duration;
|
|
||||||
use warpgate_db_entities::LogEntry;
|
use warpgate_db_entities::LogEntry;
|
||||||
use warpgate_db_migrations::migrate_database;
|
use warpgate_db_migrations::migrate_database;
|
||||||
|
|
||||||
|
use crate::helpers::fs::secure_file;
|
||||||
|
use crate::WarpgateConfig;
|
||||||
|
|
||||||
pub async fn connect_to_db(config: &WarpgateConfig) -> Result<DatabaseConnection> {
|
pub async fn connect_to_db(config: &WarpgateConfig) -> Result<DatabaseConnection> {
|
||||||
let mut url = url::Url::parse(&config.store.database_url.expose_secret()[..])?;
|
let mut url = url::Url::parse(&config.store.database_url.expose_secret()[..])?;
|
||||||
if url.scheme() == "sqlite" {
|
if url.scheme() == "sqlite" {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use tokio::sync::mpsc::error::SendError;
|
use tokio::sync::mpsc::error::SendError;
|
||||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
||||||
use tokio::sync::{Mutex, MutexGuard};
|
use tokio::sync::{Mutex, MutexGuard};
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::Secret;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use argon2::password_hash::rand_core::OsRng;
|
use argon2::password_hash::rand_core::OsRng;
|
||||||
use argon2::password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString};
|
use argon2::password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString};
|
||||||
|
@ -7,6 +6,8 @@ use data_encoding::HEXLOWER;
|
||||||
use password_hash::errors::Error;
|
use password_hash::errors::Error;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
|
use crate::Secret;
|
||||||
|
|
||||||
pub fn hash_password(password: &str) -> String {
|
pub fn hash_password(password: &str) -> String {
|
||||||
let salt = SaltString::generate(&mut OsRng);
|
let salt = SaltString::generate(&mut OsRng);
|
||||||
let argon2 = Argon2::default();
|
let argon2 = Argon2::default();
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use super::rng::get_crypto_rng;
|
|
||||||
use crate::types::Secret;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use totp_rs::{Algorithm, TOTP};
|
use totp_rs::{Algorithm, TOTP};
|
||||||
|
|
||||||
|
use super::rng::get_crypto_rng;
|
||||||
|
use crate::types::Secret;
|
||||||
|
|
||||||
pub type OtpExposedSecretKey = Bytes;
|
pub type OtpExposedSecretKey = Bytes;
|
||||||
pub type OtpSecretKey = Secret<OtpExposedSecretKey>;
|
pub type OtpSecretKey = Secret<OtpExposedSecretKey>;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use super::serde_base64;
|
|
||||||
use crate::Secret;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use serde::Serializer;
|
use serde::Serializer;
|
||||||
|
|
||||||
|
use super::serde_base64;
|
||||||
|
use crate::Secret;
|
||||||
|
|
||||||
pub fn serialize<S: Serializer>(secret: &Secret<Bytes>, serializer: S) -> Result<S::Ok, S::Error> {
|
pub fn serialize<S: Serializer>(secret: &Secret<Bytes>, serializer: S) -> Result<S::Ok, S::Error> {
|
||||||
serde_base64::serialize(secret.expose_secret().as_ref(), serializer)
|
serde_base64::serialize(secret.expose_secret().as_ref(), serializer)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use super::layer::ValuesLogLayer;
|
use std::sync::Arc;
|
||||||
use super::values::SerializedRecordValues;
|
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
use sea_orm::query::JsonValue;
|
use sea_orm::query::JsonValue;
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection};
|
use sea_orm::{ActiveModelTrait, DatabaseConnection};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use tracing_subscriber::registry::LookupSpan;
|
use tracing_subscriber::registry::LookupSpan;
|
||||||
|
@ -11,6 +10,9 @@ use tracing_subscriber::Layer;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_db_entities::LogEntry;
|
use warpgate_db_entities::LogEntry;
|
||||||
|
|
||||||
|
use super::layer::ValuesLogLayer;
|
||||||
|
use super::values::SerializedRecordValues;
|
||||||
|
|
||||||
static LOG_SENDER: OnceCell<tokio::sync::broadcast::Sender<LogEntry::ActiveModel>> =
|
static LOG_SENDER: OnceCell<tokio::sync::broadcast::Sender<LogEntry::ActiveModel>> =
|
||||||
OnceCell::new();
|
OnceCell::new();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use super::layer::ValuesLogLayer;
|
|
||||||
use crate::WarpgateConfig;
|
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use tokio::net::UnixDatagram;
|
use tokio::net::UnixDatagram;
|
||||||
|
@ -7,6 +5,9 @@ use tracing::*;
|
||||||
use tracing_subscriber::registry::LookupSpan;
|
use tracing_subscriber::registry::LookupSpan;
|
||||||
use tracing_subscriber::Layer;
|
use tracing_subscriber::Layer;
|
||||||
|
|
||||||
|
use super::layer::ValuesLogLayer;
|
||||||
|
use crate::WarpgateConfig;
|
||||||
|
|
||||||
static SKIP_KEY: &str = "is_socket_logging_error";
|
static SKIP_KEY: &str = "is_socket_logging_error";
|
||||||
|
|
||||||
pub async fn make_socket_logger_layer<S>(config: &WarpgateConfig) -> impl Layer<S>
|
pub async fn make_socket_logger_layer<S>(config: &WarpgateConfig) -> impl Layer<S>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use serde::Serialize;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
use tracing::field::Visit;
|
use tracing::field::Visit;
|
||||||
use tracing_core::Field;
|
use tracing_core::Field;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
use crate::{SessionId, SessionState, State, Target};
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
|
use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use warpgate_db_entities::Session;
|
use warpgate_db_entities::Session;
|
||||||
|
|
||||||
|
use crate::{SessionId, SessionState, State, Target};
|
||||||
|
|
||||||
pub trait SessionHandle {
|
pub trait SessionHandle {
|
||||||
fn close(&mut self);
|
fn close(&mut self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
mod handle;
|
mod handle;
|
||||||
use crate::Target;
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
pub use handle::{SessionHandle, WarpgateServerHandle};
|
pub use handle::{SessionHandle, WarpgateServerHandle};
|
||||||
use std::net::SocketAddr;
|
|
||||||
|
use crate::Target;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum TargetTestError {
|
pub enum TargetTestError {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use bytes::Bytes;
|
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use bytes::Bytes;
|
||||||
|
use sea_orm::{ActiveModelTrait, DatabaseConnection};
|
||||||
use tokio::sync::{broadcast, Mutex};
|
use tokio::sync::{broadcast, Mutex};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
use crate::helpers::fs::secure_file;
|
|
||||||
use crate::try_block;
|
|
||||||
|
|
||||||
use super::{Error, Result};
|
|
||||||
use bytes::{Bytes, BytesMut};
|
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
use bytes::{Bytes, BytesMut};
|
||||||
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
||||||
use tokio::fs::File;
|
use tokio::fs::File;
|
||||||
use tokio::io::{AsyncWriteExt, BufWriter};
|
use tokio::io::{AsyncWriteExt, BufWriter};
|
||||||
use tokio::sync::{broadcast, mpsc, Mutex};
|
use tokio::sync::{broadcast, mpsc, Mutex};
|
||||||
|
@ -15,6 +12,10 @@ use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_db_entities::Recording;
|
use warpgate_db_entities::Recording;
|
||||||
|
|
||||||
|
use super::{Error, Result};
|
||||||
|
use crate::helpers::fs::secure_file;
|
||||||
|
use crate::try_block;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct RecordingWriter {
|
pub struct RecordingWriter {
|
||||||
sender: mpsc::Sender<Bytes>,
|
sender: mpsc::Sender<Bytes>,
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
use crate::{ProtocolName, SessionHandle, SessionId, Target, WarpgateServerHandle};
|
|
||||||
use anyhow::{Context, Result};
|
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::sync::{Arc, Weak};
|
use std::sync::{Arc, Weak};
|
||||||
|
|
||||||
|
use anyhow::{Context, Result};
|
||||||
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
|
||||||
use tokio::sync::{broadcast, Mutex};
|
use tokio::sync::{broadcast, Mutex};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_db_entities::Session;
|
use warpgate_db_entities::Session;
|
||||||
|
|
||||||
|
use crate::{ProtocolName, SessionHandle, SessionId, Target, WarpgateServerHandle};
|
||||||
|
|
||||||
pub struct State {
|
pub struct State {
|
||||||
pub sessions: HashMap<SessionId, Arc<Mutex<SessionState>>>,
|
pub sessions: HashMap<SessionId, Arc<Mutex<SessionState>>>,
|
||||||
db: Arc<Mutex<DatabaseConnection>>,
|
db: Arc<Mutex<DatabaseConnection>>,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use data_encoding::HEXLOWER;
|
use data_encoding::HEXLOWER;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt::Debug;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::helpers::rng::get_crypto_rng;
|
use crate::helpers::rng::get_crypto_rng;
|
||||||
|
|
|
@ -2,10 +2,11 @@ use sea_orm::Schema;
|
||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
pub mod session {
|
pub mod session {
|
||||||
use crate::m00001_create_ticket::ticket;
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::m00001_create_ticket::ticket;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||||
#[sea_orm(table_name = "sessions")]
|
#[sea_orm(table_name = "sessions")]
|
||||||
pub struct Model {
|
pub struct Model {
|
||||||
|
|
|
@ -2,10 +2,11 @@ use sea_orm::Schema;
|
||||||
use sea_orm_migration::prelude::*;
|
use sea_orm_migration::prelude::*;
|
||||||
|
|
||||||
pub mod recording {
|
pub mod recording {
|
||||||
use crate::m00002_create_session::session;
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::m00002_create_session::session;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||||
#[sea_orm(rs_type = "String", db_type = "String(Some(16))")]
|
#[sea_orm(rs_type = "String", db_type = "String(Some(16))")]
|
||||||
pub enum RecordingKind {
|
pub enum RecordingKind {
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
use crate::known_hosts::{KnownHostValidationResult, KnownHosts};
|
use std::pin::Pin;
|
||||||
use crate::ConnectionError;
|
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use russh::client::Session;
|
use russh::client::Session;
|
||||||
use russh_keys::key::PublicKey;
|
use russh_keys::key::PublicKey;
|
||||||
use russh_keys::PublicKeyBase64;
|
use russh_keys::PublicKeyBase64;
|
||||||
use std::pin::Pin;
|
|
||||||
use tokio::sync::mpsc::UnboundedSender;
|
use tokio::sync::mpsc::UnboundedSender;
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::{Services, SessionId, TargetSSHOptions};
|
use warpgate_common::{Services, SessionId, TargetSSHOptions};
|
||||||
|
|
||||||
|
use crate::known_hosts::{KnownHostValidationResult, KnownHosts};
|
||||||
|
use crate::ConnectionError;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ClientHandlerEvent {
|
pub enum ClientHandlerEvent {
|
||||||
HostKeyReceived(PublicKey),
|
HostKeyReceived(PublicKey),
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
mod channel_direct_tcpip;
|
mod channel_direct_tcpip;
|
||||||
mod channel_session;
|
mod channel_session;
|
||||||
mod handler;
|
mod handler;
|
||||||
use self::handler::ClientHandlerEvent;
|
use std::collections::HashMap;
|
||||||
use super::{ChannelOperation, DirectTCPIPParams};
|
use std::net::ToSocketAddrs;
|
||||||
use crate::client::handler::ClientHandlerError;
|
use std::sync::Arc;
|
||||||
use crate::helpers::PublicKeyAsOpenSSH;
|
|
||||||
use crate::keys::load_client_keys;
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use channel_direct_tcpip::DirectTCPIPChannel;
|
use channel_direct_tcpip::DirectTCPIPChannel;
|
||||||
|
@ -15,9 +14,6 @@ use handler::ClientHandler;
|
||||||
use russh::client::Handle;
|
use russh::client::Handle;
|
||||||
use russh::{Preferred, Sig};
|
use russh::{Preferred, Sig};
|
||||||
use russh_keys::key::{self, PublicKey};
|
use russh_keys::key::{self, PublicKey};
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::net::ToSocketAddrs;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::mpsc::error::SendError;
|
use tokio::sync::mpsc::error::SendError;
|
||||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
||||||
use tokio::sync::{oneshot, Mutex};
|
use tokio::sync::{oneshot, Mutex};
|
||||||
|
@ -26,6 +22,12 @@ use tracing::*;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_common::{SSHTargetAuth, Services, SessionId, TargetSSHOptions};
|
use warpgate_common::{SSHTargetAuth, Services, SessionId, TargetSSHOptions};
|
||||||
|
|
||||||
|
use self::handler::ClientHandlerEvent;
|
||||||
|
use super::{ChannelOperation, DirectTCPIPParams};
|
||||||
|
use crate::client::handler::ClientHandlerError;
|
||||||
|
use crate::helpers::PublicKeyAsOpenSSH;
|
||||||
|
use crate::keys::load_client_keys;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum ConnectionError {
|
pub enum ConnectionError {
|
||||||
#[error("Host key mismatch")]
|
#[error("Host key mismatch")]
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::fs::{create_dir_all, File};
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use russh_keys::key::{KeyPair, SignatureHash};
|
use russh_keys::key::{KeyPair, SignatureHash};
|
||||||
use russh_keys::{encode_pkcs8_pem, load_secret_key};
|
use russh_keys::{encode_pkcs8_pem, load_secret_key};
|
||||||
use std::fs::{create_dir_all, File};
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::helpers::fs::secure_directory;
|
use warpgate_common::helpers::fs::secure_directory;
|
||||||
use warpgate_common::WarpgateConfig;
|
use warpgate_common::WarpgateConfig;
|
||||||
|
|
|
@ -6,7 +6,9 @@ pub mod helpers;
|
||||||
mod keys;
|
mod keys;
|
||||||
mod known_hosts;
|
mod known_hosts;
|
||||||
mod server;
|
mod server;
|
||||||
use crate::client::{RCCommand, RemoteClient};
|
use std::fmt::Debug;
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
pub use client::*;
|
pub use client::*;
|
||||||
|
@ -14,13 +16,13 @@ pub use common::*;
|
||||||
pub use keys::*;
|
pub use keys::*;
|
||||||
use russh_keys::PublicKeyBase64;
|
use russh_keys::PublicKeyBase64;
|
||||||
pub use server::run_server;
|
pub use server::run_server;
|
||||||
use std::fmt::Debug;
|
|
||||||
use std::net::SocketAddr;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use warpgate_common::{
|
use warpgate_common::{
|
||||||
ProtocolName, ProtocolServer, Services, Target, TargetOptions, TargetTestError,
|
ProtocolName, ProtocolServer, Services, Target, TargetOptions, TargetTestError,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::client::{RCCommand, RemoteClient};
|
||||||
|
|
||||||
pub static PROTOCOL_NAME: ProtocolName = "SSH";
|
pub static PROTOCOL_NAME: ProtocolName = "SSH";
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
@ -2,20 +2,22 @@ mod russh_handler;
|
||||||
mod service_output;
|
mod service_output;
|
||||||
mod session;
|
mod session;
|
||||||
mod session_handle;
|
mod session_handle;
|
||||||
use crate::keys::load_host_keys;
|
use std::fmt::Debug;
|
||||||
use crate::server::session_handle::SSHSessionHandle;
|
use std::net::SocketAddr;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use russh::MethodSet;
|
use russh::MethodSet;
|
||||||
pub use russh_handler::ServerHandler;
|
pub use russh_handler::ServerHandler;
|
||||||
pub use session::ServerSession;
|
pub use session::ServerSession;
|
||||||
use std::fmt::Debug;
|
|
||||||
use std::net::SocketAddr;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::io::{AsyncRead, AsyncWrite};
|
use tokio::io::{AsyncRead, AsyncWrite};
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::{Services, SessionStateInit};
|
use warpgate_common::{Services, SessionStateInit};
|
||||||
|
|
||||||
|
use crate::keys::load_host_keys;
|
||||||
|
use crate::server::session_handle::SSHSessionHandle;
|
||||||
|
|
||||||
pub async fn run_server(services: Services, address: SocketAddr) -> Result<()> {
|
pub async fn run_server(services: Services, address: SocketAddr) -> Result<()> {
|
||||||
let russh_config = {
|
let russh_config = {
|
||||||
let config = services.config.lock().await;
|
let config = services.config.lock().await;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use ansi_term::Colour;
|
|
||||||
use anyhow::Result;
|
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use ansi_term::Colour;
|
||||||
|
use anyhow::Result;
|
||||||
use tokio::sync::{mpsc, Mutex};
|
use tokio::sync::{mpsc, Mutex};
|
||||||
|
|
||||||
pub const ERASE_PROGRESS_SPINNER: &str = "\r \r";
|
pub const ERASE_PROGRESS_SPINNER: &str = "\r \r";
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use super::service_output::ServiceOutput;
|
use std::borrow::Cow;
|
||||||
use super::session_handle::SessionHandleCommand;
|
use std::collections::hash_map::Entry::Vacant;
|
||||||
use crate::compat::ContextExt;
|
use std::collections::HashMap;
|
||||||
use crate::server::service_output::ERASE_PROGRESS_SPINNER;
|
use std::net::{Ipv4Addr, SocketAddr};
|
||||||
use crate::{
|
use std::str::FromStr;
|
||||||
ChannelOperation, ConnectionError, DirectTCPIPParams, PtyRequest, RCCommand, RCEvent, RCState,
|
use std::sync::Arc;
|
||||||
RemoteClient, ServerChannelId, X11Request,
|
|
||||||
};
|
|
||||||
use ansi_term::Colour;
|
use ansi_term::Colour;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use bimap::BiMap;
|
use bimap::BiMap;
|
||||||
|
@ -14,12 +13,6 @@ use russh::server::Session;
|
||||||
use russh::{CryptoVec, Sig};
|
use russh::{CryptoVec, Sig};
|
||||||
use russh_keys::key::PublicKey;
|
use russh_keys::key::PublicKey;
|
||||||
use russh_keys::PublicKeyBase64;
|
use russh_keys::PublicKeyBase64;
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::collections::hash_map::Entry::Vacant;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::net::{Ipv4Addr, SocketAddr};
|
|
||||||
use std::str::FromStr;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||||
use tokio::sync::{oneshot, Mutex};
|
use tokio::sync::{oneshot, Mutex};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
|
@ -35,6 +28,15 @@ use warpgate_common::{
|
||||||
TargetOptions, TargetSSHOptions, WarpgateServerHandle,
|
TargetOptions, TargetSSHOptions, WarpgateServerHandle,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::service_output::ServiceOutput;
|
||||||
|
use super::session_handle::SessionHandleCommand;
|
||||||
|
use crate::compat::ContextExt;
|
||||||
|
use crate::server::service_output::ERASE_PROGRESS_SPINNER;
|
||||||
|
use crate::{
|
||||||
|
ChannelOperation, ConnectionError, DirectTCPIPParams, PtyRequest, RCCommand, RCEvent, RCState,
|
||||||
|
RemoteClient, ServerChannelId, X11Request,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
enum TargetSelection {
|
enum TargetSelection {
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use crate::config::load_config;
|
|
||||||
use anyhow::{Context, Result};
|
|
||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
|
|
||||||
|
use anyhow::{Context, Result};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
|
|
||||||
|
use crate::config::load_config;
|
||||||
|
|
||||||
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
||||||
let config = load_config(&cli.config, true)?;
|
let config = load_config(&cli.config, true)?;
|
||||||
config
|
config
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use crate::config::load_config;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use warpgate_protocol_ssh::helpers::PublicKeyAsOpenSSH;
|
use warpgate_protocol_ssh::helpers::PublicKeyAsOpenSSH;
|
||||||
|
|
||||||
|
use crate::config::load_config;
|
||||||
|
|
||||||
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
||||||
let config = load_config(&cli.config, true)?;
|
let config = load_config(&cli.config, true)?;
|
||||||
let keys = warpgate_protocol_ssh::load_client_keys(&config)?;
|
let keys = warpgate_protocol_ssh::load_client_keys(&config)?;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
use std::io::stdin;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use dialoguer::theme::ColorfulTheme;
|
use dialoguer::theme::ColorfulTheme;
|
||||||
use std::io::stdin;
|
|
||||||
use warpgate_common::helpers::hash::hash_password;
|
use warpgate_common::helpers::hash::hash_password;
|
||||||
|
|
||||||
pub(crate) async fn command() -> Result<()> {
|
pub(crate) async fn command() -> Result<()> {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::config::{load_config, watch_config};
|
use std::net::ToSocketAddrs;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use std::net::ToSocketAddrs;
|
#[cfg(target_os = "linux")]
|
||||||
|
use sd_notify::NotifyState;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::db::cleanup_db;
|
use warpgate_common::db::cleanup_db;
|
||||||
use warpgate_common::logging::install_database_logger;
|
use warpgate_common::logging::install_database_logger;
|
||||||
|
@ -9,8 +11,7 @@ use warpgate_common::{ProtocolServer, Services};
|
||||||
use warpgate_protocol_http::HTTPProtocolServer;
|
use warpgate_protocol_http::HTTPProtocolServer;
|
||||||
use warpgate_protocol_ssh::SSHProtocolServer;
|
use warpgate_protocol_ssh::SSHProtocolServer;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
use crate::config::{load_config, watch_config};
|
||||||
use sd_notify::NotifyState;
|
|
||||||
|
|
||||||
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use crate::config::load_config;
|
|
||||||
use anyhow::Result;
|
|
||||||
use dialoguer::theme::ColorfulTheme;
|
|
||||||
use rcgen::generate_simple_self_signed;
|
|
||||||
use std::fs::{create_dir_all, File};
|
use std::fs::{create_dir_all, File};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
use dialoguer::theme::ColorfulTheme;
|
||||||
|
use rcgen::generate_simple_self_signed;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::helpers::fs::{secure_directory, secure_file};
|
use warpgate_common::helpers::fs::{secure_directory, secure_file};
|
||||||
use warpgate_common::helpers::hash::hash_password;
|
use warpgate_common::helpers::hash::hash_password;
|
||||||
|
@ -13,6 +13,8 @@ use warpgate_common::{
|
||||||
User, UserAuthCredential, WarpgateConfigStore,
|
User, UserAuthCredential, WarpgateConfigStore,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::config::load_config;
|
||||||
|
|
||||||
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
pub(crate) async fn command(cli: &crate::Cli) -> Result<()> {
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
info!("Welcome to Warpgate {version}");
|
info!("Welcome to Warpgate {version}");
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use crate::config::load_config;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::{ProtocolServer, Services, Target, TargetTestError};
|
use warpgate_common::{ProtocolServer, Services, Target, TargetTestError};
|
||||||
|
|
||||||
|
use crate::config::load_config;
|
||||||
|
|
||||||
pub(crate) async fn command(cli: &crate::Cli, target_name: &String) -> Result<()> {
|
pub(crate) async fn command(cli: &crate::Cli, target_name: &String) -> Result<()> {
|
||||||
let config = load_config(&cli.config, true)?;
|
let config = load_config(&cli.config, true)?;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
use std::path::Path;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use config::{Config, Environment, File};
|
use config::{Config, Environment, File};
|
||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
use std::path::Path;
|
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::{mpsc, Mutex};
|
use tokio::sync::{mpsc, Mutex};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
use warpgate_common::helpers::fs::secure_file;
|
use warpgate_common::helpers::fs::secure_file;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use time::{format_description, UtcOffset};
|
use time::{format_description, UtcOffset};
|
||||||
use tracing_subscriber::filter::dynamic_filter_fn;
|
use tracing_subscriber::filter::dynamic_filter_fn;
|
||||||
use tracing_subscriber::fmt::time::OffsetTime;
|
use tracing_subscriber::fmt::time::OffsetTime;
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
mod commands;
|
mod commands;
|
||||||
mod config;
|
mod config;
|
||||||
mod logging;
|
mod logging;
|
||||||
use crate::config::load_config;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{ArgAction, StructOpt};
|
use clap::{ArgAction, StructOpt};
|
||||||
use logging::init_logging;
|
use logging::init_logging;
|
||||||
use std::path::PathBuf;
|
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
|
|
||||||
|
use crate::config::load_config;
|
||||||
|
|
||||||
#[cfg(feature = "dhat-heap")]
|
#[cfg(feature = "dhat-heap")]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: dhat::Alloc = dhat::Alloc;
|
static ALLOC: dhat::Alloc = dhat::Alloc;
|
||||||
|
|
Loading…
Reference in a new issue