chore(server): checkpoint deployed services and unfinished forums

User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
This commit is contained in:
Loki 2026-11-01 15:31:20 +01:00
parent d6d406bbf5
commit c18ccadf99
Signed by: boba
GPG key ID: 253067914055423B
96 changed files with 8665 additions and 276 deletions

View file

@ -1,5 +1,5 @@
//! Black box tests of the gateway TCP listener: TLS 1.3 only, ALPN, legacy rejection,
//! certificate fingerprint and the channel bound LNEx v3 handshake.
//! certificate fingerprint and the channel bound LNEx v4 handshake.
use std::sync::{Arc, Mutex};
use std::time::Duration;
@ -46,6 +46,9 @@ address = "127.0.0.1"
[gateway]
bind = "127.0.0.1:{port}"
admin_bind = "127.0.0.1:0"
[gateway.central_account]
issuer = "8a1495ae-7174-4d22-94a5-080f61aa1691"
public_key = "{issuer_key}"
[voice]
bind = "127.0.0.1:0"
[storage]
@ -55,7 +58,8 @@ sqlite_path = "{dir}/t.db"
[server]
mode = "private"
"#,
dir = directory.display()
dir = directory.display(),
issuer_key = hex::encode(SigningKey::from_bytes(&[73; 32]).verifying_key().to_bytes())
);
let cfg: vnox_gateway::domain::config::Config = toml::from_str(&config).unwrap();
let task = tokio::spawn(async move {
@ -215,7 +219,7 @@ async fn client_without_alpn_is_rejected_before_any_lnex_byte() {
let read = tokio::time::timeout(Duration::from_secs(3), tls.read(&mut byte)).await;
assert!(
!matches!(read, Ok(Ok(n)) if n > 0),
"no LNEx data may be sent without ALPN vnox-lnex/3"
"no LNEx data may be sent without ALPN vnox-lnex/4"
);
}
}
@ -255,12 +259,29 @@ async fn silent_v2_style_client_gets_explicit_version_error() {
assert_eq!(id, PacketId::Error as u16);
let error = ErrorPayload::decode(payload.as_slice()).unwrap();
assert_eq!(error.code, ErrorCode::VersionMismatch as u32);
assert!(error.message.contains("LNEx v3"));
assert!(error.message.contains("LNEx v4"));
}
fn account_proof(public_key: &[u8; 32]) -> Vec<u8> {
let now = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs() as i64;
let claims = serde_json::to_vec(&serde_json::json!({
"version":1,"issuer":"8a1495ae-7174-4d22-94a5-080f61aa1691",
"subject":"c3ebd30f-6bb4-4c31-9016-bec57e986c93","public_key":hex::encode(public_key),
"issued_at":now,"expires_at":now+600,"audience":"vnox-gateway"
}))
.unwrap();
let mut signed = b"VNOX-CENTRAL-ACCOUNT-v1\0".to_vec();
signed.extend_from_slice(&claims);
serde_json::to_vec(&serde_json::json!({"claims":hex::encode(claims),"signature":hex::encode(SigningKey::from_bytes(&[73;32]).sign(&signed).to_bytes())})).unwrap()
}
async fn authenticate(
tls: &mut tokio_rustls::client::TlsStream<TcpStream>,
signing_binding: Option<[u8; 32]>,
include_account: bool,
) -> (u16, Vec<u8>) {
let binding = tls
.get_ref()
@ -289,6 +310,11 @@ async fn authenticate(
nickname: "tls-test".into(),
lnex_version: LNEX_VERSION.into(),
signature: Vec::new(),
account_proof: if include_account {
account_proof(&key.verifying_key().to_bytes())
} else {
Vec::new()
},
};
let signed_with = signing_binding.unwrap_or(binding);
let transcript = client_auth_transcript(&signed_with, &payload, &auth.encode_to_vec());
@ -305,7 +331,7 @@ async fn full_handshake_over_tls_creates_a_session() {
let server = start().await;
let (config, _) = client_config(&[&rustls::version::TLS13], true);
let mut tls = connect_tls(&server, config).await.unwrap();
let (id, _) = authenticate(&mut tls, None).await;
let (id, _) = authenticate(&mut tls, None, true).await;
assert_eq!(id, PacketId::Session as u16);
}
@ -314,8 +340,28 @@ async fn auth_signed_for_another_tls_connection_is_rejected() {
let server = start().await;
let (config, _) = client_config(&[&rustls::version::TLS13], true);
let mut tls = connect_tls(&server, config).await.unwrap();
let (id, payload) = authenticate(&mut tls, Some([0x42; 32])).await;
let (id, payload) = authenticate(&mut tls, Some([0x42; 32]), true).await;
assert_eq!(id, PacketId::Error as u16);
let error = ErrorPayload::decode(payload.as_slice()).unwrap();
assert_eq!(error.code, ErrorCode::AuthFailed as u32);
}
#[tokio::test]
async fn valid_device_signature_without_a_central_account_is_rejected() {
let server = start().await;
let (config, _) = client_config(&[&rustls::version::TLS13], true);
let mut tls = connect_tls(&server, config).await.unwrap();
let (id, payload) = authenticate(&mut tls, None, false).await;
assert_eq!(id, PacketId::Error as u16);
let error = ErrorPayload::decode(payload.as_slice()).unwrap();
assert_eq!(error.code, ErrorCode::AuthFailed as u32);
assert!(error.message.contains("Central account"));
}
#[tokio::test]
async fn old_v3_alpn_is_rejected_before_any_lnex_byte() {
let server = start().await;
let (mut config, _) = client_config(&[&rustls::version::TLS13], true);
config.alpn_protocols = vec![b"vnox-lnex/3".to_vec()];
assert!(connect_tls(&server, config).await.is_err());
}