"One time" post-invoke hook

View: New views
6 Messages — Rating Filter:   Alert me  

"One time" post-invoke hook

by Julien Valroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am trying to address bug #544573 [1] against rkhunter which I
maintain.

rkhunter postinst script is used to call rkhunter --propupd which
updates/creates its file properties database.

rkhunter recommends some packages, eg. unhide, which are configured
after rkhunter, and hence after rkhunter postinst script is run.

Is there any way to add a temporary post-invoke hook so that the
database is updated/created after all packages are configured?

I have thought that adding a configuration file in /etc/apt/apt.conf.d
in postinst would work, but as apt is already running, it won't consider
that file until the next time it is run.

Another mean would be to force packages like unhide to be configured
before rkhunter (a kind of 'pre-recommends' dependency).

Any hint for this?

Cheers,
Julien

[1] http://bugs.debian.org/544573



--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: "One time" post-invoke hook

by Julien Valroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Le mercredi 04 novembre 2009 à 19:08 +0100, Julien Valroff a écrit :

> Hi,
>
> I am trying to address bug #544573 [1] against rkhunter which I
> maintain.
>
> rkhunter postinst script is used to call rkhunter --propupd which
> updates/creates its file properties database.
>
> rkhunter recommends some packages, eg. unhide, which are configured
> after rkhunter, and hence after rkhunter postinst script is run.
>
> Is there any way to add a temporary post-invoke hook so that the
> database is updated/created after all packages are configured?
>
> I have thought that adding a configuration file in /etc/apt/apt.conf.d
> in postinst would work, but as apt is already running, it won't consider
> that file until the next time it is run.
>
> Another mean would be to force packages like unhide to be configured
> before rkhunter (a kind of 'pre-recommends' dependency).
>
> Any hint for this?
>
> Cheers,
> Julien
>
> [1] http://bugs.debian.org/544573

As I had no answer, I take the leave to re-send this message.

Cheers,
Julien


--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: "One time" post-invoke hook

by Charles Plessy-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Le mercredi 04 novembre 2009 à 19:08 +0100, Julien Valroff a écrit :
> > Hi,
> >
> >
> > rkhunter recommends some packages, eg. unhide, which are configured
> > after rkhunter, and hence after rkhunter postinst script is run.

Hello Julien,

if you can cooperate with the maintainers of packages like unhide, maybe you
can arrange a dpkg trigger? (man 5 deb-triggers)

Note however that their execution is not guaranteed, so maybe it is even
simpler that packages like unhide update rkhunder in their own postinst if it
is installed.

Have a nice day,

--
Charles Plessy
Tsurumi, Kanagawa, Japan


--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: "One time" post-invoke hook

by Julien Valroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Charles,

Thanks for your answer.

Le vendredi 06 novembre 2009 à 15:37 +0900, Charles Plessy a écrit :

> > Le mercredi 04 novembre 2009 à 19:08 +0100, Julien Valroff a écrit :
> > > Hi,
> > >
> > >
> > > rkhunter recommends some packages, eg. unhide, which are configured
> > > after rkhunter, and hence after rkhunter postinst script is run.
>
> Hello Julien,
>
> if you can cooperate with the maintainers of packages like unhide, maybe you
> can arrange a dpkg trigger? (man 5 deb-triggers)

You are right, I think that is the best method which could also be used
by other packages so that the rkhunter database is only updated when
packages are upgraded/installed.

I already had a look to the triggers, but I am not sure to understand
everything.

In the rkhunter & unhide example, rkhunter needs to declare a trigger.
But where and how?

unhide needs to declare its interest in this trigger in debian/triggers
(interest <trigger-name>)

Have a nice day as well

Cheers,
Julien


--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: "One time" post-invoke hook

by Julien Valroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le vendredi 06 novembre 2009 à 08:39 +0100, Julien Valroff a écrit :

> Hi Charles,
>
> Thanks for your answer.
>
> Le vendredi 06 novembre 2009 à 15:37 +0900, Charles Plessy a écrit :
> > > Le mercredi 04 novembre 2009 à 19:08 +0100, Julien Valroff a écrit :
> > > > Hi,
> > > >
> > > >
> > > > rkhunter recommends some packages, eg. unhide, which are configured
> > > > after rkhunter, and hence after rkhunter postinst script is run.
> >
> > Hello Julien,
> >
> > if you can cooperate with the maintainers of packages like unhide, maybe you
> > can arrange a dpkg trigger? (man 5 deb-triggers)
>
> You are right, I think that is the best method which could also be used
> by other packages so that the rkhunter database is only updated when
> packages are upgraded/installed.
>
> I already had a look to the triggers, but I am not sure to understand
> everything.
>
> In the rkhunter & unhide example, rkhunter needs to declare a trigger.
> But where and how?
>
> unhide needs to declare its interest in this trigger in debian/triggers
> (interest <trigger-name>)

Well, I think I have done the right thing:
add a debian/triggers to both rkhunter and unhide containing:
interest rkhunter-update-database

In rkhunter postinst, I have added a triggered action which runs
rkhunter --propupd

However, if I install rkhunter (unhide being installed automatically by
aptitude), nothing happens.
If I reinstall unhide, the trigger is activated.

It seems the trigger is not yet installed though rkhunter is configured
before unhide.

Cheers,
Julien


--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: "One time" post-invoke hook

by Julien Valroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le vendredi 06 novembre 2009 à 10:15 +0100, Julien Valroff a écrit :

> Le vendredi 06 novembre 2009 à 08:39 +0100, Julien Valroff a écrit :
> > Hi Charles,
> >
> > Thanks for your answer.
> >
> > Le vendredi 06 novembre 2009 à 15:37 +0900, Charles Plessy a écrit :
> > > > Le mercredi 04 novembre 2009 à 19:08 +0100, Julien Valroff a écrit :
> > > > > Hi,
> > > > >
> > > > >
> > > > > rkhunter recommends some packages, eg. unhide, which are configured
> > > > > after rkhunter, and hence after rkhunter postinst script is run.
> > >
> > > Hello Julien,
> > >
> > > if you can cooperate with the maintainers of packages like unhide, maybe you
> > > can arrange a dpkg trigger? (man 5 deb-triggers)
> >
> > You are right, I think that is the best method which could also be used
> > by other packages so that the rkhunter database is only updated when
> > packages are upgraded/installed.
> >
> > I already had a look to the triggers, but I am not sure to understand
> > everything.
> >
> > In the rkhunter & unhide example, rkhunter needs to declare a trigger.
> > But where and how?
> >
> > unhide needs to declare its interest in this trigger in debian/triggers
> > (interest <trigger-name>)
>
> Well, I think I have done the right thing:
> add a debian/triggers to both rkhunter and unhide containing:
> interest rkhunter-update-database
>
> In rkhunter postinst, I have added a triggered action which runs
> rkhunter --propupd
>
> However, if I install rkhunter (unhide being installed automatically by
> aptitude), nothing happens.
> If I reinstall unhide, the trigger is activated.
>
> It seems the trigger is not yet installed though rkhunter is configured
> before unhide.

OK, it seems it is the desired behaviour: "Note that if a consumer is
going to be normally configured (i.e. it is also being updated), then no
triggering may occur and thus the standard control flow of the
maintainer scripts should still take care to handle this."

Source: http://www.seanius.net/blog/2009/09/dpkg-triggers-howto/

As a consequence, the only solution I have found is to call rkhunter
--propupd from the rkhunter postinst script (to create the database if
the package is installed for the first time), and call it again from the
unhide postinst script (to update the entries for /usr/bin/unhide).

This is not a real solution as updating rkhunter database is quite slow
on low resource systems, and calling it twice in a row is absolutely not
acceptable.

Any better alternative someone could think of?

Cheers,
Julien


--
To UNSUBSCRIBE, email to debian-mentors-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...