Hello,
I'm trying to implement CLI context awareness (context = / if (context == ...)) but the context set in one session comes back empty in the next session on the same single-connection. While debugging this, the daemon also crashes (13:50:36 in the log) with a SIGSEGV right after the authorization request, while processing the subsequent accounting packet.
Reproducible on the latest master (commit 4570c1c568d16905c3090aaad8f625f7b1a28203) with a ZTE device (single-connect flag negotiated, PAP login).
Steps to reproduce: log in, then run configure terminal → interface vlan82 → ip address 10.27.27.1/30. The crash happens on the accounting packet for the last command.
Attached: debug logs (PACKET + regex trace), backtrace, profile and device config.
The profile config:
Hi Alexandre,
thanks for reporting! I'd like to address the SEGV issue first, I think
diff --git a/tac_plus-ng/context.c
b/tac_plus-ng/context.c
index 1ed910f..6d32940 100644
--- a/tac_plus-ng/context.c
+++ b/tac_plus-ng/context.c
@@ -107,6 +107,8 @@ void tac_script_set_exec_context(tac_session
*session, char *ctxname)
sc = RB_payload(rb, struct shellctx *);
free(sc->ctxname);
} else {
+ if (!ctxname || !*ctxname)
+ return;
sc = calloc(1, sizeof(struct shellctx) +
session->username.len + session->port.len);
sc->username = sc->data;
sc->portname = sc->data + session->username.len
+ 1;
will fix that one, I'll commit this change shortly.
Regarding the main issue: Could you please retry with full debugging enabled? I don't see any script related logs, but these might actually help locating the problem.
Thanks,
Marc
--
You received this message because you are subscribed to the Google Groups "Event-Driven Servers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-driven-ser...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/e4d6e063-ebb4-42d6-9bc9-ac0f6cbb3d75n%40googlegroups.com.
Hi Alexandre,
you sure about the debug level? The debug output shows no ACL debugs at all.
Cheers,
Marc
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/ea035671-a518-406e-945b-86bc3f988f87n%40googlegroups.com.
Hi Alexandre,
debug = PACKET AUTHEN AUTHOR MAVIS PROC ACL
should work.
Thanks,
Marc
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/9563d383-4509-4c2e-9ed8-46ee4e537c18n%40googlegroups.com.
Hi Alexandre,
thanks -- the debug output indicates that the "context" value was set, but the daemon didn't recognize it later.
Alas, I couldn't reproduce that behavior on my system. Is the "context timeout" value still at the 3600s default?
Cheers,
Marc
--
You received this message because you are subscribed to the Google Groups "Event-Driven Servers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-driven-ser...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/e66b7048-6856-4d54-b10b-1339a35a6a9d%40googlemail.com.
Hi Alexandre,
I've tested the context feature with the config below, no issues
seen.
Please provide a minimalistic but complete config file for further
testing. Also, I've seen gcc bugs before, so please let me know
your compiler version.
Cheers,
Marc
id = spawnd {
background = yes
single process = yes
listen { port = 4949 }
}
id = tac_plus-ng {
device world {
address = ::/0
key = demo
single-connection = yes
enable 15 = login
}
user demo {
password login = clear demo
password pap = login
profile {
script {
if (service == shell) {
if (cmd == "") {
set priv-lvl = 15
permit
}
if (cmd =~ /^interface Loopback 100 /) {
context = "lo100"
message = "context set to ${context}
(${cmd})"
permit
}
if (cmd =~ /^interface /) {
context = ""
message = "context reset (${cmd})"
permit
}
if (context == "lo100" && cmd =~
/^(no )?ip address /) {
message = "context ${context} matched,
permitting ${cmd}"
permit
}
if (cmd =~ /^(no )?ip address /) {
deny
}
permit
}
}
}
}
}
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/9589e8e1-efa8-4767-9708-1c394d524852%40googlemail.com.
Hi,
the configuration you gave closely mirrors my sample, but sets a context and doesn't evaluate it. This looks AI generated and unvalidated. Please don't waste my time.
Cheers,
Marc
Hi Alexandre,
I couldn't repoduce the problem, but I've done some code refactoring (e626beba064fa375e1619e13f0fc917bfcc80f76) nevertheless. Please git pull, rebuild and retry.
Thanks,
Marc
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/62cf95a3-249d-44a9-af3f-46e08da8ed2cn%40googlegroups.com.
Hi Alexandre,
ok, thanks, I think I found the issue, this only happened with command accounting being active, and 59299e1fd41808531d6c1271dea8712d8d8ca160 should fix it. Please git pull and retry once more.
Cheers,
Marc
To view this discussion visit https://groups.google.com/d/msgid/event-driven-servers/86b6bfaf-366e-4279-8a83-c49e09e28ee7n%40googlegroups.com.