| Welcome to the Zimbra :: Forums! | |
Welcome, if you would like to post a comment please register.
We also encourage you to explore all things Zimbra with our team and members of the community.
|  | 
10-04-2007, 02:31 PM
| | | Automount with Zimbra Hi,
Where would be a good place to put information on how to set up centos 5 (probably would work with other OSes) with automount information coming out of Zimbra's LDAP and having a place to put it in Administrative UI?
-----------------------------------------------------------------------
eh will just put here...
-----------------------------------------------------------------------
step 1: Follow the directions for Installing posixAccount information here
step 2: Update the nis.scheme file - edit the /opt/zimbra/openldap/etc/openldap/schema/nis.schema file in those directions by adding: Code: attributetype ( 1.3.6.1.1.1.1.25 NAME 'automountInformation'
DESC 'Information used by the autofs automounter'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) and modifying: Code: objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount'
DESC 'Abstraction of an account with POSIX attributes'
SUP top AUXILIARY
MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
MAY ( userPassword $ loginShell $ gecos $ description ) ) to be: Code: objectclass ( 1.3.6.1.1.1.2.0 NAME 'posixAccount'
DESC 'Abstraction of an account with POSIX attributes'
SUP top AUXILIARY
MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
MAY ( userPassword $ loginShell $ gecos $ description $ automountInformation ) ) (note that automountInfomation was added to the posixAccount objectclasss)
step 3: Integrate automountInformation into Zimbra Admin UI - download the zimbra_posixaccount.zip file and edit the config_template.xml file and add: Code: <property name="amPath">nfs.example.com:/path/to/homedirs/%u</property> between the <global> tags, next edit the zimbra_posixaccount. js file and make it the following contents: Code: DBG.println(AjxDebug.DBG1,"Loaded zimbra_posixaccount.js");
function zimbra_posixaccount () {
}
ZaZimbraAdmin._POSIX_GROUP_LIST = ZaZimbraAdmin.VIEW_INDEX++;
ZaZimbraAdmin._POSIX_GROUP_VIEW = ZaZimbraAdmin.VIEW_INDEX++;
ZaZimbraAdmin.MSG_KEY[ZaZimbraAdmin._POSIX_GROUP_LIST] = "PSXGroups_view_title";
ZaZimbraAdmin.MSG_KEY[ZaZimbraAdmin._POSIX_GROUP_VIEW] = "PSXGroups_view_title";
if(ZaMsg) {
ZaMsg.PSXGroups_view_title = "Manage Posix Groups";
}
if(ZaItem) {
ZaItem.POSIX_ACCOUNT = "posixAccount";
}
function ZaPosixAccount(app) {
if (arguments.length == 0) return;
ZaItem.call(this, app,"ZaPosixAccount");
this.type = ZaItem.POSIX_ACCOUNT;
this.attrs = [];
this._init(app);
}
ZaPosixAccount.prototype = new ZaItem;
ZaPosixAccount.prototype.constructor = ZaPosixAccount;
ZaPosixAccount.A_gidNumber = "gidNumber";
ZaPosixAccount.A_homeDirectory = "homeDirectory";
ZaPosixAccount.A_uidNumber = "uidNumber";
ZaPosixAccount.A_gecos = "gecos";
ZaPosixAccount.A_loginShell = "loginShell";
ZaPosixAccount.A_automountInformation = "automountInformation";
ZaPosixAccount.A_userPassword = "userPassword";
if(ZaAccount.myXModel && ZaAccount.myXModel.items) {
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_gidNumber,type:_NUMBER_,ref:"attrs/"+ZaPosixAccount.A_gidNumber, required:true});
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_homeDirectory,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_homeDirectory, required:true});
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_automountInformation,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_automountInformation, required:true});
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_uidNumber,type:_NUMBER_, defaultValue:1000,ref:"attrs/"+ZaPosixAccount.A_uidNumber, required:true});
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_loginShell,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_loginShell, required:true});
ZaAccount.myXModel.items.push({id:ZaPosixAccount.A_gecos,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_gecos});
}
if(ZaResource.myXModel && ZaResource.myXModel.items) {
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_gidNumber,type:_NUMBER_,ref:"attrs/"+ZaPosixAccount.A_gidNumber, required:true});
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_homeDirectory,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_homeDirectory, required:true});
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_automountInformation,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_automountInformation, required:true});
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_uidNumber,type:_NUMBER_, defaultValue:1000,ref:"attrs/"+ZaPosixAccount.A_uidNumber, required:true});
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_loginShell,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_loginShell, required:true});
ZaResource.myXModel.items.push({id:ZaPosixAccount.A_gecos,type:_STRING_,ref:"attrs/"+ZaPosixAccount.A_gecos});
}
ZaPosixAccount.getNextUid = function () {
var soapDoc = AjxSoapDoc.create("GetLDAPEntrysRequest", "urn:zimbraAdmin", null);
soapDoc.set("ldapSearchBase", zimbra_posixaccount.ldapSearchBase);
soapDoc.set("query", "(objectClass=posixAccount)");
soapDoc.set("sortBy", ZaPosixAccount.A_uidNumber);
soapDoc.set("sortAscending", "false");
soapDoc.set("limit", "1");
var getPosixAccountsCommand = new ZmCsfeCommand();
var params = new Object();
params.soapDoc = soapDoc;
var nextId = !isNaN(zimbra_posixaccount.uidBase) ? parseInt(zimbra_posixaccount.uidBase) + 1 : 10001;
try {
var resp = getPosixAccountsCommand.invoke(params).Body.GetLDAPEntrysResponse.LDAPEntry[0];
if(resp) {
var acc = new ZaPosixAccount(new Object());;
acc.initFromJS(resp);
nextId = parseInt(acc.attrs[ZaPosixAccount.A_uidNumber])+1;
}
} catch (ex) {
//do nothing - fallback to default id for now, ideally should show a warning
}
return nextId;
}
if(ZaTabView.XFormModifiers["ZaAccountXFormView"]) {
zimbra_posixaccount.AccountXFormModifier= function (xFormObject) {
var cnt = xFormObject.items.length;
var i = 0;
for(i = 0; i <cnt; i++) {
if(xFormObject.items[i].type=="switch")
break;
}
cnt = xFormObject.items[i].items.length;
var posixTabIx = ++ZaAccountXFormView.TAB_INDEX;
var tabBar = xFormObject.items[1] ;
tabBar.choices.push({value:posixTabIx, label:"Posix Account"});
var posixAccountTab={type:_ZATABCASE_, numCols:1, relevant:("instance[ZaModel.currentTab] == " + posixTabIx),
items: [
{type:_ZAGROUP_,
items:[
{ref:ZaPosixAccount.A_gidNumber, type:_OSELECT1_, editable:false,choices:this._app.getPosixGroupIdListChoices(true), msgName:"Posix group",label:"Posix group", labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged},
{ref:ZaPosixAccount.A_gidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_gidNumber,label:ZaPosixAccount.A_gidNumber, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_uidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_uidNumber,label:ZaPosixAccount.A_uidNumber, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_homeDirectory, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_homeDirectory,label:ZaPosixAccount.A_homeDirectory, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250},
{ref:ZaPosixAccount.A_automountInformation, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_automountInformation,label:ZaPosixAccount.A_automountInformation, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250},
{ref:ZaPosixAccount.A_loginShell, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_loginShell,label:ZaPosixAccount.A_loginShell, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250}
]
} ]
};
xFormObject.items[i].items.push(posixAccountTab);
}
ZaTabView.XFormModifiers["ZaAccountXFormView"].push(zimbra_posixaccount.AccountXFormModifier);
}
if(ZaTabView.XFormModifiers["ZaResourceXFormView"]) {
zimbra_posixaccount.ResourceXFormModifier= function (xFormObject) {
var cnt = xFormObject.items.length;
var i = 0;
for(i = 0; i <cnt; i++) {
if(xFormObject.items[i].type=="switch")
break;
}
cnt = xFormObject.items[i].items.length;
var posixTabIx = ++ZaResourceXFormView.TAB_INDEX;
var tabBar = xFormObject.items[1] ;
tabBar.choices.push({value:posixTabIx, label:"Posix Account"});
var posixAccountTab={type:_ZATABCASE_, numCols:1, relevant:("instance[ZaModel.currentTab] == " + posixTabIx),
items: [
{type:_ZAGROUP_,
items:[
{ref:ZaPosixAccount.A_gidNumber, type:_OSELECT1_, editable:false,choices:this._app.getPosixGroupIdListChoices(true), msgName:"Posix group",label:"Posix group", labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged},
{ref:ZaPosixAccount.A_gidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_gidNumber,label:ZaPosixAccount.A_gidNumber, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_uidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_uidNumber,label:ZaPosixAccount.A_uidNumber, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_homeDirectory, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_homeDirectory,label:ZaPosixAccount.A_homeDirectory, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250},
{ref:ZaPosixAccount.A_automountInformation, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_automountInformation,label:ZaPosixAccount.A_automountInformation, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250},
{ref:ZaPosixAccount.A_loginShell, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_loginShell,label:ZaPosixAccount.A_loginShell, labelLocation:_LEFT_, onChange:ZaTabView.onFormFieldChanged, width:250}
]
} ]
};
xFormObject.items[i].items.push(posixAccountTab);
}
ZaTabView.XFormModifiers["ZaResourceXFormView"].push(zimbra_posixaccount.ResourceXFormModifier);
}
if(ZaXDialog.XFormModifiers["ZaNewAccountXWizard"]) {
zimbra_posixaccount.AccountXWizModifier= function (xFormObject) {
var stepCounter = this.stepChoices.length;
ZaNewAccountXWizard.POSIX_ACC_STEP = stepCounter+1;
this.stepChoices.push({value:ZaNewAccountXWizard.POSIX_ACC_STEP, label:"Posix Account"});
this._lastStep = this.stepChoices.length;
var cnt = xFormObject.items.length;
var i = 0;
for(i = 0; i <cnt; i++) {
if(xFormObject.items[i].type=="switch")
break;
}
cnt = xFormObject.items[i].items.length;
var j = 0;
var gotAdvanced = false;
var gotFeatures = false;
var posixAccountStep={type:_CASE_, numCols:1, relevant:"instance[ZaModel.currentStep] == ZaNewAccountXWizard.POSIX_ACC_STEP",
items: [
{type:_ZAWIZGROUP_,
items:[
{ref:ZaPosixAccount.A_gidNumber, type:_OSELECT1_, editable:false,choices:this._app.getPosixGroupIdListChoices(true), msgName:"Posix group",label:"Posix group", labelLocation:_LEFT_},
{ref:ZaPosixAccount.A_gidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_gidNumber,label:ZaPosixAccount.A_gidNumber, labelLocation:_LEFT_, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_uidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_uidNumber,label:ZaPosixAccount.A_uidNumber, labelLocation:_LEFT_, width:250,
getDisplayValue:function () {
var val = this.getInstanceValue();
if(!val) {
val = ZaPosixAccount.getNextUid();
this.setInstanceValue(val);
}
return val;
}
},
{ref:ZaPosixAccount.A_homeDirectory, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_homeDirectory,label:ZaPosixAccount.A_homeDirectory, labelLocation:_LEFT_,
getDisplayValue:function() {
var val = this.getInstanceValue();
var instance = this.getInstance();
if((val === null || val === undefined) && zimbra_posixaccount.homePath && instance && instance.name) {
var chunks = instance.name.split("@");
if(chunks) {
var uname = chunks[0];
if(uname) {
val = String(zimbra_posixaccount.homePath).replace("%u",uname);
this.setInstanceValue(val);
}
}
}
return val;
}
},
{ref:ZaPosixAccount.A_automountInformation, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_automountInformation,label:ZaPosixAccount.A_automountInformation, labelLocation:_LEFT_,
getDisplayValue:function() {
var val = this.getInstanceValue();
var instance = this.getInstance();
if((val === null || val === undefined) && zimbra_posixaccount.amPath && instance && instance.name) {
var chunks = instance.name.split("@");
if(chunks) {
var uname = chunks[0];
if(uname) {
val = String(zimbra_posixaccount.amPath).replace("%u",uname);
this.setInstanceValue(val);
}
}
}
return val;
}
},
{ref:ZaPosixAccount.A_loginShell, type:_OSELECT1_, editable:true, msgName:ZaPosixAccount.A_loginShell,label:ZaPosixAccount.A_loginShell, labelLocation:_LEFT_, choices:zimbra_posixaccount.shells}
]
} ]
};
xFormObject.items[i].items.push(posixAccountStep);
}
ZaXDialog.XFormModifiers["ZaNewAccountXWizard"].push(zimbra_posixaccount.AccountXWizModifier);
}
if(ZaXDialog.XFormModifiers["ZaNewResourceXWizard"]) {
zimbra_posixaccount.ResourceXWizModifier= function (xFormObject) {
var stepCounter = this.stepChoices.length;
ZaNewResourceXWizard.POSIX_ACC_STEP = stepCounter+1;
this.stepChoices.push({value:ZaNewResourceXWizard.POSIX_ACC_STEP, label:"Posix Account"});
this._lastStep = this.stepChoices.length;
var cnt = xFormObject.items.length;
var i = 0;
for(i = 0; i <cnt; i++) {
if(xFormObject.items[i].type=="switch")
break;
}
cnt = xFormObject.items[i].items.length;
var j = 0;
var gotAdvanced = false;
var gotFeatures = false;
var posixAccountStep={type:_CASE_, numCols:1, relevant:"instance[ZaModel.currentStep] == ZaNewResourceXWizard.POSIX_ACC_STEP",
items: [
{type:_ZAWIZGROUP_,
items:[
{ref:ZaPosixAccount.A_gidNumber, type:_OSELECT1_, editable:false,choices:this._app.getPosixGroupIdListChoices(true), msgName:"Posix group",label:"Posix group", labelLocation:_LEFT_},
{ref:ZaPosixAccount.A_gidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_gidNumber,label:ZaPosixAccount.A_gidNumber, labelLocation:_LEFT_, cssClass:"admin_xform_number_input"},
{ref:ZaPosixAccount.A_uidNumber, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_uidNumber,label:ZaPosixAccount.A_uidNumber, labelLocation:_LEFT_, width:250,
getDisplayValue:function () {
var val = this.getInstanceValue();
if(!val) {
val = ZaPosixAccount.getNextUid();
this.setInstanceValue(val);
}
return val;
}
},
{ref:ZaPosixAccount.A_homeDirectory, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_homeDirectory,label:ZaPosixAccount.A_homeDirectory, labelLocation:_LEFT_,
getDisplayValue:function() {
var val = this.getInstanceValue();
var instance = this.getInstance();
if((val === null || val === undefined) && zimbra_posixaccount.homePath && instance && instance.name) {
var chunks = instance.name.split("@");
if(chunks) {
var uname = chunks[0];
if(uname) {
val = String(zimbra_posixaccount.homePath).replace("%u",uname);
this.setInstanceValue(val);
}
}
}
return val;
}
},
{ref:ZaPosixAccount.A_automountInformation, type:_TEXTFIELD_, msgName:ZaPosixAccount.A_automountInformation,label:ZaPosixAccount.A_automountInformation, labelLocation:_LEFT_,
getDisplayValue:function() {
var val = this.getInstanceValue();
var instance = this.getInstance();
if((val === null || val === undefined) && zimbra_posixaccount.amPath && instance && instance.name) {
var chunks = instance.name.split("@");
if(chunks) {
var uname = chunks[0];
if(uname) {
val = String(zimbra_posixaccount.amPath).replace("%u",uname);
this.setInstanceValue(val);
}
}
}
return val;
}
},
{ref:ZaPosixAccount.A_loginShell, type:_OSELECT1_, editable:true, msgName:ZaPosixAccount.A_loginShell,label:ZaPosixAccount.A_loginShell, labelLocation:_LEFT_, choices:zimbra_posixaccount.shells}
]
} ]
};
xFormObject.items[i].items.push(posixAccountStep);
}
ZaXDialog.XFormModifiers["ZaNewResourceXWizard"].push(zimbra_posixaccount.ResourceXWizModifier);
}
zimbra_posixaccount.initSettings= function () {
try {
var soapDoc = AjxSoapDoc.create("GetAdminExtensionZimletsRequest", "urn:zimbraAdmin", null);
var command = new ZmCsfeCommand();
var params = new Object();
params.soapDoc = soapDoc;
var resp = command.invoke(params);
var zimlets = null;
try {
if(resp && resp.Body && resp.Body.GetAdminExtensionZimletsResponse && resp.Body.GetAdminExtensionZimletsResponse.zimlets && resp.Body.GetAdminExtensionZimletsResponse.zimlets.zimlet) {
zimlets = resp.Body.GetAdminExtensionZimletsResponse.zimlets.zimlet;
}
} catch (ex) {
//go on
}
if(zimlets && zimlets.length > 0) {
var cnt = zimlets.length;
for(var ix = 0; ix < cnt; ix++) {
if(zimlets[ix] && zimlets[ix].zimlet && zimlets[ix].zimlet[0] && zimlets[ix].zimletConfig && zimlets[ix].zimletConfig[0]) {
var zimletConfig = zimlets[ix].zimletConfig[0];
if(zimletConfig.name=="zimbra_posixaccount") {
var global = zimletConfig.global[0];
if(global) {
var properties = global.property;
var cnt2 = properties.length;
for (var j=0;j<cnt2;j++) {
zimbra_posixaccount[properties[j].name] = properties[j]._content;
}
}
break;
}
} else {
continue;
}
}
}
} catch (ex) {
//do nothing, do not block the app from loading
}
}
if(ZaSettings.initMethods) // <-- FROM THIS LINE DOWN THE FILE IS THE SAME AS THE ORIGINAL Rebuild the zimbra_posixaccounts.zip and install it via the Admin Extensions in the Administrator UI
Step 4: Telling AutoFs how to access the mapping information - on a system where you want your automount home directories to work (assuming you have the authentication piece already done) edit the /etc/auto.master file and add: Code: /home ldap:ldap.example.com:ou=people,dc=example,dc=com next edit /etc/sysconfig/autofs and add the following lines: Code: DEFAULT_MAP_OBJECT_CLASS="organizationalRole"
DEFAULT_ENTRY_OBJECT_CLASS="posixAccount"
DEFAULT_MAP_ATTRIBUTE="ou"
DEFAULT_ENTRY_ATTRIBUTE="uid"
DEFAULT_VALUE_ATTRIBUTE="automountInformation" restart the autofs service and every thing should be ready to go!
Last edited by tmf; 10-04-2007 at 04:52 PM..
Reason: Added How to do it.
| 
10-05-2007, 07:14 PM
| | Former Zimbran | |
Posts: 5,606
| | The wiki would be Awesome!
Thanks! | 
01-07-2009, 06:47 PM
| | | Ubuntu 8.10 Client and Ubuntu Server LTS - Automount w/Zimbra Good Evening,
I've redeployed the posix extensions.zip after updating the nis schema and modifying the config_template.xml / . js file.
I've also edited the /etc/autofs.master file.
However, I'm using an Ubuntu 8.10 client which can already authenticate to the server which is an Ubuntu LTS Server. I modified the following file instead of /etc/sysconfig/autofs with no success:
/etc/default/autofs
Any suggestions, while I'm tailing my logs? "/var/log/auth.log........
Thanks,
Anthony Curry | 
12-08-2009, 06:36 PM
| | | hello, folks
I'm confusing a bit, in this howto, zimbra will act as nfs server too?
What should I do if I want to have nfs server on another server, then user infomation stored on zimbra server, user login then the automount work same way in this topic? | 
12-09-2009, 06:51 AM
| | | No. Zimbra will not act as an NFS server. But, I used an Ubuntu LTS Server with NFS, automount to provide roaming profiles for Ubuntu 8.10 users about a year ago.
The Ubuntu site at https://help.ubuntu.com/ was very helpful. It provided all the documentation needed. | 
12-11-2009, 07:57 PM
| | | Thank you. I follow this tutorial and then, I login using zimbra user, log say: Dec 12 17:47:26 localhost automount[3361]: lookup_mount: lookup(ldap): key "user1" not found in map
What should I do? | | Thread Tools | Search this Thread | | | | | Display Modes | Linear Mode | | Why Join? Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.  |