User's e-mail address an accessible variable?

I know this sounds odd. Under LDAP Users and Groups, I have attributes that all new users receive:

sn: ${REAL}
authAuthority: ;basic;

I would like to put their e-mail address into ldap as well so that dbmail will recognize it. Can I do something like:

mail: ${EMAILADDRESS}

?

Yes. MAILBOX is better. USER could very well be entirely wrong. :wink:

Wow these posts are showing up COMPLETELY out of order…

Wow these posts are showing up COMPLETELY out of order...

Yes, sorry. I bumped the timezone in the forums (since it so cleverly has its own time zone, at odds with the rest of Joomla and the server itself…real smart) to correct it…so our posts are going to be a wee bit messy for another few hours.

When I submit the form, I get an amusing, albeit entirely wrong error:

“Failed to save mailbox : The additional email domain ‘oss-solutions.com’ is not managed by Virtualmin”

I beg to differ… :smiley:

Good job, Tony, you broke the Internet.

I’ll ask Jamie to chime in (if he can make heads or tails of the order of messages since the TZ change). As you know, we think LDAP is nifty and all, and as long as it’s not too hard and we don’t have to think much, we’ll do what we can do support it. :wink:

Hi Tony,

Regarding the additional email addresses problem, I wasn’t able to re-produce this myself. However, the only cases where that message could appears is if the domain name wasn’t entered correctly, or if the oss-solutions.com domain doesn’t have email enabled.

Are either of those the case?

d’oh! :slight_smile:

Here’s the pertinent parts of my personal entry from LDAP in ldif format:

version: 1
dn: uid=tshadwick,cn=users,dc=oss-solutions,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
objectClass: apple-user
objectClass: extensibleObject
objectClass: organizationalPerson
objectClass: top
objectClass: person
apple-generateduid: 40EE732D-7C95-4AE2-BB26-31D3F6D8A35A
apple-imhandle: AIM:tonyshadwick
apple-imhandle: JABBER:tshadwick@oss-solutions.com
apple-mcxflags:: SNIP
apple-mcxsettings:: *SNIP
apple-mcxsettings:: SNIP
apple-user-picture: /private/Network/Servers/nas1.oss-solutions.com/mnt/home/tshadwick/Library/Images/iChat Recent Pictures/Recent 1.jp2
apple-webloguri: http://www.numbski.com
authAuthority: ;ApplePasswordServer;0x45fb046a76d88e290000000500000005,1024 35 151065087552365604662078053629772612290451253897449139807761324872121578236120047288155653152944089278080889602367588271055754278910497130577738270309682434205013777183280878944259422232257321274949926628553133410079079204895203526240725395504763554014428908067293849022106544972630274236718090726484292219531 SNIP
authAuthority: ;Kerberosv5;0x45fb046a76d88e290000000500000005;tshadwick@OSS-SOLUTIONS.COM;OSS-SOLUTIONS.COM;1024 35 151065087552365604662078053629772612290451253897449139807761324872121578236120047288155653152944089278080889602367588271055754278910497130577738270309682434205013777183280878944259422232257321274949926628553133410079079204895203526240725395504763554014428908067293849022106544972630274236718090726484292219531 SNIP
c: United States
cn: Tony Shadwick
facsimileTelephoneNumber: SNIP
gidNumber: 20
givenName: Tony
homeDirectory: /Network/Servers/nas1.oss-solutions.com/mnt/home/tshadwick
l: Ballwin
labeledURI: http://www.oss-solutions.com
loginShell: /bin/bash
mail: tshadwick@oss-solutions.com
mail: tony@hksilver.net
mobile: SNIP
postalCode: SNIP
sn: Shadwick
st: Missouri
street: 555 SomeStreet
telephoneNumber: SNIP
uid: tshadwick
uidNumber: 1025
userPassword:: None of your bizness, buster. :smiley:

Virtualmin actually has two ways it can talk to LDAP - one is for regular Unix users in an LDAP DB, and the other is designed more for a Qmail+LDAP (or Postfix or Sendmail) environment. In the latter case, it will actually set all those mail-related attributes like mail: for you automaticallly…

So…what, in Virtualmin’s module config, should I fill in the fields as those I were using Qmail+LDAP?

Yeah, if you are using Sendmail then the Qmail+LDAP mode isn’t going to help, as it won’t update the various Sendmail config files like local-domain-names.

You may instead want to look into Virtualmin/Webmin’s post-user-creation script functionality, and have that call the LDAP commands you need to add the attributes.

Would love to. That’s what I’m trying to find. :slight_smile: Where can I find it?

Actually, I just realized that attributes like the email addresses are not available to post-user creation scripts … so that won’t help you.

Did you have any luck with setting custom LDAP attributes for new users in the LDAP Users and Groups module? These can be set on the Module Config page, in the ‘LDAP properties for all new users’ field…

Actually, scratch that - I just realized that this approach isn’t going to work either, as even though there is a user attribute $EXTRAEMAIL that contains all the addresses, it is a perl hash and so isn’t suitable for substituting into that field…

So right now, I can’t think of any solution that can be done in the current Virtualmin release.

That said, I could add an option to the set the ‘mail’ LDAP attribute with all email addresses in the next release. Would that solve the problem for you?

If you want to have a command run after a user is deleted, you can do the following :

  1. Click on Webmin -> System -> Users and Groups.
  2. Click on the Module Config link in the top left and select the ‘Before and after commands’ section.
  3. In the ‘Command to run after making changes’ field, enter :
    test “$USERADMIN_ACTION” = “DELETE_USER” && dbmail-users -e $USERADMIN_USER

Per your instructions, I’ve entered that, but there was a command there already to rebuild the passwd db for FreeBSD, so here’s what I have there now:

test "$USERADMIN_ACTION" = "DELETE_USER" && dbmail-users -e $USERADMIN_USER && /usr/sbin/pwd_mkdb -p /etc/master.passwd

Does that look right to you, or should I have it go afterwards (or does it really matter?)

I would suggest something more like :

(test "$USERADMIN_ACTION" = "DELETE_USER" && dbmail-users -e $USERADMIN_USER) ; /usr/sbin/pwd_mkdb -p /etc/master.passwd

So that pwd_mkdb is always run.

Done. Thanks for the pointer. I almost assuredly would have done that wrong otherwise. :slight_smile:

Thanks again. I look forward to the LDAP population support!

I think right now you’d need to build it–I’m not seeing any variables for the email address. But you could probably do:

${USER}@${DOM}

Or some variant thereof.

I thought I’d replied to this earlier…

is it not ${MAILBOX}@${DOM}

?

I thought I’d replied to this earlier…

is it not ${MAILBOX}@${DOM}

?