{"id":1478,"date":"2011-08-30T00:00:00","date_gmt":"2011-08-29T22:00:00","guid":{"rendered":"https:\/\/wwwneu.strehle.de\/tim\/weblog\/archives\/2011\/08\/30\/1418\/"},"modified":"2011-08-30T00:00:00","modified_gmt":"2011-08-29T22:00:00","slug":"1418","status":"publish","type":"post","link":"https:\/\/www.strehle.de\/tim\/weblog\/archives\/2011\/08\/30\/1418\/","title":{"rendered":"HTTP basic authentication using OS X Lion Server accounts"},"content":{"rendered":"<p>Mac OS X Lion Server has a nice built-in directory (LDAP) server \u2013 when you need to password protect a web page hosted there, you don&#8217;t want to set up user accounts in old-fashioned &#8222;htpasswd&#8220; text files. It&#8217;s much nicer to set up HTTP basic authentication against the users and groups you manage in the Server App.<\/p>\n<p>With some help from the <a href=\"http:\/\/trac.edgewall.org\/wiki\/TracOnLeopardServer\">Trac documentation<\/a>, it was quite easy to make this work. (Please note that I&#8217;m not an OS X Server expert, so I might have broken something or missed a better way. Try at your own risk.)<\/p>\n<p>First I enabled mod_auth_basic.so in the Apache web server configuration file \/etc\/apache2\/httpd.conf (seems to be required in addition to mod_auth_apple.so) \u2013 for some reason, this line is missing in the &lt;IfDefine MACOSXSERVER&gt; block so I added it there:<\/p>\n<p>LoadModule auth_basic_module libexec\/apache2\/mod_auth_basic.so<\/p>\n<p>Then I inserted this into \/etc\/apache2\/sites\/0000_any_80_.conf:<\/p>\n<p>&lt;Directory &#8222;\/Library\/Server\/Web\/Data\/Sites\/Default\/secret&#8220;&gt;<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\nAuthName &#8222;Secret stuff&#8220;<br \/>\nAuthType Basic<br \/>\nAuthUserFile \/dev\/null<br \/>\nAuthBasicAuthoritative Off<br \/>\nRequire valid-user<\/p>\n<h1>Instead of &#8222;valid-user&#8220;, you could also limit access by group name:<\/h1>\n<h1>Require group &#8222;dcxadmin&#8220;<\/h1>\n<p>&lt;\/Directory&gt;<\/p>\n<p>After an Apache restart (sudo \/usr\/sbin\/apachectl restart), everything worked as expected: I was able to access the password protected directory with a test user account created in Server App.<\/p>\n<p>[Update 2013-02-14: Alvaro Miranda points out an even easier way \u2013 <a href=\"http:\/\/kikitux.blogspot.co.nz\/2013\/02\/osx-server-https-with-password-page.html\">OSX Server https with password page<\/a>.]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mac OS X Lion Server has a nice built-in directory (LDAP) server \u2013 when you need to password protect a web page hosted there, you don&#8217;t want to set up user accounts in old-fashioned &#8222;htpasswd&#8220; text files. It&#8217;s much nicer to set up HTTP basic authentication against the users and groups you manage in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_share_on_mastodon":"0"},"categories":[1],"tags":[],"class_list":["post-1478","post","type-post","status-publish","format-standard","hentry","category-weblog"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts\/1478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/comments?post=1478"}],"version-history":[{"count":0,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/posts\/1478\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/media?parent=1478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/categories?post=1478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strehle.de\/tim\/wp-json\/wp\/v2\/tags?post=1478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}