Skip to contentSkip to conversation

HOST expansion with autofs+LDAP

DISCUSSION Wilson Snyder 3 participants 6 messages May 12, 2009 – May 22, 2009 Kernel automounter

lore
Share & tools
lore
#0 lore raw

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Same thing if I use cn=${host}

Any hints? Thanks!

maintainer
#1 lore raw
Quoted 11 lines · Wilson Snyder

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

Quoted 7 lines

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Same thing if I use cn=${host}

Any hints? Thanks!

Oddly enough I think that $HOST should be expanded but I have no idea how you think this is supposed to work because you haven't provided any information about the LDAP entry, other than the dn, or provided any debug log information.

Ian

maintainer
#2 lore raw
Quoted 16 lines · Ian Kent
Quoted 15 lines · Wilson Snyder

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Quoted 8 lines
Quoted 3 lines

Same thing if I use cn=${host}

Any hints? Thanks!

Oddly enough I think that $HOST should be expanded but I have no idea how you think this is supposed to work because you haven't provided any information about the LDAP entry, other than the dn, or provided any debug log information.

Sorry, that isn't correct.
Macro expansion is not done on keys and never has been.

Which begs the question, is it sensible to do macro expansion on keys from a map before trying to match them against the key string received from the kernel for the lookup?

Ian

#3 lore raw
Quoted 27 lines
Quoted 16 lines · Ian Kent
Quoted 15 lines · Wilson Snyder

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Quoted 8 lines
Quoted 3 lines

Same thing if I use cn=${host}

Any hints? Thanks!

Oddly enough I think that $HOST should be expanded but I have no idea how you think this is supposed to work because you haven't provided any information about the LDAP entry, other than the dn, or provided any debug log information.

Quoted 6 lines

Sorry, that isn't correct.
Macro expansion is not done on keys and never has been.

Which begs the question, is it sensible to do macro expansion on keys from a map before trying to match them against the key string received from the kernel for the lookup?

I'm not sure if I'm decoding the question properly, but I suspect it's fast enough to expand on the fly, as that's more flexible, but either way works for my application since HOST is (well is generally) constant.

Can you point me to the right place in t the 5.0.2 sources to patch this in? I see the expansion code in parse_mount but am not sure what the best place to call it from is.

Thanks

-Wilson

maintainer
#4 lore raw
Quoted 27 lines · Wilson Snyder
Quoted 27 lines
Quoted 16 lines · Ian Kent
Quoted 15 lines · Wilson Snyder

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Quoted 7 lines
Quoted 3 lines

Same thing if I use cn=${host}

Any hints? Thanks!

Oddly enough I think that $HOST should be expanded but I have no idea how you think this is supposed to work because you haven't provided any information about the LDAP entry, other than the dn, or provided any debug log information.

Sorry, that isn't correct.
Macro expansion is not done on keys and never has been.

Quoted 8 lines
Quoted 3 lines

Which begs the question, is it sensible to do macro expansion on keys from a map before trying to match them against the key string received from the kernel for the lookup?

I'm not sure if I'm decoding the question properly, but I suspect it's fast enough to expand on the fly, as that's more flexible, but either way works for my application since HOST is (well is generally) constant.

Your not interpreting my statement quite right.
The "between the lines" meaning is "question to self; should I allow this, if not why not"!

Anyway, I haven't got time to ponder that just yet, except for below.

Quoted 4 lines

Can you point me to the right place in t the 5.0.2 sources to patch this in? I see the expansion code in parse_mount but am not sure what the best place to call it from is.

Mmmm ... it's the "key" so one reason why you might find it difficult is that you need to "lookup" the string you get from the kernel as a key in the map source, for example NIS or LDAP, but you can't look it up if the key in the map source needs to be translated in order to match. Catch 22.

There is just no way that we will do a linear search for every lookup. Consider what that would mean to someone with a map of more that 6 or 8 thousand entries.

Things start to get more complicated from here on with regard to this question.

Ian

#5 lore raw
In reply to Wilson Snyder
Quoted 33 lines · [email protected] (Wilson Snyder) writes:
Quoted 26 lines
Quoted 16 lines · Ian Kent
Quoted 15 lines · Wilson Snyder

I have a suse10.3 system which includes autofs-5.0.2-30.2

I'd like an LDAP entry that makes an autofs mountpoint that includes the local host's name. If this wasn't under LDAP I believe "/net/$HOST" would work - creating a "/net/{name-of-hostname}" mountpoint.

However, if I add a mountpoint with cn=$HOST

cn=$HOST,nismapname=auto.net,dc=company,dc=com

The automounter nicely makes a "/net/$HOST" mount - *literally* /net/$HOST, that is it doesn't expand $HOST to the hostname.

Quoted 8 lines
Quoted 3 lines

Same thing if I use cn=${host}

Any hints? Thanks!

Oddly enough I think that $HOST should be expanded but I have no idea how you think this is supposed to work because you haven't provided any information about the LDAP entry, other than the dn, or provided any debug log information.

Quoted 6 lines

Sorry, that isn't correct.
Macro expansion is not done on keys and never has been.

Which begs the question, is it sensible to do macro expansion on keys from a map before trying to match them against the key string received from the kernel for the lookup?

Quoted 8 lines

I'm not sure if I'm decoding the question properly, but I suspect it's fast enough to expand on the fly, as that's more flexible, but either way works for my application since HOST is (well is generally) constant.

Can you point me to the right place in t the 5.0.2 sources to patch this in? I see the expansion code in parse_mount but am not sure what the best place to call it from is.

Here's a general overview of how things work:

1) A process walks into an automount managed mountpoint and does a lookup of a directory, in your case, fully.qualified.domain.name.
2) The kernel passes this on to the automount daemon as a lookup of "fully.qualified.domain.name"
3) the automount daemon checks its maps for an entry with a key of "fully.qualified.domain.name"

So, the trick is figuring out how the automount daemon is supposed to know that "fully.qualified.domain.name" belongs to your entry with cn="$HOST".

You *could* enumerate the entire map on startup, and expand the $HOST in the automounter's cache. However, not all map sources support enumeration (hesiod and program maps come to mind). So, what do you do in those cases?

Further, Ian mentioned that this is a catch 22. You want to parse an entry in the lookup phase. The automounter is laid out in a bit of a layered format:

daemon proper  |
-------------  |
lookup modules |  (looks up keys)
-------------  |
parse modules  |  (expands *entries*)
-------------  |
mount modules  V  (mounts expanded entry on dir named by key)

The flow is as the arrow indicates. What you're asking for is parsing in the lookup module. (It's doable, of course, barring the problem that it won't work for all map types.)

Now, backing up, here, why do you want to create a directory with the local host's fqdn? What are you really trying to do? This goes back to Ian's initial question, I guess.

Cheers,
Jeff