<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns="http://purl.org/rss/1.0/">




    



<channel rdf:about="http://www.held-im-ruhestand.de/software/index/RSS">
  <title>index</title>
  <link>http://www.held-im-ruhestand.de</link>

  <description>
    
      
    
  </description>

  

  
            <syn:updatePeriod>daily</syn:updatePeriod>
            <syn:updateFrequency>1</syn:updateFrequency>
            <syn:updateBase>2008-03-20T19:21:36Z</syn:updateBase>
        

  <image rdf:resource="http://www.held-im-ruhestand.de/logo.png"/>

  <items>
    <rdf:Seq>
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/android"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/apache-ldap-active-directory-authentication"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/bugzilla"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/cluster-suite"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/eclipse"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/firefox-1"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/flash-game-highscores"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/network"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/openssl"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/oracle"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/plone-1"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/postfix"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/referer-graph"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/samba-and-active-directory"/>
      
      
        <rdf:li rdf:resource="http://www.held-im-ruhestand.de/software/sheevaplug"/>
      
    </rdf:Seq>
  </items>

</channel>


  <item rdf:about="http://www.held-im-ruhestand.de/software/android">
    <title>Android</title>
    <link>http://www.held-im-ruhestand.de/software/android</link>
    <description>About that google mobile operating system</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-09-20T10:13:47Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/apache-ldap-active-directory-authentication">
    <title>Apache LDAP/Active Directory Authentication</title>
    <link>http://www.held-im-ruhestand.de/software/apache-ldap-active-directory-authentication</link>
    <description>Use a Windows Active Directory (or another LDAP Server) to manage your Apache Basic Authentication</description>
    <content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p>Imagine a typical Company Office. A Microsoft dominated Backoffice using Windows PCs, an Exchange Server and of course an Actice Directory.</p>
<p>Somewhere is an Apache running a smal set of custom Scripts. Now you need to limit the access to this bunch of quick and dirty Apps. Typical solution: put an htaccess file and some htpasswd manages passwords on it. This works but everyone needs to remember his windows login and his Application password. What happens if a user leaves the company? You disable the Windows account. But did you remember to remove him from all the htaccess files?</p>
<p>Goal is to have only one user/password. For everything in the Company and only one central usermanagement. This is your Active Directory. It has the users and LDAP is the interface to use it.</p>
<h2>mod_authnz_ldap</h2>
<p>Make sure your apache supports mod_authnz_ldap. If it is compiled into the binary you can use httpd -L to list it. Otherwise it is in the modules directory as mod_authnz_ldap.so. Maybe you need to install it from your Distributions repository. If you compile from source, use these switches during configure</p>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --enable-ldap \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --enable-authnz-ldap \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --with-included-apr \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --with-ldap&nbsp;</pre>
<h2>Prepare Active Directory</h2>
<p>Authentication consists of</p>
<ol><li>Finding the user (getting the Distinguished Name DN) in the Active Directory using the supplied username</li><li>Binding to the Active Directory using the now found DN and the supplied password</li><li>Doing stuff to find group memberships</li></ol>
<p>&nbsp;</p>
For the first Step (finding the user) we already need access to the Active Directory. As AD won't allow anonymous acces, you need a username and a password just to do the search. This is <strong>not</strong>
<p> your administration account! Create a new account with minimal rights.</p>
<p>So what is the username? Depends on your AD Layout. This should give you a pretty good hint</p>
<p>CN=John Doe,OU=IT Department,OU=Germany,DC=example,DC=com</p>
<h2>httpd.conf</h2>
<p>Let's start with an example</p>
<pre>&lt;Location /protected&gt;
# Using this to bind
AuthLDAPBindDN "CN=John Doe,OU=IT Department,OU=Germany,DC=example,DC=com"
AuthLDAPBindPassword "XXX"
# search user
AuthLDAPURL "ldap://IP-DOMAIN-CONTROLLER/ou=Germany,dc=example,dc=com?sAMAccountName?sub?(objectClass=*)"

AuthType Basic
AuthName "USE YOUR WINDOWS ACCOUNT"
AuthBasicProvider ldap
# Important, otherwise "(9)Bad file descriptor: Could not open password file: (null)"
AuthUserFile /dev/null
require valid-user
&lt;/Location&gt;
</pre>
<p>&nbsp;AuthLDAPBindDN and AuthLDAPBindPassword are uesd for the first step, Accessing the active directory.</p>
<p>Next we need to find the users, this is AuthLDAPURL. It looks like AD won't allow to search the complete Tree (dc=example,dc=com). I always needed to specify at least one organizational unit (ou). We search the whole subtree (sub) not just one folder. When searching the tree we compare sAMAccountName with the username supplied to us. You could also the eMail Addresses</p>
<pre>AuthLDAPURL "ldap://IP-DOMAIN-CONTROLLER/ou=Germany,dc=example,dc=com?mail?sub?(objectClass=*)"
</pre>
<p>AuthType, AuthName should be known.</p>
<p>Important is the AuthUserFile directive.</p>
<h2>Specific Users, Groups</h2>
<pre># specific user
#   Require ldap-user "john.doe"
# specific user by DN
#   Require ldap-dn CN=John Doe,OU=Finance,OU=Germany,DC=example,DC=com
# member of group
#   Require ldap-group CN=Finance Department,OU=Finance,OU=Germany,DC=example,DC=com
</pre>
]]></content:encoded>
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2008-04-05T14:01:54Z</dc:date>
    <dc:type>Page</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/bugzilla">
    <title>Bugzilla</title>
    <link>http://www.held-im-ruhestand.de/software/bugzilla</link>
    <description></description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-06-16T14:30:19Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/cluster-suite">
    <title>Cluster Suite</title>
    <link>http://www.held-im-ruhestand.de/software/cluster-suite</link>
    <description>Redhat Cluster Suite</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-08-21T10:19:23Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/eclipse">
    <title>Eclipse</title>
    <link>http://www.held-im-ruhestand.de/software/eclipse</link>
    <description></description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>admin</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2007-12-09T20:42:04Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/firefox-1">
    <title>Firefox</title>
    <link>http://www.held-im-ruhestand.de/software/firefox-1</link>
    <description></description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-03-08T11:11:46Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/flash-game-highscores">
    <title>Flash Game Highscores</title>
    <link>http://www.held-im-ruhestand.de/software/flash-game-highscores</link>
    <description>About those flash game highscores and why everyone else has a higher score then you</description>
    <content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p>Ever played an online Flash game? Always wondered why everyone has a higher score then you?</p>
<p>Well, flash games need to store highscores somewhere on the server. So on some point during the game, scores are posted. And this happens via http. As http is a well known easy protocoll and most games don't think about protecting the scores someone just posted his score.</p>
<h3>Step 1: log the http traffic.&nbsp;</h3>
<p>For simple cases firebugs net log is enough. For more complicated stuff add a local proxy and capture the traffic. There is no way flash games can prevent you from this.</p>
<h3>Step 2: check how scores are submitted</h3>
<p>If you know the score you just submitted, it is in most cases enough to grep the traffic log and find the http POST request that submits it.</p>
<h3>Step 3: manual submit</h3>
<p>write a five line python to submit the same request again but this time submit a different score.</p>
<pre>#!/usr/bin/python
import urllib2
import urllib

url = 'http://example.com/submit.php'
values = {
    'score': 1234,
}
cookies = ['a=b',]
headers = {
    'User-Agent': 'python',
    'cookie': '; '.join(cookies)
}
data = urllib.urlencode(values)
req = urllib2.Request(url, data, headers)
response = urllib2.urlopen(req)
print response.read()

</pre>
<h3>Advanced</h3>
<p>Flash might encode or encrypt the submitted data. Use a actionscript decompiler and read the code</p>
<h2>Or...</h2>
<p>simply play the game to have fun and not to reach a highscore ;)</p>
<p>&nbsp;</p>
]]></content:encoded>
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-06-13T10:20:53Z</dc:date>
    <dc:type>Page</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/network">
    <title>network</title>
    <link>http://www.held-im-ruhestand.de/software/network</link>
    <description>various stuff about IP routing</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-12-04T16:25:30Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/openssl">
    <title>openssl</title>
    <link>http://www.held-im-ruhestand.de/software/openssl</link>
    <description>Using openssl commandline tool</description>
    <content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p>openssl comes with a nice commandline tool: openssl.</p>
<p>I used to check if some services (like http, smtp) are working by telnetting into them. Then i could just execute commands as needed. Usefull for example to check if an apache normaly accessed by a loadbalancer is serving something for a virtual host.</p>
<pre>echo -e "GET / HTTP/1.1\nhost:www.example.com\n\n" |\
nc physical.example.com 80</pre>
<p>&nbsp;</p>
<p>But as encryption is on the raise i need to check https services. And that is something i can't do by hand.</p>
<p>openssl comes to the rescue.</p>
<pre>openssl s_client -connect www.example.com:443</pre>
<p>&nbsp;</p>
<p>To make the same example as before, you can't simply replace the echo. openssl will terminate the connection as soon as the EOF ist sent via stdin. That is before the response is retrieved. So we make the echo in a subshell and add a sleep</p>
<pre>(echo -e "GET / HTTP/1.1\nhost:www.example.com\n\n"; sleep 5) |\

openssl s_client -connect physical.example.com:443</pre>
<p>&nbsp;</p>
<p>Another nice thing is the check of certifcates. For example expiration date.</p>
<p>&nbsp;</p>
<pre>echo ""&nbsp; |\
openssl s_client -connect www.example.com:443 |\
 openssl x509 -noout -enddate</pre>
<p>Here the immediate termination by openssl is fine, we already got the cert.</p>
]]></content:encoded>
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-06-16T13:25:30Z</dc:date>
    <dc:type>Page</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/oracle">
    <title>oracle</title>
    <link>http://www.held-im-ruhestand.de/software/oracle</link>
    <description>Oracle 10g unter Linux</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>admin</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2007-12-09T20:45:00Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/plone-1">
    <title>plone</title>
    <link>http://www.held-im-ruhestand.de/software/plone-1</link>
    <description>Various stuff related to Plone</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2008-03-30T15:02:04Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/postfix">
    <title>Postfix</title>
    <link>http://www.held-im-ruhestand.de/software/postfix</link>
    <description></description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>admin</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2007-12-09T20:10:11Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/referer-graph">
    <title>Referer Graph</title>
    <link>http://www.held-im-ruhestand.de/software/referer-graph</link>
    <description>Generate a visual map of referes from a logfile</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-03-24T14:25:58Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/samba-and-active-directory">
    <title>Samba and Active Directory</title>
    <link>http://www.held-im-ruhestand.de/software/samba-and-active-directory</link>
    <description>Using a Samba Fileserver authenticating users against an Active Directory Domain Controller </description>
    <content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[
<p>&nbsp;</p>
<div class="plain">
<p>Goal: Using a Linux (Debian 3.1, sarge) as a Fileserver for a Windows Network

<br />To do this the Linux machine will access the Windows Domain Controller to get 
username and passwords. This is done using the winbind daemon. The daemon will also map
linux-userids and groups to windows-sids (A windows Account has a unique SID that 
will differ even if you recreate an account with the same name).</p>
<h1>Software</h1>
<p>
Used Software: Debian, Samba 3, Kerberos

Kerberos packages:</p>
<pre>apt-get install krb5-config krb5-user libkrb53 libpam-krb5</pre>
Samba packages:
<pre>apt-get install samba-common samba winbind smbclient</pre>
Utility packages
<pre>apt-get install ntpdate</pre>
List of package version at the time of writing
<pre>krb5-config                1.6          
krb5-user                  1.3.6-2sarge2
libkrb53                   1.3.6-2sarge2
libpam-krb5                1.0-12    
samba-common               3.0.14a-3
samba                      3.0.14a-3
winbind                    3.0.14a-3              
smbclient                  3.0.14a-3              
</pre>
<h1>Configuration</h1>
<h2>Kerberos</h2>
<p>
Kerberos Configuration sits in /etc/krb5.conf, we add a default_realm 
and a server to the realm (write Uppercase Text also in uppercase).</p>
<pre># file /etc/krb5.conf
[libdefaults]
   default_realm = MY.ACTIVE.DIRECTORY
   ...
[realms]
   MY.ACTIVE.DIRECTORY = {
      kdc = dc1.active.directory
      kdc = dc2.active.directory   
      kdc = dc3.active.directory         
      ...
      admin_server = dc1.active.directory
   }
...
</pre>
<p>

Now we can check if we can Authenticate a user against the Active Directory</p>
<pre>debian:~# kinit administrator
Password for administrator@MY.ACTIVE.DIRECTORY
debian:~# 
</pre>
<h2>Winbind</h2>
<p>

The Winbind Daemon will map users and groups from the Active Directory to Linux.
To do this we will tell winbind which ID-Range and which prefix it should use.
The mapping is set up on use and stored in a file-database in the samba lock-dir /var/lib/samba/winbindd_idmap.tdb</p>
<p>

The Configuration sits in the smb.conf</p>
<pre># file /etc/samba/smb.conf
[global]
   workgroup = ADGROUP
   security = ADS
   realm = MY.ACTIVE.DIRECTORY
   winbind separator = +
   idmap uid = 10000-20000
   idmap gid = 10000-20000
   winbind enum users = yes
   winbind enum groups = yes
   auth methods = winbind
   ...

# the share we will use to test it, make sure path is 
# valid and writeable
[testshare]
comment = Test Share using Active Directory
read only = no
path = /data/test
valid users = @"ADGROUP+domain users"
   
</pre>
<p>   

Start the winbind daemon (/etc/init.d/winbind start) and now we can list the users from the Active Directory<br /></p>
<pre>debian:~# wbinfo -u
ADGROUP+administrator
ADGROUP+guest
ADGROUP+chandel
...
</pre>
<h2>Samba</h2>
<p>
Next we will get a kerberos Ticket and join our Server to the active directory</p>
<pre>debian:~# kinit administrator
Password for administrator@MY.ACTIVE.DIRECTORY
debian:~# net ads join
Using short domain name -- ADGROUP
Joined 'DEBIAN' to realm 'MY.ACTIVE.DIRECTORY'
</pre>
<h2>PAM</h2>
So far so good. We can authenticate using kerberos tickets and Samba knows how to get
userids and groups. But we also need to tell the operating system about the userids. This 
is done using PAM.

We tell PAM that samba requires authentication and account from winbind.
<pre># File /etc/pam.d/samba
auth required /lib/security/pam_winbind.so
account required /lib/security/pam_winbind.so
</pre>
<p>
And we tell the system that it can get information about userdata (id,
name, homedir, etc.) not only from /etc/passwd but also from winbind</p>
<pre># File /etc/nsswitch.conf
...
passwd:      compat winbind
group:       compat winbind
shadow:      compat 
...
</pre>
<p>

Test it by listing the accounts known to the system</p>
<pre>debian:~# getent passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
...
ADGROUP+administrator:x:10001:10000:Administrator:/home/ADGROUP/administrator:/bin/false
ADGROUP+guest:x:10002:10001:Guest:/home/ADGROUP/guest:/bin/false
...
</pre>
<h1>Test</h1>
<p>Test it using our own server as a linux client. We will
get a ticket, and connect to the share using this ticket. Than we place
a file there and check in the filesystem who owns the file.<br /></p>
<pre>debian:~# kinit administrator
Password for administrator@MY.ACTIVE.DIRECTORY
debian:~# touch hello_world.txt
debian:~# smbclient //fileservername/testshare -k
OS=[Unix] Server=[Samba 3.0.14a-Debian]
smb: \&gt; put hello_world.txt
putting file hello_world.txt as \hello_world.txt (0.0 kb/s) (average nan kb/s)
smb: \&gt; quit
debian:~# ls -l /data/testshare/hello_world.txt
-rwxr--r--  1 ADGROUP+administrator ADGROUP+domain users 0 2005-07-22 13:37 /data/test/hello_world.txt
debian:~#
</pre>
<h1>Hints</h1>
Kerberos relies on synchronized time between client (linux box) and Server (Domain Controller).
Keep your machines in sync using ntpd or ntpdate</div>
]]></content:encoded>
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>admin</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2007-12-09T20:05:40Z</dc:date>
    <dc:type>Page</dc:type>
  </item>


  <item rdf:about="http://www.held-im-ruhestand.de/software/sheevaplug">
    <title>Sheevaplug</title>
    <link>http://www.held-im-ruhestand.de/software/sheevaplug</link>
    <description>notes and informations about marvells small embedded Computer</description>
    
    <dc:publisher>No publisher</dc:publisher>
    <dc:creator>chandel</dc:creator>
    <dc:rights></dc:rights>
    <dc:date>2009-08-09T11:48:46Z</dc:date>
    <dc:type>Folder</dc:type>
  </item>





</rdf:RDF>

