fix tor addressing for realzies

This commit is contained in:
Aiden McClelland
2021-09-08 19:13:36 -06:00
committed by Aiden McClelland
parent 296c2a98c3
commit 45d945db2e
5 changed files with 49 additions and 22 deletions

1
appmgr/Cargo.lock generated
View File

@@ -1914,6 +1914,7 @@ dependencies = [
"json-patch",
"json-ptr",
"lazy_static",
"log",
"nix 0.20.1",
"patch-db-macro",
"qutex-2",

View File

@@ -43,7 +43,7 @@ portable = []
production = []
[dependencies]
aes = { version = "0.7.5", features = ["ctr", "armv8"] }
aes = { version = "0.7.5", features = ["ctr"] }
anyhow = "1.0.40"
async-trait = "0.1.42"
avahi-sys = { git = "https://github.com/Start9Labs/avahi-sys", version = "0.10.0", branch = "feature/dynamic-linking", features = [
@@ -76,7 +76,9 @@ log = "0.4.11"
nix = "0.22.0"
openssh-keys = "0.5.0"
openssl = { version = "0.10.30", features = ["vendored"] }
patch-db = { version = "*", path = "../../patch-db/patch-db" }
patch-db = { version = "*", path = "../../patch-db/patch-db", features = [
"log",
] }
pbkdf2 = "0.9.0"
pin-project = "1.0.6"
prettytable-rs = "0.8.0"

View File

@@ -38,6 +38,24 @@
]
}
},
"3e57a0e52b69f33e9411c13b03a5d82c5856d63f0375eb4c23b255a09c54f8b1": {
"query": "SELECT key FROM tor WHERE package = ? AND interface = ?",
"describe": {
"columns": [
{
"name": "key",
"ordinal": 0,
"type_info": "Blob"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false
]
}
},
"4691e3a2ce80b59009ac17124f54f925f61dc5ea371903e62cdffa5d7b67ca96": {
"query": "SELECT * FROM session WHERE logged_out IS NULL OR logged_out > CURRENT_TIMESTAMP",
"describe": {
@@ -178,24 +196,6 @@
]
}
},
"c895b08869cc611708d37643ec92b5c827c1766c63e263d5687aa639357b27e6": {
"query": "INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?) RETURNING key AS \"key!:Vec<u8>\"",
"describe": {
"columns": [
{
"name": "key!:Vec<u8>",
"ordinal": 0,
"type_info": "Null"
}
],
"parameters": {
"Right": 3
},
"nullable": [
null
]
}
},
"d5117054072476377f3c4f040ea429d4c9b2cf534e76f35c80a2bf60e8599cca": {
"query": "SELECT openssh_pubkey FROM ssh_keys",
"describe": {
@@ -214,6 +214,16 @@
]
}
},
"d79d608ceb862c15b741a6040044c6dd54a837a3a0c5594d15a6041c7bc68ea8": {
"query": "INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?)",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
}
},
"de2a5e90798d606047ab8180c044baac05469c0cdf151316bd58ee8c7196fdef": {
"query": "SELECT * FROM ssh_keys WHERE fingerprint = ?",
"describe": {

View File

@@ -36,12 +36,19 @@ impl Interfaces {
if iface.tor_config.is_some() || iface.lan_config.is_some() {
let key = TorSecretKeyV3::generate();
let key_vec = key.as_bytes().to_vec();
let key_row = sqlx::query!(
"INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?) RETURNING key AS \"key!:Vec<u8>\"",
sqlx::query!(
"INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?)",
**package_id,
**id,
key_vec,
)
.execute(&mut *secrets)
.await?;
let key_row = sqlx::query!(
"SELECT key FROM tor WHERE package = ? AND interface = ?",
**package_id,
**id,
)
.fetch_one(&mut *secrets)
.await?;
let mut key = [0_u8; 64];

View File

@@ -17,6 +17,13 @@ impl Shutdown {
pub fn execute(&self) {
use std::process::Command;
Command::new("systemctl")
.arg("stop")
.arg("systemd-journald")
.spawn()
.unwrap()
.wait()
.unwrap();
if let Err(e) = export_blocking(&self.zfs_pool) {
log::error!("Error Exporting ZFS Pool: {}", e);
}