Skip to content

Commit 19f2784

Browse files
author
nuno
committed
fixes debian packages
1 parent 9b0d58d commit 19f2784

File tree

15 files changed

+55
-43
lines changed

15 files changed

+55
-43
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ jobs:
2626
needs:
2727
- build
2828
steps:
29-
- run: cargo install cargo-deb
29+
- run: apt-get update -qq
30+
- run: apt-get install -y -qq devscripts build-essential debhelper lintian dh-make
3031
- uses: actions/checkout@v2
3132
- name: DEB packaging
32-
run: cargo deb -p doh
33+
- run: mk-build-deps --install --remove --tool "apt-get -y -qq"
34+
- run: dpkg-buildpackage -us -uc -b
3335
- uses: "marvinpinto/action-automatic-releases@latest"
3436
with:
3537
repo_token: "${{ secrets.GITHUB_TOKEN }}"
File renamed without changes.
File renamed without changes.

debian/dbrotate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
copytruncate
99
create 640 root root
1010
postrotate
11-
/usr/bin/systemctl restart frost-doh.service > /dev/null 2>&1 || true
11+
/usr/bin/pkill doh-daemon > /dev/null 2>&1 || true
1212
endscript
1313
dateext
1414
dateformat -%Y%m%d-%H%M%S

debian/install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ target/release/doh-daemon /usr/bin
33
debian/com.glaciaos.NameResolver.conf /etc/dbus-1/system.d
44
debian/com.glaciaos.NameResolver.service /usr/share/dbus-1/system-services
55
debian/dbrotate /etc/logrotate.d
6-
doh-daemon/config.prod.ini /etc/frost-doh
6+
debian/config.ini /etc/frost-doh

debian/postinst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
set -e
3+
4+
mkdir -p /var/log/frost-doh
5+
6+
7+
exit 0

debian/rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export CARGO_HOME := $(CURDIR)/debian/cargo
44
export DEB_CARGO_PACKAGE := $(shell dpkg-parsechangelog -S Source)
55
export DEB_VERSION := $(shell dpkg-parsechangelog -S Version)
66
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
7+
export RUSTFLAGS := --cfg tokio_unstable
78

89
%:
910
dh $@

doh-daemon/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ version = "0.1.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
[build]
8+
rustflags = ["--cfg", "tracing_unstable"]
9+
710

811
[dependencies]
912
log = "0.4.17"
10-
env_logger = "0.11.8"
1113
zbus = { version = "5.9.0", features = ["tokio"] }
1214
zvariant = "5.6.0"
1315
zvariant_derive = "5.6.0"
@@ -21,4 +23,4 @@ async-sqlite="0.5.3"
2123
reqwest = { version = "0.12.23", features = ["gzip","json", "brotli"] }
2224
configparser = "3.1.0"
2325
tracing = "0.1"
24-
console-subscriber = "0.4.1"
26+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

doh-daemon/src/database/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fmt::{Debug, Formatter};
55
use std::ops::{Add};
66
use std::sync::Arc;
77
use std::time::UNIX_EPOCH;
8-
8+
use tracing::instrument;
99
use doh_common::error::Error;
1010

1111
use crate::provider::DnsReply;
@@ -138,6 +138,7 @@ impl DatabaseService {
138138
}).await.map_err(|e| e.into())
139139
}
140140

141+
#[instrument(skip(self))]
141142
pub async fn create_host_blocked(&self, host: &str) -> Result<bool, Error> {
142143

143144
let host_clone = host.to_lowercase();
@@ -152,6 +153,7 @@ impl DatabaseService {
152153
}).await.map_err(|e| e.into())
153154
}
154155

156+
#[instrument(skip(self))]
155157
pub async fn delete_host_blocked(&self, host: &str) -> Result<bool, Error> {
156158

157159
let host_clone = host.to_lowercase();
@@ -193,7 +195,7 @@ impl DatabaseService {
193195

194196
let offset = page * 10;
195197
let mut statement = connection.prepare(
196-
"SELECT process_name, dns_name, created FROM audit_dns_query ORDER BY id DESC LIMIT 10 OFFSET ?"
198+
"SELECT process_name, dns_name, strftime('%s', 'created') FROM audit_dns_query ORDER BY id DESC LIMIT 10 OFFSET ?"
197199
)?;
198200

199201
let mut rows = statement.query(params![offset])?;

doh-daemon/src/dbus/mod.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::time::Instant;
2-
use tracing::{instrument, trace};
1+
2+
use tracing::{info, instrument};
33
use zbus::interface;
44

55
use doh_common::AuditDnsQueryPage;
@@ -19,14 +19,14 @@ impl DoHBusService {
1919

2020
#[interface(name = "com.glaciaos.NameResolver")]
2121
impl DoHBusService {
22-
#[instrument(level = "debug", skip(self), fields(process_id, name, family))]
23-
async fn name_request(
22+
#[instrument(skip(self))]
23+
async fn resolve_name(
2424
&mut self,
2525
process_id: u32,
2626
name: &str,
2727
family: u32,
2828
) -> zbus::fdo::Result<libnss::host::Host> {
29-
trace!("received query: {} - {} {}", process_id, name, family);
29+
info!("received query: {} - {} {}", process_id, name, family);
3030

3131
let result = self
3232
.resolver
@@ -44,6 +44,13 @@ impl DoHBusService {
4444
.map_err(|e: doh_common::error::Error | e.into())
4545
}
4646

47+
async fn unblock_host(&mut self, name: &str) -> zbus::fdo::Result<bool> {
48+
self.resolver
49+
.remove_from_blacklist(name)
50+
.await
51+
.map_err(|e: doh_common::error::Error | e.into())
52+
}
53+
4754
async fn get_last_queries(&mut self, page: u64) -> zbus::fdo::Result<AuditDnsQueryPage> {
4855
self.resolver.get_queries(page)
4956
.await

0 commit comments

Comments
 (0)