Zentyal Customization (templates, hooks, LDAP)
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Zentyal Customization (templates, hooks, LDAP)

on

  • 18,511 views

Learn how to customize your Zentyal Server by modifying configuration files templates

Learn how to customize your Zentyal Server by modifying configuration files templates

Statistics

Views

Total Views
18,511
Views on SlideShare
18,511
Embed Views
0

Actions

Likes
2
Downloads
187
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Zentyal Customization (templates, hooks, LDAP) Presentation Transcript

  • 1. How to customize Zentyal(hooks, templates and LDAP)Zentyal Summit 201112th NovemberCarlos Pérez-Aradros <cperez@zentyal.com> Linux small business server
  • 2. Linux small business serverZentyal... Easy to use Good integration Versatile...but sometimes you need Some specific customization Integration with external apps www.zentyal.com © eBox Technologies S.L. 2011
  • 3. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Upstream! Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  • 4. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  • 5. Linux small business serverTemplates (I) Zentyal uses templates to write system configurations files Modify templates to: Adjust parameters to adapt Zentyal to your requirements Add/remove configuration options www.zentyal.com © eBox Technologies S.L. 2011
  • 6. Linux small business serverTemplates (II) Mason as template processor www.zentyal.com © eBox Technologies S.L. 2011
  • 7. Linux small business serverTemplates (III) Default templates location: /usr/share/zentyal/stubs/<module>/<template>.mas Custom templates: /etc/zentyal/stubs/<module>/<template>.mas www.zentyal.com © eBox Technologies S.L. 2011
  • 8. Linux small business serverTemplates (IV)Default stub/usr/share/zentyal/stubs/network/resolv.conf.mas T Conf file /etc/resolv.conf TCustom stub/etc/zentyal/stubs/network/resolv.conf.mas www.zentyal.com © eBox Technologies S.L. 2011
  • 9. Linux small business serverTemplates example: Samba hidden folders We want to add a hidden folder in File Sharing module (samba) Zentyal GUI doesnt allow this: www.zentyal.com © eBox Technologies S.L. 2011
  • 10. Linux small business serverTemplates example: Samba hidden folders Copy and edit default template: mkdir -p /etc/zentyal/stubs/samba/ cp /usr/share/zentyal/stubs/samba/smb.conf.mas /etc/zentyal/stubs/samba/ Write custom configuration www.zentyal.com © eBox Technologies S.L. 2011
  • 11. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  • 12. Linux small business serverHooks (I) Execute actions (scripts) during Zentyal save changes process Create hook scripts to: Watch for changes in any module Add custom scripts before/after module actions www.zentyal.com © eBox Technologies S.L. 2011
  • 13. Linux small business serverHooks (II): paths Before saving changes /etc/zentyal/pre-save/ After saving changes /etc/zentyal/post-save/ /etc/zentyal/hooks/ Before saving module configuration <module>.presetconf After saving module configuration <module>.postsetconf Before restarting the service <module>.preservice After restarting the service <module>.postservice www.zentyal.com © eBox Technologies S.L. 2011
  • 14. Linux small business server one time for each moduleHooks (III) pre-save .presetconf Write conf files .postsetconf .preservice Restart daemons .postservice hook post-save Zentyal action www.zentyal.com © eBox Technologies S.L. 2011
  • 15. Linux small business serverHooks Example: Firewall We want to block traffic from a specific country (using GeoIP) Zentyal GUI does not allow this kind of rules If we add the rule by hand: Firewall module restart will delete it Solution: Add the rule after firewall restart (postservice hook) www.zentyal.com © eBox Technologies S.L. 2011
  • 16. Linux small business serverHooks Example: Firewall Setup GeoIP sudo apt-get install module-assistant sudo module-assistant a-i xtables-addons wget http://sourceforge.net/projects/xtables- addons/files/Xtables-addons/1.38/xtables-addons-1.38.tar.xz sudo ./xt_geoip_dl sudo ./xt_geoip_build *.csv sudo mkdir /var/geoip && sudo cp -r LE /var/geoip www.zentyal.com © eBox Technologies S.L. 2011
  • 17. Linux small business serverHooks Example: Firewall Create the hook /etc/zentyal/hooks/firewall.postservice #!/bin/sh sudo iptables -I INPUT -m geoip --src-cc KP -j ACCEPT Dont forget to make it executable! chmod +x /etc/zentyal/hooks/firewall.postservice www.zentyal.com © eBox Technologies S.L. 2011
  • 18. Linux small business serverHooks: Future (3.0) Users operations hooks create modify delete Backup pre-backup post-backup www.zentyal.com © eBox Technologies S.L. 2011
  • 19. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  • 20. Linux small business serverLDAP Integration (I) Zentyal provides great Users and Groups management LDAP integration: Central point for users management Centralized authentication Distributed: master / slave architecture www.zentyal.com © eBox Technologies S.L. 2011
  • 21. Linux small business serverLDAP Integration (II) Integrate third apps with Zentyal Users and Groups www.zentyal.com © eBox Technologies S.L. 2011
  • 22. Linux small business serverLDAP Integration (II): settings Users and Groups → LDAP Settings Server: ldap://localhost:389/ (port 1389 in slaves) Users DN: ou=Users,<basedn> Groups DN: ou=Groups,<basedn> www.zentyal.com © eBox Technologies S.L. 2011
  • 23. Linux small business serverLDAP Integration (III): filtersuid=cperez,ou=Users,dc=zentyal,dc=comuid: cperez Base DN: ou=Users,dc=zentyal,dc=comloginShell: /usr/sbin/nologinuidNumber: 2002 Filter: (uid=*)gidNumber: 1901homeDirectory: /home/cperezobjectClass: inetOrgPersonobjectClass: posixAccountobjectClass: passwordHolder cn=developers,ou=Groups,dc=zentyal,dc=comgivenName: Carlos cn: developersuserPassword: {SHA}... gidNumber: 2005eboxSha1Password: {SHA}... objectClass: posixGroupeboxMd5Password: {MD5}... memberUid: cperezeboxDigestPassword: {MD5}... memberUid: jsalameroeboxRealmPassword: {MD5}... memberUid: ejhernandezcn:; Carlos Pérez-Aradros Herce memberUid: jacalvo memberUid: jamorsn:; Pérez-Aradros Herce ... www.zentyal.com © eBox Technologies S.L. 2011 c
  • 24. Linux small business serverLDAP Integration example: Wordpress www.zentyal.com © eBox Technologies S.L. 2011
  • 25. Linux small business serverLDAP Integration example: Wordpress Look for a LDAP Auth backend www.zentyal.com © eBox Technologies S.L. 2011
  • 26. Linux small business serverLDAP Integration example: Wordpress www.zentyal.com © eBox Technologies S.L. 2011
  • 27. Linux small business serverIn summary Modify source code Add new logic or functionality Breaks on upgrade Upstream! Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  • 28. Linux small business serverGet help Zentyal Support Forum http://forum.zentyal.org Users and Developers mailing lists https://lists.zentyal.com/cgi-bin/mailman/listinfo/zentyal-devel https://lists.zentyal.com/cgi-bin/mailman/listinfo/zentyal-users IRC #zentyal at freenode.net Official support and training http://www.zentyal.com/en/services/ Contribute! www.zentyal.com © eBox Technologies S.L. 2011
  • 29. Linux small business serverFurther reading... Zentyal Documentation - Advanced Service Customisation http://doc.zentyal.org/en/develop.html Mason Documentation (Templates) http://www.masonhq.com/docs/manual/Devel.html xtables addons http://xtables-addons.sourceforge.net/ Openldap filters doc http://www.zytrax.com/books/ldap/apa/search.html www.zentyal.com © eBox Technologies S.L. 2011
  • 30. Linux small business serverwww.zentyal.com ? © eBox Technologies S.L. 2011