<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Helion-Prime Solutions blog &#187; ypldap</title>
	<atom:link href="http://blogs.helion-prime.com/tag/ypldap/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.helion-prime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 18 Dec 2011 13:27:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Authorization with LDAP on OpenBSD</title>
		<link>http://blogs.helion-prime.com/2009/05/07/authorization-with-ldap-on-openbsd.html</link>
		<comments>http://blogs.helion-prime.com/2009/05/07/authorization-with-ldap-on-openbsd.html#comments</comments>
		<pubDate>Thu, 07 May 2009 11:22:46 +0000</pubDate>
		<dc:creator>vasiliy.kiryanov</dc:creator>
				<category><![CDATA[openBSD]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[login_ldap]]></category>
		<category><![CDATA[ypldap]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=486</guid>
		<description><![CDATA[preamble common case: you have LDAP server and want to use it to authorize your users on OpenBSD. First thing is to understand if you really want to use LDAP server for authorization due to OpenBSD doesn&#8217;t have build-in support for it. But has such support for many others authorization styles: # passwd local password [...]]]></description>
			<content:encoded><![CDATA[<h2>preamble</h2>
<p>common case: you have LDAP server and want to use it to authorize your users on OpenBSD.</p>
<p>First thing is to understand if you really want to use LDAP server for authorization due to OpenBSD doesn&#8217;t have build-in support for it.</p>
<p>But has such support for many others authorization styles:<br />
# passwd local password file<br />
# krb5 Kerberos V password<br />
# radius radius authentication<br />
# skey S/Key authentication<br />
# activ activCard X9.9 token authentication<br />
# crypto CRYPTOCard X9.9 token authentication<br />
# snk Digital Pathways SecureNet Key authentication<br />
# token Generic X9.9 token authentication</p>
<p>see for details: man login.conf</p>
<h2>setup as pain</h2>
<p><strong>1. login_ldap &#8211; contact ldap directory server for authentication</strong></p>
<p>install login_ldap package:<br />
# pkg_add -iv login_ldap</p>
<p>use example files in: [/usr/local/share/examples/login_ldap/]<br />
configure it in /etc/login.conf</p>
<p>you should add something like this:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ldap:\<br />
&nbsp; &nbsp; &nbsp; &nbsp; :<span style="color: #007800;">auth</span>=-ldap:\<br />
&nbsp; &nbsp; &nbsp; &nbsp; :x-ldap-server=127.0.0.1,,ssl:\<br />
&nbsp; &nbsp; &nbsp; &nbsp; :x-ldap-basedn=<span style="color: #007800;">ou</span>=Users,<span style="color: #007800;">ou</span>=auth,<span style="color: #007800;">dc</span>=helion-prime,<span style="color: #007800;">dc</span>=com:\<br />
&nbsp; &nbsp; &nbsp; &nbsp; :x-ldap-filter=<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">objectclass</span>=posixAccount<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">uid</span>=<span style="color: #000000; font-weight: bold;">%</span>u<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:\<br />
&nbsp; &nbsp; &nbsp; &nbsp; :<span style="color: #007800;">tc</span>=default:</div></td></tr></tbody></table></div>
<p>look for details:  man login_ldap</p>
<p>test it with: #  /usr/libexec/auth/login_-ldap -d -s login USERNAME ldap</p>
<p><strong>2. ypldap &#8211; YP map server using LDAP backend (provide users&#8217; info)</strong></p>
<p>as OpenBSD has great support for YP using of ypldap provides soft integration of LDAP server.</p>
<p>use example in man: man ypldap.conf<br />
configure it in /etc/ypldap.conf</p>
<p>you should have something like this:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">interval <span style="color: #000000;">100</span><br />
domain <span style="color: #ff0000;">&quot;helion-prime.com&quot;</span><br />
<br />
provide map <span style="color: #ff0000;">&quot;passwd.byname&quot;</span><br />
provide map <span style="color: #ff0000;">&quot;passwd.byuid&quot;</span><br />
provide map <span style="color: #ff0000;">&quot;group.byname&quot;</span><br />
provide map <span style="color: #ff0000;">&quot;group.bygid&quot;</span><br />
<br />
directory <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># directory options</span><br />
&nbsp; &nbsp;binddn <span style="color: #ff0000;">&quot;cn=Manager,dc=helion-prime,dc=com&quot;</span><br />
&nbsp; &nbsp;bindcred <span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #666666; font-style: italic;">#we don't need it if anonymous searches are allowed</span><br />
&nbsp; &nbsp;basedn <span style="color: #ff0000;">&quot;ou=Users,ou=auth,dc=helion-prime,dc=com&quot;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># passwd maps configuration</span><br />
&nbsp; &nbsp;<span style="color: #c20cb9; font-weight: bold;">passwd</span> filter <span style="color: #ff0000;">&quot;(objectClass=posixAccount)&quot;</span><br />
<br />
&nbsp; &nbsp;attribute name maps to <span style="color: #ff0000;">&quot;uid&quot;</span><br />
&nbsp; &nbsp;fixed attribute <span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #666666; font-style: italic;"># we do no need passwords - we use login_ldap for authentication</span><br />
&nbsp; &nbsp;attribute uid maps to <span style="color: #ff0000;">&quot;uidNumber&quot;</span><br />
&nbsp; &nbsp;attribute gid maps to <span style="color: #ff0000;">&quot;gidNumber&quot;</span><br />
&nbsp; &nbsp;attribute gecos maps to <span style="color: #ff0000;">&quot;cn&quot;</span><br />
&nbsp; &nbsp;attribute home maps to <span style="color: #ff0000;">&quot;homeDirectory&quot;</span><br />
&nbsp; &nbsp;fixed attribute shell <span style="color: #ff0000;">&quot;/bin/ksh&quot;</span> &nbsp;<span style="color: #666666; font-style: italic;"># no bash in default install (check it)</span><br />
&nbsp; &nbsp;fixed attribute change <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #666666; font-style: italic;"># we can have issues with time format (check it)</span><br />
&nbsp; &nbsp;fixed attribute expire <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #666666; font-style: italic;"># we can have issues with time format (check it)</span><br />
&nbsp; &nbsp;fixed attribute class <span style="color: #ff0000;">&quot;ldap&quot;</span> <span style="color: #666666; font-style: italic;"># class of login.conf</span><br />
<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># group maps configuration</span><br />
&nbsp; &nbsp;group filter <span style="color: #ff0000;">&quot;(objectClass=posixGroup)&quot;</span><br />
<br />
&nbsp; &nbsp;attribute groupname maps to <span style="color: #ff0000;">&quot;cn&quot;</span><br />
&nbsp; &nbsp;fixed attribute grouppasswd <span style="color: #ff0000;">&quot;*&quot;</span><br />
&nbsp; &nbsp;attribute groupgid maps to <span style="color: #ff0000;">&quot;gidNumber&quot;</span><br />
&nbsp; &nbsp;list groupmembers maps to <span style="color: #ff0000;">&quot;memberUid&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></td></tr></tbody></table></div>
<p>test it with:  # ypldap -dv</p>
<p>as ypldad currently doesn&#8217;t support ldap over ssl, you should configure your ldap server to listen over regular ldap.<br />
I believe developer soon will create appropriate support for it.</p>
<p><strong>3. ypbind &#8211; create and maintain a binding to a YP server</strong></p>
<p>add your domainname to /etc/defaultdomain<br />
# echo DOMAINNAME &gt; /etc/defaultdomain</p>
<p>the standard way to enable YP passwd support in /etc/master.passwd is to add string: +:::::::::/bin/ksh<br />
use vipw to edit  master.passwd</p>
<p>see for details: man 5 passwd</p>
<p>same with groups:<br />
# echo &#8220;+:::&#8221; &gt;&gt; /etc/group</p>
<p>see for details: man 5 group</p>
<p><strong>4. automate execution</strong></p>
<p>worst part is: we should modify: /etc/rc script</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> X<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">domainname</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">!</span>= X <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>yp<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">domainname</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># YP server capabilities needed...</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">' ypserv'</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ypserv <span style="color: #800000;">${ypserv_flags}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;">#echo -n ' ypxfrd'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ypxfrd</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#if [ -d /var/yp/binding ]; then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; # YP client capabilities needed...</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; echo -n ' ypbind'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ypbind</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#fi</span><br />
....</div></td></tr></tbody></table></div>
<p>second entry will run ypbind before  ypldap that we exec according to OpenBSD rules in rc.local</p>
<p>Then we should add something like this to: /etc/rc/local</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> X<span style="color: #ff0000;">&quot;<span style="color: #007800;">${ypldap_flags}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= X<span style="color: #ff0000;">&quot;NO&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">' ypldap'</span>; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ypldap <span style="color: #800000;">${ypldap_flags}</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>yp<span style="color: #000000; font-weight: bold;">/</span>binding <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">' ypbind'</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ypbind<br />
<span style="color: #000000; font-weight: bold;">fi</span></div></td></tr></tbody></table></div>
<p>And to /etc/rc.conf.local:</p>
<div class="codecolorer-container bash mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">portmap</span>=YES<br />
<span style="color: #007800;">ypldap_flags</span>=<span style="color: #ff0000;">&quot;&quot;</span></div></td></tr></tbody></table></div>
<p>When I review text I see that it is quite easy and it is hard to believe someone can spend more then hour on this ..<br />
Good luck, guys..</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2009/05/07/authorization-with-ldap-on-openbsd.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

