Skip to content

Commit ae56bec

Browse files
committed
Fix Debian package
1 parent 2fd3e9f commit ae56bec

4 files changed

Lines changed: 74 additions & 7 deletions

File tree

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Build-Depends: debhelper-compat (= 13)
99
, libcurl4-openssl-dev
1010
, libjson-c-dev
1111
, libpam0g-dev
12+
, libssl-dev
1213
, pkgconf
1314

1415
Package: libpam-llng
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[Unit]
2+
Description=PAM LLNG Heartbeat Timer
3+
Documentation=man:llng-pam-heartbeat(8)
4+
After=network-online.target
5+
Wants=network-online.target
6+
ConditionPathExists=/etc/security/pam_llng.token
7+
8+
[Timer]
9+
# First heartbeat 1 minute after boot
10+
OnBootSec=1min
11+
# Then every 5 minutes
12+
OnUnitActiveSec=5min
13+
# Persist the timer across reboots
14+
Persistent=true
15+
# Randomize by up to 30 seconds to avoid thundering herd
16+
RandomizedDelaySec=30
17+
18+
[Install]
19+
WantedBy=timers.target

debian/postinst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,6 @@ case "$1" in
201201
mkdir -p /var/lib/pam_llng
202202
chmod 700 /var/lib/pam_llng
203203

204-
# Enable and start heartbeat timer
205-
if [ -d /run/systemd/system ]; then
206-
systemctl daemon-reload || true
207-
systemctl enable pam-llng-heartbeat.timer || true
208-
systemctl start pam-llng-heartbeat.timer || true
209-
fi
210-
211204
# Clear secret from debconf database for security
212205
db_set libpam-llng/client-secret ""
213206
fi

tests/test_secret_store.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@ static int tests_passed = 0;
3030
} while(0)
3131

3232
static const char *test_store_dir = "/tmp/test_pam_llng_secrets";
33+
static int machine_id_available = 0;
34+
35+
/* Check if /etc/machine-id exists (required for secret store) */
36+
static int check_machine_id(void)
37+
{
38+
struct stat st;
39+
return stat("/etc/machine-id", &st) == 0;
40+
}
3341

3442
/* Setup test directory */
3543
static void setup(void)
3644
{
3745
mkdir(test_store_dir, 0700);
46+
machine_id_available = check_machine_id();
3847
}
3948

4049
/* Recursively remove directory - safe alternative to system("rm -rf") */
@@ -79,6 +88,11 @@ static void cleanup(void)
7988
/* Test initialization */
8089
static int test_init(void)
8190
{
91+
if (!machine_id_available) {
92+
printf("SKIP (no machine-id) ");
93+
return 1;
94+
}
95+
8296
secret_store_config_t config = {
8397
.enabled = true,
8498
.store_dir = (char *)test_store_dir,
@@ -97,6 +111,11 @@ static int test_init(void)
97111
/* Test store and retrieve */
98112
static int test_put_get(void)
99113
{
114+
if (!machine_id_available) {
115+
printf("SKIP (no machine-id) ");
116+
return 1;
117+
}
118+
100119
secret_store_config_t config = {
101120
.enabled = true,
102121
.store_dir = (char *)test_store_dir,
@@ -131,6 +150,11 @@ static int test_put_get(void)
131150
/* Test exists */
132151
static int test_exists(void)
133152
{
153+
if (!machine_id_available) {
154+
printf("SKIP (no machine-id) ");
155+
return 1;
156+
}
157+
134158
secret_store_config_t config = {
135159
.enabled = true,
136160
.store_dir = (char *)test_store_dir,
@@ -156,6 +180,11 @@ static int test_exists(void)
156180
/* Test delete */
157181
static int test_delete(void)
158182
{
183+
if (!machine_id_available) {
184+
printf("SKIP (no machine-id) ");
185+
return 1;
186+
}
187+
159188
secret_store_config_t config = {
160189
.enabled = true,
161190
.store_dir = (char *)test_store_dir,
@@ -184,6 +213,11 @@ static int test_delete(void)
184213
/* Test not found */
185214
static int test_not_found(void)
186215
{
216+
if (!machine_id_available) {
217+
printf("SKIP (no machine-id) ");
218+
return 1;
219+
}
220+
187221
secret_store_config_t config = {
188222
.enabled = true,
189223
.store_dir = (char *)test_store_dir,
@@ -207,6 +241,11 @@ static int test_not_found(void)
207241
/* Test different keys */
208242
static int test_different_keys(void)
209243
{
244+
if (!machine_id_available) {
245+
printf("SKIP (no machine-id) ");
246+
return 1;
247+
}
248+
210249
secret_store_config_t config = {
211250
.enabled = true,
212251
.store_dir = (char *)test_store_dir,
@@ -240,6 +279,11 @@ static int test_different_keys(void)
240279
/* Test overwrite */
241280
static int test_overwrite(void)
242281
{
282+
if (!machine_id_available) {
283+
printf("SKIP (no machine-id) ");
284+
return 1;
285+
}
286+
243287
secret_store_config_t config = {
244288
.enabled = true,
245289
.store_dir = (char *)test_store_dir,
@@ -290,6 +334,11 @@ static int test_disabled(void)
290334
/* Test binary data */
291335
static int test_binary_data(void)
292336
{
337+
if (!machine_id_available) {
338+
printf("SKIP (no machine-id) ");
339+
return 1;
340+
}
341+
293342
secret_store_config_t config = {
294343
.enabled = true,
295344
.store_dir = (char *)test_store_dir,
@@ -352,6 +401,11 @@ static int test_error_message(void)
352401
/* Test rotate key returns error (not implemented) */
353402
static int test_rotate_key_not_implemented(void)
354403
{
404+
if (!machine_id_available) {
405+
printf("SKIP (no machine-id) ");
406+
return 1;
407+
}
408+
355409
secret_store_config_t config = {
356410
.enabled = true,
357411
.store_dir = (char *)test_store_dir,

0 commit comments

Comments
 (0)