upgrade dependencies

This commit is contained in:
Hannaeko 2023-02-22 12:55:37 +01:00
parent c6ba207a2f
commit 515cc06dec
8 changed files with 744 additions and 556 deletions

1230
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,32 +1,35 @@
[package] [package]
name = "nomilo" name = "nomilo"
version = "0.1.0-dev" version = "0.1.0-dev"
authors = ["Gaël Berthaud-Müller <blacksponge@tuta.io>"] authors = ["DNS Witch Collective <dns-witch@familier.net.eu.org>"]
edition = "2021" edition = "2021"
license = "AGPL-3.0-or-later"
readme = "README.md"
repository = "https://git.familier.net.eu.org/dns-witch/nomilo"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
trust-dns-client = { version = "0.21", features = ["dnssec-openssl"] } trust-dns-client = { version = "0.22", features = ["dnssec-openssl"] }
trust-dns-proto = "0.21" trust-dns-proto = "0.22"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1.0" serde_json = "1"
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "6bdd2f8", version = "0.5.0-rc.1", features = ["json"], default-features = false } rocket = { version = "0.5.0-rc.2", features = ["json"], default-features = false }
rocket_sync_db_pools = { git = "https://github.com/SergioBenitez/Rocket", rev = "6bdd2f8", default-features = false, features = ["diesel_sqlite_pool"], version = "0.1.0-rc.1"} rocket_sync_db_pools = { default-features = false, features = ["diesel_sqlite_pool"], version = "0.1.0-rc.2"}
base64 = "0.13.0" base64 = "0.21"
uuid = { version = "0.8.2", features = ["v4", "serde"] } uuid = { version = "0.8", features = ["v4", "serde"] }
diesel = { version = "1.4", features = ["sqlite", "chrono"] } diesel = { version = "1.4", features = ["sqlite", "chrono"] }
diesel_migrations = "1.4" diesel_migrations = "1.4"
diesel-derive-enum = { version = "1", features = ["sqlite"] } diesel-derive-enum = { version = "1", features = ["sqlite"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
humantime = "2.1.0" humantime = "2.1"
tokio = "1" tokio = "1"
figment = { version = "0.10.6", features = ["toml", "env"] } figment = { version = "0.10", features = ["toml", "env"] }
clap = {version = "3", features = ["derive", "cargo"]} clap = {version = "3", features = ["derive", "cargo"]}
argon2 = {version = "0.4", default-features = false, features = ["alloc", "password-hash"] } argon2 = {version = "0.4", default-features = false, features = ["alloc", "password-hash"] }
rand = "0.8" rand = "0.8"
tera = {version = "1", default-features = false} tera = {version = "1", default-features = false}
# From trust-dns-client # From trust-dns-client
futures-util = { version = "0.3.5", default-features = false, features = ["std"] } futures-util = { version = "0.3", default-features = false, features = ["std"] }
# From rocket / cookie-rs # From rocket / cookie-rs
time = "0.3" time = "0.3"

View file

@ -2,6 +2,7 @@ use std::net::SocketAddr;
use std::time::Duration; use std::time::Duration;
use std::path::PathBuf; use std::path::PathBuf;
use base64::{Engine, engine::general_purpose};
use serde::{Deserialize, Deserializer}; use serde::{Deserialize, Deserializer};
use crate::models::name::SerdeName; use crate::models::name::SerdeName;
@ -53,7 +54,7 @@ fn from_base64<'de, D>(deserializer: D) -> Result<Vec<u8>, D::Error>
{ {
use serde::de::Error; use serde::de::Error;
String::deserialize(deserializer) String::deserialize(deserializer)
.and_then(|string| base64::decode(&string).map_err(|err| Error::custom(err.to_string()))) .and_then(|string| general_purpose::STANDARD.decode(&string).map_err(|err| Error::custom(err.to_string())))
} }
fn from_tsigalg<'de, D>(deserializer: D) -> Result<TsigAlgorithm, D::Error> fn from_tsigalg<'de, D>(deserializer: D) -> Result<TsigAlgorithm, D::Error>

View file

@ -1,4 +1,3 @@
use time;
use rocket::http::{Cookie, SameSite, CookieJar}; use rocket::http::{Cookie, SameSite, CookieJar};
use rocket::State; use rocket::State;

View file

@ -1,7 +1,7 @@
use trust_dns_proto::DnsHandle; use trust_dns_proto::DnsHandle;
use trust_dns_client::client::ClientHandle; use trust_dns_client::client::ClientHandle;
use trust_dns_client::rr::{DNSClass, RecordType}; use trust_dns_client::rr::{DNSClass, RecordType};
use trust_dns_client::op::{UpdateMessage, OpCode, MessageType, Message, Query, ResponseCode}; use trust_dns_client::op::{UpdateMessage, OpCode, MessageType, Message, Query, ResponseCode, Edns};
use trust_dns_client::error::ClientError; use trust_dns_client::error::ClientError;
use super::{Name, Record, RData}; use super::{Name, Record, RData};
@ -61,7 +61,11 @@ impl std::fmt::Display for DnsConnectorError {
} }
} }
fn set_edns(message: &mut Message) {
let edns = message.extensions_mut().get_or_insert_with(Edns::new);
edns.set_max_payload(MAX_PAYLOAD_LEN);
edns.set_version(0);
}
#[async_trait] #[async_trait]
impl RecordConnector for DnsConnectorClient { impl RecordConnector for DnsConnectorClient {
@ -115,11 +119,7 @@ impl RecordConnector for DnsConnectorClient {
message.add_zone(zone_query); message.add_zone(zone_query);
message.add_updates(new_records); message.add_updates(new_records);
{ set_edns(&mut message);
let edns = message.edns_mut();
edns.set_max_payload(MAX_PAYLOAD_LEN);
edns.set_version(0);
}
let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) { let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) {
Err(e) => return Err(e), Err(e) => return Err(e),
@ -179,11 +179,7 @@ impl RecordConnector for DnsConnectorClient {
message.add_updates(new_records); message.add_updates(new_records);
// Extended dns // Extended dns
{ set_edns(&mut message);
let edns = message.edns_mut();
edns.set_max_payload(MAX_PAYLOAD_LEN);
edns.set_version(0);
}
let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) { let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) {
Err(e) => return Err(e), Err(e) => return Err(e),
@ -229,11 +225,7 @@ impl RecordConnector for DnsConnectorClient {
message.add_updates(delete); message.add_updates(delete);
// Extended dns // Extended dns
{ set_edns(&mut message);
let edns = message.edns_mut();
edns.set_max_payload(MAX_PAYLOAD_LEN);
edns.set_version(0);
}
let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) { let response = match ClientResponse(self.client.send(message)).await.map_err(|e| Box::new(DnsConnectorError::ClientError(e))) {
Err(e) => return Err(e), Err(e) => return Err(e),

View file

@ -1,6 +1,7 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use std::net::{Ipv6Addr, Ipv4Addr}; use std::net::{Ipv6Addr, Ipv4Addr};
use base64::{Engine, engine::general_purpose};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use trust_dns_client::serialize::binary::BinEncoder; use trust_dns_client::serialize::binary::BinEncoder;
@ -127,7 +128,7 @@ impl From<dns::RData> for RData {
mail_exchanger: SerdeName(mx.exchange().clone()) mail_exchanger: SerdeName(mx.exchange().clone())
}, },
dns::RData::NULL(null) => RData::NULL { dns::RData::NULL(null) => RData::NULL {
data: base64::encode(null.anything()) data: general_purpose::STANDARD.encode(null.anything())
}, },
dns::RData::NS(target) => RData::NS { dns::RData::NS(target) => RData::NS {
target: SerdeName(target) target: SerdeName(target)
@ -168,7 +169,7 @@ impl From<dns::RData> for RData {
RData::Unknown { RData::Unknown {
code, code,
data: base64::encode(data), data: general_purpose::STANDARD.encode(data),
} }
} }
} }
@ -212,7 +213,7 @@ impl TryFrom<RData> for dns::RData {
), ),
RData::NULL { data } => dns::RData::NULL( RData::NULL { data } => dns::RData::NULL(
dns::null::NULL::with( dns::null::NULL::with(
base64::decode(data).map_err(|e| ProtoError::from(format!("{}", e)))? general_purpose::STANDARD.decode(data).map_err(|e| ProtoError::from(format!("{}", e)))?
) )
), ),
RData::NS { target } => dns::RData::NS(target.into_inner()), RData::NS { target } => dns::RData::NS(target.into_inner()),

View file

@ -56,9 +56,7 @@ impl<'r, S: Serialize> Template<'r, S> {
impl<'r, 't, S: Serialize> Responder<'r, 'static> for Template<'t, S> { impl<'r, 't, S: Serialize> Responder<'r, 'static> for Template<'t, S> {
fn respond_to(self, request: &'r Request<'_>) -> response::Result<'static> { fn respond_to(self, request: &'r Request<'_>) -> response::Result<'static> {
let template_state = request.rocket().state::<TemplateState>().ok_or_else(|| { let template_state = request.rocket().state::<TemplateState>().ok_or(Status::InternalServerError)?;
Status::InternalServerError
})?;
self.render(&template_state.tera).respond_to(request) self.render(&template_state.tera).respond_to(request)
} }

View file

@ -4,7 +4,7 @@
{% block title %}{{ current_zone }} ⋅ Records ⋅ {% endblock title %} {% block title %}{{ current_zone }} ⋅ Records ⋅ {% endblock title %}
{% block main %} {% block main %}
<h1>Gestion la zone {{ current_zone }}</h1> <h1>Gestion de la zone {{ current_zone }}</h1>
<nav aria-label="Secondaire"> <nav aria-label="Secondaire">
<ul> <ul>
<li> <li>