This commit is contained in:
Eugene Pankov 2022-08-14 18:54:31 +02:00
parent 7ed223c8dd
commit 6b805e686f
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
15 changed files with 21 additions and 36 deletions

4
Cargo.lock generated
View file

@ -4649,7 +4649,6 @@ dependencies = [
"humantime-serde",
"lazy_static",
"once_cell",
"packet",
"password-hash 0.4.1",
"poem",
"poem-openapi",
@ -4666,7 +4665,6 @@ dependencies = [
"totp-rs",
"tracing",
"tracing-core",
"tracing-subscriber",
"url",
"uuid",
"warpgate-sso",
@ -4839,7 +4837,6 @@ dependencies = [
name = "warpgate-sso"
version = "0.5.0"
dependencies = [
"async-trait",
"bytes 1.2.1",
"once_cell",
"openidconnect",
@ -4848,7 +4845,6 @@ dependencies = [
"thiserror",
"tokio",
"tracing",
"uuid",
]
[[package]]

View file

@ -15,7 +15,6 @@ humantime-serde = "1.1"
lazy_static = "1.4"
futures = "0.3"
once_cell = "1.10"
packet = "0.1"
password-hash = "0.4"
poem = { version = "^1.3.37", features = ["rustls"] }
poem-openapi = { version = "^2.0.6", features = [
@ -39,7 +38,6 @@ tokio = { version = "1.20", features = ["tracing"] }
totp-rs = { version = "3.0", features = ["otpauth"] }
tracing = "0.1"
tracing-core = "0.1"
tracing-subscriber = "0.3"
url = "2.2"
uuid = { version = "1.0", features = ["v4", "serde"] }
warpgate-sso = { version = "*", path = "../warpgate-sso" }

View file

@ -2,8 +2,8 @@ use chrono::{DateTime, Utc};
use poem_openapi::Object;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use warpgate_db_entities::{Session};
use warpgate_common::{SessionId, Target, User};
use warpgate_db_entities::Session;
#[derive(Serialize, Deserialize, Object)]
pub struct SessionSnapshot {

View file

@ -4,9 +4,9 @@ use tokio::net::UnixDatagram;
use tracing::*;
use tracing_subscriber::registry::LookupSpan;
use tracing_subscriber::Layer;
use warpgate_common::WarpgateConfig;
use super::layer::ValuesLogLayer;
use warpgate_common::WarpgateConfig;
static SKIP_KEY: &str = "is_socket_logging_error";

View file

@ -7,7 +7,7 @@ use sea_orm::{ActiveModelTrait, DatabaseConnection, EntityTrait};
use tokio::sync::{broadcast, Mutex};
use tracing::*;
use uuid::Uuid;
use warpgate_common::{SessionId, ProtocolName, Target};
use warpgate_common::{ProtocolName, SessionId, Target};
use warpgate_db_entities::Session;
use crate::{SessionHandle, WarpgateServerHandle};

View file

@ -9,9 +9,9 @@ use poem_openapi::{ApiResponse, Enum, Object, OpenApi};
use tokio::sync::Mutex;
use tracing::*;
use uuid::Uuid;
use warpgate_common::auth::{AuthCredential, AuthState, CredentialKind, AuthResult};
use warpgate_core::{Services};
use warpgate_common::auth::{AuthCredential, AuthResult, AuthState, CredentialKind};
use warpgate_common::{Secret, WarpgateError};
use warpgate_core::Services;
use crate::common::{
authorize_session, endpoint_auth, get_auth_state_for_request, SessionAuthorization, SessionExt,

View file

@ -3,9 +3,9 @@ use poem::web::Data;
use poem_openapi::payload::Json;
use poem_openapi::{ApiResponse, Object, OpenApi};
use serde::Serialize;
use warpgate_common::TargetOptions;
use warpgate_core::Services;
use warpgate_db_entities::Target;
use warpgate_common::{TargetOptions};
use warpgate_core::{Services};
use crate::common::{endpoint_auth, SessionAuthorization};

View file

@ -10,8 +10,8 @@ use serde::{Deserialize, Serialize};
use tokio::sync::Mutex;
use tracing::*;
use uuid::Uuid;
use warpgate_common::auth::{AuthState};
use warpgate_common::{ProtocolName, TargetOptions, WarpgateError};
use warpgate_common::auth::AuthState;
use warpgate_common::{ProtocolName, TargetOptions, WarpgateError};
use warpgate_core::{AuthStateStore, Services};
use crate::session::SessionStore;

View file

@ -5,8 +5,7 @@ use tracing::*;
use crate::session_handle::WarpgateServerHandleFromRequest;
pub async fn span_for_request(req: &Request) -> poem::Result<Span> {
let handle = WarpgateServerHandleFromRequest::from_request_without_body(req)
.await;
let handle = WarpgateServerHandleFromRequest::from_request_without_body(req).await;
Ok(match handle {
Ok(ref handle) => {

View file

@ -1,16 +1,13 @@
#![feature(type_alias_impl_trait, let_else, try_blocks)]
use warpgate_protocol_http::api;
use regex::Regex;
use poem_openapi::OpenApiService;
use regex::Regex;
use warpgate_protocol_http::api;
#[allow(clippy::unwrap_used)]
pub fn main() {
let api_service = OpenApiService::new(
api::get(),
"Warpgate HTTP proxy",
env!("CARGO_PKG_VERSION"),
)
.server("/@warpgate/api");
let api_service =
OpenApiService::new(api::get(), "Warpgate HTTP proxy", env!("CARGO_PKG_VERSION"))
.server("/@warpgate/api");
let spec = api_service.spec();
let re = Regex::new(r"PaginatedResponse<(?P<name>\w+)>").unwrap();

View file

@ -65,7 +65,6 @@ impl<E: Endpoint> Endpoint for TicketMiddlewareEndpoint<E> {
if let Some(ticket_model) = {
let ticket = Secret::new(ticket);
let cp = services.config_provider.lock().await;
if let Some(res) = authorize_ticket(&services.db, &ticket).await? {
consume_ticket(&services.db, &res.id).await?;
Some(res)

View file

@ -7,12 +7,10 @@ use tokio::net::TcpStream;
use tokio::sync::Mutex;
use tracing::*;
use uuid::Uuid;
use warpgate_common::auth::{AuthCredential, AuthSelector, AuthResult};
use warpgate_common::auth::{AuthCredential, AuthResult, AuthSelector};
use warpgate_common::helpers::rng::get_crypto_rng;
use warpgate_common::{
Secret, TargetMySqlOptions, TargetOptions,
};
use warpgate_core::{WarpgateServerHandle, Services, authorize_ticket, consume_ticket};
use warpgate_common::{Secret, TargetMySqlOptions, TargetOptions};
use warpgate_core::{authorize_ticket, consume_ticket, Services, WarpgateServerHandle};
use warpgate_database_protocols::io::{BufExt, Decode};
use warpgate_database_protocols::mysql::protocol::auth::AuthPlugin;
use warpgate_database_protocols::mysql::protocol::connect::{

View file

@ -5,12 +5,10 @@ name = "warpgate-sso"
version = "0.5.0"
[dependencies]
async-trait = "0.1"
bytes = "1.2"
thiserror = "1.0"
tokio = { version = "1.20", features = ["tracing", "macros"] }
tracing = "0.1"
uuid = { version = "1.0", features = ["v4"] }
openidconnect = { version = "2.3", features = ["reqwest", "rustls-tls"] }
serde = "1.0"
serde_json = "1.0"

View file

@ -10,8 +10,8 @@ use tracing::*;
use warpgate_common::helpers::fs::{secure_directory, secure_file};
use warpgate_common::helpers::hash::hash_password;
use warpgate_common::{
HTTPConfig, ListenEndpoint, MySQLConfig, Role, SSHConfig, Secret, Target,
TargetOptions, TargetWebAdminOptions, User, UserAuthCredential, WarpgateConfigStore,
HTTPConfig, ListenEndpoint, MySQLConfig, Role, SSHConfig, Secret, Target, TargetOptions,
TargetWebAdminOptions, User, UserAuthCredential, WarpgateConfigStore,
};
use warpgate_core::Services;

View file

@ -6,8 +6,8 @@ use tracing_subscriber::fmt::time::OffsetTime;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::{EnvFilter, Layer};
use warpgate_core::logging::{make_database_logger_layer, make_socket_logger_layer};
use warpgate_common::WarpgateConfig;
use warpgate_core::logging::{make_database_logger_layer, make_socket_logger_layer};
pub async fn init_logging(config: Option<&WarpgateConfig>) {
if std::env::var("RUST_LOG").is_err() {