[Kea-users] Kea-users Digest, Vol 122, Issue 13

Darren Ankney darren.ankney at gmail.com
Sat Aug 10 15:21:50 UTC 2024


Hi,

I think the legal log will have the features you are looking for
(https://kea.readthedocs.io/en/kea-2.6.1/arm/hooks.html#libdhcp-legal-log-so-forensic-logging).

Alternatively, you could log the packets in DEBUG (see:
https://kea.readthedocs.io/en/kea-2.6.1/arm/logging.html sepcifically
kea-dhcp4.packets).  At some debuglevel (45 perhaps?), the logger
starts to dump the contents of the packets.  This may show the data
you are after if it is able to pretty print the content of the
option(s).

Thank you,
Darren Ankney

On Fri, Aug 9, 2024 at 8:25 AM Uskokovic, Sinisa
<sinisa.uskokovic at wu.ac.at> wrote:
>
> Hi Darren,
>
> Thank you for your answer.
>
> What I actually need is to pretty-print the contents of what switch added the option 82 into the logs. To be clear, here is an excerpt of what we have now in our isc dhcp:
>
> ...
> set SwitchName = "";
> if ((exists agent.remote-id) and (substring (option agent.remote-id, 0, 1) = 0))
>         {       #       Remote ID Type 0 means Mac Address
>         # Ethernetadress of FIRST Interface
>         set SwitchMac = concat (
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 2, 1))),2), ":",
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 3, 1))),2), ":",
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 4, 1))),2), ":",
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 5, 1))),2), ":",
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 6, 1))),2), ":",
>             suffix (concat ("0", binary-to-ascii (16, 8, "", substring (option agent.remote-id, 7, 1))),2));
>         set SwitchName = SwitchMac;
> }
>
> if ((exists agent.remote-id) and (substring (option agent.remote-id, 0, 1) = 1))
>         {       #       Remote ID Type 1 means ASCII String
>         set SwitchName_Length = extract-int (substring (option agent.remote-id, 1, 1),8);
>         set SwitchName = substring (option agent.remote-id, 2, SwitchName_Length);
> }
> #       Switch="switchname";
> if (SwitchName = "") {set LogSwitchName = "";}
> else {set LogSwitchName = concat (" Switch=\042", SwitchName, "\042;");}
>
> set LogSlotPortVlan = "";
> if ((exists agent.circuit-id) and (substring (option agent.circuit-id, 0, 1) = 0))
>       { #       Remote ID Type 0
>         set Vlan =       binary-to-ascii(10,16,"", substring(option agent.circuit-id,2,2));
>         set SwitchSlot = binary-to-ascii(10,8, "", substring(option agent.circuit-id,4,1));
>         set SwitchPort = binary-to-ascii(10,8, "", substring(option agent.circuit-id,5,1));
> #                       SlotPort="n/nn"; Vlan="nnnn";
> set LogSlotPortVlan = concat (" SlotPort=\042", SwitchSlot, "/", SwitchPort, "\042;", " Vlan=\042", Vlan, "\042;");
> }
> ...
>
> So, my question is how to implement this in kea dhcp?
>
> Kind regards,
> Sinisa
>
> Message: 4
> Date: Thu, 8 Aug 2024 05:46:25 -0400
> From: Darren Ankney <darren.ankney at gmail.com>
> To: "Kea user's list" <kea-users at lists.isc.org>
> Subject: Re: [Kea-users] Custom logging in kea dhcp
> Message-ID:
>         <CAKabWHjjc-Xx_7p9bpMuRgrAcyXTFB9pNeCv-sYOnaG21H+mAg at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi Wu,
>
> Perhaps this article might help a little?
> https://kb.isc.org/docs/isc-dhcp-logging-compared-to-kea
>
> Thank you,
> Darren Ankney
>
> On Tue, Aug 6, 2024 at 7:23?AM Uskokovic, Sinisa <sinisa.uskokovic at wu.ac.at> wrote:
> >
> > Hi all,
> >
> >
> >
> > Does anyone know how to get client device information like MAC address, Switch Port, Vlan and so on in kea dhcp? We have all of these in our custom made isc dhcp logging configuration, but I have no idea how this can be achieved in kea dhcp. I can paste our current conf if it helps.
> >
> >
> >
> > Kind regards,
> >
> > Sini?a
> >
> >
> >
> > Sinisa Uskokovic
> > IT-SERVICES, Core Services
> >
> > WU
> > Wirtschaftsuniversit?t Wien
> >
> > Vienna University of Economics and Business
> > 1020 Wien, Welthandelsplatz 1, Geb?ude LC
> >
> > Tel: +43-1-313-36 - 4147
> > E-Mail: sinisa.uskokovic at wu.ac.at
> >
> > Web: www.wu.ac.at/it
> >
> >
> >
> > --
> > ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
> >
> > To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
> >
> > Kea-users mailing list
> > Kea-users at lists.isc.org
> > https://lists.isc.org/mailman/listinfo/kea-users
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
>
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users
>
>
> ------------------------------
>
> End of Kea-users Digest, Vol 122, Issue 13
> ******************************************
> --
> ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users


More information about the Kea-users mailing list