<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-948616129588852269</id><updated>2012-01-18T10:21:57.339Z</updated><category term='WebApps'/><category term='Python'/><category term='IPv6'/><category term='Chess'/><category term='Maths'/><category term='Assembler'/><category term='Linux'/><category term='LPIC'/><category term='Samba'/><category term='cryptogen'/><category term='expect'/><category term='GraphViz'/><category term='Security'/><category term='Crypto'/><category term='LDAP'/><category term='misc'/><category term='Huawei'/><title type='text'>oozie's blog</title><subtitle type='html'>Python hacking and data visualization.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.ooz.ie/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>69</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8367973311607933458</id><published>2012-01-02T15:54:00.004Z</published><updated>2012-01-02T16:04:23.604Z</updated><title type='text'>Inspiration for veggie meals</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you're looking for veg cooking ideas, consider adding the following gadget to your iGoogle page or some other personalized dashboard. The gadget presents a new vegetarian or vegan meal suggestion every 24 hours and the user can click-through to the recipe.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://gadgets.vegidea.org/randomidea" style="border: medium none; height: 220px; overflow: hidden; width: 220px;"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;a href="http://www.vegidea.org/p/gadgets.html"&gt;Click here&lt;/a&gt;&lt;/b&gt; for instructions on embedding it from &lt;a href="http://vegidea.org/"&gt;http://vegidea.org/&lt;/a&gt;.&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8367973311607933458?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8367973311607933458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8367973311607933458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8367973311607933458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8367973311607933458'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2012/01/inspiration-for-veggie-meals.html' title='Inspiration for veggie meals'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-327342238134816006</id><published>2011-12-18T13:05:00.004Z</published><updated>2011-12-18T13:07:22.721Z</updated><title type='text'>Learn natural English with daily Collocations</title><content type='html'>Collocations are best defined by Christopher Manning &amp;amp; Hinrich Schütze:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;A COLLOCATION is an expression consisting of two or more words that&lt;/i&gt;&lt;i&gt; correspond to some conventional way of saying things. Or in the words. &lt;a href="http://nlp.stanford.edu/fsnlp/promo/colloc.pdf"&gt;(Read the full text here paper)&lt;/a&gt;&lt;/i&gt;&lt;/blockquote&gt;Collocations of words make the language sound "native" and other combinations may cause it to sound unnatural. The new collocations.ooz.ie service helps English learners absorb the natural language faster through visual representation of collocations. Take a look:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-GGcNssm8YmA/Tu3k-iIXXbI/AAAAAAAAAQY/L9qSlmaRITs/s1600/heavy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="362" src="http://2.bp.blogspot.com/-GGcNssm8YmA/Tu3k-iIXXbI/AAAAAAAAAQY/L9qSlmaRITs/s640/heavy.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The word being the subject of collocation analysis is placed in the yellow ellipse.&lt;/li&gt;&lt;li&gt; Words in rectangular boxes are collocating words. &lt;/li&gt;&lt;li&gt;The thickness of the line linking two words implies the strength of their collocation in terms of the subject word.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: center;"&gt;&amp;nbsp;For more, subscribe to the feed on &lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: x-large;"&gt;&lt;a href="http://collocations.ooz.ie/"&gt;&lt;b&gt;http://collocations.ooz.ie/&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-327342238134816006?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/327342238134816006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=327342238134816006' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/327342238134816006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/327342238134816006'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/12/httpcollocationsoozie-learn-natural.html' title='Learn natural English with daily Collocations'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-GGcNssm8YmA/Tu3k-iIXXbI/AAAAAAAAAQY/L9qSlmaRITs/s72-c/heavy.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1134921978581181032</id><published>2011-12-12T18:52:00.002Z</published><updated>2011-12-12T18:54:30.239Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python issublist()</title><content type='html'>An inefficient yet basic and mostly sufficient implementation of a Python function asserting that elements of one iterator are a sublist another's.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:py"&gt;def issublist(a, b):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sep = '\xC0\xFF\xEE'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in a]), sep)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in b]), sep)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return a_str in b_str&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1134921978581181032?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1134921978581181032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1134921978581181032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1134921978581181032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1134921978581181032'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/12/python-issublist.html' title='Python issublist()'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7165031606356930814</id><published>2011-10-23T14:06:00.001+01:00</published><updated>2011-10-23T14:15:41.378+01:00</updated><title type='text'>http://rozhlas.ooz.ie/ - Český Rozhlas live stream czech</title><content type='html'>A webapp looking up M3U and XSPF streams for Czech National Radio channels&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://rozhlas.ooz.ie/"&gt;&lt;span style="font-size: large;"&gt;http://rozhlas.ooz.ie/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7165031606356930814?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7165031606356930814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7165031606356930814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7165031606356930814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7165031606356930814'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/10/httprozhlasoozie-cesky-rozhlas-live.html' title='http://rozhlas.ooz.ie/ - Český Rozhlas live stream czech'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7810971429461949893</id><published>2011-05-19T00:56:00.005+01:00</published><updated>2011-05-19T01:23:20.671+01:00</updated><title type='text'>A Finite State Machine module for Python</title><content type='html'>In preparation for yet another maths exam I created a Python module for modeling, building and describing finite-state automata. I used it for doing my homework assignment and got a nice enough score. The following transducer (my homework) describes the operation of a microwave oven. Green - current state; blue - possible transitions from the current state.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://oozie-apps.appspot.com/microwave"&gt;&lt;img border="0" height="257" src="http://3.bp.blogspot.com/-V2zeR7nkuWk/TdRizBWzY_I/AAAAAAAAAPE/zrr2J61yTxo/s640/mw-closed_i.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The python-fsm project is hosted at&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: large;"&gt;&lt;a href="http://code.google.com/p/python-fsm"&gt;http://code.google.com/p/python-fsm&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;where more examples and some docs can be found.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7810971429461949893?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7810971429461949893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7810971429461949893' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7810971429461949893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7810971429461949893'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/05/finite-state-machine-module-for-python.html' title='A Finite State Machine module for Python'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-V2zeR7nkuWk/TdRizBWzY_I/AAAAAAAAAPE/zrr2J61yTxo/s72-c/mw-closed_i.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8775109233526270502</id><published>2011-03-24T13:57:00.001Z</published><updated>2011-03-24T13:59:16.403Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python exec module in namespace, an importless import.</title><content type='html'>The following code demonstrates how to import a Python module into a namespace if the module file does not end with ".py" extension, contains dots or the filename is established during execution. It might be useful for unit testing of scripts of which path is known but which can't be imported directly in the testing module. &lt;br /&gt;&lt;br /&gt;I assume that module's name is "module.filename.py.txt", the content follows.&lt;br /&gt;&lt;pre class="brush:py" &gt;# module.filename.py.txt&lt;br /&gt;def hello():&lt;br /&gt;    for i in range(3):&lt;br /&gt;       print 'oO',&lt;br /&gt;    print&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The interactive interpreter:&lt;br /&gt;&lt;pre class="brush: py"&gt;Python 2.6.5 (r265:79063, Jun  3 2010, 14:39:13)&lt;br /&gt;[GCC 4.1.2 20090703] on linux2&lt;br /&gt;Type "help", "copyright", "credits" or "license" for more information.&lt;br /&gt;&gt;&gt;&gt; class Module(object):&lt;br /&gt;...     """Module object."""&lt;br /&gt;...     def __init__(self, ns_dict):&lt;br /&gt;...         """Populate the module."""&lt;br /&gt;...         self.__dict__ = ns_dict&lt;br /&gt;...&lt;br /&gt;&gt;&gt;&gt; mod_filename = 'module.filename.py.txt'&lt;br /&gt;&gt;&gt;&gt; mod_ns_alias = 'mymodule'&lt;br /&gt;&gt;&gt;&gt; source = open(mod_filename).read()&lt;br /&gt;&gt;&gt;&gt; module_code = compile(source, mod_filename, 'exec')&lt;br /&gt;&gt;&gt;&gt; mod_ns = {}&lt;br /&gt;&gt;&gt;&gt; exec module_code in mod_ns&lt;br /&gt;&gt;&gt;&gt; exec('%s = Module(mod_ns)' % mod_ns_alias)&lt;br /&gt;&gt;&gt;&gt;&lt;br /&gt;&gt;&gt;&gt; mymodule.hello()&lt;br /&gt;oO oO oO&lt;br /&gt;&gt;&gt;&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8775109233526270502?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8775109233526270502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8775109233526270502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8775109233526270502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8775109233526270502'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/03/python-exec-module-in-namespace.html' title='Python exec module in namespace, an importless import.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8571075364767334980</id><published>2011-03-20T01:20:00.003Z</published><updated>2011-03-20T01:22:15.940Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebApps'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Google Questions SOAP service</title><content type='html'>I launched a Google Questions SOAP service via  on Google Appengine using a method &lt;a href="http://soappy.ooz.ie/2011/03/is-it-possible-to-run-soappy-on-google.html"&gt;described here&lt;/a&gt;. One can now fetch a list of questions frequently typed in the Google search box via the &lt;a href="http://peopleask.ooz.ie/"&gt;PeopleAsk.ooz.ie&lt;/a&gt; UI and programatically, a SOAPpy example follows:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: py"&gt;In [1]: import SOAPpy&lt;br /&gt;In [2]: client = SOAPpy.SOAPProxy('http://peopleask.ooz.ie/soap', &lt;br /&gt;                                  'http://peopleask.ooz.ie/')&lt;br /&gt;In [3]: client.GetQuestionsAbout('god')&lt;br /&gt;Out[3]: &lt;br /&gt;['does god exist',&lt;br /&gt; 'does god love me',&lt;br /&gt; 'does god hate me',&lt;br /&gt; 'do god and satan talk',&lt;br /&gt; 'does god love everyone',&lt;br /&gt; 'does god answer prayers',&lt;br /&gt; "where is god when bad things happen"]&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8571075364767334980?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8571075364767334980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8571075364767334980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8571075364767334980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8571075364767334980'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/03/google-questions-soap-service.html' title='Google Questions SOAP service'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5980072499864638814</id><published>2011-03-19T18:17:00.000Z</published><updated>2011-03-19T18:17:48.161Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraphViz'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>A circular graph of Python 2.7 Types.</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-CghjHohss6A/TYTy3e8QS4I/AAAAAAAAAOw/S_LXzVmup9A/s1600/python.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="603" src="http://4.bp.blogspot.com/-CghjHohss6A/TYTy3e8QS4I/AAAAAAAAAOw/S_LXzVmup9A/s640/python.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;Generated in graphviz from Python.asdl (Python2.7)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5980072499864638814?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5980072499864638814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5980072499864638814' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5980072499864638814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5980072499864638814'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/03/circular-graph-of-python-27-types.html' title='A circular graph of Python 2.7 Types.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-CghjHohss6A/TYTy3e8QS4I/AAAAAAAAAOw/S_LXzVmup9A/s72-c/python.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7153731707978673490</id><published>2011-03-17T16:03:00.000Z</published><updated>2011-03-19T18:17:48.162Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python logging: extending standard logger by custom debug levels.</title><content type='html'>&lt;div style="text-align: justify;"&gt;In a recent discussion I advocated for using standard loggers instead of reinventing the square wheel with a custom pretty-printer. Python's &lt;a href="http://docs.python.org/library/logging.html"&gt;logging module&lt;/a&gt; is comprehensive enough and comes with 5 default loglevels (debug, info, warning, error and critical).  Additionally, it allows for adding your own custom loglevels with &lt;a href="http://docs.python.org/library/logging.html#logging.addLevelName"&gt;addLevelName&lt;/a&gt; and invocation of &lt;i&gt;logging.log(customlevel, message)&lt;/i&gt;. It is also possible to bind custom logging methods to the logger object if the need arises. This  should probably never be practiced, but is nevertheless possible, see the code snippet:&lt;/div&gt;&lt;pre class="brush: py"&gt;import logging&lt;br /&gt;&lt;br /&gt;def debug_factory(logger, debug_level):&lt;br /&gt;    def custom_debug(msg, *args, **kwargs):&lt;br /&gt;        if logger.level &gt;= debug_level:&lt;br /&gt;           return&lt;br /&gt;        logger._log(debug_level, msg, args, kwargs)&lt;br /&gt;    return custom_debug    &lt;br /&gt;&lt;br /&gt;mylogger = logging.Logger('my-logger')&lt;br /&gt;ch = logging.StreamHandler()&lt;br /&gt;formatter = logging.Formatter("%(asctime)s - %(funcName)s - %(levelname)s - %(message)s")&lt;br /&gt;ch.setFormatter(formatter)&lt;br /&gt;mylogger.addHandler(ch)&lt;br /&gt;&lt;br /&gt;for i in range(1,5):&lt;br /&gt;    logging.addLevelName(logging.DEBUG+i, 'DEBUG%i' % i)&lt;br /&gt;    setattr(mylogger, 'debug%i' % i, debug_factory(mylogger, logging.DEBUG+i))&lt;br /&gt;&lt;br /&gt;def from_this_function():&lt;br /&gt;    mylogger.debug('test')&lt;br /&gt;    mylogger.debug1('test2')&lt;br /&gt;    mylogger.debug2('test3')&lt;br /&gt;&lt;br /&gt;def from_that_function():&lt;br /&gt;    mylogger.debug('test4')&lt;br /&gt;    mylogger.debug1('test5')&lt;br /&gt;    mylogger.debug2('test6')&lt;br /&gt;    mylogger.debug3('test7')&lt;br /&gt;    &lt;br /&gt;def from_another_function():&lt;br /&gt;    mylogger.debug('asdasd')&lt;br /&gt;    mylogger.debug1('agasdf')&lt;br /&gt;    mylogger.debug2('adasdfa')&lt;br /&gt;    mylogger.debug4('asdfa')&lt;br /&gt;    mylogger.warning('blah')&lt;br /&gt;&lt;br /&gt;mylogger.setLevel(logging.DEBUG)&lt;br /&gt;from_this_function()    &lt;br /&gt;mylogger.setLevel(logging.DEBUG+1)&lt;br /&gt;from_that_function()    &lt;br /&gt;mylogger.setLevel(logging.DEBUG+2)&lt;br /&gt;from_another_function() &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7153731707978673490?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7153731707978673490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7153731707978673490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7153731707978673490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7153731707978673490'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/03/python-logging-extending-standard.html' title='Python logging: extending standard logger by custom debug levels.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2735632627392675437</id><published>2011-01-03T22:52:00.000Z</published><updated>2011-01-03T22:54:03.759Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebApps'/><category scheme='http://www.blogger.com/atom/ns#' term='Maths'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>http://sole.ooz.ie/ - Solving Systems of linear equations</title><content type='html'>&lt;div style="text-align: justify;"&gt;In preparation for the upcoming algebra exam I wrote up a webapp which  solves 3x3 systems of linear equations using notation similar to the one  expected from us in the exam. Kinda handy for verifying hand-written  calculations and tracking down where mistakes are made:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;&lt;a href="http://sole.ooz.ie/en"&gt;http://sole.ooz.ie/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2735632627392675437?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2735632627392675437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2735632627392675437' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2735632627392675437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2735632627392675437'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2011/01/httpsoleoozie-solving-systems-of-linear.html' title='http://sole.ooz.ie/ - Solving Systems of linear equations'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8287596259700174045</id><published>2010-12-26T20:53:00.000Z</published><updated>2010-12-26T20:59:20.710Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Chess'/><category scheme='http://www.blogger.com/atom/ns#' term='GraphViz'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Transpositions in Sicilian Defense</title><content type='html'>&lt;div style="text-align: justify;"&gt;A graph of most fundamental transpositions in Open Sicilian Defense. It is by no means complete but it does show the idea.&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_YxqJFnCxl14/TRepbh45FeI/AAAAAAAAANQ/R9Bo1BW228U/s1600/sicilian.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 377px;" src="http://1.bp.blogspot.com/_YxqJFnCxl14/TRepbh45FeI/AAAAAAAAANQ/R9Bo1BW228U/s400/sicilian.png" alt="" id="BLOGGER_PHOTO_ID_5555094955803350498" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8287596259700174045?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8287596259700174045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8287596259700174045' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8287596259700174045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8287596259700174045'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/12/transpositions-in-sicilian-defense.html' title='Transpositions in Sicilian Defense'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_YxqJFnCxl14/TRepbh45FeI/AAAAAAAAANQ/R9Bo1BW228U/s72-c/sicilian.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7111357289443960377</id><published>2010-12-10T00:39:00.006Z</published><updated>2010-12-26T20:59:38.238Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraphViz'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Finding all successors of a node with pygraphviz</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_YxqJFnCxl14/TQF6t-g44rI/AAAAAAAAAL0/_Ltb683NvSU/s1600/s2.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YxqJFnCxl14/TQF5YAuaA_I/AAAAAAAAALs/C72EDpcMa2I/s1600/s1.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 205px;" src="http://2.bp.blogspot.com/_YxqJFnCxl14/TQF5YAuaA_I/AAAAAAAAALs/C72EDpcMa2I/s400/s1.png" alt="" id="BLOGGER_PHOTO_ID_5548849669315625970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;pygraphviz.AGraph class implements the &lt;span style="font-weight: bold;"&gt;successors&lt;/span&gt; method for finding first level successors of a given node.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;g.successors('a')&lt;/span&gt; returns ['b', 'c', 'd', 'z']&lt;br /&gt;&lt;br /&gt;Sometimes a need arises to find all the successors of all successive nodes as well. The class can be extended to allow for this behavior. The following example illustrates this by extending the base class with all_successors method&lt;br /&gt;&lt;br /&gt;&lt;font face="monospace"&gt;&lt;font color="#00ffff"&gt;&lt;b&gt;#!/usr/bin/python&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#8080ff"&gt;&lt;b&gt;import&lt;/b&gt;&lt;/font&gt;&amp;nbsp;pygraphviz &lt;font color="#ffff00"&gt;&lt;b&gt;as&lt;/b&gt;&lt;/font&gt;&amp;nbsp;pgv&lt;br&gt;&lt;br&gt;&lt;font color="#ffff00"&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;&lt;b&gt;Graph&lt;/b&gt;&lt;/font&gt;(pgv.AGraph):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;&lt;b&gt;__init__&lt;/b&gt;&lt;/font&gt;(self, **kvargs):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pgv.AGraph.__init__(self, **kvargs)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.__successors = &lt;font color="#00ffff"&gt;&lt;b&gt;None&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;&lt;b&gt;all_successors&lt;/b&gt;&lt;/font&gt;(self, node):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.__successors = []&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;start_node = self.get_node(node)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;def&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;&lt;b&gt;recur_successor&lt;/b&gt;&lt;/font&gt;(node):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;node_successors = self.successors(node)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/font&gt;&amp;nbsp;s &lt;font color="#ffff00"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/font&gt;&amp;nbsp;node_successors:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&amp;nbsp;s &lt;font color="#ffff00"&gt;&lt;b&gt;not&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/font&gt;&amp;nbsp;self.__successors:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.__successors.append(s)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;recur_successor(s)&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;recur_successor(start_node)&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/font&gt;&amp;nbsp;self.__successors&lt;br&gt;&lt;br&gt;g = Graph(directed=&lt;font color="#00ffff"&gt;&lt;b&gt;True&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'b'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'c'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'d'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'d'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'e'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'e'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'f'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'x'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'b'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'z'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'r'&lt;/b&gt;&lt;/font&gt;, &lt;font color="#ff40ff"&gt;&lt;b&gt;'s'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;g.add_edge(&lt;font color="#ff40ff"&gt;&lt;b&gt;'b'&lt;/b&gt;&lt;/font&gt;,&lt;font color="#ff40ff"&gt;&lt;b&gt;'c'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;br&gt;g.draw(&lt;font color="#ff40ff"&gt;&lt;b&gt;'s1.png'&lt;/b&gt;&lt;/font&gt;, prog=&lt;font color="#ff40ff"&gt;&lt;b&gt;'fdp'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;br&gt;&lt;font color="#00ffff"&gt;&lt;b&gt;print&lt;/b&gt;&lt;/font&gt;&amp;nbsp;g.successors(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;font color="#00ffff"&gt;&lt;b&gt;print&lt;/b&gt;&lt;/font&gt;&amp;nbsp;g.all_successors(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;br&gt;related_to_a = g.all_successors(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;related_to_a.extend(&lt;font color="#ff40ff"&gt;&lt;b&gt;'a'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;font color="#ffff00"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/font&gt;&amp;nbsp;n &lt;font color="#ffff00"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/font&gt;&amp;nbsp;g.nodes():&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&amp;nbsp;n &lt;font color="#ffff00"&gt;&lt;b&gt;not&lt;/b&gt;&lt;/font&gt;&amp;nbsp;&lt;font color="#ffff00"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/font&gt;&amp;nbsp;related_to_a:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g.delete_node(n)&lt;br&gt;&lt;br&gt;g.draw(&lt;font color="#ff40ff"&gt;&lt;b&gt;'s2.png'&lt;/b&gt;&lt;/font&gt;, prog=&lt;font color="#ff40ff"&gt;&lt;b&gt;'fdp'&lt;/b&gt;&lt;/font&gt;)&lt;br&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_YxqJFnCxl14/TQF6t-g44rI/AAAAAAAAAL0/_Ltb683NvSU/s1600/s2.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 337px; height: 259px;" src="http://3.bp.blogspot.com/_YxqJFnCxl14/TQF6t-g44rI/AAAAAAAAAL0/_Ltb683NvSU/s400/s2.png" alt="" id="BLOGGER_PHOTO_ID_5548851146190807730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;g.all_successors('a')&lt;/span&gt; returns ['b', 'c', 'd', 'e', 'f', 'z']&lt;br /&gt;&lt;br /&gt;'r' and 's' are not related to 'a'  at all and 'x', although it's a predecessor of 'b' it is not a successor of 'a'.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7111357289443960377?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7111357289443960377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7111357289443960377' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7111357289443960377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7111357289443960377'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/12/finding-all-successors-of-node-with.html' title='Finding all successors of a node with pygraphviz'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_YxqJFnCxl14/TQF5YAuaA_I/AAAAAAAAALs/C72EDpcMa2I/s72-c/s1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4892121320717677430</id><published>2010-11-30T22:47:00.001Z</published><updated>2011-04-25T16:34:53.657+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraphViz'/><category scheme='http://www.blogger.com/atom/ns#' term='WebApps'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>http://huffman.ooz.ie/ - Huffman Tree Generator</title><content type='html'>Huffman Coding is a lossless data compression algorithm that builds weight-ordered binary tree of characters from a text and assigns each character a corresponding binary code value. The binary code depends on occurrence frequency of each character. This webapp is  generating &lt;a href="http://en.wikipedia.org/wiki/Huffman_coding"&gt;Huffman Trees&lt;/a&gt; out of short text snippets.&lt;br /&gt;&lt;span id="goog_1846918314"&gt;&lt;/span&gt;&lt;span id="goog_1846918315"&gt;&lt;/span&gt;&lt;a href="http://huffman.ooz.ie/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://huffman.ooz.ie/"&gt;&lt;img border="0" height="206" src="http://chart.apis.google.com/chart?cht=gv:dot&amp;amp;chl=digraph%20G%7Bedge[label=0];graph[ranksep=0];SPACE[shape=record,label=%22%7B%7BSPACE%7C5%7D%7C00%7D%22];F[shape=record,label=%22%7B%7BF%7C3%7D%7C010%7D%22];M[shape=record,label=%22%7B%7BM%7C2%7D%7C0110%7D%22];N[shape=record,label=%22%7B%7BN%7C2%7D%7C0111%7D%22];A[shape=record,label=%22%7B%7BA%7C4%7D%7C100%7D%22];E[shape=record,label=%22%7B%7BE%7C4%7D%7C101%7D%22];O[shape=record,label=%22%7B%7BO%7C1%7D%7C11000%7D%22];P[shape=record,label=%22%7B%7BP%7C1%7D%7C11001%7D%22];H[shape=record,label=%22%7B%7BH%7C1%7D%7C11010%7D%22];L[shape=record,label=%22%7B%7BL%7C1%7D%7C11011%7D%22];HL[label=2];OPHL[label=4];T[shape=record,label=%22%7B%7BT%7C1%7D%7C11100%7D%22];X[shape=record,label=%22%7B%7BX%7C1%7D%7C11101%7D%22];TX[label=2];R[shape=record,label=%22%7B%7BR%7C1%7D%7C11110%7D%22];U[shape=record,label=%22%7B%7BU%7C1%7D%7C11111%7D%22];RU[label=2];TXRU[label=4];OPHLTXRU[label=8];28-%3E12-%3ESPACE;7-%3EF;4-%3EM;16-%3E8-%3EA;OPHLTXRU-%3EOPHL-%3E2-%3EO;HL-%3EH;TXRU-%3ETX-%3ET;RU-%3ER;12-%3E7-%3E4-%3EN[label=1];8-%3EE[label=1];2-%3EP[label=1];OPHL-%3EHL-%3EL[label=1];TX-%3EX[label=1];28-%3E16-%3EOPHLTXRU-%3ETXRU-%3ERU-%3EU[label=1];%7D" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Generate your own at &lt;br /&gt;&lt;div style="font-weight: bold; text-align: center;"&gt;&lt;a href="http://huffman.ooz.ie/"&gt;&lt;span style="font-size: 130%;"&gt;http://huffman.ooz.ie/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4892121320717677430?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4892121320717677430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4892121320717677430' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4892121320717677430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4892121320717677430'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/11/httphuffmanoozie-huffman-tree-generator.html' title='http://huffman.ooz.ie/ - Huffman Tree Generator'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-24481261106461561</id><published>2010-10-25T00:18:00.004+01:00</published><updated>2010-10-25T23:20:26.600+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='WebApps'/><title type='text'>PeopleAsk.ooz.ie - A fresh blend of top-most questions to Google</title><content type='html'>I've just published the first version of &lt;a href="http://peopleask.ooz.ie/"&gt;PeopleAsk&lt;/a&gt; webapp. It takes a commonly googled term as input and presents the user with a list of bewildering tangles that thousands, if not millions, of people  around the world try to solve fighting a battle in the war with confusion. Check of &lt;a href="http://peopleask.ooz.ie/men"&gt;men&lt;/a&gt;, &lt;a href="http://peopleask.ooz.ie/women"&gt;women&lt;/a&gt;, &lt;a href="http://peopleask.ooz.ie/iraq"&gt;Iraq&lt;/a&gt; or &lt;a href="http://peopleask.ooz.ie/fox+news"&gt;Fox News&lt;/a&gt; and you'll know exactly what I mean.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://peopleask.ooz.ie/"&gt;&lt;span style="font-size:180%;"&gt;http://PeopleAsk.ooz.ie/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-24481261106461561?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/24481261106461561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=24481261106461561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/24481261106461561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/24481261106461561'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/10/peopleaskoozie-fresh-blend-of-top-most.html' title='PeopleAsk.ooz.ie - A fresh blend of top-most questions to Google'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7913508661258560768</id><published>2010-04-29T20:58:00.002+01:00</published><updated>2010-04-29T21:05:27.446+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Command line BBC news reader.</title><content type='html'>My BBC RSS feed XML parser:&lt;hr /&gt;&lt;br /&gt;&lt;font color="#8080ff"&gt;#!/usr/bin/env python&lt;/font&gt;&lt;br&gt; &amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &lt;font color="#ff6060"&gt;Command line BBC News reader, by oozie &amp;lt;root ooz ie&amp;gt;&lt;/font&gt;&lt;br&gt; &lt;br&gt; &lt;font color="#ff6060"&gt;$ ./bbcnews.py&lt;/font&gt;&lt;br&gt; &amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &lt;font color="#ff40ff"&gt;import&lt;/font&gt;&amp;nbsp;urllib2&lt;br&gt; &lt;font color="#ff40ff"&gt;from&lt;/font&gt;&amp;nbsp;xml.parsers &lt;font color="#ff40ff"&gt;import&lt;/font&gt;&amp;nbsp;expat&lt;br&gt; &lt;br&gt; GREEN = '&lt;font color="#ff40ff"&gt;\x1b&lt;/font&gt;&lt;font color="#ff6060"&gt;[32m&lt;/font&gt;'&lt;br&gt; BLUE = '&lt;font color="#ff40ff"&gt;\x1b&lt;/font&gt;&lt;font color="#ff6060"&gt;[34m&lt;/font&gt;'&lt;br&gt; NORMAL = '&lt;font color="#ff40ff"&gt;\x1b&lt;/font&gt;&lt;font color="#ff6060"&gt;[30m&lt;/font&gt;'&lt;br&gt; &lt;br&gt; BBC_NEWS_RSS = '&lt;font color="#ff6060"&gt;&lt;a href="http://newsrss.bbc.co.uk/"&gt;http://newsrss.bbc.co.uk/&lt;/a&gt;&lt;/font&gt;'+&lt;font color="#ff40ff"&gt;\&lt;/font&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&lt;font color="#ff6060"&gt;rss/newsonline_world_edition/front_page/rss.xml&lt;/font&gt;'&lt;br&gt; &lt;br&gt; &lt;font color="#ffff00"&gt;class&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;NewsItem&lt;/font&gt;(object):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Class representing a news item.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;category = None&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;description = None&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;link = None&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;title = None&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;summary&lt;/font&gt;(self):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Summarize news item in color.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;'&lt;font color="#ff6060"&gt;%s%s: %s%s %s%s&lt;/font&gt;'&amp;nbsp;% (BLUE, self.title, &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GREEN, self.description,&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NORMAL, self.link)&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;headline&lt;/font&gt;(self):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Print news item title and corresponding link.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;'&lt;font color="#ff6060"&gt;%s%s %s%s&lt;/font&gt;'&amp;nbsp;% (BLUE, self.title,&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NORMAL, self.link)&lt;br&gt; &lt;br&gt; &lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;get_news&lt;/font&gt;(rss_feed):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Get a list of news items.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;class&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;_CurrentData&lt;/font&gt;(object):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Class holding a set of current attributes.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;item = None&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text = None&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;_start_element_handler&lt;/font&gt;(name, attrs):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Handle XML start-elements.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;name == '&lt;font color="#ff6060"&gt;item&lt;/font&gt;':&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#8080ff"&gt;# Allocate a new item.&lt;/font&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;current.item = NewsItem()&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;_end_element_handler&lt;/font&gt;(name):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Handle XML end-elements.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;name == '&lt;font color="#ff6060"&gt;item&lt;/font&gt;':&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;news_items.append(current.item)&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;elif&lt;/font&gt;&amp;nbsp;name &lt;font color="#ffff00"&gt;in&lt;/font&gt;&amp;nbsp;('&lt;font color="#ff6060"&gt;title&lt;/font&gt;', '&lt;font color="#ff6060"&gt;description&lt;/font&gt;', '&lt;font color="#ff6060"&gt;link&lt;/font&gt;', '&lt;font color="#ff6060"&gt;category&lt;/font&gt;'):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;try&lt;/font&gt;:&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setattr(current.item, name, current.text)&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;except&lt;/font&gt;&amp;nbsp;AttributeError:&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#8080ff"&gt;# The parser has run into a non-news item.&lt;/font&gt;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;pass&lt;/font&gt;&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;def&lt;/font&gt;&amp;nbsp;&lt;font color="#00ffff"&gt;_char_data_handler&lt;/font&gt;(data):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;quot;&amp;quot;&amp;quot;&lt;font color="#ff6060"&gt;Handle XML element character data.&lt;/font&gt;&amp;quot;&amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;current.text = data&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;news_items = list()&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;current = _CurrentData()&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parser = expat.ParserCreate()&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parser.StartElementHandler = _start_element_handler&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parser.EndElementHandler = _end_element_handler&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parser.CharacterDataHandler = _char_data_handler&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;news_handle = urllib2.urlopen(rss_feed)&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xml_data = news_handle.read()&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parser.Parse(xml_data)&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;return&lt;/font&gt;&amp;nbsp;news_items&lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;font color="#ffff00"&gt;if&lt;/font&gt;&amp;nbsp;__name__ == '&lt;font color="#ff6060"&gt;__main__&lt;/font&gt;':&lt;br&gt; &lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;for&lt;/font&gt;&amp;nbsp;news_item &lt;font color="#ffff00"&gt;in&lt;/font&gt;&amp;nbsp;get_news(BBC_NEWS_RSS):&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#ffff00"&gt;print&lt;/font&gt;&amp;nbsp;news_item.summary()&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7913508661258560768?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7913508661258560768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7913508661258560768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7913508661258560768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7913508661258560768'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/04/command-line-bbc-news-reader.html' title='Command line BBC news reader.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3955173425906866149</id><published>2010-01-24T08:57:00.003Z</published><updated>2011-02-27T13:26:01.051Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Chess'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python code to recognize a color of a chessboard square</title><content type='html'>&lt;pre&gt;&lt;span style="color: rgb(153, 153, 255); font-weight: bold;"&gt;def chesssquare(square):&lt;/span&gt;&lt;br /&gt;   &lt;span style="color: rgb(255, 255, 51);"&gt;"""Return the color of a chessboard square."""&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    rank,file=square&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    return ord(file) &amp;amp; int(rank) &amp;amp; 1 and 'black' or 'white'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51); font-weight: bold;"&gt;In [1]: chesssquare('a1')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;Out [1]: 'black'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0); font-weight: bold;"&gt;In [2]: chesssquare('A2')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;Out [2]: 'white'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3955173425906866149?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3955173425906866149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3955173425906866149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3955173425906866149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3955173425906866149'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2010/01/python-code-to-recognize-color-of.html' title='Python code to recognize a color of a chessboard square'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8499530698943728725</id><published>2009-11-28T22:59:00.003Z</published><updated>2009-11-28T23:44:02.526Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='expect'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Colorful output in expect.</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you want to change shell color attributes from &lt;span style="font-style: italic;"&gt;expect&lt;/span&gt; make sure that you escape at least the first three characters of the ANSI color sequence.  This is necessary due to  the way  &lt;span style="font-style: italic;"&gt;expect &lt;/span&gt;&lt;span&gt;interprets&lt;/span&gt; strings. For instance, if you try to declare the red color sequence like this:&lt;br /&gt;&lt;pre&gt;set red "\x1b[1;31;40m"&lt;/pre&gt;&lt;span style="font-style: italic;"&gt;expect&lt;/span&gt; will think that you forgot to close the square bracket. If you escape the square bracket and continue like this:&lt;br /&gt;&lt;pre&gt;set red "\x1b\x5b1;31;40m"&lt;/pre&gt; &lt;span style="font-style: italic;"&gt;expect&lt;/span&gt; will think that the following "1" belongs to the preceding"\x5b". The following trick can be used to quickly convert an un-escaped string to a fully hex-escaped one:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;$ export RED="\x1b[1;31;40m"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;$ python -c "print ''.join([r'\x%x' % ord(c) for c in \"$COLOR\"])"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;\x1b\x5b\x31\x3b\x33\x31\x3b\x34\x30\x6d&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;ANSI sequence strings escaped this way can be further used in &lt;span style="font-style: italic;"&gt;except&lt;/span&gt; scripts.&lt;br /&gt;&lt;hr /&gt;&lt;span style="font-family:monospace;"&gt;&lt;span style="color:#00ffff;"&gt;&lt;b&gt;#!/usr/bin/env expect&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;&lt;b&gt;# Colorful output from expect.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;&lt;b&gt;# Slawek Ligus &lt;root@*.ie&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;&lt;b&gt;proc&lt;/b&gt;&lt;/span&gt; stripe_write {text} {&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;&lt;b&gt;# This procedure prints every second character of a given &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;&lt;b&gt;# string argument $text in red.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;&lt;b&gt;# RED="\x1b[1;31;40m"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   set red &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;1b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;5b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;31&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;3b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;33&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;31&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;3b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;34&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;30&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;6d"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;&lt;b&gt;# NORMAL="\x1b[1;0;40m"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   set normal &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;1b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;5b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;31&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;3b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;30&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;3b&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;34&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;30&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\x&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;6d"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#ffff00;"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; {set i &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;0&lt;/b&gt;&lt;/span&gt;} {&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$i&lt;/b&gt;&lt;/span&gt; &lt; [string length &lt;span style="color:#ff6060;"&gt;&lt;b&gt;$text&lt;/b&gt;&lt;/span&gt;]} {incr i &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;2&lt;/b&gt;&lt;/span&gt;} {&lt;br /&gt;      puts -nonewline &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$red&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;[string index &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$text&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$i&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;]"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      puts -nonewline &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$normal&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;[string index &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$text&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt; [expr &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;$i&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;+1]]"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   }&lt;br /&gt;   puts -nonewline &lt;span style="color:#ff6060;"&gt;&lt;b&gt;$normal&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;stripe_write &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"  Expect in color.   &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\n&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;stripe_write &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;" &lt;a href="http://blog.ooz.ie/"&gt;http://blog.ooz.ie/&lt;/a&gt; &lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\n&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;stripe_write &lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"=====================&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;&lt;b&gt;\n&lt;/b&gt;&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;&lt;b&gt;"&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8499530698943728725?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8499530698943728725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8499530698943728725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8499530698943728725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8499530698943728725'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/11/colorful-output-in-expect.html' title='Colorful output in expect.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3266423110262655146</id><published>2009-11-01T00:08:00.005Z</published><updated>2009-11-22T01:58:56.477Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Network Security with OpenSSL - exercises.</title><content type='html'>Set of exercises to the book of &lt;span style="font-style: italic;"&gt;Network Security with OpenSSL&lt;/span&gt; by J. Viega, M. Messier, P. Chandra.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Explain the following terms: SSL, TLS, CA, CRL, OCSP, PKI, PRNG&lt;br /&gt;&lt;/li&gt;&lt;li&gt;List goals of cryptography.&lt;/li&gt;&lt;li&gt;What is the difference between symmetric and public key encryption?&lt;/li&gt;&lt;li&gt;List three cryptographic hash functions. What are their strengths and weaknesses?&lt;/li&gt;&lt;li&gt;Explain what the term "digital signature" means.&lt;/li&gt;&lt;li&gt;What are the challenges of SSL?&lt;/li&gt;&lt;li&gt;Build OpenSSL from source.&lt;/li&gt;&lt;li&gt;Use openssl to compute SHA1 and MD5 message digests for a given file.&lt;/li&gt;&lt;li&gt;Encrypt and decrypt a file using 3DES.&lt;/li&gt;&lt;li&gt;Generate parameters for Diffie-Hellman key exchange.&lt;/li&gt;&lt;li&gt;Create a pair of DSA and RSA keys.&lt;/li&gt;&lt;li&gt;What is the major difference between RSA and DSA?&lt;/li&gt;&lt;li&gt;Explain the purpose of a CRL.&lt;/li&gt;&lt;li&gt;What are Certificate extensions and how to use them?&lt;/li&gt;&lt;li&gt;Do some research about OCSP (RFC2560)&lt;/li&gt;&lt;li&gt;Create a CA environment.&lt;/li&gt;&lt;li&gt;Generate a self signed certificate.&lt;/li&gt;&lt;li&gt;Generate a certificate request.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Issue a few certificates from certificate requests.&lt;/li&gt;&lt;li&gt;Revoke some of the generated certificates.&lt;/li&gt;&lt;li&gt;Retrieve HTTPS certificates of some of the Internet giants, e.g.&lt;br /&gt;&lt;pre class="programlisting"&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;$ echo|openssl s_client -connect www.google.com:443|\&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;  sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p&lt;/span&gt;' &gt; cert.txt&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Print the certificate in the text form&lt;br /&gt;&lt;pre style="color: rgb(255, 255, 51);"&gt;$ cat cert.txt|openssl x509 -text&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3266423110262655146?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3266423110262655146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3266423110262655146' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3266423110262655146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3266423110262655146'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/11/network-security-with-openssl.html' title='Network Security with OpenSSL - exercises.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3210224465660938569</id><published>2009-09-23T13:42:00.011+01:00</published><updated>2009-09-30T00:31:56.959+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cryptogen'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Crypto'/><title type='text'>Install encrypted Gentoo in no time.</title><content type='html'>&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/zNnXXTDpQbk&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/zNnXXTDpQbk&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/td&gt;&lt;td&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: justify;"&gt;Having a spare moment I decided to revisit my &lt;a href="http://blog.ooz.ie/2008/04/encrypting-root-swap-partitions-on.html"&gt;older post&lt;/a&gt; about installing encrypted Gentoo Linux as fast and easy as possible. That post is well out of date and the scripts were not working anymore as pointed out by a kind anonymous reader. So over the last two days I worked out a new/better way of installing an encrypted base Gentoo,&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;&lt;a href="http://ooz.ie/cryptogen.sh"&gt;http://ooz.ie/cryptogen.sh&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;it's a single shell script using dialog for ncurses interface (included on the mini-install DVDs). It's configuration is contained in the header, just under the LICENSE.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;The installation process goes as follows:&lt;div style="text-align: left;"&gt;&lt;ol&gt;&lt;li&gt;Boot off the &lt;a target="_blank" href="http://www.gentoo.org/main/en/where.xml"&gt; Gentoo MINI-install CD for your architecture&lt;/a&gt; and download cryptogen.sh&lt;/li&gt;&lt;li&gt;You can customize the settings contained in the header of the script, most users however, will be just happy to run it.&lt;/li&gt;&lt;li&gt;Follow the instructions.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3210224465660938569?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3210224465660938569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3210224465660938569' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3210224465660938569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3210224465660938569'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/09/install-encrypted-gentoo-in-no-time.html' title='Install encrypted Gentoo in no time.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-535297626491236554</id><published>2009-07-30T10:19:00.008+01:00</published><updated>2010-10-25T23:21:07.075+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebApps'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Timestamp converter powered by Google AppEngine</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_YxqJFnCxl14/SnFqhLOQCBI/AAAAAAAAAKo/7Qv4K3cV1EU/s1600-h/dali.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 140px; height: 168px;" src="http://4.bp.blogspot.com/_YxqJFnCxl14/SnFqhLOQCBI/AAAAAAAAAKo/7Qv4K3cV1EU/s400/dali.jpg" alt="" id="BLOGGER_PHOTO_ID_5364185749355759634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I wrote a semi-useful AppEngine application, a Unix/AD-LDAP timestamp converter. It's approximately 130 lines of code, plus an HTML template.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;&lt;a href="http://timestamp.ooz.ie/" target="_BLANK"&gt;http://timestamp.ooz.ie/&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;It converts Unix and Active Directory/LDAP timestamps to human readable UTC strings. It does it also from the command line...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-535297626491236554?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/535297626491236554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=535297626491236554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/535297626491236554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/535297626491236554'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/07/timestamp-converter-powered-by-google.html' title='Timestamp converter powered by Google AppEngine'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_YxqJFnCxl14/SnFqhLOQCBI/AAAAAAAAAKo/7Qv4K3cV1EU/s72-c/dali.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8495282365268008772</id><published>2009-07-19T18:26:00.004+01:00</published><updated>2009-07-19T19:57:55.187+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>sms_exec.py - SMS controlled POSIX machine.</title><content type='html'>I have just released the beta of PyHumod 0.02 with improved event handling. It comes with a sample application, &lt;a style="font-weight: bold;" href="http://code.google.com/p/pyhumod/wiki/CoolApps"&gt;sms_exec.py&lt;/a&gt;, that allows the user to execute remote commands on a POSIX system by sending an SMS into the modem, that subsequently is interpreted by the shell on the privileges of the user running &lt;a style="font-weight: bold;" href="http://code.google.com/p/pyhumod/wiki/CoolApps"&gt;sms_exec.py&lt;/a&gt;.&lt;BR/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8495282365268008772?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8495282365268008772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8495282365268008772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8495282365268008772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8495282365268008772'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/07/smsexecpy-sms-controlled-unix-machine.html' title='sms_exec.py - SMS controlled POSIX machine.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4730505910125240160</id><published>2009-06-27T19:52:00.004+01:00</published><updated>2009-07-01T09:06:02.413+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>PyHumod 0.01 beta is out!</title><content type='html'>&lt;h1&gt;&lt;a name="Installation"&gt;Installation&lt;/a&gt;&lt;/h1&gt;&lt;pre style="color: rgb(255, 204, 0);" class="prettyprint"&gt;&lt;a name="Installation"&gt;&lt;span class="pln"&gt;$ wget http&lt;/span&gt;&lt;span class="pun"&gt;:&lt;/span&gt;&lt;span class="com"&gt;//pyhumod.googlecode.com/files/pyhumod-0.01-beta.tar.gz&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;$ tar xzf pyhumod&lt;/span&gt;&lt;span class="pun"&gt;-*.&lt;/span&gt;&lt;span class="pln"&gt;tar&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;gz&lt;br /&gt;$ cd humod&lt;/span&gt;&lt;span class="pun"&gt;-*&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;$ sudo python setup&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;py install&lt;/span&gt;&lt;/a&gt;&lt;/pre&gt;&lt;h1&gt;&lt;a name="Basic_usage"&gt;Basic usage&lt;/a&gt;&lt;/h1&gt;&lt;p&gt;&lt;a name="Basic_usage"&gt;For most users the following should work: &lt;/a&gt;&lt;/p&gt;&lt;pre class="prettyprint"&gt;&lt;a name="Basic_usage"&gt;&lt;span class="pln"&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;$ python&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="typ"&gt;Python&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;2.5.4&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;(&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;r254&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;:&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;67916&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;,&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="typ"&gt;May&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;21&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;2009&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;,&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;22&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;:&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;07&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;:&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;14&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;)&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;[&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;GCC &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;4.1.2&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;(&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="typ"&gt;Gentoo&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;4.1.2&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; p1&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;.0.2&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;)]&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; on linux2&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="typ"&gt;Type&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="str"&gt;"help"&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;,&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="str"&gt;"copyright"&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;,&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="str"&gt;"credits"&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="kwd"&gt;or&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="str"&gt;"license"&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="kwd"&gt;for&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; more information&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="kwd"&gt;import&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;span style="color: rgb(255, 153, 255);"&gt; humod&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;=&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;humod&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="typ"&gt;Modem&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;show_model&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="str"&gt;'E270'&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;enter_text_mode&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;send_text&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="str"&gt;'+353?????????'&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;,&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="str"&gt;'hello world'&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;)&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="lit"&gt;52&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;connect&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;()&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pun"&gt;&gt;&gt;&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);" class="pln"&gt; &lt;span style="color: rgb(255, 153, 255);"&gt;m&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pun"&gt;.&lt;/span&gt;&lt;span style="color: rgb(255, 153, 255);" class="pln"&gt;disconnect&lt;/span&gt;&lt;span class="pun"&gt;&lt;span style="color: rgb(255, 153, 255);"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/pre&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;Visit &lt;a href="http://pyhumod.googlecode.com/"&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;http://pyhumod.googlecode.com/&lt;/span&gt;&lt;/a&gt;&lt;a href="http://pyhuawei.googlecode.com/"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;and &lt;a href="http://pyhumod.ooz.ie/"&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;http://pyhumod.ooz.ie/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4730505910125240160?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4730505910125240160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4730505910125240160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4730505910125240160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4730505910125240160'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/06/pyhumod-001-beta-is-out.html' title='PyHumod 0.01 beta is out!'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3719364551080865862</id><published>2009-06-20T11:50:00.009+01:00</published><updated>2011-04-07T10:35:49.407+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Find Huawei interfaces on Linux</title><content type='html'>&lt;div style="text-align: justify;"&gt;After two years of null-activity in the area of Huawei devices I'm resuming the work.  Right now I'm  in a process of coding &lt;a style="font-weight: bold;" href="http://pyhumod.ooz.ie/"&gt;a python package, PyHumod&lt;/a&gt;, that will talk to Huawei (and compatible) modems. I've just jotted a detection tool for Huawei interfaces on a HAL-enabled Linux.&lt;br /&gt;&lt;br /&gt;Run it as follows:&lt;br /&gt;&lt;/div&gt;&lt;pre style="color: rgb(255, 255, 51);"&gt;$ python find_huawei_iface.py&lt;/pre&gt;It should come up with something like that as response:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;5 Huawei interfaces detected.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;    E220 HSDPA Modem : /dev/ttyUSB4&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;    E220 HSDPA Modem : /dev/ttyUSB3&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;      E620 USB Modem : /dev/ttyUSB1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;      E620 USB Modem : /dev/ttyUSB2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;      E620 USB Modem : /dev/ttyUSB0&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;Tested on Huawei E220, K3520 and E270. It's meant to work with all models.&lt;br /&gt;&lt;pre class="brush: py"&gt;#!/usr/bin/python&lt;br /&gt;# &lt;br /&gt;# Copyright (c) 2009, Slawek Ligus &lt;root@ooz.ie&gt;&lt;br /&gt;# All rights reserved.&lt;br /&gt;# &lt;br /&gt;# Redistribution and use in source and binary forms, with or without&lt;br /&gt;# modification, are permitted provided that the following conditions are met:&lt;br /&gt;#    * Redistributions of source code must retain the above copyright&lt;br /&gt;#      notice, this list of conditions and the following disclaimer.&lt;br /&gt;#    * Redistributions in binary form must reproduce the above copyright&lt;br /&gt;#      notice, this list of conditions and the following disclaimer in the&lt;br /&gt;#      documentation and/or other materials provided with the distribution.&lt;br /&gt;# &lt;br /&gt;#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS&lt;br /&gt;#  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED&lt;br /&gt;#  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE &lt;br /&gt;#  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,&lt;br /&gt;#  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES&lt;br /&gt;#  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;&lt;br /&gt;#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND&lt;br /&gt;#  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT&lt;br /&gt;#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF &lt;br /&gt;#  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;# &lt;br /&gt;&lt;br /&gt;"""find_huawei_iface.py finds active USB huawei interfaces."""&lt;br /&gt;&lt;br /&gt;import dbus&lt;br /&gt;&lt;br /&gt;BUS_NAME = 'org.freedesktop.Hal'&lt;br /&gt;MGR_OBJ = '/org/freedesktop/Hal/Manager'&lt;br /&gt;HAL_DEV_IFACE = 'org.freedesktop.Hal.Device'&lt;br /&gt;HAL_MGR_IFACE = 'org.freedesktop.Hal.Manager'&lt;br /&gt;&lt;br /&gt;bus = dbus.SystemBus()&lt;br /&gt;&lt;br /&gt;def find_huawei_devices():&lt;br /&gt;    """Find Huawei devices."""&lt;br /&gt;&lt;br /&gt;    # Huawei vendor ID&lt;br /&gt;    vendor_id = '12d1'&lt;br /&gt;    hal_mgr_obj = bus.get_object(BUS_NAME, MGR_OBJ)&lt;br /&gt;    hal_mgr = dbus.Interface(hal_mgr_obj, HAL_MGR_IFACE)&lt;br /&gt;    all_dev = hal_mgr.FindDeviceByCapability('serial')&lt;br /&gt;    devices = list()&lt;br /&gt;    for device in all_dev:&lt;br /&gt;        if vendor_id in device:&lt;br /&gt;            devices.append(device)&lt;br /&gt;    return devices&lt;br /&gt;&lt;br /&gt;def get_hal_info(udi):&lt;br /&gt;    """Return Huawei interface name and short description."""&lt;br /&gt;&lt;br /&gt;    hal_dev = bus.get_object(BUS_NAME, udi)&lt;br /&gt;    dev_property = hal_dev.GetProperty&lt;br /&gt;    serial_port = dev_property('serial.device', dbus_interface=HAL_DEV_IFACE)&lt;br /&gt;    info_product = dev_property('info.product', dbus_interface=HAL_DEV_IFACE)&lt;br /&gt;&lt;br /&gt;    return info_product, serial_port&lt;br /&gt;&lt;br /&gt;def main():&lt;br /&gt;    """Find Serial interfaces for Huawei USB modems on a system."""&lt;br /&gt;&lt;br /&gt;    devices = find_huawei_devices()&lt;br /&gt;    if devices:&lt;br /&gt;        l = len(devices)&lt;br /&gt;        print '%s Huawei interface%s detected.' % (l, l &gt; 1 and 's' or '')&lt;br /&gt;        for dev in devices:&lt;br /&gt;            print "%20s : %s" % get_hal_info(dev)&lt;br /&gt;    else:&lt;br /&gt;        print 'No Huawei devices found.'&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt;    main()&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3719364551080865862?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3719364551080865862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3719364551080865862' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3719364551080865862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3719364551080865862'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/06/find-huawei-interfaces-on-linux.html' title='Find Huawei interfaces on Linux'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2665264352233631401</id><published>2009-06-18T00:50:00.002+01:00</published><updated>2009-06-18T01:12:51.795+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Cloud Computing - Another paper from Sun Microsystems</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;Sun has an annoying habbit of advertising white papers as "free" and then pointing you to a link with a survey, where they want you to fill out some stuff about your personal situation, current job status (including the company as a &lt;span style="color: rgb(204, 0, 0);"&gt;*required field&lt;/span&gt;) and some other similar pieces of information that you otherwise don't feel like sharing. Once you submit your factual or fictional data you'll discover that it wasn't necessary but Sun failed to inform you about it  in time. Anyhow, have an interesting read without giving them your personal data:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="https://www.sun.com/offers/docs/CloudComputing.pdf" target="_blank"&gt;https://www.sun.com/offers/docs/CloudComputing.pdf&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2665264352233631401?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2665264352233631401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2665264352233631401' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2665264352233631401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2665264352233631401'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/06/cloud-computing-another-paper-from-sun.html' title='Cloud Computing - Another paper from Sun Microsystems'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5347325572667309809</id><published>2009-06-03T10:18:00.005+01:00</published><updated>2009-06-18T01:12:51.795+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Listening to technical presentations.</title><content type='html'>&lt;div style="text-align: justify;"&gt;My reception of technical presentations can vary depending on how well I'm prepared. Things I'm going to list might seem obvious at first, oh yeah you know them all, but the tricky part is to actually do it.&lt;br /&gt;&lt;br /&gt;When going to a technical presentation...&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Make sure you understand the jargon.&lt;/span&gt;&lt;br /&gt;Collect the vocabulary that is related to the subject and might pop up in the talk. Search through related mailing list archives or just lurk on one of them.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Have a general understanding of how stuff works.&lt;/span&gt;&lt;br /&gt;Familiarize yourself with the programming language, protocol or product that the presentation is about. Most importantly, look at &lt;span style="font-weight: bold;"&gt;other&lt;/span&gt; languages, protocols and pieces of software designed to do more/less the same thing and try to compare the differences.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Try to stay focused during the presentation&lt;/span&gt;. If you lose concentration only for a split second you might get out of sync which turns out to be a little discouraging.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Take bullet point notes during the presentation&lt;/span&gt;, expand them afterwards.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Always&lt;/span&gt;&lt;span style="font-style: italic;"&gt; follow up with some hands-on exercise&lt;/span&gt;, e.g. install the software, set up the network configuration, do some coding.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5347325572667309809?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5347325572667309809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5347325572667309809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5347325572667309809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5347325572667309809'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/06/listening-to-technical-presentations.html' title='Listening to technical presentations.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8416995899500145838</id><published>2009-05-30T21:50:00.004+01:00</published><updated>2009-06-18T01:12:51.795+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Virtualization for Dummies from AMD and Sun.</title><content type='html'>&lt;div style="text-align: justify;"&gt;Sun Microsystems asked me to fill a survey for them and as a reward I would download Virtualization for Dummies e-book. They didn't mention, that it's publically available on their website, I'm not sure if they mentioned that it's a part of the Sun+AMD marketing campaign (if they had done that I'd like to see the results of the survey). Anyway, might be an interesting read and it's only 50 pages long (of which you should and will skip the first 9 pages full of marketing crap). Help yourselves:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;&lt;a href="http://www.sun.com/systems/virtualization-for-dummies.pdf" target="_blank"&gt;http://www.sun.com/systems/virtualization-for-dummies.pdf&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8416995899500145838?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8416995899500145838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8416995899500145838' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8416995899500145838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8416995899500145838'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/05/virtualization-for-dummies-from-amd-and.html' title='Virtualization for Dummies from AMD and Sun.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4823930599411533004</id><published>2009-05-27T12:03:00.016+01:00</published><updated>2009-06-03T11:48:00.081+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Thoughts on troubleshooting methodology...</title><content type='html'>&lt;div style="text-align: justify;"&gt;I never thought I could have any problems troubleshooting IT stuff,  especially since it's been my day-to-day job for the last 3 years. However, not so long ago I was asked a couple of troubleshooting scenario questions in an interview and while I had the right feeling about the solution I still failed to break the problem down theoretically and when the time was up the interviewer didn't seem impressed with me (this is probably a nice way of putting it). I said to myself 'no big deal', as having my hands on the actual problem in the real world I would probably have had it solved in no time.&lt;br /&gt;Or would I? Maybe yeah, but certainly without the 'no time' factor.&lt;br /&gt;It got me thinking about how intuitively I have been doing my job sofar and that it's actually not the right approach for a troubleshoot professional. I decided I needed some structure, and here it is. I'd like to share my thoughts with you:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Problem identification and data collection.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If someone reported the problem, ask the reporter precise questions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What's wrong?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;When did it happen for the 1st time? (If relevant, where?)&lt;/li&gt;&lt;li&gt;Did you change something just before the occurence? If so, what?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Is the problem persistent or intermittent?&lt;/li&gt;&lt;li&gt;Are you aware about other people experiencing the same issue?&lt;/li&gt;&lt;li&gt;Have you tried any workarounds?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;What does an Internet search return? Maybe a fairly common issue globally?&lt;br /&gt;What does your internal knowledge base return? Maybe a fairly common local issue?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;What is the scope of the problem. Local? Global?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Reproducing a problem.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Where possible, create a test environment.&lt;/li&gt;&lt;li&gt;Try to reproduce the bug. If succesfully reproduced, on Unix-like systems &lt;span style="font-weight: bold;"&gt;truss&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;strace&lt;/span&gt; are irreplaceable for runtime executable analysis. Similar tools for Windows are available too.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Analysis.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Visualize. Draw all the components and try to figure out visually where the problem might be hidden.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Try to understand the potential dangers.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Make a thorough research and refer to technical documentation.&lt;/li&gt;&lt;li&gt;It is crucial that you &lt;span style="font-weight: bold;"&gt;understand the terminology&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Isolating the issue.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Rule out factors that have nothing to do with the problem, but don't just assume - make sure they don't.&lt;/li&gt;&lt;li&gt;Test the problem under many different conditions. Change one or two conditions at a time.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Suggest and apply fixes.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Always make a backup of any important data that can be lost.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Escalate where appropriate.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Understanding and verifying the solution.&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Make sure you understand what's going on before moving on to conclusions.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;Creating Documentation!&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Document your findings in order to avoid effort duplication. Describe the symptoms, error messages and the solution and publish them somewhere. Try to organize your knowledge base so that finding information is easy after you get the same problem in after 6 months time...&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4823930599411533004?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4823930599411533004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4823930599411533004' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4823930599411533004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4823930599411533004'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/05/thoughts-on-troubleshooting-methodology.html' title='Thoughts on troubleshooting methodology...'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-6098825273636544664</id><published>2009-05-24T12:18:00.004+01:00</published><updated>2009-05-24T13:38:32.400+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='IPv6'/><title type='text'>IPv6 on Gentoo.</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you've got IPv6 connectivity on Gentoo Linux, you may want to set some applications to prefer IPv6 over IPv4 addresses. This way, if both IPv4 and IPv6 addresses are returned from the DNS server, the application will go with the latter.&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Add ipv6 to the default USE flags in /etc/make.conf. Otherwise the applications built by emerge, will not necessarily be IPv6 aware.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;wget&lt;br /&gt;Edit /etc/wget/wgetrc file and uncomment the following setting:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;#/etc/wget/wgetrc&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# [...]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;prefer-family = IPv6&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# [...]&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;Consequently, /usr/bin/emerge which uses wget as download engine, will try to pull the traffic via IPv6 first if only the DNS server of your mirror returns an IPv6 address.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;rsync&lt;br /&gt;Edit /etc/conf.d/rsyncd and add &lt;span style="color: rgb(51, 204, 255);"&gt;--ipv6&lt;/span&gt; to the RSYNC_OPTS variable.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-6098825273636544664?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/6098825273636544664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=6098825273636544664' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6098825273636544664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6098825273636544664'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/05/ipv6-on-gentoo.html' title='IPv6 on Gentoo.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4863809489633123918</id><published>2009-05-03T15:09:00.006+01:00</published><updated>2009-05-27T22:37:09.203+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IPv6'/><title type='text'>IPv6 Google Search Firefox Plugin</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you already have IPv6 connectivity you should consider pointing your Firefox to &lt;a href="http://ipv6.google.com/" target="_blank"&gt;http://IPv6.Google.com &lt;/a&gt;instead of &lt;a href="http://www.google.com/" target="_blank"&gt;www.google.com&lt;/a&gt; as your default Search Engine.&lt;br /&gt;&lt;br /&gt;Google provides IPv6 Google search as of 5/13/2008, as we read from the official blog:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://googleblog.blogspot.com/2008/05/looking-towards-ipv6.html"&gt;Official Google Blog: Looking towards IPv6&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;You can do it with this OpenSearch compliant Firefox Search Plugin&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:180%;"&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/11730" target="_blank"&gt;IPv6 Google Search.&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Search is performed over IPv6, but the search suggestions go over IPv4 network.&lt;br /&gt;&lt;br /&gt;It's issued under GPLv3.&lt;br /&gt;THERE IS NO WARRANTY FOR THE PLUGIN. IT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PLUGIN IS WITH YOU. SHOULD THE PLUGIN PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.&lt;br /&gt;&lt;br /&gt;Troubleshooting tips:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"Failed to Connect" in Firefox - your computer can resolve ipv6.google.com DNS address but can't find the route to the host.&lt;br /&gt;Solution:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Get an IPv6 connection. Start &lt;a href="http://www.ipv6.org/" target="_blank"&gt;here&lt;/a&gt;, and move on to opening an account with a tunnel broker (e.g. &lt;a href="http://www.sixxs.net/main/" target="_blank"&gt;SixXS.NET&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;"Address Not Found" in Firefox - your computer can't resolve the ipv6.google.com DNS address.&lt;br /&gt;Solution:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Go to about:config in the address bar of Firefox and make sure that &lt;span style="font-weight: bold;"&gt;network.dns.disableIPv6&lt;/span&gt; is set to False&lt;/li&gt;&lt;li&gt;Check your DNS settings.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ul&gt;Please ask your questions in the comments.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4863809489633123918?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4863809489633123918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4863809489633123918' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4863809489633123918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4863809489633123918'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html' title='IPv6 Google Search Firefox Plugin'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-459821420944831140</id><published>2009-05-03T13:52:00.007+01:00</published><updated>2011-04-07T11:07:09.120+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IPv6'/><title type='text'>A simple javascript test for IPv6 connectivity.</title><content type='html'>JavaScript test for IPv6 connectivity to IPv6.google.com.&lt;br /&gt;&lt;pre class="brush: js"&gt;/*&lt;br /&gt; * http://blog.ooz.ie/2009/05/test-for-ipv6-connectivity.html&lt;br /&gt; *&lt;br /&gt; * A simple test for IPv6 connectivity to http://ipv6.google.com/&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;function loadOK() {&lt;br /&gt;// Image loaded OK.&lt;br /&gt;alert('Success. IPv6 connectivity to Google detected.');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function loadError() {&lt;br /&gt;// There was an error loading an image.&lt;br /&gt;alert('Error. No IPv6 connectivity to Google.');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var GoogleV6Logo = new Image();&lt;br /&gt;GoogleV6Logo.onload = loadOK;&lt;br /&gt;GoogleV6Logo.onerror = loadError;&lt;br /&gt;&lt;br /&gt;GoogleV6Logo.src = "http://ipv6.google.com/intl/en_ALL/images/logo.gif";&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-459821420944831140?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/459821420944831140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=459821420944831140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/459821420944831140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/459821420944831140'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/05/test-for-ipv6-connectivity.html' title='A simple javascript test for IPv6 connectivity.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2379623856985228415</id><published>2009-03-02T00:36:00.004Z</published><updated>2009-03-23T00:58:57.090Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Crypto'/><title type='text'>Trivial encryption with coreutils</title><content type='html'>&lt;div style="text-align: justify;"&gt;We all know /bin/tr and /bin/dd, two very powerful tools, both are part of Linux' coreutils.  Combined together by a Unix pipe they become even more powerful, here is how.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;ROT13&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Rot13 is a simple substitution cipher. It consists in shifting each character of the alphabet 13 places to the right. If a character goes beyond the original Z place, it is moved to the beginning of the alphabet  and continues shifting from there. Effectively all characters are moved by 13 places, so that the alphabet starts now with N instead of A and ends with M instead of Z.&lt;br /&gt;&lt;br /&gt;Substitution ciphers are considered weak, because they are prone to pattern matching and statistical attacks. It is good enough to hide the contents of the message from human eyes at the first glance. /bin/tr is a Linux core tool that can be used to translate the alphabet into it's rot13 equivalent.&lt;br /&gt;&lt;pre&gt;$ tr A-Za-z N-ZA-Mn-za-m&lt;br /&gt;hello world&lt;br /&gt;uryyb jbeyq&lt;br /&gt;^C&lt;br /&gt;$&lt;/pre&gt;&lt;span style="font-size:130%;"&gt;ENDIANNESS&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This feature comes to us thanks to diversity of computer hardware. Little-endians address the 16-bit values in memory differently from from Big-endians, what sometimes  causes incompatibility issues. Here /bin/dd comes comes to rescure with it's conversion flag:&lt;pre&gt;$ dd conv=swab bs=1&lt;br /&gt;hello world&lt;br /&gt;ehll oowlr&lt;br /&gt;d^C12+0 records in&lt;br /&gt;12+0 records out&lt;br /&gt;12 bytes (12 B) copied, 13.3088 s, 0.0 kB/s&lt;/pre&gt;Byte swapping is not an encryption method in itself, because swapped bytes in a word are still readable. An interesting thing about the swap, however, is the fact that if a human readable sentence delimited by spaces is byte-swapped the words, while still somehow readable, change the length.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;TRIVIAL ENCRYPTION CYPHER&lt;/span&gt;&lt;br /&gt;The fact that the two converisions named above are absolutely independent from each other allows us to combine them together. A message encrypted this way is a little less likely to be decoded with a statistical or pattern matching algorithm.&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;$ cat secret|tr A-Za-z N-ZA-Mn-za-m|dd conv=swab&lt;br /&gt;uG rrfepgrz frnfrts ybbyfj&lt;br /&gt;!0+1 records in&lt;br /&gt;0+1 records out&lt;br /&gt;28 bytes (28 B) copied, 0.00179017 s, 15.6 kB/s&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2379623856985228415?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2379623856985228415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2379623856985228415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2379623856985228415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2379623856985228415'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/03/trivial-encryption-with-coreutils.html' title='Trivial encryption with coreutils'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4236612939908002784</id><published>2009-02-20T23:27:00.004Z</published><updated>2009-02-21T19:40:44.492Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>% percent string formatting in Python</title><content type='html'>&lt;div style="text-align: justify;"&gt;Playing around with string formatting in Python I made an interesting discovery. Python supports extended string formatting similar to the one introduced in C, but much more powerful. It does it by means of using a % (percent) sign optionally followed by name in brackets (which can be a dictionary key), formatting flags, unit width, a dot with precision point and finally mandatory character code for formatted unit's type. General definition looks as follows:&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 204, 0); font-weight: bold;"&gt;'preceding text %[(key)][flags][width][.precision point] following text' % value&lt;/span&gt;&lt;char code=""&gt;&lt;/char&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;and if you want to feed a string with a literal percentage sign you use '%%' (double percentage)... but there is a catch! The double-percentage rule is only valid for strings that are about to be injected values by format strings; strings that are not meant to be formatted  should contain only one percentage sign to reach the same outcome. In other words the following lines of code produce the same output:&lt;br /&gt;&lt;/div&gt;&lt;pre style="color: rgb(102, 255, 255);"&gt;print '%% %s' % 'hello'&lt;br /&gt;print '% hello'&lt;/pre&gt;whereby&lt;pre style="color: rgb(102, 255, 255);"&gt;print '%% %s' % 'hello'&lt;br /&gt;print '%% hello'&lt;/pre&gt;causes the second line to print out the percentage sign twice, and&lt;pre style="color: rgb(102, 255, 255);"&gt;print '% %s' % 'hello'&lt;/pre&gt;is wrong and errors out with &lt;span style="font-style: italic;"&gt;'TypeError: not all arguments converted during string formatting'&lt;/span&gt;. This behaviour is diffrent from the C one, where all strings, formatted or not are treated equally.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4236612939908002784?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4236612939908002784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4236612939908002784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4236612939908002784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4236612939908002784'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2009/02/percent-string-formatting-in-python.html' title='% percent string formatting in Python'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2316817770549583768</id><published>2008-09-21T22:37:00.024+01:00</published><updated>2008-10-05T01:13:18.721+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Assembler'/><title type='text'>[0x04]. Notes on Assembly - The fairytale of an x86 CPU</title><content type='html'>&lt;table align="center" border="1" width="70%"&gt;&lt;tbody&gt;&lt;tr bgcolor="#5566ff"&gt;&lt;td style="text-align: center; font-style: italic; color: rgb(0, 0, 0);" bgcolor="#aaaaff"&gt;FLAGS&lt;/td&gt;&lt;td style="text-align: center;" bgcolor="#5678ff"&gt;EIP&lt;/td&gt;&lt;td style="text-align: center;"&gt;ESP&lt;/td&gt;&lt;td style="text-align: center;"&gt;EBP&lt;/td&gt;&lt;/tr&gt;&lt;tr bgcolor="blue"&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;CS&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;DS&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;ES&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;SS&lt;/td&gt;&lt;/tr&gt;&lt;tr bgcolor="#0000cc"&gt;&lt;td style="text-align: center; font-weight: bold;" bgcolor="blue"&gt;FS&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;" bgcolor="blue"&gt;GS&lt;/td&gt;&lt;td style="text-align: center;"&gt;ESI&lt;/td&gt;&lt;td style="text-align: center;"&gt;EDI&lt;/td&gt;&lt;/tr&gt;&lt;tr bgcolor="#000088"&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;EAX&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;EBX&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;ECX&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;EDX&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;A 32bit x86 has 16 registers, divided in 6 groups respectively:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1 x EFLAGS register&lt;/li&gt;&lt;li&gt;1 x Instruction Pointer&lt;/li&gt;&lt;li&gt;2 x Stack Pointing Registers&lt;br /&gt;&lt;/li&gt;&lt;li&gt;6 x Segment Registers&lt;/li&gt;&lt;li&gt;2 x Index Registers&lt;br /&gt;&lt;/li&gt;&lt;li&gt;4 x General Purpose Registers&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The registers are assigned specific roles:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;EFLAGS register (Extended FLAGS register is a 32bit version of the 16bit FLAGS) contains the state of current processor. Only 18 out of 32 flags have a meaning assigned. &lt;/li&gt;&lt;li&gt;EIP - Extended Instruction Pointer points to the next instruction memory address in the Fetch-Execute cycle.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ESP - Extended Stack Pointer - points to the top of the stack. You can see how it grows down on an x86 architecture in the following example: &lt;a target="_blank" href="http://oozie.fm.interia.pl/src/stack_pointer.c"&gt;stack_pointer.c&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;EBP - Extended Base Pointer - points to the base of the current Stack Frame. If you assemble &lt;a target="_blank" href="http://oozie.fm.interia.pl/src/func.c"&gt;func.c&lt;/a&gt; as follows:&lt;br /&gt;&lt;pre&gt;$ gcc -S func.c -o func.s&lt;/pre&gt;and take a look into func.s file, the f() function will be translated to some thing like that:&lt;pre style="color: rgb(255, 255, 102);"&gt;f:&lt;br /&gt;pushl   %ebp  &lt;br /&gt;movl    %esp, %ebp&lt;br /&gt;subl    $16, %esp&lt;br /&gt;movl    $11, -16(%ebp)&lt;br /&gt;movl    $22, -12(%ebp)&lt;br /&gt;movl    $33, -8(%ebp)&lt;br /&gt;movl    $44, -4(%ebp)&lt;br /&gt;leave&lt;br /&gt;ret&lt;/pre&gt;&lt;span style="font-size:85%;"&gt;1. Line one saves the old EBP&lt;br /&gt;2. Old ESP becomes new EBP&lt;br /&gt;3. Increasing the stack by the size of 1 paragraph&lt;br /&gt;4-7. Saving local variables in the stack frame locations relative to EBP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;?S - Segment Registers&lt;br /&gt;&lt;ul&gt;&lt;li&gt;CS, Code Segment&lt;br /&gt;&lt;/li&gt;&lt;li&gt;DS, Data Segment&lt;/li&gt;&lt;li&gt;SS, Stack Segment&lt;/li&gt;&lt;li&gt;ES, Extra Segment&lt;br /&gt;&lt;/li&gt;&lt;li&gt;FS, another Extra Segment&lt;br /&gt;&lt;/li&gt;&lt;li&gt;GS, another Extra Segment&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Extended Index Registers, used for array operations (e.g. strings, which are arrays of bytes)&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Source Index&lt;/li&gt;&lt;li&gt;Destination Index&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Extended General Purpose Registers&lt;br /&gt;&lt;ul&gt;&lt;li&gt;EAX - accumulator, used for storing intermediate results of I/O access, interrupts or arithmetics.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;EBX - base register, used for addressing&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ECX - counter, used in loops and countdowns.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;EDX - data register&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2316817770549583768?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2316817770549583768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2316817770549583768' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2316817770549583768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2316817770549583768'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/09/0x04-notes-on-assembly-fairytale-of-x86.html' title='[0x04]. Notes on Assembly - The fairytale of an x86 CPU'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-6321208673696056936</id><published>2008-09-14T02:08:00.024+01:00</published><updated>2009-08-03T17:24:00.742+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Assembler'/><title type='text'>[0x03]. Notes on Assembly - Memory from a process' point of view</title><content type='html'>&lt;div style="text-align: justify;"&gt;In-depth memory layout is specific to both the CPU architecture and the OS itself. I'm going to describe how a process sees its own memory share during execution.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Memory Layout from a process perspective&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When a program is executed it is read into memory* where it resides until  termination. The code allocates a number of special purpose memory blocks for different data types. A  very common scheme, but not the only one, is depicted in the following table.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;*that's why a statement that the size of your binary does not influence the memory use is not true. Programs static code is read into the lower part of memory. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table bg="" style="color: rgb(1, 35, 69);" align="center" border="1" cellpadding="5" width="80%"&gt;&lt;tbody&gt;&lt;tr style="color: rgb(255, 255, 255);"&gt;&lt;td&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Stack&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;a very dynamic kind of memory located at it's top (high addresses) and growing downwards&lt;/div&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="font-weight: bold; color: rgb(51, 102, 255);" align="center"&gt;&lt;td bg=""&gt;&lt;br /&gt;&lt;br /&gt;Memory not allocated yet&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: normal;"&gt;Memory that will soon become allocated by the stack, that grows down. Stack will grow until it hits the administrative limit (predefined).&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Administrative limit for the stack&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="font-weight: bold; color: rgb(51, 102, 255);" align="center"&gt;&lt;td&gt;&lt;span style="font-weight: normal; font-style: italic;"&gt;Shared Libraries&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="font-weight: bold; color: rgb(51, 102, 255);" align="center"&gt;&lt;td bg=""&gt;Administrative limit for the heap&lt;br /&gt;&lt;br /&gt;Memory not allocated yet&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: normal;"&gt;Memory that will soon become allocated by the heap growing up from underneath.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color: rgb(255, 255, 255);"&gt;&lt;td&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Heap&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;It is said that this is the most dynamic part of memory. It is dynamically allocated and freed in big chunks. The allocation process is rather complex (stub/buddy system) and is more time consuming than putting things on stack.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color: rgb(255, 255, 255);"&gt;&lt;td&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;BSS&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Memory containing global variables of known (predeclared) size.&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color: rgb(255, 255, 255);"&gt;&lt;td&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Constant data&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;All constants used in a program.&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color: rgb(255, 255, 255);"&gt;&lt;td&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Static program code&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style="color: rgb(255, 255, 255);" align="center"&gt;&lt;td&gt;&lt;span style="font-weight: bold;"&gt;Reserved / other stuff&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In order to prove that things work this way (on many systems anyway) I wrote a C program, &lt;a target="_blank" style="font-weight: bold;" href="http://oozie.fm.interia.pl/src/mem_sequence.c"&gt;mem_sequence.c&lt;/a&gt;, that allocates 5 types of data, finds their location the (virtual) memory address, sorts them in descending order and then displays presenting a similar output to the table above. &lt;a style="font-weight: bold;" href="http://oozie.fm.interia.pl/src/mem_sequence.c" target="_blank"&gt;mem_sequence.c&lt;/a&gt; is tested on Linux, FreeBSD, MacOS X, WinXP and DOS. All UNIX-like systems preserve a similar model with slight differences in address thresholds, the output from Microsoft systems is different and hence interesting.&lt;br /&gt;&lt;br /&gt;This is how you use &lt;span style="font-weight: bold;"&gt;mem_sequence&lt;/span&gt;:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;$ gcc mem_sequence.c -o mem_sequence&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;$ ./mem_sequence&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;1.(0xbf828124) stack&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;2.(0x0804a008) heap&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;3.(0x080497d4) bss&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;4.(0x08048688) const's&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;5.(0x08048557) code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;^Z&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;[1]+  Stopped                 ./mem_sequence&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;$ cat /proc/`pidof mem_sequence`/maps&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;08048000-08049000 r-xp 00000000 fd:01 313781     mem_sequence&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;08049000-0804a000 rw-p 00000000 fd:01 313781     mem_sequence&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;0804a000-0806b000 rw-p 0804a000 00:00 0          [heap]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7dda000-b7ddb000 rw-p b7dda000 00:00 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7ddb000-b7efe000 r-xp 00000000 fd:01 4872985    /lib/libc-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7efe000-b7eff000 r--p 00123000 fd:01 4872985    /lib/libc-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7eff000-b7f01000 rw-p 00124000 fd:01 4872985    /lib/libc-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7f01000-b7f04000 rw-p b7f01000 00:00 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7f18000-b7f1b000 rw-p b7f18000 00:00 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7f1b000-b7f35000 r-xp 00000000 fd:01 4872978    /lib/ld-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7f35000-b7f36000 r--p 00019000 fd:01 4872978    /lib/ld-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;b7f36000-b7f37000 rw-p 0001a000 fd:01 4872978    /lib/ld-2.5.so&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;bf816000-bf82b000 rw-p bffeb000 00:00 0          [stack]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;$&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;Let's analyze it:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The code (5) and constants (4) fall into the readable and executable (non-writable!) portion of code.&lt;/li&gt;&lt;li&gt;BSS (3) is enclosed in the read-write but not executable partition.&lt;/li&gt;&lt;li&gt;Heap sits on top of them and is denoted by "[Heap]".&lt;/li&gt;&lt;li&gt;...long long nothing...&lt;/li&gt;&lt;li style="text-align: justify;"&gt;Stack at the very top, described as "[Stack]". Yahtzee!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;It works, great news, but it works differently on different x86 based Operating Systems. Check it out yourself and please let me know if you make an interesting discovery on some other exotic system.&lt;br /&gt;&lt;/div&gt;&lt;table align="center" border="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;span style="font-size:85%;"&gt;top&lt;/span&gt;&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;&lt;a target="_blank" href="http://oozie.fm.interia.pl/src/linux_seq.txt"&gt;Linux&lt;/a&gt;&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;&lt;a target="_blank" href="http://oozie.fm.interia.pl/src/freebsd_seq.txt"&gt;FreeBSD&lt;/a&gt;&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;&lt;span style="font-size:100%;"&gt;MacOSX&lt;/span&gt; &lt;a target="_blank" href="http://oozie.fm.interia.pl/src/macosx_seq.txt"&gt;x86&lt;/a&gt; / &lt;a target="_blank" href="http://oozie.fm.interia.pl/src/macosxppc_seq.txt"&gt;PPC&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;&lt;a target="_blank" href="http://oozie.fm.interia.pl/src/win32_seq.txt"&gt;WinXP 32&lt;br /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;&lt;a target="_blank" href="http://oozie.fm.interia.pl/src/dos_seq.txt"&gt;DOS&lt;/a&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;AmigaOS 4.1&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;Vista Home 32bit&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;1&lt;br /&gt;&lt;/td&gt;&lt;td style="text-align: center;"&gt;stack&lt;/td&gt;&lt;td style="text-align: center;"&gt;stack&lt;/td&gt;&lt;td style="text-align: center;"&gt;stack&lt;/td&gt;&lt;td style="text-align: center;"&gt;heap&lt;/td&gt;&lt;td style="text-align: center;"&gt;heap&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt; code&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;bss&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;2&lt;br /&gt;&lt;/td&gt;&lt;td style="text-align: center;"&gt;heap&lt;/td&gt;&lt;td style="text-align: center;"&gt;heap&lt;/td&gt;&lt;td style="text-align: center;"&gt;heap&lt;/td&gt;&lt;td style="text-align: center;"&gt;bss&lt;/td&gt;&lt;td style="text-align: center;"&gt;stack&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;heap&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;const's&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;3&lt;br /&gt;&lt;/td&gt;&lt;td style="text-align: center;"&gt;bss&lt;/td&gt;&lt;td style="text-align: center;"&gt;bss&lt;/td&gt;&lt;td style="text-align: center;"&gt;bss&lt;/td&gt;&lt;td style="text-align: center;"&gt;const&lt;/td&gt;&lt;td style="text-align: center;"&gt;bss&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;bss&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;code&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;4&lt;br /&gt;&lt;/td&gt;&lt;td style="text-align: center;"&gt;const&lt;/td&gt;&lt;td style="text-align: center;"&gt;const&lt;/td&gt;&lt;td style="text-align: center;"&gt;const&lt;/td&gt;&lt;td style="text-align: center;"&gt;code&lt;/td&gt;&lt;td style="text-align: center;"&gt;const&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;const's&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;heap&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;5&lt;/td&gt;&lt;td style="text-align: center;"&gt;code&lt;/td&gt;&lt;td style="text-align: center;"&gt;code&lt;/td&gt;&lt;td style="text-align: center;"&gt;code&lt;/td&gt;&lt;td style="text-align: center;"&gt;stack&lt;/td&gt;&lt;td style="text-align: center;"&gt;code&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;stack&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top; text-align: center;"&gt;stack&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Thanks to &lt;a href="http://monihart.at/" target="_blank"&gt;Harald Monihart&lt;/a&gt; for providing MacOSX PPC data.&lt;br /&gt;Thanks to Anonymous for AmigaOS 4.1 data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-6321208673696056936?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/6321208673696056936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=6321208673696056936' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6321208673696056936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6321208673696056936'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/09/0x03-notes-on-assembly-memory-from.html' title='[0x03]. Notes on Assembly - Memory from a process&apos; point of view'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4202188607113759935</id><published>2008-08-17T23:47:00.019+01:00</published><updated>2008-09-14T00:12:14.986+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Assembler'/><title type='text'>[0x02]. Notes on Assembly - Acquainting oneself with the Memory</title><content type='html'>&lt;div style="text-align: justify;"&gt;The biggest part of Assembly Language is all about the CPU talking to the main memory. I'm going to dive deep into this subject. Let's start with the memory management so we can smoothly move over to the CPU and understand what different CPU registers were designed for.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;For a start read &lt;a href="http://books.google.com/books?id=tAbWspLyLIoC"&gt;How Computers Work: Processor and Main Memory by Roger Young&lt;/a&gt; to understand in more detail how memory addressing and memory IO operations are performed.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Below a list of essential terms connected to memory and its management.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:130%;"&gt;Random Access Memory (RAM)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;main operational memory in PC computers. Its characteristic consists in the way the data is accessed (read from or written to), namely just by using electric impulses. &lt;span style="font-size:85%;"&gt;(This is very different from other storage mediums, e.g. magnetic tape, where reading data requires mechanical movement of the tape what takes very long and the time of reading some particular data depends on data's physical location on the medium.)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Running programs and their data are read into RAM at execution time.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:130%;"&gt;x86 Processor Modes&lt;/span&gt;&lt;br /&gt;Memory is always accessed under a strong supervision of the processor, if not by the CPU itself, hence the CPU controls what mode the memory is accessed in.&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;Real mode - there original CPU mode introduced with 286 machines. It has a 20bit address space, thus allowing to address 2^20bytes (=1MiB) of memory only. Segments in real more are always 64KiB in size.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Protected mode -  due to compatibility reasons, all x86 CPUs start in Real mode (so they can support archaic operating systems like DOS), and can be immediately switched to Protected mode by setting appropriate flags in the registers. Protected mode can enrich the system into additional features, like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;the use of virtual memory, &lt;/li&gt;&lt;li&gt;8086 virtual mode, &lt;/li&gt;&lt;li&gt;privilege levels, &lt;/li&gt;&lt;li&gt;multitasking&lt;/li&gt;&lt;li&gt;and others...&lt;/li&gt;&lt;/ul&gt;Segment sizes can vary.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Unreal mode - this mode breaks the 20-bit addressing limit that exists in real mode and allows to address up to 4GiB of Memory&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li style="text-align: justify;"&gt;Long - this mode is available on 64bit processors only. It allows 64bit applications to run 64bit, at the same time 16 and 32 bit apps are switched to compatibility mode and can be executed without problems.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:130%;"&gt;Virtual Memory&lt;/span&gt;&lt;br /&gt;On modern operating systems hundreds of processes run at the same time. If you sum up the amount of memory they use at any given time it would exceed the  physical RAM amount.  This is possible thanks to virtual memory, a technique that tricks running programs into thinking, that they have more RAM memory at disposal than there is factually available.  It is done by dumping the memory space of inactive processes into secondary storage. This is called paging. Moreover, Virtual Memory enables Operating Systems to  protect and manage memory the way an Operating System is programmed to.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Paging&lt;/span&gt;&lt;br /&gt;During this process inactive areas of real memory are dumped onto the secondary storage and used re-read back into RAM when a program calls them.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Segmentation &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;A relative way (not an absolute way) to address physical memory by a usage of the Segment:Offset notation. Best explained in &lt;a href="http://mirror.href.com/thestarman/asm/debug/Segments.html"&gt;this article by  Daniel Sedory&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:130%;"&gt;Memory Management Unit&lt;/span&gt;&lt;br /&gt;a hardware part of the CPU that controls how the CPU accesses memory. Its 4 main functions are:&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;translating virtual-to-physical addresses;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;memory protection;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;cache control;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;bus arbitration;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:130%;"&gt;... so roughly:&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;When a x86 computer is turned on, it starts in &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;real mode&lt;/span&gt;&lt;span style="font-size:100%;"&gt; and can only address the first mebibyte (1024*1024bytes=KiB^2) of &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;RAM.&lt;/span&gt;&lt;span style="font-size:100%;"&gt; This is more than enough to bootstrap an Operating System.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;The Operating System can switch the CPU from &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;real&lt;/span&gt;&lt;span style="font-size:100%;"&gt; into &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;protected mode&lt;/span&gt;&lt;span style="font-size:100%;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;When in &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;protected mode,&lt;/span&gt;&lt;span style="font-size:100%;"&gt; the system can take advantage of e.g. &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;memory protection&lt;/span&gt;&lt;span style="font-size:100%;"&gt; and &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;virtual memory&lt;/span&gt;&lt;span style="font-size:100%;"&gt; to manage memory resources. It does that under strong supervision of the &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Memory Management Unit&lt;/span&gt;&lt;span style="font-size:100%;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;http://en.wikipedia.org/wiki/X86&lt;br /&gt;http://en.wikipedia.org/wiki/Memory_management_unit&lt;br /&gt;http://en.wikipedia.org/wiki/Virtual_memory&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4202188607113759935?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4202188607113759935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4202188607113759935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4202188607113759935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4202188607113759935'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/08/0x02-notes-on-assembly-acquainting.html' title='[0x02]. Notes on Assembly - Acquainting oneself with the Memory'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1089141417477017009</id><published>2008-08-05T00:15:00.016+01:00</published><updated>2008-08-17T22:07:44.241+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Assembler'/><title type='text'>[0x01]. Notes on Assembly - AT&amp;T  vs Intel syntax</title><content type='html'>&lt;div style="text-align: justify;"&gt;There are two main syntaxes for Assembly Language: AT&amp;amp;T and Intel. The former was invented by AT&amp;amp;T Labs in 1960's and is used on all UNIX-based systems, the original intention was to preserve portability and compatibility between different UNIX flavors. The latter was invented by Intel and is commonly used in MS systems. I have a bit of a chicken'n'egg problem here, as I have no idea who ripped off the most part from the other party but it's not relevant  nor important here... The main differences between the syntax are as follows:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;table align="center" border="1" width="95%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="center"&gt;&lt;span style="font-size:130%;"&gt;Intel&lt;/span&gt;&lt;/td&gt;&lt;td align="center"&gt;&lt;span style="font-size:130%;"&gt;AT&amp;amp;T&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Mnemonics are case-insensitive&lt;/td&gt;&lt;td&gt;Mnemonics are lowercase&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;case insensitive registers in form of AH, ax, Eax&lt;br /&gt;&lt;/td&gt;&lt;td&gt;lowercase registers are preceded with % (percent) sign, as in %eax, %ax&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Memory operands are prefixed with size accordingly: &lt;ul&gt;&lt;li&gt;byte ptr ADDR - 8 bits &lt;/li&gt;&lt;li&gt;word ptr ADDR - 16 bits&lt;/li&gt;&lt;li&gt;dword ptr ADDR - 32 bits&lt;/li&gt;&lt;li&gt;qword ptr ADDR - 64 bits&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;machine instructions end with one of three possible suffixes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;b - for byte&lt;/li&gt;&lt;li&gt;w - for word&lt;/li&gt;&lt;li&gt;l - for long word&lt;/li&gt;&lt;li&gt;q - for quadruple&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;e.g. movl, movw, movb&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;The programmer first specifies the destination and then the source operand.&lt;br /&gt;"mov bx, ax" moves ax to bx&lt;/td&gt;&lt;td&gt;You first specify the source and then the destination operand.&lt;br /&gt;"movw %ax, %bx" will move %ax to %bx.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Immediate operands, like numbers or memory addresses, are entered with "h", "b", or no suffix at all for hex, binary or decimal digits respectively&lt;/td&gt;&lt;td&gt;Immediate operands are preceded by $ (dollar sign).&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Comment is denoted by a ; (colon)&lt;/td&gt;&lt;td&gt;A comment is denoted by a # (hash)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Jump and call operands are undelimited&lt;/td&gt;&lt;td&gt;Jumps and calls are prefixed by an * (asterisk)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;...so that the same C program (main.c), that only returns 0 to the environment would look like this:&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="10"&gt;&lt;tbody&gt;&lt;tr bg=""  style="color:yellow;"&gt;&lt;td style="text-align: right;"&gt;&lt;span style="font-size:130%;"&gt;AT&amp;amp;T&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="text-align: center;"&gt;&lt;span style="font-size:180%;"&gt;C&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:130%;"&gt;Intel&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr bgcolor="darkblue"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;.text&lt;br /&gt;.globl _main&lt;br /&gt;_main:&lt;br /&gt;pushl   %ebp&lt;br /&gt;movl    %esp, %ebp&lt;br /&gt;subl    $8, %esp&lt;br /&gt;movl    $0, %eax&lt;br /&gt;leave&lt;br /&gt;ret&lt;br /&gt;.subsections_via_symbols&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;int main(void){&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;[SECTION        .text]&lt;br /&gt;_main:&lt;br /&gt;push    ebp&lt;br /&gt;mov     ebp, esp&lt;br /&gt;sub     esp, 8&lt;br /&gt;mov     eax, 0&lt;br /&gt;leave&lt;br /&gt;ret&lt;br /&gt;.subsections_via_symbols&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Sources:&lt;br /&gt;http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gnu-assembler/i386-syntax.html&lt;br /&gt;http://en.wikipedia.org/wiki/Unix&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1089141417477017009?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1089141417477017009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1089141417477017009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1089141417477017009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1089141417477017009'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/08/0x01-notes-on-assembly-at-vs-intel.html' title='[0x01]. Notes on Assembly - AT&amp;T  vs Intel syntax'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1090675431495632610</id><published>2008-07-28T12:30:00.024+01:00</published><updated>2008-08-17T23:50:19.290+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Assembler'/><title type='text'>[0x00]. Notes on Assembly - Basic Terms</title><content type='html'>&lt;span style="font-size:180%;"&gt;Coding with programmatic Lego bricks.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Assembly language is the lowest-level human readable programming language. It consists of a set of instructions that directly manipulate the CPU and memory, thus taking the programmer as close to the core of the machine as it gets. Writing programs in Assembly is like playing with Lego bricks in computing terms and this is probably why I like it so much.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Below I have put together a quick Assembly talk reference, differences between Intel and AT&amp;amp;T syntax, and some good practices. I hope some Assembly virgins may find it useful.&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;What is what? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Opcode -&lt;span style="font-size:100%;"&gt; literally OPeraction CODE, is a numeric &lt;/span&gt;&lt;span style="font-size:100%;"&gt;value &lt;/span&gt;&lt;span style="font-size:100%;"&gt;(binary in its original form, but most often represented hexadecimally) that stands for a basic machine instruction, e.g. incrementing one of the registers by 1, an AND instruction and such. &lt;/span&gt;The CPU fetches opcodes and executes them according to instruction set architecture provided by the vendor.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Mnemonic -&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;A human-readable nickname for opcodes. Mnemonics are usually from 2-5 characters long (e.g. jz, movsb). Mnemonics, just like opcodes, are specific to the CPU.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Operand - If a mnemonic takes arguments, those arguments are called operands (since they are input values to an operator). In Assembly a valid operand can possibly be a register, a memory address, a constant or a label (which in fact is a memory address). E.g. the instruction "movl %eax,%ebx" has two operands - eax and ebx.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Immediate Operand - a literal (immediate) value, e.g. a numeric constant, like a memory address&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Register - a basic data storage space, which can be accessed by CPU extremely fast, due to the fact that it lives in a CPU. The registers can be 64bit (?), 32bit (eax),16bit(ax), and 8bit (ah) in value. A pair of 4bit "nybbles" (byte halves) can be extracted from an 8bit register using ANDing or SHL/SHR tricks.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Paragraph - a 16-byte sized chunk of memory. Main memory is broken down into paragraphs starting from the address of 0000:0000 throughout, marking paragraph boundry every 16 (10h) bytes. In Segment:Offset memory addressing mode, every segment has to start in a position being a paragraph boundry.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Segment:Offset - standard memory addressing notation. Because of the nature Segment:Offset notation is computed, the Segment is denoted by a hexadecimal integer number always starts at a position in memory that is divisible by a paragraph size (16 bytes), so that actual memory address that the Segment points to equals to Segment value * 16. The Offset is a distance measured in bytes from the Segment address to the place in memory that you want to refer to. Please revert to sources section at the end of this post for more details.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;Stack - a LIFO queue nested in the upper part of the main memory but ruled by the CPU mainly with push, pop commands.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Stack frame - a data structure in memory (on the stack) containing information about subroutine state.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Local and global labels - in the assembly code you can insert a label at any point by typing a label name followed by a colon. During compilation labels are translated into memory addresses. Global labels start with an alphanumeric character or an _ (underscore) and can be jumped to from any place in the code. Local labels start with a . (dot) character and can be placed after global labels. Local labels can be accessed by jmp instructions only within the code between two global labels.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Sources:&lt;br /&gt;&lt;a target="_BLANK" href="http://www.duntemann.com/assembly.htm"&gt;Assembly Language Step-By-Step by Jeff Duntemann&lt;/a&gt;&lt;br /&gt;&lt;a target="_BLANK" href="http://en.wikipedia.org/wiki/Operand"&gt;http://en.wikipedia.org/wiki/Operand&lt;/a&gt;&lt;br /&gt;&lt;a target="_BLANK" href="http://en.wikipedia.org/wiki/64-bit"&gt;http://en.wikipedia.org/wiki/64-bit&lt;/a&gt;&lt;br /&gt;&lt;span class="a"&gt;&lt;a target="_BLANK" href="http://en.wikipedia.org/wiki/Opcode"&gt;http://en.wikipedia.org/wiki/Opcode&lt;/a&gt;&lt;br /&gt;&lt;a target="_BLANK" href="http://www.geocities.com/thestarman3/asm/debug/Segments.html"&gt;Explaination of the Segment:Offset notation by Daniel B. Sedory&lt;/a&gt;&lt;br /&gt;&lt;a target="_BLANK" href="http://en.wikipedia.org/wiki/Call_stack"&gt;http://en.wikipedia.org/wiki/Call_stack&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1090675431495632610?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1090675431495632610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1090675431495632610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1090675431495632610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1090675431495632610'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/07/0x00-notes-on-assembly-language-terms.html' title='[0x00]. Notes on Assembly - Basic Terms'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2775262883975622166</id><published>2008-07-14T05:35:00.003+01:00</published><updated>2008-08-01T15:13:34.021+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x08. [LPIC-302] LPIC 117-302 online exam simulation (yes, for free)</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt; I passed this exam almost two weeks ago. There was some more filling out the gaps that I expected, but the exam itself is never not too hard if you are prepared. It was a good fun and I enjoyed passing all 6 exams. I want to share a little bit of my joy with you with the exam simulation. It contains only 10 questions for now, just to give you a basic idea, but this will change soon (when I only get some time). If you want to suggest a question, please comment, and if it's gonna makes sense I will append it to the test. &lt;br /&gt;&lt;br /&gt;As usual, comments are very welcome. I would appreciate your help in tracking any ambiguities/mistakes. Now, I hope it will help you gain some self-confidence before taking the real one. Have fun!&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://oozie.fm.interia.pl/src/test302.html" noscroll="" frameborder="no" height="400" scrolling="no" width="100%"&gt; &lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2775262883975622166?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2775262883975622166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2775262883975622166' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2775262883975622166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2775262883975622166'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/07/0x08-lpic-302-lpic-117-302-online-exam.html' title='0x08. [LPIC-302] LPIC 117-302 online exam simulation (yes, for free)'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1227497699485019480</id><published>2008-06-14T14:31:00.004+01:00</published><updated>2008-06-25T01:09:09.597+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x07. [LPIC-302] Security and Performance</title><content type='html'>&lt;h4&gt;&lt;span style="font-size:130%;"&gt;Linux File System and Share/Service Permissions&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:78%;" &gt;Candidates should understand file permissions on a Linux file system in a mixed environment&lt;/span&gt;&lt;/h4&gt;From the official Samba Howto, ch. 16, we read:&lt;br /&gt;&lt;p style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;   Samba does not attempt to go beyond POSIX ACLs, so the various finer-grained access control   options provided in Windows are actually ignored.&lt;/span&gt;   &lt;/p&gt;&lt;div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"&gt;&lt;h3 style="font-style: italic;" class="title"&gt;Note&lt;/h3&gt;&lt;p&gt;&lt;span style="font-style: italic;"&gt;   All access to UNIX/Linux system files via Samba is controlled by the operating system file access controls.   When trying to figure out file access problems, it is vitally important to find the identity of the Windows   user as it is presented by Samba at the point of file access. This can best be determined from the   Samba log files.&lt;/span&gt;   &lt;/p&gt;&lt;/div&gt;This points us to well known commands of chmod and chown. Refresh their syntax. When it comes to smb.conf file, there are two options of particular importance:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;create mask -  This option takes an octal value of four digits and sets permissions on Samba-newly-created files accordingly. It can be used in all sections. It's default value is 0744&lt;br /&gt;&lt;/li&gt;&lt;li&gt;directory mask - does the same for directories what create mask does for files.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a name="eztoc2040_1_6_2" id="eztoc2040_1_6_2"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span style="font-size:130%;"&gt;Samba Security&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:78%;" &gt;Candidates should be able to secure Samba at both the firewall level, and the Samba daemons themselves&lt;/span&gt;&lt;/h4&gt;The first move that we take towards Samba security can be hosts allow/hosts deny directives for smb.conf.&lt;br /&gt;&lt;pre&gt;hosts allow = 127.0.0.1 192.168.1.0/24&lt;br /&gt;hosts deny = 0.0.0.0/0&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;The configuration above allows you to access Samba server only from localhost and it's local network.&lt;br /&gt;&lt;br /&gt;Similarly, we can go about narrowing down users that are allowed to connect:&lt;br /&gt;&lt;pre&gt;valid users = @group, user1, user2&lt;br /&gt;&lt;/pre&gt;On top of this, access to samba can be restricted based on the interface specified:&lt;br /&gt;&lt;pre&gt;interfaces = eth0 ath0 lo&lt;br /&gt;bind interfaces only = yes&lt;br /&gt;&lt;/pre&gt;In order to block incoming connections to Samba ports with iptables make it drop packets.&lt;br /&gt;[...]&lt;br /&gt;     &lt;a name="eztoc2040_1_6_3" id="eztoc2040_1_6_3"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span style="font-size:130%;"&gt;Performance Tuning&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;font-size:78%;" &gt;Candidates should be able to cluster services for load balancing and high availability purposes, and tune Samba settings for better server and network performance&lt;/span&gt;&lt;/h4&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;While measuring performance two tools will be of particular interest:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;netstat, which reports on current network connections and stats&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;smbstatus, which reports on current samba connections&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Socket Options - &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Of all the socket options that can be applied to smb.conf file, apperently TCP_NODELAY has the biggest impact on performance. For full reference of Socket Options consult smb.conf&lt;br /&gt;&lt;br /&gt;Other Options to smb.conf:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;log level - is known to cause drops in performance&lt;/li&gt;&lt;li&gt;read size - sets optimal value for&lt;br /&gt;&lt;/li&gt;&lt;li&gt;read raw&lt;/li&gt;&lt;li&gt;write raw&lt;/li&gt;&lt;li&gt;max xmit&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max connections&lt;/li&gt;&lt;li&gt;max disk size&lt;/li&gt;&lt;li&gt;max mux&lt;/li&gt;&lt;li&gt;max open files&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max print jobs (S)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max protocol (G)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max reported print jobs (S)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max stat cache size (G)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max ttl (G)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;max wins ttl (G)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1227497699485019480?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1227497699485019480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1227497699485019480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1227497699485019480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1227497699485019480'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/06/0x07-lpic-302-security-and-performance.html' title='0x07. [LPIC-302] Security and Performance'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4129741870567314176</id><published>2008-06-14T14:29:00.018+01:00</published><updated>2008-07-16T03:43:35.254+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x06. [LPIC-302] Working with CIFS, NetBIOS, and Active Directory</title><content type='html'>&lt;h4&gt;&lt;span style="font-size:130%;"&gt;CIFS Integration&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-weight: normal;"&gt;Candidates should be comfortable working with CIFS in a mixed environment&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;span style="font-size:130%;"&gt;CIFS features and benefits&lt;/span&gt;&lt;br /&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;SMB/CIFS needs very little configuration to create a basic working system&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Integrity and concurrency&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Fault tolerance&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt; Optimization for slow links&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Security&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Performance and scalability&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;Unicode&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;At least this is what Microsoft maintains.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In order to use remote CIFS shares from a Linux box, as always, you have a number of options. The first option would be smbclient, with help of which you can traverse the remote CIFS filesystem in an FTP-client style.&lt;br /&gt;&lt;pre&gt;# smbclient //sambasrv/pub&lt;br /&gt;Password:&lt;br /&gt;Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.28]&lt;br /&gt;smb: \&gt; dir&lt;br /&gt;.                                   D        0  Tue Jun  3 00:47:55 2008&lt;br /&gt;..                                  D        0  Sat May 31 22:50:16 2008&lt;br /&gt;manual.html                         A   112237  Thu Sep  6 06:18:20 2007&lt;br /&gt;00ZIE                                        0  Sat May 31 22:56:40 2008&lt;br /&gt;&lt;br /&gt;  55125 blocks of size 2097152. 52360 blocks available&lt;br /&gt;smb: \&gt; mkdir directory&lt;br /&gt;smb: \&gt; dir&lt;br /&gt;.                                   D        0  Mon Jun 16 00:56:08 2008&lt;br /&gt;..                                  D        0  Sat May 31 22:50:16 2008&lt;br /&gt;directory                           D        0  Mon Jun 16 00:56:08 2008&lt;br /&gt;manual.html                         A   112237  Thu Sep  6 06:18:20 2007&lt;br /&gt;00ZIE                                        0  Sat May 31 22:56:40 2008&lt;br /&gt;&lt;br /&gt;  55125 blocks of size 2097152. 52360 blocks available&lt;br /&gt;smb: \&gt; get 00ZIE&lt;br /&gt;getting file \00ZIE of size 0 as 00ZIE (0.0 kb/s) (average 0.0 kb/s)&lt;br /&gt;smb: \&gt;&lt;br /&gt;&lt;/pre&gt;and so on...&lt;br /&gt;&lt;br /&gt;The second option would be smbmount (which is exactly the same as mount -t smbfs, but at this stage we know that these options are deprecated and you should use mount -t cifs). Basically you can also mount remote CIFS filesystems.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# export PASSWD=qweasdzxc&lt;br /&gt;# mount -t cifs -o user=oozie //ip.add.re.ss/pub /mnt/&lt;br /&gt;# ls /mnt/&lt;br /&gt;00ZIE  directory  manual.html&lt;br /&gt;#&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;Following this, a line in /etc/fstab that says:&lt;br /&gt;&lt;pre&gt;# /etc/fstab&lt;br /&gt;# [...]&lt;br /&gt;//ip.add.re.ss/pub      /mnt    cifs    credentials=/etc/secret 0 0&lt;br /&gt;# [...]&lt;br /&gt;&lt;/pre&gt;...will mount the share at startup!&lt;br /&gt;&lt;a name="eztoc2040_1_5_2" id="eztoc2040_1_5_2"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span style="font-size:130%;"&gt;NetBIOS and WINS&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;Candidates should be familiar with NetBIOS/WINS concepts and understand network browsing&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;NetBIOS &lt;/span&gt;- An API that allows client computers on the same network to communicate. It also lays out guidelines for computer names and their behaviour on a local network. NetBIOS names are registered at system startup.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WINS &lt;/span&gt;- is a MS implementation of NetBIOS Name Service (NBNS). WINS server provides name lookups on Windows networks.&lt;br /&gt;&lt;br /&gt;On a network without a WINS server domain registration is performed by a UDP broadcast.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Local Master Browser&lt;/span&gt; - every NetBIOS enabled machine on a common broadcast domain (subnet) is a potential LMB. It is 'local' because the name registration is done with UDP broadcasts, that don't trespass subnets. A local master browser is elected based on stability criteria, like uptime. A PDC is typically acting as a LMB, but in addition to that it can become a Domain Master Browser. Samba can be configured for being a local master with &lt;span style="font-style: italic;"&gt;"&lt;/span&gt;&lt;span id="intelliTxt"&gt;&lt;span style="font-style: italic;"&gt;local master = yes".&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Domain Master Browser&lt;/span&gt; - this is typicall a role of a PDC, which collects browse lists from Local Masters and merges it into a domain wide list. It also connects to its primary WINS server to collect DomainName &lt;1b&gt; entries reported by different PDCs.&lt;br /&gt;&lt;/div&gt;Samba can be configured to be a  domain master with &lt;span style="font-style: italic;"&gt;"&lt;/span&gt;&lt;span id="intelliTxt"&gt;&lt;span style="font-style: italic;"&gt;domain master = yes"&lt;/span&gt; in smb.conf.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Elections &lt;/span&gt;- a server becomes a DMB by elections. This procedure is detailed in a &lt;a href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/cnet/cnfi_brs_ecea.mspx?mfr=true"&gt;KB article from Microsoft&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The methods used by MS Windows to perform name lookup requests (name resolution) is determined by a configuration parameter called the NetBIOS node-type. There are four basic NetBIOS node types: &lt;a class="indexterm" name="id367259"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367266"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367273"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367280"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367287"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367293"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367300"&gt;&lt;/a&gt;&lt;a class="indexterm" name="id367307"&gt;&lt;/a&gt;&lt;div class="itemizedlist"&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;p&gt;&lt;span class="emphasis"&gt;&lt;em&gt;b-node (type 0x01):&lt;/em&gt;&lt;/span&gt; The Windows client will use only  NetBIOS broadcast requests using UDP broadcast.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span class="emphasis"&gt;&lt;em&gt;p-node (type 0x02):&lt;/em&gt;&lt;/span&gt; The Windows client will use point-to-point  (NetBIOS unicast) requests using UDP unicast directed to a WINS server.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span class="emphasis"&gt;&lt;em&gt;m-node (type 0x04):&lt;/em&gt;&lt;/span&gt; The Windows client will first use  NetBIOS broadcast requests using UDP broadcast, then it will use (NetBIOS unicast)  requests using UDP unicast directed to a WINS server.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span class="emphasis"&gt;&lt;em&gt;h-node (type 0x08):&lt;/em&gt;&lt;/span&gt; The Windows client will use  (NetBIOS unicast) requests using UDP unicast directed to a WINS server, then it will use  NetBIOS broadcast requests using UDP broadcast.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Samba as a WINS server&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;Configuring Samba to be a WINS is fortunately very easy.  The process of doing so requires only two arguments added to the [global] section. Those are:&lt;br /&gt;&lt;pre&gt;        wins support = yes&lt;br /&gt;name resolve order = wins lmhosts hosts bcast&lt;br /&gt;&lt;/pre&gt;where &lt;span style="font-style: italic;"&gt;hosts&lt;/span&gt; denotes the generic way of how Unix goes about DNS resolution according to /etc/nsswitch.conf. Samba will try to resolve names in the order specified by the second option. In this case, it will look into wins in the first place, then into lmhosts file, will performs a DNS lookup and will try to resolve name based on broadcast information.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WINS replication &lt;/span&gt;is a process of copying updated resolution data from one server to another. &lt;a href="http://technet2.microsoft.com/windowsserver/en/library/cc3b6bc5-78c3-4007-9c76-526c3deaab031033.mspx?mfr=true"&gt;Refer here for a full explanation from Microsoft&lt;/a&gt;. It is not supported by Samba 3.&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Samba Tools&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;smbtree - gathers information about the domains/workgroups available on the network and prints them out in a form of a tree.&lt;/li&gt;&lt;li&gt;findsmb - a perl script that collects information about machines on a subnet that respond to SMB queries&lt;/li&gt;&lt;li&gt;smbclient - a powerful tool to list and browse resources on SMB clients&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;lmhosts file &lt;/span&gt;- in its structure very similar to /etc/hosts, this file maps IP addresses to NetBIOS names.   &lt;a name="eztoc2040_1_5_3" id="eztoc2040_1_5_3"&gt;&lt;/a&gt;&lt;/div&gt;&lt;h4&gt;&lt;span style="font-size:180%;"&gt;Integrating with Active Directory&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: normal;font-size:78%;" &gt;Candidates should be able to integrate Linux servers into an environment where Active Directory is present&lt;/span&gt;&lt;/h4&gt;&lt;span style="font-weight: bold;"&gt;Getting a Linux machine on the domain.&lt;/span&gt;&lt;br /&gt;You need to tweak two files. As always smb.conf to change "security = ads" and krb5.conf.&lt;br /&gt;Edit your /etc/krb5.conf file and add your realm there. My one looks like this:&lt;br /&gt;&lt;pre&gt;--- krb5.conf ---&lt;br /&gt;[realms]&lt;br /&gt;AD.CORP.COM = {&lt;br /&gt;    kdc = dc1.corp.com&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[libdefaults]&lt;br /&gt;default_realm = AD.CORP.COM&lt;br /&gt;forwardable = true&lt;br /&gt;&lt;br /&gt;[domain_realm]&lt;br /&gt;    corp.com = AD.CORP.COM&lt;br /&gt;&lt;br /&gt;[appdefaults]&lt;br /&gt;ticket_lifetime = 90000&lt;br /&gt;renew_lifetime = 608400&lt;br /&gt;max_renewable_life = 608400&lt;br /&gt;&lt;br /&gt;# [...]&lt;br /&gt;--- krb5.conf ---&lt;br /&gt;&lt;/pre&gt;Then perform the following to get a valid krb5 ticket from the domain controller:&lt;br /&gt;&lt;pre&gt;$ kinit oozie@AD.CORP.COM&lt;br /&gt;Password for oozie@AD.CORP.COM:&lt;br /&gt;$&lt;/pre&gt;Now in order to join your machine onto domain do:&lt;br /&gt;&lt;pre&gt;$ sudo net ads join&lt;br /&gt;Joined 'HOSTNAME' to realm 'AD.CORP.COM'&lt;br /&gt;$ sudo net ads testjoin&lt;br /&gt;Join is OK&lt;br /&gt;&lt;/pre&gt;You need to perform this as root or sudo the operations, because secrets.tdb has to be accessible.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Groups and Users&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;Once you are authenticated and on the domain you can manage users and groups.&lt;br /&gt;&lt;pre&gt;# GROUPS&lt;br /&gt;$ net ads group&lt;br /&gt;&lt;list&gt;&lt;br /&gt;$&lt;br /&gt;&lt;br /&gt;# USERS&lt;br /&gt;$ net ads user&lt;br /&gt;[list of users follows]&lt;br /&gt;$ net ads user info oozie&lt;br /&gt;[groups that oozie is a member of follow]&lt;br /&gt;$ net ads delete username&lt;br /&gt;[removes user from AD]&lt;br /&gt;$ net ads user add username&lt;br /&gt;[adds username to AD]&lt;br /&gt;$ net ads user rename user&lt;br /&gt;[renames a user]&lt;br /&gt;&lt;br /&gt;# HOST&lt;br /&gt;$ net ads status&lt;br /&gt;[shows info about your workstation]&lt;br /&gt;&lt;br /&gt;# PRINTERS&lt;br /&gt;$ net ads printer search&lt;br /&gt;[dumps info about all the printers in AD]&lt;br /&gt;$ net ads printer info printerName serverName&lt;br /&gt;[info about a particular printer]&lt;br /&gt;$&lt;br /&gt;&lt;/list&gt;&lt;/pre&gt;/*** Work in progress&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Knowledge of the DNS requirements for Active Directory&lt;/li&gt;&lt;/ul&gt;    &lt;ul&gt;&lt;li&gt;DNS&lt;/li&gt;&lt;li&gt;LDAP&lt;/li&gt;&lt;li&gt;smbcalcs&lt;/li&gt;&lt;/ul&gt;***/&lt;br /&gt;&lt;a name="eztoc2040_1_5_4" id="eztoc2040_1_5_4"&gt;&lt;/a&gt;&lt;h4&gt;&lt;span style="font-size:180%;"&gt;Working with Windows Clients / know your enemy&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-weight: normal;"&gt;Clients should be able to interact with remote Windows clients, and configure Windows workstations to access file and print services from Linux servers&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;span style="font-weight: bold;"&gt;net.exe&lt;/span&gt;&lt;br /&gt;Windows' NET command helps you manage all kinds of network resources.&lt;br /&gt;&lt;br /&gt;net view - browses and lists NetBIOS enabled computers.&lt;br /&gt;net view \\workstation - shows browsable shares available on a workstation&lt;br /&gt;net time \\workstation - returns the time on a remote computer.&lt;br /&gt;net use [drive letter] [\\server\share] - maps a share to a virtual drive.&lt;br /&gt;net use /delete [drive letter] - disconnects from a share&lt;br /&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;rdesktop&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.rdesktop.org/"&gt;rdesktop&lt;/a&gt; is an opensource RDP client.&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://www.meteck.org/cifs.htm"&gt;http://www.meteck.org/cifs.htm&lt;/a&gt;&lt;a href="http://www.samba.org/"&gt;http://www.samba.org/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Windows_Internet_Name_Service"&gt;http://en.wikipedia.org/wiki/Windows_Internet_Name_Service&lt;/a&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/188001"&gt;http://support.microsoft.com/kb/188001&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4129741870567314176?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4129741870567314176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4129741870567314176' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4129741870567314176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4129741870567314176'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/06/0x06-lpic-302-working-with-cifs-netbios.html' title='0x06. [LPIC-302] Working with CIFS, NetBIOS, and Active Directory'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1662232284990316670</id><published>2008-06-14T14:26:00.013+01:00</published><updated>2008-07-16T03:45:47.922+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x05. [LPIC-302]  User and Group Management</title><content type='html'>&lt;h4&gt;&lt;span style="font-size:130%;"&gt;Managing User Accounts and Groups&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-weight: normal;"&gt;Candidates should be able to manage user and group accounts in a mixed environment&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div style="text-align: justify;"&gt;Exploring this chapter some knowledge about SIDs can be useful (See &lt;a href="http://thewinningmove.blogspot.com/2008/05/0x00-lpic-302-sambacifs-terms-glossary.html"&gt;Terms Glossary&lt;/a&gt;). Basically every object, be it a group, user, domain or machine has it's SID. Samba provides you with the "net" program to find out about SIDs and not only. E.g.&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;# net getlocalsid&lt;br /&gt;# net sam show oozie&lt;br /&gt;&lt;/pre&gt;Users can be added with 'smbpasswd -a' which stores the information about the password in three possible locations:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;smbpasswd file, if passdb backend =  smbpasswd&lt;br /&gt;&lt;/li&gt;&lt;li&gt;TDB file, if passdb backend = tdbsam&lt;br /&gt;&lt;/li&gt;&lt;li&gt;LDAP directory, if passdb backend = ldapsam&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;Mapping users&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Since usernames on Microsoft systems can violate the rules applied to Unix usernames, Samba provides the administrator with username mapping functionality. This is independent from the backend used. For translating Windows to Unix usernames Samba can use dictionary file, typically called smbusers, or a script/program that takes the windows username as it's first argument and returns it's Unix counterpart. smb.conf options to achieve that are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;username map = filename&lt;/li&gt;&lt;li&gt;username map script = /absolute/path/to/script&lt;/li&gt;&lt;/ul&gt;Username map dictionary has a simple syntax of 'map_to_username = map_from'. If the entry is prefixed with &amp;amp;,@ or a + then it makes it a NIS or Unix netgroup.&lt;br /&gt;&lt;br /&gt;Samba associates Unix groups with Windows SIDs and this way presents it to Windows clients.&lt;br /&gt;Group attributes can be modified with 'net groupmap'.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;smbpasswd cheatsheet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;smbpasswd -a = adds a user&lt;br /&gt;smbpasswd -d = disables an account&lt;br /&gt;smbpasswd -e = reenables an account&lt;br /&gt;smbpasswd (without options) = changes user's password&lt;br /&gt;smbpasswd -x = remove account&lt;br /&gt;smbpasswd -n = set accounts password to null value&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;force user / force group&lt;/span&gt;&lt;br /&gt;The options named above force authenticated users to perform operations on the shares as some other users. This is useful, especially in case of 'force group', to either restrict or extend file sharing. Please refer to smb.conf for more details.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Identity mapping (IDMAP)&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;If Samba operates as a standalone server there is no need for extensive identity mapping, because the users and groups are managed locally. A need for IDMAP facility occures when Samba is a member of&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Windows NT4 domain&lt;/li&gt;&lt;li&gt;Active Directory domain&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=948616129588852269&amp;amp;postID=1662232284990316670"&gt;&lt;/a&gt;Samba Domain&lt;/li&gt;&lt;/ul&gt;hence it requires a running instance of winbindd. There is a number of situations for which we deploy the winbind server to help with IDMAP.&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4&gt;&lt;span style="font-size:130%;"&gt;Authentication and Authorization&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;span style="font-size:78%;"&gt;&lt;span style="font-weight: normal;"&gt;Candidates should understand the various authentication mechanisms and configure access control&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;Setting up a local password database can be achieved by setting 'passdb backend' to smbpasswd or tdbsam. The former setting will use flat database (text) file of the following format:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;username:uid:LM hash:NT hash:flags:last_change&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;where flags are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;U - a user a account&lt;br /&gt;&lt;/li&gt;&lt;li&gt;N - no password&lt;br /&gt;&lt;/li&gt;&lt;li&gt;D - account disabled&lt;br /&gt;&lt;/li&gt;&lt;li&gt;W - machine trust account&lt;/li&gt;&lt;/ul&gt;... whereas the latter will store passwords in passdb.tdb.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Password Synchronization&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;There are many reasons why Samba administrators want Samba users to have a common password for SMB and Unix. Normally, a user has to change her password twice, with Unix passwd command and then with smbpasswd. This will almost certainly not keep consistency between databases. Here is where pam_smbpass.so comes in handy. It is used to keep /etc/shadow and smbpasswd consistent.&lt;br /&gt;&lt;a href="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/pam.html#smbpassoptions"&gt;Please find examples for pam_smbpass.so config here.&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;a name="eztoc2040_1_4_3" id="eztoc2040_1_4_3"&gt;&lt;/a&gt;Winbind&lt;/span&gt;&lt;span style="font-weight: normal;font-size:78%;" &gt;&lt;br /&gt;Candidates should be able to install and configure the Winbind service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;Winbind combines together PAM, NSS and MSRPC and allows "Windows NT domain users to appear and operate as UNIX users on a UNIX  machine" (quotation from Samba Howto - Chapter24). It includes two core functalities:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Authentication of users with help of PAM and ntlm_auth program. This comprises:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;obtaining user/group information&lt;/li&gt;&lt;li&gt;authentication&lt;/li&gt;&lt;li&gt;password changing&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Identity resolution used for IDMAP and maintanance of IDMAP table. winbind stores the mappings into tdb file as it goes along and finds out about new ones.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The main binary lives in /usr/sbin/winbindd or /usr/local/sbin/winbindd. To read the configuration winbind refers to smb.conf. Below is a snippet extracted from Samba howto:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;[global]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# separate domain and username with '\', like DOMAIN\username&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;winbind separator = \&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# use uids from 10000 to 20000 for domain users&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;idmap uid = 10000-20000&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# use gids from 10000 to 20000 for domain groups&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;idmap gid = 10000-20000&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# allow enumeration of winbind users and groups&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;winbind enum users = yes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;winbind enum groups = yes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# give winbind users a real shell (only needed if they have telnet access)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;template homedir = /home/winnt/%D/%U&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;template shell = /bin/bash&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;pam_winbind.so is the PAM module responsible for talking to winbind.&lt;br /&gt;&lt;br /&gt;Do not run NSCD on a computer that runs winbindd at the same time. If you do, it will be impossible to resolve domain users and groups for directory system controls.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1662232284990316670?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1662232284990316670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1662232284990316670' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1662232284990316670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1662232284990316670'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/06/0x05-lpic-302-user-and-group-management.html' title='0x05. [LPIC-302]  User and Group Management'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1019222794223079630</id><published>2008-05-27T22:58:00.010+01:00</published><updated>2008-06-14T21:16:02.594+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x04. [LPIC-302] Samba Advanced Config - DCs, SWAT and Internationalization</title><content type='html'>&lt;h4&gt;&lt;span style="font-size:180%;"&gt;Domain Control&lt;/span&gt; &lt;/h4&gt;  &lt;p&gt;&lt;span style="font-size:78%;"&gt;Candidates should be able to setup and maintain primary and backup domain controllers, and manage Windows/Linux clients' access to the domain&lt;/span&gt;&lt;/p&gt;      &lt;div style="text-align: justify;"&gt;To control a domain means to have a central point of command from which the users and machines within the domain can be authenticated and authorized and resources accessed.&lt;br /&gt;&lt;br /&gt;There are three main types of domain controllers:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;NT4 PDC (P stands for Primary) - This is a server on the network that initiates new domain control database. By definition, the clients should refer to the BDCs prior to consulting a PDC, so it doesn't have to be the strongest machine in your domain.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;NT4 BDC (B is for Backup) - synchronizes its authentication database with a PDC and plays a key role in answering authentication requests from the clients. It answers most of the authentications requests from the clients. PDC responds to authentication call only if BDC is heavily loaded.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;On  a Microsoft network it is possible, that PDC and BDC swap their roles, however, Samba does not implement this feature and PDC/BDC have to be specifically defined (a rather excessive feature anyway). What Samba offers and Microsoft Systems NOT, is the ability to change the role of the server between a PDC, BDC, domain member and a standalone server. The Redmond team tells us to reinstall everytime we want a change. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ADS DC (Active Directory Service DC) - while Samba3 fully supports ADS domain membership, it couldn't act as a full-featured DC. There are some efforts to make it happen, but still in an experimental phase, so officially no support for:&lt;br /&gt;machine policy files, Group Policy Objects, synchronously executed AD logon scripts, AD management tools.&lt;br /&gt;&lt;h3 class="title"&gt;&lt;a name="id2561162"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;Domain membership&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Microsoft Systems can organize themselves on a network in two types of gatherings: Workgroups and Domains.&lt;br /&gt;&lt;br /&gt;A workgroup is nothing but an informal organization of computers that employs no security and every machine can become a member just by assigning itself to a particular workgroup (a very common name for a workgroup would be WORKGROUP itself).&lt;br /&gt;&lt;br /&gt;A domain is a security organized gathering of computers that involves &lt;span style="font-weight: bold;"&gt;security machine accounts&lt;/span&gt; called Machine Trust Account. A user account with local admin rights can attach a computer onto a domain. During this process a machine account is created on the Domain Controller and is used for further authentication. Benefits of being a part of the domain comprise e.g.:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Single Sign-On for all shares and printers on the domain&lt;/li&gt;&lt;li&gt;Central management of users access control&lt;/li&gt;&lt;li&gt;Ability of desktop profiles and policies usage&lt;/li&gt;&lt;/ul&gt;When creating machine accounts in Samba we need to remember that they have to be available in /etc/passwd too. The difference between them and normal accounts is the $ (dollar) sign appended to the end of their name. You smbpasswd -a machine account names without the $ sign at the end.&lt;br /&gt;&lt;br /&gt;Samba howto explains how to configure a {P,B}DC. Please revert to it and play around.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Roaming profiles&lt;br /&gt;&lt;span style="font-size:100%;"&gt;An excerpt from Chapter 27 of Samba Howto:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Roaming profiles allow an administrator to make available a consistent user desktop as the user moves from one machine to another. This chapter provides much information regarding how to configure and manage roaming profiles.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A very useful feature for companies employing a greater number of users than computers and on top of this working in different shifts, so that every now and then a user has to sit at a different computer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;System policies&lt;/span&gt;&lt;br /&gt;    In order to avoid confusion you need to understand a difference between two things: NT 4.0 System Policies and Group Policy Objects. GPOs are a part of AD, which samba 3 does not support, hence we'll focus on System Policies.&lt;br /&gt;    System policies are applied during users logon. Samba client connects to the domain controller and looks for the NETLOGON share. If it's found, the client would look further for ntconfig.pol file and if found and successfully read, it will try to modify clients system registry.&lt;br /&gt;System policies can be modified with help of Policy Editor, provided with WinNT 4.0 SP.&lt;br /&gt;&lt;/div&gt;&lt;h4&gt;&lt;span style="font-size:180%;"&gt;SWAT Configuration&lt;/span&gt;&lt;br /&gt;&lt;/h4&gt;  &lt;p&gt;&lt;span style="font-size:78%;"&gt;Description: Candidates should be able to install and configure the Samba web administration tool, and be comfortable with configuring changes to Samba within it.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;Samba Web Administration Tool is a very handy browser based config file creation tool. It comes with the Samba distribution and is meant to be run from within xinetd, it's main binary lives in /usr/sbin/swat. Once you have your SWAT configured as per &lt;a href="http://us4.samba.org/samba/docs/man/Samba-HOWTO-Collection/SWAT.html"&gt;Samba Howto&lt;/a&gt;, you can access it via http://localhost:901 url in your favourite browser. Don't forget to "smbpasswd -a root" and set its password, otherwise SWAT won't let you in.&lt;br /&gt;SWAT consists of a web-based interface with all the options available  in the current version of Samba. With its help you can add shares and printers and tweak their configuration. It also contains a wizard to walk the user through. From the Howto we read:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-style: italic;"&gt; The purpose of the SWAT Wizard is to help the Microsoft-knowledgeable network administrator to configure Samba with a minimum of effort.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Fair play to the authors for the choice of language and sense of humour.&lt;br /&gt;I'm not going to guide you through SWAT, which however powerful, is easy enough to grasp. Good luck, leaving you to it, but don't worry, because the Samba Howto is really well documented. It describes a simple way to run SWAT over SSL and Internalization support.&lt;br /&gt;&lt;/div&gt;&lt;a name="eztoc2040_1_3_6" id="eztoc2040_1_3_6"&gt;&lt;/a&gt; &lt;h4&gt;&lt;span style="font-size:130%;"&gt;Internalization&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;Candidates should be able to work with internationalization character codes and code pages&lt;/span&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4 style="text-align: justify;"&gt;&lt;span style="font-weight: normal;"&gt;Before Unicode was introduced computers in non-English countries used to exchange data using codepages. They are character encoding tables allowing you to use extra characters like the Polish łóżźąęćś. Samba 3 talks Unicode by default and will be understood by WinNT/ME/XP. Older clients, however, will still use DOS charsets, like CP850. This can be customized in smb.conf with "dos charset" option. If you want to check what is the default charset on your Samba installation run "testparm -v|grep 'dos charset'" and hit enter.&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1019222794223079630?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1019222794223079630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1019222794223079630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1019222794223079630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1019222794223079630'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/0x04-lpic-302-samba-advanced-config-dcs.html' title='0x04. [LPIC-302] Samba Advanced Config - DCs, SWAT and Internationalization'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-166046070469370615</id><published>2008-05-27T22:56:00.020+01:00</published><updated>2008-07-16T03:46:45.384+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x03. [LPIC-302] Samba Basic Config - file and printer shares</title><content type='html'>&lt;h4&gt;&lt;span style="font-size:180%;"&gt;Configuring File Sharing Services&lt;/span&gt;&lt;/h4&gt;&lt;span style="font-size:130%;"&gt;Public Share&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We start with configuring a basic public share that is world-readable. There are actually two ways of doing it, but we will focus on one only (user security mode) since the other (share security mode) is deprecated and likely to disappear from future releases of Samba. If your distribution does not create a role account for Samba, it might be a good idea to create one instead of mapping guest users to "guest" or "nobody" accounts. The account has to be added with smbpasswd, or otherwise you will be having hard times understanding unexpected behaviour of some config options. So...&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;# useradd smbguest&lt;br /&gt;# smbpasswd -n smbguest&lt;br /&gt;&lt;/pre&gt;Before we put our fingers on smb.conf  let's create the public share on the local filesystem.&lt;br /&gt;&lt;pre&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;# mkdir -p /var/smb/ebooks&lt;br /&gt;# chmod 1755 /var/smb/ebooks&lt;br /&gt;&lt;/pre&gt;Use your favourite editor to create an smb.conf file like that:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;---- smb.conf ----&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;[global]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;security = user&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 204, 0);"&gt;workgroup = tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;netbios name = elibrary&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;guest account = smbguest&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;[ebooks]&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 204, 0);"&gt;path = /var/smb/ebooks/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;guest = ok&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;---- smb.conf ----&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt; Upload your favorite man pages to the public directory and restart smbd.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Writable Public Share&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Let's take our share to the next level (LOL) and make it possible for everyone to upload their ebooks. Simply append &lt;span style="font-style: italic;"&gt;"read only = no"&lt;/span&gt; or&lt;span style="font-style: italic;"&gt; "writable = yes"&lt;/span&gt; to the [ebooks] section.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Invisible Writable Public Share&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;At this stage if a client tries to access \\elibrary\ it will see all the shares available, which at this stage should be [ebooks] and the default printer share. [ebooks] includes some books that contain information not for everyone to see. If you want to make [ebooks] disappear from clients listing then append &lt;span style="font-style: italic;"&gt;"browsable = no" &lt;/span&gt;to the share section. This way the share will be invisible for listing, but still accessible when specified explicitly (\\elibrary\ebooks)&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Authenticating Users&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Because the current configuration is a mock in terms of security and functionality we should make a small improvement to it and give write access only to authenticated users whereas guests are still able to read files, however, no way of writing anything.&lt;br /&gt;&lt;br /&gt;We need to create Samba users on the server first, and this is done with "smbpasswd -a".&lt;br /&gt;&lt;pre&gt;# smbpasswd -a oozie&lt;br /&gt;New SMB password:&lt;br /&gt;Retype new SMB password:&lt;br /&gt;#&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;An important note: the user has to be available via getent call, so most typically it should be available in /etc/passwd file. If it isn't you will most likely see this error message: "Failed to modify password entry for user [username]". On the other hand ff you add an existing POSIX user with smbpasswd, remove it from /etc/passwd and try to smbpasswd -x (remove user) you will see this: "smbpasswd database is corrupt! username [user] with uid [uid] is not in unix passwd database!" &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;Again, a slight reconfiguration of smb.conf is necessar&lt;span style="font-size:100%;"&gt;y.  Append "read list =  smbguest"&lt;/span&gt; to the end of [ebooks] section and restart the daemons. This way oozie will be able to read/write, whereas all the guests will read the e-books only.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Exceptions&lt;/span&gt;&lt;br /&gt;Samba allows exceptions from many rules, practically even from exceptions themselves. If we want to narrow down or widen the list of users that should have access to our folders we can use "invalid users" or "valid users" directives to smb.conf. They will sit on top of other ACLs that we specified earlier and will allow/disallow exceptional access respectively.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Mounting Samba Shares&lt;/span&gt;&lt;br /&gt;You can mount Samba shares with help of mount -t smbfs (deprecated in favor of mount -t cifs) and smbmount, that invokes mount.smbfs to mount a share (which makes it a deprecated option). So a situation like this will be very common nowadays:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# mount.smbfs //192.168.1.36/ebooks /mnt&lt;br /&gt;Password:&lt;br /&gt;ERROR: smbfs filesystem not supported by the kernel&lt;br /&gt;Please refer to the smbmnt(8) manual page&lt;br /&gt;smbmnt failed: 255&lt;br /&gt;&lt;/pre&gt;In this situation "modprobe smbfs" should help, but make sure that this module comes compiled with your kernel. A preferred alternative to smbmount/mount.smbfs is mount.cifs (that requires cifs.ko module)&lt;br /&gt;&lt;pre&gt;# mount.cifs -o user=oozie,pass=passwd //192.168.1.36/ebooks /mnt&lt;br /&gt;Password:&lt;br /&gt;# ls /mnt&lt;br /&gt;ebook1.pdf ebook2.pdf ebook3.pdf&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-size:130%;"&gt;[homes] share&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This share is a special option that tells samba to create a temporary share named after the username of the connecting user. The share gets all the attibutes specified in the [homes] section.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Plan file service migration&lt;/span&gt;&lt;br /&gt;&lt;a href="http://us4.samba.org/samba/docs/man/Samba-HOWTO-Collection/NT4Migration.html#id2676131"&gt;&lt;span style="font-size:100%;"&gt;http://us4.samba.org/samba/docs/man/Samba-HOWTO-Collection/NT4Migration.html#id2676131&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Create scripts for user and group handling of file shares&lt;/li&gt;&lt;li&gt;smbcquotas - Set or get QUOTAs of NTFS 5 shares&lt;/li&gt;&lt;li&gt;smbsh - Allows access to remote SMB shares  using UNIX commands&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Configuring Print Services&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Samba supports a number of protocols for print sharing. The list includes {the print subsystem it should expect. Samba supports CUPS, LPD, LPRNG, SYSV, HPUX, AIX, QNX, PLP}, but CUPS is here of particular interest, since Samba supports it natively. It makes direct library calls, so smb.conf requires only minimal configuration in the [printers] section for the printers to work:&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;[...]&lt;br /&gt;&lt;br /&gt;[printers]&lt;br /&gt;path = /var/spool/samba&lt;br /&gt;printable = yes&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;/pre&gt;The 'path =' parameter must be different from the subsystem spooling directory, in this case different from /var/spool/cups.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;The [print$] share&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;print$ hosts all the drivers required by Samba printers. It should not be used under a different name, because Windows clients are hardcoded this way. When they connect to the share, they try to look up drivers based on their own architecture, which is one of the following {W32ALPHA,W32MIPS,W32PPC,W32x86,WIN40}. The most frequently looked-through directory nowadays is W32X86 because it is used by Windows NT, 200x and XP.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Commands:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;div style="text-align: justify;"&gt;smbprngenpdf - a shellscript that converts printer spool files to PostScript format, and translates it to PDF later, unless -k option is specified. By default, files printed in this way are stored in the ~/PDF directory of the requesting user.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;smbspool - sends a print file to a Samba printer (man 8 smbspool for more info)&lt;/li&gt;&lt;/ul&gt;Sources:&lt;br /&gt;&lt;a href="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html"&gt;http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/classicalprinting.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-166046070469370615?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/166046070469370615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=166046070469370615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/166046070469370615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/166046070469370615'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/0x03-lpic-302-samba-basic-config-file.html' title='0x03. [LPIC-302] Samba Basic Config - file and printer shares'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5363660634956848014</id><published>2008-05-27T20:58:00.007+01:00</published><updated>2008-05-28T08:41:38.652+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x02. [LPIC-302] Samba - introduction to basic configuration</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;Configuring Samba... &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;While configuring Samba we should start with learning about it's main config file structure, namely the structure of smb.conf. Many tutorials write entire chapters about it, but I think that an extract in form of bullet points is enough.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;smb.conf&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;smb.conf has a general format of a Microsoft Windows INI file.&lt;/li&gt;&lt;li&gt;It is divided into sections denoted by a section name enclosed in square brackets, e.g.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;[share name]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Sections are file or printer shares that are available on the server.&lt;/li&gt;&lt;li&gt;The only section that is not a share is the &lt;span style="font-style: italic;"&gt;[global]&lt;/span&gt; section.&lt;/li&gt;&lt;li&gt;Options specified in the&lt;span style="font-style: italic;"&gt; [global]&lt;/span&gt; section determine the behavior of the server itself and not it's shares.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Every configuration directive in it is of  the following format:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;configuration directive = value&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;All lines in the config file starting with ; (semicolon) or  # (hash) are understood to be comments.&lt;/li&gt;&lt;li&gt;smb.conf DOES NOT support a mix of config parameters and comments on the same line&lt;/li&gt;&lt;li&gt;You can extend a long non-comment line in smb.conf file by adding \ (backslash) at it's end and continuing in the following line.&lt;/li&gt;&lt;li&gt;If you want to check for the correct smb.conf syntax, use the &lt;span style="font-weight: bold;"&gt;testparm&lt;/span&gt;(1) utility.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Samba variables and configuration parameters.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Samba has over 350 configuration options to apply in the smb.conf file, so you must admit that it is quite customizable just by this fact itself. I'm obviously not going to list them all here. Instead I'm pointing you to a very good reference, namely smb.conf(5) manual page. It describes all of the options we need + many more. So...&lt;br /&gt;&lt;pre&gt;$ man 5 smb.conf&lt;br /&gt;&lt;/pre&gt;The variables as well as the values are not case nor whitespace sensitive.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;SMB/CIFS TCP/IP Ports information&lt;br /&gt;&lt;/span&gt;SMB/CIFS protocol requires to keep TCP/UDP open on the following ports:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;137/udp for nmbd (NetBIOS network browsing)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;138/udp for nmbd (NetBIOS name service)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;139/tcp for smbd (file and printer sharing)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;445/tcp for smbd (to run SMB/CIFS directly via TCP/IP)&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;901 for SWAT, not essential&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Samba logging&lt;/span&gt;&lt;br /&gt;Samba logs normally live in /var/log/samba, but this path can be changed during compilation time with --with-logfilebase=/path parameter. If you are not sure about the path on your system, use the magic "smb -b" and grep it for LOGFILEBASE. All of the logging configuration  options are optional and all of them come up in the [global] section. Please find the most interesting ones for us below:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;log level&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;debug level&lt;/span&gt; - defines a loglevel that should be used. By default it is 0, which means it only logs critical events.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;max log size &lt;/span&gt;- defines the maximum log file size.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;syslog only&lt;/span&gt; - it tells smbd not to use the logfiles, but the syslog facility instead.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;      &lt;a name="eztoc2040_1_3_2" id="eztoc2040_1_3_2"&gt;&lt;/a&gt;&lt;a name="eztoc2040_1_3_4" id="eztoc2040_1_3_4"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5363660634956848014?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5363660634956848014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5363660634956848014' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5363660634956848014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5363660634956848014'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/0x03-lpic-302-samba-introduction-to.html' title='0x02. [LPIC-302] Samba - introduction to basic configuration'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3776500406667778391</id><published>2008-05-25T13:04:00.014+01:00</published><updated>2008-05-26T20:32:13.377+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x01. [LPIC-302] Samba configuration and compilation from source</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Installation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As we know from the previous exams, LPI tries to be vendor independent that's we had to learn about both RPM and DEB packages. The knowledge about Gentoo e-builds is not required, but it's worth a recommendation, as it illustrates very clearly the need for dependencies and configure-time options.&lt;br /&gt;&lt;br /&gt;While installing a package from DEB or RPM, the package management system  creates directories, copies the pre-compiled binaries where appropriate as well as the necessary config files. The obvious advantage here is the speed of installation. The disadvantage: if you want to customize your installation, you need to uninstall the DEB/RPM packet, look for the source, download it, resolve dependencies by hand and compile it. This takes much more time, but lets you have a secure and customized installation of Samba. You are required to know both how to install Samba from source and packages.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Install Samba from packages&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Packaged binaries for a number of different Linux distributions can be found on the following URL:&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://us1.samba.org/samba/ftp/Binary_Packages"&gt;http://us1.samba.org/samba/ftp/Binary_Packages&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If there is no package for your distribution, double check if your distribution maintainers didn't packaged it for you. LPIC foresees installing things with help of rpm and dpkg.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Install Samba from source&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;You can always get the latest source from &lt;a href="http://samba.org/samba/ftp/samba-latest.tar.gz"&gt;http://samba.org/samba/ftp/samba-latest.tar.gz&lt;/a&gt;&lt;/span&gt;. Download  the package and its signature and check it with gpg:&lt;br /&gt;&lt;pre&gt;$ wget http://samba.org/samba/ftp/samba-pubkey.asc&lt;br /&gt;&lt;span&gt;$ wget http://samba.org/samba/ftp/samba-latest.tar.asc&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;$ wget http://samba.org/samba/ftp/samba-latest.tar.gz&lt;/span&gt;&lt;/span&gt; $ gpg --import samba-pubkey.asc&lt;br /&gt;$ gpg --import samba-pubkey.asc&lt;br /&gt;$ gunzip samba-&lt;em&gt;latest&lt;/em&gt;.tar.gz&lt;br /&gt;$ gpg --verify samba-&lt;em&gt;latest&lt;/em&gt;.tar.asc&lt;br /&gt;[...]&lt;br /&gt;&lt;/pre&gt;Once you make sure that the packages have not been tempered with, you can proceed with  pre-compile configuration.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$ tar xf samba-latest.tar&lt;br /&gt;$ cd samba-*/source&lt;br /&gt;$ ./configure --help&lt;br /&gt;[... read ...]&lt;br /&gt;$ ./configure [--lists --of --args]*&lt;br /&gt;$ make &amp;amp;&amp;amp; make install installbin installman&lt;br /&gt;[...]&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Makefile for samba is inteligent enough to look for existing installation of Samba first. If it finds the binaries, it changes their name to &lt;oldname&gt;.old. This way, if something goes wrong you can easily revert all changes with "make revert". A very nice feature.&lt;br /&gt;&lt;br /&gt;&lt;/oldname&gt;&lt;/div&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Notable options to ./configure script include:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;To find out about all options that are available at compilation time refer to the "./configure --help" command. Below I list the options that are not enabled by default and may be of interest for you:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#./configure --help|grep default=no&lt;br /&gt;--enable-static=PKGS    build static libraries default=no&lt;br /&gt;--enable-debug          Turn on compiler debugging information (default=no)&lt;br /&gt;--enable-socket-wrapper         Turn on socket wrapper library (default=no)&lt;br /&gt;--enable-developer      Turn on developer warnings and debugging (default=no)&lt;br /&gt;--enable-krb5developer  Turn on developer warnings and debugging,&lt;br /&gt;    except -Wstrict-prototypes (default=no)&lt;br /&gt;--enable-dmalloc        Enable heap debugging default=no&lt;br /&gt;--with-fhs              Use FHS-compliant paths (default=no)&lt;br /&gt;--with-profiling-data   Include gathering source code profile information (default=no)&lt;br /&gt;--with-afs              Include AFS clear-text auth support (default=no)&lt;br /&gt;--with-fake-kaserver    Include AFS fake-kaserver support (default=no)&lt;br /&gt;--with-vfs-afsacl       Include AFS to NT ACL mapping module (default=no)&lt;br /&gt;--with-dce-dfs          Include DCE/DFS clear-text auth support (default=no)&lt;br /&gt;--with-automount        Include automount support (default=no)&lt;br /&gt;--with-smbmount         Include smbmount (Linux only) support (default=no)&lt;br /&gt;--with-pam              Include PAM support (default=no)&lt;br /&gt;--with-pam_smbpass      Build PAM module for authenticating against&lt;br /&gt;    passdb backends (default=no)&lt;br /&gt;--with-nisplus-home     Include NISPLUS_HOME support (default=no)&lt;br /&gt;--with-syslog           Include experimental SYSLOG support (default=no)&lt;br /&gt;--with-quotas           Include disk-quota support (default=no)&lt;br /&gt;--with-cluster-support  Enable cluster extensions (default=no)&lt;br /&gt;--with-acl-support      Include ACL support (default=no)&lt;br /&gt;--with-aio-support      Include asynchronous io support (default=no)&lt;br /&gt;#                            &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Identify and resolve dependencies&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Dependencies on samba are mostly optional.&lt;br /&gt;It requires the following packages for additional functionality:&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;MIT or Heimdal Kerberos for AD support&lt;br /&gt;&lt;/li&gt;&lt;li&gt;OpenLDAP for LDAP integration&lt;/li&gt;&lt;li&gt;CUPS&lt;/li&gt;&lt;li&gt;Linux-PAM&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Upgrade Samba&lt;/span&gt;&lt;br /&gt;&lt;li&gt;dpkg&lt;br /&gt;&lt;/li&gt;&lt;/pre&gt;$ wget http://samba.org/samba/ftp/samba-pubkey.asc&lt;br /&gt;# apt-key add samba-pubkey.asc&lt;br /&gt;# dpkg --install samba-NewerVersion.deb&lt;br /&gt;&lt;br /&gt;&lt;li&gt;rpm&lt;pre&gt;$ wget http://samba.org/samba/ftp/samba-pubkey.asc&lt;br /&gt;# rpm --import samba-pubkey.asc&lt;br /&gt;# rpm -Uhv samba-NewerVersion.rpm&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;Source:&lt;br /&gt;http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/install.html&lt;br /&gt;http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/compiling.html&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3776500406667778391?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3776500406667778391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3776500406667778391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3776500406667778391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3776500406667778391'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/0x01-lpic-302-samba-configuration-and.html' title='0x01. [LPIC-302] Samba configuration and compilation from source'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5758956585269719824</id><published>2008-05-23T21:50:00.023+01:00</published><updated>2008-06-21T10:46:20.897+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samba'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x00. [LPIC-302] Samba/CIFS - Terms glossary</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;If you want to dive deep into Samba world it would be good to understand the wording used in the following sections. If you spot any inconsistencies and/or have any suggestions, please let me know. This is one of those posts that are in constant development.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic;font-size:130%;" &gt;What is the difference between SMB and SAMBA ? &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Many people confuse these terms and think they can use it interchangeably. It's not the case.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;SMB -&lt;/span&gt; stands for Server Message Block, was originally invented by Barry Feigenbaum at IBM and it represents more the protocol rather than the actual implementation.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;SAMBA - &lt;/span&gt;is the open source implementation of the SMB protocol, originally coded by Andrew Tridgell in 1991. Nowadays Samba distribution (version 3 standard) contains three daemons:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;smbd&lt;/span&gt; - this is the most famous daemon from the Samba suite. Its task list comprises:&lt;br /&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;authentication&lt;br /&gt;&lt;/li&gt;&lt;li&gt;authorization&lt;/li&gt;&lt;li&gt;file+printer sharing&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt; &lt;span style="font-weight: bold;"&gt;nmbd&lt;/span&gt; - NetBIOS Message Block Daemon, handles NetBIOS naming as per its name. It should be started as the first of all three samba daemons.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;winbindd&lt;/span&gt; - this daemon talks to Windows domain controllers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;smbcontrol - &lt;/span&gt;&lt;span&gt;knowing that we have three daemons at our disposal, it is good to be aware of a little program of smbcontrol, that can talk to the daemons on their run-time. smbcontrol is capable of sending commands to the daemons, e.g. reinforcement of a browser master election. &lt;/span&gt;&lt;br /&gt;&lt;hr style="margin-left: 0px; margin-right: 0px;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;CIFS&lt;/span&gt; - &lt;span style="font-style: italic;"&gt;Common Internet File System&lt;/span&gt;. This term was introduced first time by Microsoft in 1996. It is more extensive than the original SMB, but both names are used interchangeably.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NetBIOS&lt;/span&gt; - &lt;span style="font-style: italic;"&gt;Network Basic I/O System&lt;/span&gt;. A network protocol originally designed by Sytec Inc. in 1983. It describes three kinds of service: name service (registration on the network and  address resolution), session service (connection oriented, TCP based) and datagram distribution service (connectionless, UDP based).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; smb.conf -&lt;/span&gt; Samba system-wide configuration file. It has an easily readable structure of a standard Windows INI file. The file tells samba which security mode should be used.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Samba Security Modes&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt; User Level Security - The client first negotiates the protocol, then it sends a Session Setup request along with users credentials. If the server accepts the client, the latter expects to be able to connect to any share on the server with the original username and password combination and does not expect to be prompted for it again.&lt;br /&gt;&lt;br /&gt;A rejection of the clients request can be based on a wrong pair of username/password supplied or bad hostname.&lt;br /&gt;&lt;br /&gt;This level of security is set by the following directive in smb.conf:&lt;br /&gt;&lt;br /&gt;&lt;a class="indexterm" name="id348790"&gt;&lt;/a&gt;&lt;em class="parameter"&gt;&lt;code&gt;security = user&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;Typically, this is the default Security Mode setting&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Share Level Security - the client authenticates with each share separately. It sends the password along with each "tree connect" request, however, the username is never sent over, so Samba has to figure it out on its own. This way, a password is associated with a share rather than with a username. Sounds dodgy? It is, and will likely be removed from Samba in it's future releases. Share security mode is deprecated and the user is requested to avoid its usage as much as possible.&lt;br /&gt;&lt;br /&gt;&lt;em class="parameter"&gt;&lt;code&gt;security = share&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Domain Security Mode - in this security mode Samba has to have a machine account on the domain controller, and passes all the authentication requests through it.&lt;br /&gt;&lt;br /&gt;&lt;em class="parameter"&gt;&lt;code&gt;security = domain&lt;/code&gt;&lt;/em&gt;&lt;a class="indexterm" name="id349177"&gt;&lt;/a&gt;&lt;em class="parameter"&gt;&lt;code&gt;&lt;br /&gt;workgroup = your-domain&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;This security mode does not make Samba a domain controller. It means that Samba should be a member of a domain.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; ADS Security Mode - this security mode uses "NT4 style RPC based security". In can go in sync with Active Directory.&lt;br /&gt;&lt;br /&gt;&lt;em class="parameter"&gt;&lt;code&gt;&lt;/code&gt;&lt;/em&gt;&lt;table style="text-align: left; margin-left: 0px; margin-right: 0px;" class="simplelist" summary="Simple list" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;em class="parameter"&gt;&lt;code&gt;realm = YOUR.KERBEROS.REALM&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a class="indexterm" name="id349485"&gt;&lt;/a&gt;&lt;em class="parameter"&gt;&lt;code&gt;security = ADS&lt;/code&gt;&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;a class="indexterm" name="id349504"&gt;&lt;/a&gt;&lt;em class="parameter"&gt;&lt;code&gt;password server = your.kerberos.server&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;secrets.tdb&lt;/span&gt; - It contains passwords for workstations, LDAP admin DN (Distinguished Name), and information about trust account.&lt;br /&gt;&lt;br /&gt;secrets.tdb is just an example of a TDB file. TDB stands for "Trivial Database". It is one of the persistent TDB files, that do not change frequently. Persistent TDB files should be backed up regularily and moved over during upgrades and migrations. They live typically in /etc/samba/private directory, as opposed to non-persistent ("mundane") files, that typically live in /var/lib/samba. Note, that the default locations of both file types can be changed during compilation. In order to find out where the location is for compiled binaries, do the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;# smbd -b | grep PRIVATE_DIR&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;- for persistent files&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;# smbd -b | grep LOCKDIR&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;- for non-persistent files&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is a number of commands that we should pay attention to in relation to TDB files:&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt; pdbedit - manages the database of Samba Users&lt;br /&gt;&lt;/li&gt;&lt;li&gt; tdbbackup - you can backup and check the integrity of TDB files with this one&lt;br /&gt;&lt;/li&gt;&lt;li&gt; tdbdump - you can use this program for printing the contents of a TDB file&lt;br /&gt;&lt;/li&gt;&lt;li&gt; tdbtool - this is an interactive tool for modifying the contents of a TDB file.&lt;br /&gt;&lt;/li&gt;&lt;li&gt; smbpasswd - changes user's SMB password&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;SID&lt;/span&gt; - Security Identifier, is a string of the following format: S-a-b-c-d-[e-,f-,g-,...] , where:&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;S-a -  denotes SID revision, e.g. S-1&lt;/li&gt;&lt;li&gt;b - number of authorities and subauthorities&lt;/li&gt;&lt;li&gt;c - top level authority&lt;/li&gt;&lt;li&gt;d and following are numbers of subauthorities, their total number is equal to b&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;SIDs uniquely identify a CIFS object, be it a domain, user, group or other things.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Foreign SID &lt;/span&gt;- an SID not belonging to the current domain.&lt;br /&gt;&lt;br /&gt;Sources:&lt;br /&gt;man {pdbedit, tdbbackup, tdbdump, tdbtool, smbpasswd}&lt;br /&gt;http://www.samba.org/cifs/&lt;br /&gt;http://de.wikipedia.org/wiki/Server_Message_Block&lt;br /&gt;http://en.wikipedia.org/wiki/NetBIOS&lt;br /&gt;http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/ServerType.html&lt;br /&gt;http://wiki.samba.org/index.php/Frequently_Asked_Questions&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5758956585269719824?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5758956585269719824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5758956585269719824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5758956585269719824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5758956585269719824'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/0x00-lpic-302-sambacifs-terms-glossary.html' title='0x00. [LPIC-302] Samba/CIFS - Terms glossary'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1779454577423718774</id><published>2008-05-02T23:40:00.005+01:00</published><updated>2008-05-23T07:05:37.527+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>bash kick - A quick way to get rid of unwanted users from the system.</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you play cyber wargames you may feel a necessity to quickly and efficiently kill other users sessions. This has to be done within seconds and the hit must be precise. "&lt;span style="font-weight: bold;"&gt;kill -9 $(ps -o pid= -u user)&lt;/span&gt;" would be enough to get the user away but it is a bit longish (= not suitable for a stressful time-critical situation). Ideally, you should use a short and simple word, like &lt;span style="font-weight: bold;"&gt;kick&lt;/span&gt;, and have an ability to eliminate your enemy from the system by their username or their TTY. This can be achieved by a simple extension to root's local .bashrc file.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_YxqJFnCxl14/SBug3HSxsyI/AAAAAAAAACc/VkAjGvxOQ5k/s1600-h/montypythonkick.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_YxqJFnCxl14/SBug3HSxsyI/AAAAAAAAACc/VkAjGvxOQ5k/s400/montypythonkick.png" alt="" id="BLOGGER_PHOTO_ID_5195923463813051170" border="0" /&gt;&lt;/a&gt;&lt;a style="font-weight: bold;" href="http://oozie.fm.interia.pl/src/kick.tar.bz2"&gt;&lt;span style="font-size:180%;"&gt;kick.tar.bz2&lt;/span&gt;&lt;/a&gt;&lt;table align="center" bgcolor="DARKBLUE"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td align="left"&gt;&lt;b&gt;Installation (as root):&lt;br /&gt;&lt;/b&gt;cd&lt;b&gt;&lt;br /&gt;&lt;/b&gt;wget http://oozie.fm.interia.pl/src/kick.tar.bz2&lt;br /&gt;tar xjvf kick.tar.bz2&lt;br /&gt;append ". ~/.kick/bashrc.include" to root's .bashrc&lt;br /&gt;type "bash" to restart the shell&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:130%;"&gt;kick &lt;username&gt; - if you want to kill all processes of the user &lt;username&gt;, e.g. kick dummy&lt;br /&gt;&lt;br /&gt;kick tty &lt;tty&gt; - if you want to kill only one particular teletype session, e.g.  kick tty pts/0&lt;/tty&gt;&lt;/username&gt;&lt;/username&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1779454577423718774?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1779454577423718774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1779454577423718774' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1779454577423718774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1779454577423718774'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/05/bash-kick-quick-way-to-get-rid-of.html' title='bash kick - A quick way to get rid of unwanted users from the system.'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_YxqJFnCxl14/SBug3HSxsyI/AAAAAAAAACc/VkAjGvxOQ5k/s72-c/montypythonkick.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-405527694996055636</id><published>2008-04-20T03:18:00.012+01:00</published><updated>2009-09-26T22:38:59.893+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Encrypted root &amp; swap partitions on Gentoo with cryptsetup (LUKS) in less than an hour!</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://blog.ooz.ie/2009/09/install-encrypted-gentoo-in-no-time.html"&gt;&lt;span style="font-size:130%;"&gt;UPDATE: This post is out of date. Check the new script for automated Gentoo Installation.&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;I was sick for two days last week and not having gone to work I finally found some time to play with encrypting Linux partitions using cryptsetup-luks. There is a very good HOWTO on &lt;a style="font-weight: bold;" href="http://gentoo-wiki.com/SECURITY_System_Encryption_DM-Crypt_with_LUKS" target="_BLANK"&gt;Gentoo-Wiki&lt;/a&gt; describing the entire process step by step. Manual installation takes a bit too long and since I need encrypted hard drive on every computer, especially a laptop I wrote a set of scripts and got Gentoo to install on an encrypted root+swap in 10 quick steps. All you need is a Gentoo Minimal Installation CD version 2006.1 or 2007.0 and Internet access. Let's start!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://oozie.fm.interia.pl/src/gentoo-crypto.tbz2"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_YxqJFnCxl14/SA5zvHSxsxI/AAAAAAAAACU/JNII0W16sug/s400/kiss_my_s_linux.jpg" alt="" id="BLOGGER_PHOTO_ID_5192214673653609234" border="0" /&gt;&lt;span style="font-size:180%;"&gt;gentoo-crypto.tbz2&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;Installation from a &lt;a style="font-weight: bold;" href="http://www.gentoo.org/main/en/where.xml"&gt;Gentoo Mini Install&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Current version fully supports only the x86 architecture. If you have an 64bit system, make sure you download the right stage3 in the step 0x06!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;The installation process:&lt;/span&gt;&lt;br /&gt;0. Boot off a Gentoo Mini Install CD&lt;br /&gt;1. Partition your hard drive, so that you have at least 3 partitions: boot, swap and root.&lt;br /&gt;2. wget http://oozie.fm.interia.pl/src/gentoo-crypto.tar.bz2&lt;br /&gt;3. tar xjf gentoo-crypto.tar.bz2&lt;br /&gt;4. cd gentoo-crypto&lt;br /&gt;5. cat README&lt;br /&gt;6. run ./00config.sh and answer the questions&lt;br /&gt;7. run ./0?*.sh files one by one and look for errors.&lt;br /&gt;8. You should finish with setting up root password.&lt;br /&gt;9. You write a basic /boot/grub/menu.lst and install grub onto your hard drive from a chrooted environment on /mnt/gentoo&lt;br /&gt;&lt;br /&gt;That's it :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   0. Create a basic config file with 00config.sh :)&lt;br /&gt;   Partitions on your disk should be laid out prior to this step!&lt;br /&gt;&lt;ol&gt;&lt;li&gt;01modules.sh - this script loads appropriate cryptographic modules that are necessary for cryptsetup to proceed.&lt;/li&gt;&lt;li&gt;02crypt_dwnld.sh - downloads the statically liked binary of cryptsetup&lt;/li&gt;&lt;li&gt;03cryptswap.sh - sets up and encrypts the swap space&lt;/li&gt;&lt;li&gt;04cryptroot.sh - does the same as the one above, but with the root partition&lt;br /&gt;&lt;/li&gt;&lt;li&gt;05filesystem.sh -  creates the root filesystem and mounts it&lt;br /&gt;&lt;/li&gt;&lt;li&gt;06baseinstall.sh - downloads stage3 and portage, extracts them, makes you select a mirror and downloads the kernel source&lt;/li&gt;&lt;li&gt;07etcfiles.sh - the script edits /etc/fstab and points both root and swap to /dev/mapper/root and /dev/mapper/swap&lt;/li&gt;&lt;li&gt;08kernelchk.sh - this script checks your kernel config for all required options. This may not be reliable, as the option names may change from one kernel version to another. I attach a simple config for 2.6.24 kernel.&lt;/li&gt;&lt;li&gt;09initramfs.sh - creation of initramfs takes&lt;br /&gt;&lt;/li&gt;&lt;li&gt;0Abasicsetup.sh - merges a couple of ebuilds, the ones that are crucial for the system to work and those specified in config.crypto EBUILDS variable. Most importantly, it reemerges udev to the newer version, thus letting you emerge device-mapper which is necessary for the /dev/mapper/root device to be recognized in the system*.&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: center;"&gt; Enjoy.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;http://luks.endorphin.org/dm-crypt&lt;br /&gt;http://gentoo-wiki.com/SECURITY_System_Encryption_DM-Crypt_with_LUKS&lt;br /&gt;&lt;br /&gt;* If you neglect re-emerging udev and device-mapper ebuilds you are very likely to see a message like this:&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;* Checking root filesystem ...&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;fsck.ext3: No such file or directory while trying to open /dev/mapper/root &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; /dev/mapper/root: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; The superblock could not be read or does not describe a correct ext2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; filesystem.  If the device is valid and it really contains an ext2 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; filesystem (and not swap or ufs or something else), then the superblock &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; is corrupt, and you might try running e2fsck with an alternate superblock: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      e2fsck -b 8193 &lt;device&gt; &lt;/device&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; * Filesystem couldn't be fixed :( &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; Give root password for maintenance &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; (or type Control-D to continue):&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;  &lt;/span&gt;&lt;br /&gt;The super block can not be read, because /dev/mapper/ directory is empty, non-existent or contains only the special character device control. You can otherwise fix this message by changing two last fields in /etc/fstab from "0 1" to "0 0", but it's not a real solution - you just prevent the partition from being checked.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-405527694996055636?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/405527694996055636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=405527694996055636' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/405527694996055636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/405527694996055636'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/04/encrypting-root-swap-partitions-on.html' title='Encrypted root &amp; swap partitions on Gentoo with cryptsetup (LUKS) in less than an hour!'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_YxqJFnCxl14/SA5zvHSxsxI/AAAAAAAAACU/JNII0W16sug/s72-c/kiss_my_s_linux.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4630955207034947195</id><published>2008-01-01T20:11:00.002Z</published><updated>2008-04-21T09:33:58.658+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0F. [LPIC-301] Capacity Planning - Predict Future Resource Needs</title><content type='html'>* Predict capacity break point of a configuration&lt;br /&gt;   * Observe growth rate of capacity usage&lt;br /&gt;   * Graph the trend of capacity usage&lt;br /&gt;   * diagnose&lt;br /&gt;   * predict growth&lt;br /&gt;   * average&lt;br /&gt;   * resource exhaustion&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4630955207034947195?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4630955207034947195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4630955207034947195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4630955207034947195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4630955207034947195'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0f-lpic-301-capacity-planning-predict.html' title='0x0F. [LPIC-301] Capacity Planning - Predict Future Resource Needs'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-2636710032651885598</id><published>2008-01-01T20:09:00.001Z</published><updated>2008-04-21T09:33:58.659+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0E. [LPIC-301] Capacity Planning - Analyze Demand</title><content type='html'>Demand analysis is based on the &lt;a href="http://en.wikipedia.org/wiki/Queueing_theory"&gt;Queuing Theory.&lt;/a&gt;&lt;br /&gt;Perl::PDQ makes use of it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-2636710032651885598?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/2636710032651885598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=2636710032651885598' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2636710032651885598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/2636710032651885598'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0e-lpic-301-capacity-planning-analyze.html' title='0x0E. [LPIC-301] Capacity Planning - Analyze Demand'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-6686018536680918460</id><published>2008-01-01T20:08:00.000Z</published><updated>2008-04-21T09:33:58.660+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0D. [LPIC-301] Capacity Planning - Troubleshoot Resource Problems</title><content type='html'>&lt;div style="text-align: justify;"&gt;Let's kick off with a glossary:&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;a block device &lt;/span&gt;= in Linux system it is a special file corresponding to data storage devices. The system talks to block devices using "blocks".&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;block&lt;/span&gt; = a bulk of bytes, typically having a multiplication of 1024 as it's size. Files on a filesystem are segmented in blocks. File block size = file bytes size / block size, brought to the next integral value down and incremented by 1. Data being read from a filesystem is not read byte-by-byte, it's read in the whole block instead. It's much faster.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;"blocks in" / bi&lt;/span&gt; = blocks received from a block device. vmstat&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;"blocks out" / bo&lt;/span&gt; = blocks sent to a block device. vmstat&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;process blocked by I/O&lt;/span&gt; = this happens when the read or write speed for a single process is not sufficient.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;It happens on occasions that some processes get blocked (or rather postponed to avoid confusion with the glossary explanations above) due to block devices I/O.  (here block devices in the meaning from the glossary). You can verify this information using &lt;span style="font-weight: bold;"&gt;vmstat&lt;/span&gt;, more precisely the info will be displayed in the procs subsection. You may want to perform a test and issue the followoing command:&lt;br /&gt;&lt;br /&gt;dd if=/dev/zero of=/dev/null &amp;amp;&lt;br /&gt;&lt;br /&gt;This will produce a big number \0's being transferred between two virtual devices continuously. Compare the output from vmstat from before and after the command execution.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Reference to a good resource:&lt;br /&gt;&lt;a href="http://tldp.org/LDP/intro-linux/html/sect_04_03.html"&gt;http://tldp.org/LDP/intro-linux/html/sect_04_03.html&lt;/a&gt;&lt;br /&gt;todo:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="content"&gt; Match / correlate system symptoms  with likely problems &lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p class="content"&gt; Identify bottlenecks in a system &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="content"&gt;swap&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-6686018536680918460?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/6686018536680918460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=6686018536680918460' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6686018536680918460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6686018536680918460'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0d-lpic-301-capacity-planning.html' title='0x0D. [LPIC-301] Capacity Planning - Troubleshoot Resource Problems'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3173676236595040084</id><published>2008-01-01T20:07:00.000Z</published><updated>2008-04-21T09:33:58.660+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0C. [LPIC-301] Capacity Planning - Measure Resource Usage</title><content type='html'>In this section we focus on measurement tools, in particular on &lt;a href="http://www.blogger.com/pagesperso-orange.fr/sebastien.godard/"&gt;the sysstat suite by Sebastien Godard&lt;/a&gt;.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;I presume you are familiar with the /proc/cpuinfo file already. This information is static. How to obtain a dynamic info about CPU I/O?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;iostat&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YxqJFnCxl14/R6Xt44yjtGI/AAAAAAAAAB0/NroaIAT1_Po/s1600-h/iostat.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_YxqJFnCxl14/R6Xt44yjtGI/AAAAAAAAAB0/NroaIAT1_Po/s400/iostat.png" alt="" id="BLOGGER_PHOTO_ID_5162794109423039586" border="0" /&gt;&lt;/a&gt;According to it's man page, iostat reports CPU statistics and I/O statistics for devices and partitions. In it's basic for iostat output looks like this:&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;100% of the CPU load is split into 6 categories as presented on the picture. Below a block device, sda, and statistics for it: transfers per second, block reads per second, block writes per second, total block reads, total block writes. Go to iostat man page for more information.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;mpstat&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;mpstat reports all CPU related statistics. Its output is similar to iostat's with the main difference being much preciser CPU stats (mstat is able to show info for every processor alone) and no information about other devices at all.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_YxqJFnCxl14/R6XucoyjtII/AAAAAAAAACE/Q1OhCOQy3NA/s1600-h/mpstat.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_YxqJFnCxl14/R6XucoyjtII/AAAAAAAAACE/Q1OhCOQy3NA/s400/mpstat.png" alt="" id="BLOGGER_PHOTO_ID_5162794723603362946" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;vmstat&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;vmstat reports information about processes, memory, paging, block I/O, traps, and CPU activity. Basic vmstat output looks as follows:&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YxqJFnCxl14/R6Xur4yjtJI/AAAAAAAAACM/AB62IphaBAs/s1600-h/vmstat.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_YxqJFnCxl14/R6Xur4yjtJI/AAAAAAAAACM/AB62IphaBAs/s400/vmstat.png" alt="" id="BLOGGER_PHOTO_ID_5162794985596368018" border="0" /&gt;&lt;/a&gt;You can specify a number of seconds (X) as a command line argument. If you do so, vmstat will show you average load since the last reboot as the first line (like above) and consecutive lines will be generated every X seconds and will  report average stats for the last X-seconds period. You can find a some more comprehensive information on what can be read from the reports in &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?vmstat"&gt;the vmstat man page&lt;/a&gt;, "field description for vm mode" section.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;sar&lt;/span&gt;&lt;br /&gt;This utility is more sophisticated than the previous programs from sysstat suite. sar is a command-line front-end to sadc program, which collects data at specific intervals (you can add data collection to crontab). In order to collect data, you can use two shellscripts sa1 and sa2, wrappers around sadc. Configuration of the tool is described at &lt;a href="http://pagesperso-orange.fr/sebastien.godard/tutorial.html"&gt;http://pagesperso-orange.fr/sebastien.godard/tutorial.html&lt;/a&gt;. The following picture shows the how my two processors performed during one second:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_YxqJFnCxl14/R6XtDoyjtFI/AAAAAAAAABs/gLKuMmaNz8A/s1600-h/sar.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_YxqJFnCxl14/R6XtDoyjtFI/AAAAAAAAABs/gLKuMmaNz8A/s400/sar.png" alt="" id="BLOGGER_PHOTO_ID_5162793194595005522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Other, helpful tools include { pstree, w, lsof, top,      uptime }. Refer to their man pages for more info.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;How to ... ?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;- Measure CPU usage&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;you can fire up 'uptime'. It gives you a one line of information: current time, time since the last reboot, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. If the load over the for the three values is consecutively decreasing, it means we may be in trouble. If the values increase from left to right it means that things are getting less and less CPU load. Usually good news.&lt;/li&gt;&lt;li&gt;iostat discloses instantaneous information about the average CPU load on all processors and some block I/O info, which can be connected to each other.&lt;/li&gt;&lt;li&gt;In order to get some more detailed info about the CPU, run mpstat, if you prefer with the "-P &amp;lt;processor_nr&amp;gt;&lt;processor_nr&gt;" option in order to see info specific for one of the processors. (cat /proc/cpuinfo to see the amount of processors)&lt;br /&gt;&lt;/processor_nr&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;- Measure memory usage&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;vmstat would be the right pick for that purpose. According to the man page, it shows memory information in the following sections you:&lt;br /&gt;swpd: the amount of virtual memory used.&lt;br /&gt;free: the amount of idle memory.&lt;br /&gt;buff: the amount of memory used as buffers.&lt;br /&gt;cache: the amount of memory used as cache.&lt;br /&gt;inact: the amount of inactive memory. (-a option)&lt;br /&gt;active: the amount of active memory. (-a option)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;- Measure disk I/O&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;vm in vmstat stands virtual memory and for this one it's intended. You can, however measure disk"vmstat -d" or "vmstat -p &amp;lt;partition_name&amp;gt;"&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;- Measure network I/O&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"sar 1 -n DEV" does the trick. It will show you stats for network interfaces in received/transferred packets/compressed packets/bytes per second, as well as multicast packets per sec.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;- Measure firewalling and routing throughput&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;sar?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;- Map client bandwidth usage&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;sar?&lt;/li&gt;&lt;/ul&gt;Some good reference:&lt;br /&gt;&lt;a href="http://tldp.org/LDP/sag/html/system-resources.html"&gt;http://tldp.org/LDP/sag/html/system-resources.html&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3173676236595040084?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3173676236595040084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3173676236595040084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3173676236595040084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3173676236595040084'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0c-lpic-301-capacity-planning-measure.html' title='0x0C. [LPIC-301] Capacity Planning - Measure Resource Usage'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_YxqJFnCxl14/R6Xt44yjtGI/AAAAAAAAAB0/NroaIAT1_Po/s72-c/iostat.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-770386652990149223</id><published>2008-01-01T19:59:00.000Z</published><updated>2008-05-24T23:31:55.458+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0B. [LPIC-301] LDAP - Development</title><content type='html'>&lt;div style="text-align: justify;"&gt;As LDAP is constantly gaining on popularity so are numerous applications based on it. If you happen to work with LDAP on the regular basis and use it for something more than keeping whitepages with contacts for your Thunderbird, you will need to write some scripts eventually. LPIC requires Perl knowledge in this respect. If I was to recommend a compact guide to it, I would point you in the direction of "LDAP System Administration" by Gerald Carter (It seems like the whole exam is based on it anyway). It describes the basics about Net::LDAP module, but requires from you some background in Perl.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Getting Libraries...&lt;/span&gt;&lt;br /&gt;Libraries are available on CPAN, you can get all the required libraries downloading Bundle::Net::LDAP.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;root@hackpospolita:/home/oozie# cpan&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;Terminal does not support AddHistory.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;cpan shell -- CPAN exploration and modules installation (v1.7601)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;ReadLine support available (try 'install Bundle::CPAN')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;cpan&gt; install Bundle::Net::LDAP&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;CPAN: Storable loaded ok&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;[...]&lt;/span&gt;&lt;br /&gt;... and answer a lot of questions :)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Scripting&lt;br /&gt;&lt;/span&gt;I think the best method to learn scripting is to try doing it yourself. Reference documentation can be also found on the &lt;a href="http://ldap.perl.org/FAQ.htm"&gt;PERL.ORG&lt;/a&gt;&lt;span style="font-size:100%;"&gt;. Find some example scripts with their brief descriptions below:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://oozie.fm.interia.pl/src/ldap/anonsimple.pl" target=_blank&gt;&lt;span style="font-size:130%;"&gt;Anonymous unencrypted bind - searching for UID&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[ yet to come ]&lt;br /&gt;&lt;/span&gt;[...]&lt;br /&gt;&lt;br /&gt;{Python, C/C++, PHP}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-770386652990149223?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/770386652990149223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=770386652990149223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/770386652990149223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/770386652990149223'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0b-lpic-301-ldap-development.html' title='0x0B. [LPIC-301] LDAP - Development'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7437475447023274940</id><published>2008-01-01T19:58:00.001Z</published><updated>2008-05-24T23:31:55.459+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x0A. [LPIC-301] LDAP - Integration</title><content type='html'>&lt;span style="font-weight: bold;font-size:130%;" &gt;NSS and PAM integration&lt;/span&gt;&lt;br /&gt;This is a very important one, has been described before in &lt;a href="http://thewinningmove.blogspot.com/2007/11/0x05-lpi-301-make-use-of-ldap-nssldap.html"&gt;"Make use of LDAP"&lt;/a&gt;&lt;a href="http://thewinningmove.blogspot.com/2007/11/0x05-lpi-301-make-use-of-ldap-nssldap.html"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Outlook&lt;/span&gt;&lt;br /&gt;I could be entering my own settings into Outlook, then taking screenshots, then publishing them here, but what for? Someone has already done it better &lt;a href="http://www1.umn.edu/adcs/guides/email/winoutlook2003/#ldap" target="_blank"&gt;in this location.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Single Sign-On&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I think that the best place to go for a more comprehensive explanation on SSO would be &lt;a href="http://www.opengroup.org/security/sso/" target="_blank"&gt;OpenGroup's SSO website&lt;/a&gt;. In short, SSO allows a user to authenticate once and be authorized to use her services for a specific period of time without a need to re-login. This, in conjunction with LDAP, gives flexibility and functionality and reduces human mistakes, e.g. while entering passwords. In order to achive SSO model, we need to deploy Kerberos.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To come: { www, nis, ftp, http, ssh, samba, freeradius, kerberos, AD }&lt;br /&gt;[This article is obsolete and incomplete]&lt;br /&gt;[...]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7437475447023274940?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7437475447023274940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7437475447023274940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7437475447023274940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7437475447023274940'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x0a-lpic-301-ldap-integration.html' title='0x0A. [LPIC-301] LDAP - Integration'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1943357337059764005</id><published>2008-01-01T19:55:00.000Z</published><updated>2008-05-24T23:31:55.460+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x09. [LPIC-301] LDAP - Directory performance tuning</title><content type='html'>&lt;span style="font-size:180%;"&gt;Before we start&lt;/span&gt;&lt;br /&gt;Prior to configuring slapd take few factors into consideration.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Main memory. It's always a good idea to extend it according to the needs so later you can scale the cache with the cachesize directive.&lt;/li&gt;&lt;li&gt;Hard drive. It's a good idea to allocate each database on a separate disk.  Of course the faster hard drive you use, the better performance you get.&lt;/li&gt;&lt;li&gt;Filesystem tuning. noatime is one of the options you may want to use in /etc/fstab&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:180%;"&gt;Indexing&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Start your performance tuning with the &lt;span style="font-weight: bold;"&gt;index&lt;/span&gt; directive in slapd.conf. Generally, indexing entries is supposed to speed up the performance, however, if you index entries you never or vary infrequently search for it will only slow down your directory.&lt;br /&gt;&lt;br /&gt;If a search for some specific filter is performed particularly often, slapd can create an index based on the information available in the database. From now on if a user searches the directory the entries are returned based on the index and slapd won't waste its own and users time.&lt;br /&gt;The general syntax for doing indexing with slapd is to add a line (or multiple lines) with the &lt;span style="font-weight: bold;"&gt;index&lt;/span&gt; directive to slapd.conf. The said line is of the following format:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:130%;"&gt;index           &lt;span style="font-style: italic;"&gt;attr1[,attr2[,...]]  &lt;/span&gt;         &lt;span style="font-style: italic;"&gt;index_type1[,index_type2[,...]]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;where attrX is an arbitrary attribute, like objectClass, uid, cn, sn etc and index_typeX is one of the four following options:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;eq - tells slapd to index all searches with an exact match for a particular attribute&lt;/li&gt;&lt;li&gt;sub - creates an index with substrings for the given attribute&lt;/li&gt;&lt;li&gt;approx - indexes entries with approximate or phonetic value&lt;/li&gt;&lt;li&gt;pres - checks for presence. Apparently this type is not very commonly used, as normally the application expects itself, if an attribute is present or not.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;slapindex&lt;/span&gt; must be run every time you update index section in slapd.conf, otherwise the indexes won't be recreated.&lt;br /&gt;&lt;br /&gt;Go to &lt;a href="http://www.openldap.org/faq/data/cache/42.html"&gt;http://www.openldap.org/faq/data/cache/42.html&lt;/a&gt; for some more explanation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;DB_CONFIG&lt;/span&gt;&lt;br /&gt;Internal database tuning can be achived by modifying DB_CONFIG file, located in the root directory of the database. For detailed information on the file itself please refer to &lt;a href="http://www.sleepycat.com/docs/ref/env/db_config.html"&gt;http://www.sleepycat.com/docs/ref/env/db_config.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;db4.3_archive, db4.3_deadlock, db4.3_load, db4.3_recover, db4.3_upgrade, db4.3_checkpoint, db4.3_dump, db4.3_printlog, db4.3_stat, db4.3_verify are programs that come with Berkley DB 4.3. and can be used to verify / tune performance on the database itself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;other&lt;br /&gt;&lt;/span&gt;Opulent logging can decrease performance. A simple solution for that is to reduce the logging level to minimum:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;# - slapd.conf excerpt -&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;code style="font-family: courier new;"&gt;loglevel 0&lt;br /&gt;#&lt;/code&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1943357337059764005?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1943357337059764005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1943357337059764005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1943357337059764005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1943357337059764005'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x09-lpic-301-ldap-directory.html' title='0x09. [LPIC-301] LDAP - Directory performance tuning'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5851770578779961982</id><published>2008-01-01T19:20:00.000Z</published><updated>2008-05-24T23:31:55.460+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x08. [LPIC-301] LDAP - OpenLDAP customizing - schema files</title><content type='html'>(This article is based on Section 9 of LDAP Admin Guide 2.3 &lt;a href="http://www.openldap.org/doc/admin23/"&gt;http://www.openldap.org/doc/admin23/)&lt;/a&gt;&lt;br /&gt;&lt;ol style="text-align: justify;"&gt;&lt;li&gt;in default OpenLDAP installation schema files reside in /usr/local/etc/openldap/schema. If you install OpenLDAP as a package from your distribution you will find the files in /etc/openldap/schema&lt;/li&gt;&lt;li&gt;Schema files have to be included from under slapd.conf with the 'include' directive. slapd.conf normally starts with schema inclusion&lt;/li&gt;&lt;li&gt;6 schema files are distributed along with OpenLDAP, these are: (table ripped off directly from &lt;a href="http://www.openldap.org/doc/admin23/schema.html"&gt;here&lt;/a&gt;)&lt;table style="text-align: left; margin-left: 0px; margin-right: 0px;" class="columns" border="1"&gt;&lt;caption align="top"&gt;Table 8.1: Provided Schema Specifications&lt;/caption&gt; &lt;tbody&gt;&lt;tr class="heading"&gt; &lt;td align="left"&gt; &lt;strong&gt;File&lt;/strong&gt; &lt;/td&gt; &lt;td align="right"&gt; &lt;strong&gt;Description&lt;/strong&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;core.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; OpenLDAP &lt;em&gt;core&lt;/em&gt; (required) &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;cosine.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; Cosine and Internet X.500 (useful) &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;inetorgperson.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; InetOrgPerson (useful) &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;misc.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; Assorted (experimental) &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;nis.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; Network Information Services (FYI) &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;tt&gt;openldap.schema&lt;/tt&gt; &lt;/td&gt; &lt;td align="right"&gt; OpenLDAP Project (experimenta &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;inetorgperson.schema is dependent on cosine.schema&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Schema files distributed with the directory should never be modified. You should create new schema if you want to extend objectClasses and attributes.&lt;/li&gt;&lt;li&gt;OpenLDAP Admin Guide version 2.3 defines five steps while creating new schemas:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;a) obtain object identifier (OID)&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;You can obtain an OID for your enterprise with IANA (&lt;a href="http://www.iana.org/"&gt;http://www.iana.org/&lt;/a&gt;). An OID is a number in dot-decimal notation, uniquely identifying your organization. It has a similar format: 1.3.6.1.4.1.X, where X is an integer number representing you.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;b) choose a name prefix&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;You should come up with a name prefix added to every attribute and object class in your schema. This way you avoid confusion with other non-standard schemas. An encouraged format for the prefix is &lt;span style="font-style: italic;"&gt;topleveldomainCompanyname, &lt;/span&gt;e.g. deFirma, ieCompany, plFirma, tuxPorta&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;c) create local schema file&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;A customary name for your local schema file would be local.schema, but it fact it can be called whatever you want. Your local file should be included at the end of all other schema inclusions in slapd.conf&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;d) define custom attribute types (if necesarry)&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;Creating attributes is best described and illustrated with examples in &lt;a href="http://www.rfc-editor.org/rfc/rfc2252.txt"&gt;RFC 2252&lt;/a&gt;. An attribute defined in a schema file should contain at minimum name(s), description and attribute syntax expressed as an OID. The list of attribute syntaxes and associated OID can be found in &lt;a href="http://www.openldap.org/doc/admin23/schema.html"&gt;OpenLDAP Admin Guide 2.3, table 8.3 - Commonly used Syntaxes&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;e) define custom object classes&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:arial;"&gt;Object classes are defined in the schema file at the end following the definition of the attributes. Simplified object class definition has the following format: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;    ObjectClass ( OID-in-numeric-format&lt;br /&gt;            NAME "object-class-name-in-qdescrs-format"&lt;br /&gt;            DESC "object-class-description-in-qdstring"&lt;br /&gt;            OBSOLETE  ; only to denote obsolete class&lt;br /&gt;            SUP  ( superior $ objectclasses $ separeted $ byDollar )&lt;br /&gt;            ABSTRACT / STRUCTURAL / AUXILIARY ; STRUCTURAL by default&lt;br /&gt;            MUST ( OIDs $ of $ mandatory $ attrs $ separated $ byDollar )&lt;br /&gt;            MAY  ( OIDs $ of $ optional $ attrs $ separated $ byDollar )&lt;br /&gt;  )&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5851770578779961982?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5851770578779961982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5851770578779961982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5851770578779961982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5851770578779961982'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2008/01/0x08-lpic-301-ldap-openldap-customizing.html' title='0x08. [LPIC-301] LDAP - OpenLDAP customizing - schema files'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3295994389034626405</id><published>2007-12-23T22:54:00.000Z</published><updated>2008-05-24T23:31:55.461+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x07. [LPIC-301] LDAP - Directory replication</title><content type='html'>&lt;div style="text-align: justify;"&gt;Our directory is being used all the time for some specific purpose, namely authentication. For that reason security had to be taken into account, nevertheless, it's stability now is of no less importance. Also, decreasing load on a (master) and moving it over to slaves increases performance of the whole directory instance. It is also important, that you come up with a good backup strategy. For all that OpenLDAP 2.3 and below provide &lt;span style="font-weight: bold;"&gt;slurpd&lt;/span&gt; daemon, which is responsible for directory replication. In OpenLDAP 2.4 slurpd was completely replaced with Syncrepl for a number of reasons.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-size:180%;"&gt;slurpd logic&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;slapd and slurpd run on the same server, which from now on will be called &lt;span style="font-weight: bold;"&gt;master&lt;/span&gt;. Following this there are several slave servers running only slapd deamon. DNS for our ldap service should be configured with RoundRobin (in my case it's simply porta.tux, but ldap.porta.tux would be more appropriate), so when clients connect to the directory the load is distributed among the slave servers. They simply read the directory from a slave server. Now let's assume that a client wants to change password entry in the directory. This process is more complicated and, according to OpenLDAP admin guide, includes the following steps:&lt;br /&gt;&lt;ol style="color: rgb(255, 255, 51);"&gt;&lt;li&gt;The LDAP client submits an LDAP modify operation to the slave slapd. &lt;/li&gt;&lt;li&gt;The slave slapd returns a referral to the LDAP client referring the client to the master slapd. &lt;/li&gt;&lt;li&gt;The LDAP client submits the LDAP modify operation to the master slapd. &lt;/li&gt;&lt;li&gt;The master slapd performs the modify operation, writes out the change to its replication log file and returns a success code to the client. &lt;/li&gt;&lt;li&gt;The slurpd process notices that a new entry has been appended to the replication log file, reads the replication log entry, and sends the change to the slave slapd via LDAP. &lt;/li&gt;&lt;li&gt;The slave slapd performs the modify operation and returns a success code to the slurpd process.&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;Say I have 3 slave slapd servers and one master. A client wants to perform a password change modification. The following happens: 1) client sends ldap modify request, 2) slave slapd server points the client to the master server, 3) client resends ldap modify request to the master server, 4) master server confirms  success, 5)  master server informs slurpd about the changes in the directory via changelog. 6) slurpd replicates the changes to all slave servers&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_YxqJFnCxl14/R3WwGudzIDI/AAAAAAAAABM/G8VQNxHFl6g/s1600-h/graph2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_YxqJFnCxl14/R3WwGudzIDI/AAAAAAAAABM/G8VQNxHFl6g/s320/graph2.jpg" alt="" id="BLOGGER_PHOTO_ID_5149215378566750258" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;A slave server which the ldap data is pushed to is called a &lt;span style="font-weight: bold;"&gt;replica server&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;br /&gt;How to configure a replica? &lt;/span&gt;&lt;br /&gt;Kick off with building a copy of your master ldap server on another computer. It is important to secure it as much as you do the master server, as slurpd on the master will update slaves with LDAP protocol, and you don't want sensitive data wandering over network unencrypted. Second step is migrating the data from the master server. Theoretically, you can copy the database files from the master to the slave, but make sure that the database software is compatible on both machines and that CPU architecture does not prevent compatibility. If you want to avoid these and possibly other factors there is a universal solution: &lt;span style="font-weight: bold;"&gt;slapcat&lt;/span&gt;. This will dump the database content in an LDIF format. Move this file over to the replica and slapadd it into the new directory. Once that is done we can get down to the configuration files... I presume that slapd.conf on both servers are fully functional.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Replica slapd.conf&lt;br /&gt;&lt;/span&gt;We need to change the rootdn/rootpw for the replica server. Master's slurpd will use these credentials for modifying entries. If you decide not to use rootdn as the updating user it is good to doublecheck that this particular user has sufficient access.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;#  New rootdn/rootpw on the slave&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;# -- this is only an example, in real life rootpw should be hashed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;rootdn    "cn=replica,dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;rootpw    "replicaPasswd"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;#  -- Now the most important part. updatedn (user responsible&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;#  for updates on the slave) is associated with rootdn entry.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;# slave's slapd will point users willing to write to updateref&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;updatedn "cn=replica,dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;updateref "ldaps://porta.tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;#-- &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Master slapd.conf&lt;/span&gt;&lt;br /&gt;Analogically, master should know the credentials for the slave and the hostname to refer to. The following directive accomplishes that:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;# to add on the master slapd.conf&lt;br /&gt;replogfile /var/lib/openldap-slurp/replica/slapd.replog&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;replica uri=ldaps://princess.tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;         suffix="dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;         binddn=&lt;/span&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;"cn=replica,dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;         credentials=replicaPasswd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;         bindmethod=simple&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;replog&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;In the line above we defined the replog file. Slapd communicates with slurpd via replog. So what's it content?&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 255, 255);font-size:130%;" &gt;&lt;span style="font-size:100%;"&gt;#- replog&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);font-size:130%;" &gt;&lt;span style="font-size:100%;"&gt;replica: porta.tux:636&lt;br /&gt;time: 1198985069&lt;br /&gt;dn: uid=spitfire,ou=People,dc=porta,dc=tux&lt;br /&gt;changetype: modify&lt;br /&gt;replace: userPassword&lt;br /&gt;userPassword:: cXdTcffzZEZ6eG2N&lt;br /&gt;-&lt;br /&gt;replace: entryCSN&lt;br /&gt;entryCSN: 20071230032429Z#000000#00#000000&lt;br /&gt;-&lt;br /&gt;replace: modifiersName&lt;br /&gt;modifiersName: uid=spitfire,ou=People,dc=porta,dc=tux&lt;br /&gt;-&lt;br /&gt;replace: modifyTimestamp&lt;br /&gt;modifyTimestamp: 20071230032429Z&lt;br /&gt;-&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 255, 255);font-size:130%;" &gt;&lt;span style="font-size:100%;"&gt;#- end of replog&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The snippet from the logfile shows that spitfire was changing password. Slurpd reads it and pushes the changes to further the slave servers. If it is unsucessful, it writes an error replog ( a .rej file) with exactly the same syntax as replog, but it adds ERROR at the beginning. (Example taken from OpenLDAP admin guide 2.3)&lt;br /&gt;&lt;pre style="color: rgb(255, 255, 153);"&gt;       ERROR: No such attribute&lt;br /&gt;replica: slave.example.com:389&lt;br /&gt;time: 809618633&lt;br /&gt;dn: uid=bjensen,dc=example,dc=com&lt;br /&gt;changetype: modify&lt;br /&gt;replace: description&lt;br /&gt;description: A dreamer...&lt;br /&gt;-&lt;br /&gt;replace: modifiersName&lt;br /&gt;modifiersName: uid=bjensen,dc=example,dc=com&lt;br /&gt;-&lt;br /&gt;replace: modifyTimestamp&lt;br /&gt;modifyTimestamp: 20000805073308Z&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;span style="font-family:Georgia,serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;slurpd in One-shot mode and reject files&lt;/span&gt;&lt;br /&gt;If you want to correct an error from error log, you needn't do it by hand. You can run slurpd in one-shot mode: (-o for one-shot mode and -r for file name of the replog to be processed)&lt;br /&gt;&lt;pre&gt;slurpd -r rejected.replog.file.name.rej -o&lt;br /&gt;&lt;/pre&gt;After successful processing of the file slurpd exits instead of going into daemon mode.&lt;br /&gt;&lt;br /&gt;slurpd operates in push mode only (master pushes the changes to the slaves)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;syncrepl logic &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;A preferred alternative to slurpd is syncrepl. It is a consumer-side replication engine. Syncrepl uses LDAP Content Synchronization Protocol for keeping date up-to-date and supports both push- and pull-based replication. It is synchronizing automatically with the provider database.&lt;br /&gt;&lt;br /&gt;The LDAP Content Synchronization Protocol supports two types of operation: &lt;em&gt;refreshOnly&lt;/em&gt; (polling) and &lt;em&gt;refreshAndPersist&lt;/em&gt; (listening).&lt;br /&gt;&lt;br /&gt;Consumer server is synchronized during the polling and disconnects when finished (refreshOnly).&lt;br /&gt;When refresh|AndPersist policy is selected, the consumer server remains connected and updates all the newly changed entries on the fly.&lt;br /&gt;&lt;br /&gt;refreshOnly and the "refresh" part of refreshAndPersist can be performed in one of two phases: &lt;span style="font-style: italic;"&gt;present&lt;/span&gt; or &lt;span style="font-style: italic;"&gt;delete.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the &lt;span style="font-weight: bold;"&gt;present phase&lt;/span&gt; the server slapd sends some information to client slapd, that is...&lt;br /&gt;a) all the entries with their attributes that have been changed since the last synchronization&lt;br /&gt;b) changed attributes in these entries with new values&lt;br /&gt;c) unchanged attributes without values but being marked as "present" on the server&lt;br /&gt;d) entries that haven't been mentioned do not exist, thus are removed from the client slapd&lt;br /&gt;&lt;br /&gt;In the &lt;span style="font-weight: bold;"&gt;delete phase&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;the information sent by the server slapd is as follows:&lt;br /&gt;a) all the entries with their attributes that have been changed since the last synchronization&lt;br /&gt;b) changed attributes/entries with new values&lt;br /&gt;c) unchanged attributes are not mentioned&lt;br /&gt;d) removed entries without values but being marked as "deleted" on the server&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style: italic;"&gt;refreshOnly &lt;/span&gt;operation is finished with LDAP Sync sending a cookie to the LDAP Sync client. The client will present this cookie to the server before priot to the next synchronization in order to check if something has changed on the server since the last sync.&lt;br /&gt;&lt;br /&gt;The difference between &lt;span style="font-style: italic;"&gt;refreshOnly&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;refreshAndPersist&lt;/span&gt; is that in the latter the connection between sync servers is not terminated and the state cookie can be updated anytime the servers request it.&lt;br /&gt;&lt;br /&gt;You can find out more refering to &lt;a href="http://www.openldap.org/doc/admin23/syncrepl.html" target="_blank"&gt;http://www.openldap.org/doc/admin23/syncrepl.html&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;configuring syncrepl&lt;/span&gt;&lt;br /&gt;You can start with undoing changes we did during slurpd configuration :)&lt;br /&gt;As mentioned above, syncrepl is a LDAP Sync Client (consumer) based type of replication, that's why there is not to much to do on the LDAP Sync Server's (Provider's) side.&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;   # --&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;   overlay syncprov&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;   syncprov-checkpoint 100 10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;   syncprov-sessionlog 100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;   # --&lt;/span&gt;&lt;span style="font-family: Georgia,serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;the first directive defines the syncprov overlay.&lt;br /&gt;Second line is the providers checkpoint limit. In the example above a checkpoint will be performed every 100 LDAP operations or every 10 minutes, whatever comes first.&lt;br /&gt;&lt;br /&gt;On the client LDAP Sync side things are getting more interesting:&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;# -- snippet from slapd.conf on princess-pc&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;syncrepl    rid=1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                provider=ldaps://porta.tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                type=refreshOnly&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                interval=00:01:00:00&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                searchbase="dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                scope=sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                bindmethod=simple&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                binddn="cn=Manager,dc=porta,dc=tux"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;                credentials=secret&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;# -- &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So our princess-pc will connect to porta.tux every hour and will perform &lt;span style="font-style: italic;"&gt;refreshOnce&lt;/span&gt; operation. It uses rootdn of the master provider server (what from the security point of view is not the smartest thing to do)&lt;br /&gt;&lt;br /&gt;constrains:&lt;br /&gt;ldbm backend does not support &lt;span style="font-style: italic;"&gt;refreshAndPersist&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3295994389034626405?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3295994389034626405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3295994389034626405' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3295994389034626405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3295994389034626405'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/12/0x07-lpi-301-directory-replication-with.html' title='0x07. [LPIC-301] LDAP - Directory replication'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_YxqJFnCxl14/R3WwGudzIDI/AAAAAAAAABM/G8VQNxHFl6g/s72-c/graph2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5966278557903170357</id><published>2007-12-07T10:02:00.000Z</published><updated>2008-05-24T23:31:55.461+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x06. [LPIC-301] LDAP - Tightening security</title><content type='html'>&lt;div style="text-align: justify;"&gt;In the previous post I confugured nss_ldap and pam_ldap, but the ACL applied to this configuration not only allows users to read other users passwords but also change them! We should change it ASAP.&lt;br /&gt;&lt;/div&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;ACL&lt;/span&gt;&lt;br /&gt;The OpenLDAP ACL syntax is not too complicated and it lets us express all we need. The general syntax rule is:&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center; color: rgb(255, 255, 153);"&gt;&lt;span style="font-size:130%;"&gt;&lt;span&gt;access to (&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;resource&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="color: rgb(255, 255, 153);font-size:130%;" &gt;&lt;span&gt;                    by (&lt;span style="font-weight: bold;"&gt;whom&lt;/span&gt;) (&lt;span style="font-weight: bold;"&gt;access level&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;where:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;resource&lt;/span&gt; can be represented as&lt;br /&gt;&lt;table border="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;any entry in the entire directory&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;regular expression&lt;/td&gt;&lt;td&gt;a regex denoting an entry or a group of entries. There are four methods of inheriting the expression:&lt;br /&gt;- dn.base=regex&lt;br /&gt;- dn.children=regex&lt;br /&gt;- dn.one=regex&lt;br /&gt;- dn.subtree=regex&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;filter=(LDAP-Filter)&lt;/td&gt;&lt;td&gt;A standard LDAP filter, e.g. ...&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;attrs=&lt;/td&gt;&lt;td&gt;A list of attribures with specific access control. A very common example would be userPassword which should not be read by anyone but the owner who also should have write permission in order to change it.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-weight: bold;"&gt;who&lt;/span&gt; can be represented as:&lt;br /&gt;&lt;table style="text-align: left; margin-left: auto; margin-right: auto;" border="1"&gt;&lt;tbody&gt;&lt;tr style="font-weight: bold;" align="center"&gt;&lt;td&gt;*&lt;/td&gt;&lt;td&gt;anonymous&lt;/td&gt;&lt;td&gt;users&lt;/td&gt;&lt;td&gt;self&lt;/td&gt;&lt;td&gt;dn&lt;/td&gt;&lt;td&gt;group=*&lt;/td&gt;&lt;/tr&gt;&lt;tr align="center"&gt;&lt;td&gt;anyone&lt;/td&gt;&lt;td&gt;non authenticated users&lt;/td&gt;&lt;td&gt;authenticated users&lt;/td&gt;&lt;td&gt;user trying to get access to his DN entry&lt;/td&gt;&lt;td&gt;user defined by the specific DN&lt;/td&gt;&lt;td&gt;an ldap group in DN notation&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;and finally &lt;span style="font-weight: bold;"&gt;access level&lt;/span&gt; is one of the following:&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;none&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;-&lt;/td&gt;&lt;td&gt;no access is granted&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;auth&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;x&lt;/td&gt;&lt;td&gt;The right for authentication. Client sends credentials to the server, server compares and responds.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;compare&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;c&lt;/td&gt;&lt;td&gt;If the client knows what's the value of the entry already, the value can be confirmed already. Works similar to auth access level.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;search&lt;/td&gt;&lt;td style="text-align: center; font-weight: bold;"&gt;s&lt;/td&gt;&lt;td&gt;ability to search the entry with filters&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;read&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;r&lt;/td&gt;&lt;td&gt;full read access&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;write&lt;/td&gt;&lt;td style="font-weight: bold; text-align: center;"&gt;w&lt;/td&gt;&lt;td&gt;full write access&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="color: rgb(255, 255, 51); font-weight: bold;"&gt;&lt;span class="a"&gt;Note: There are more options for OpenLDAP ACL syntax. For complete reference go to &lt;a href="http://www.openldap.org/doc/admin23" target="_blank"&gt;OpenLDAP Admin Guide&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;Based on that we want to come up with a solution which would:&lt;br /&gt;- not let anybody change other user password&lt;br /&gt;- not let anybody read other user password&lt;br /&gt;- still be able to read other users contact data&lt;br /&gt;Here is the answer:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;access to attrs=userPassword&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;      by self write&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;      by * auth&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;access to *&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;      by * read&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The sequence in which the ACLs are defined is of great importance. Basically, you always should specify the most specific entries first, followed by less specific ones, finishing with totally general definitions, like in the example above. That's the reason behind it: the first matching entry from the top gets applied.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;TCP Wrappers&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;slapd is a tcpd aware server. You can configure /etc/hosts.deny and /etc/hosts.allow accordingly to increase security. It's not a good idea though to trust TCP wrappers completely. iptables should be the preffered method of securing the network environment. Anyway, this configuration should cut off connections from the outside networks:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;# /etc/hosts.allow&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;slapd: 192.168.1.0/255.255.255.0 127.0.0.1 : ALLOW&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;# /etc/hosts.deny&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;slapd: ALL : DENY&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;SSF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Security Strength Factor is not the best documented feature. According to the OpenLDAP Admin Guide SSF indicates the relative strength of protection, whereby 0 = no protection at all, 1 = data integrity check, &lt;term&gt;56 = DES&lt;/term&gt; encryption, 112 = &lt;term&gt;3DES&lt;/term&gt; and everything over 128 denotes one of the strong, modern algorithms like AES, RC4 or Blowfish. Different SSF value depends on the key length.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;SSF will be used during ACL planning and SASL authentication.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;SASL&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;An alternative to simple binds is&lt;b&gt; Simple Authentication and Security Layer. &lt;/b&gt;It is a framework of different standarized security mechanisms providing strong authentication and data integrity checks. I will discuss implementation of SASL DIGEST-MD5 and GSSAPI configuration.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Before you start troubleshooting your SASL configuration, it's worth checking if your slapd supports SASL at all. This command is very helpful in determining this:&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 51);"&gt;&lt;br /&gt;$ ldapsearch -x -s "base"  -b "" supportedSASLMechanisms &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# extended LDIF&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# LDAPv3&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# base &lt;&gt; with scope baseObject&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# filter: (objectclass=*)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# requesting: supportedSASLMechanisms&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;dn:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: GSSAPI&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: NTLM&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: LOGIN&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: PLAIN&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: DIGEST-MD5&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;supportedSASLMechanisms: CRAM-MD5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# search result&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;search: 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;result: 0 Success&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# numResponses: 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 153);"&gt;# numEntries: 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;OK, my server supports 6 types of SASL authentication. If your does not, the only solution now is to shut it down, (re)compile cyrus-sasl package with appropriate options (-&gt; Kerberos!!!, otherwise no GSSAPI) and recompile the entire openldap again. If you don't do it you can see a message saying &lt;span style="font-size:100%;"&gt;&lt;span style="font-family: times new roman;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:-1;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold; font-family: times new roman;"&gt;ldap_sasl_interactive_bind_s: &lt;/span&gt;&lt;b style="font-family: times new roman;"&gt;No such attribute" &lt;/b&gt;&lt;span style="font-family: times new roman;"&gt;when running openldap tools on the client side. In this case the message means literally "your server does not have support for SASL".  &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;DIGEST-MD5&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The DIGEST-MD5 assumes that both the server and the client know the shared secret, that is a password. During the authentication process the following occurs:&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;1. Connection is initiated&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;2. Server sends a challenge to the client, it is based on a known password&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;3. Client responds to the server with a response to the challenge.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;4. Server refers to the response in order to decide if the client knows the password.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Configuration&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;As always, some minor corrections of slapd.conf are necessary. I had to enrich my slapd.conf with the following snippet:&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;-------&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(153, 255, 255);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;sasl-realm      PORTA.TUX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;sasl-host       porta.tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;authz-regexp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    uid=([^,]*),cn=porta.tux,cn=digest-md5,cn=auth&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    uid=$1,ou=people,dc=porta,dc=tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;-------&lt;/span&gt;&lt;br /&gt;The first two lines define the SASL realm and the hostname/IP address of the SASL host to refer. Following lines are a translation of "ldap dn username" to "sasl username" mapping.&lt;br /&gt;&lt;br /&gt;According to the LDAP-HOWTO, the uid is taken from SASL and mapped to it's LDAP DN counterpart.&lt;br /&gt;The first part of the configuration directove has the following format:&lt;br /&gt;&lt;span style="color: rgb(255, 204, 153);"&gt;uid=username,cn=realm,cn=mechanism,cn=auth&lt;/span&gt;&lt;br /&gt;where "mechanism" is the SASL mechanism applied - in my example - "digest-md5".&lt;br /&gt;&lt;br /&gt;In DIGEST-MD5 passwords can be stored either in SASL database (accessible via saslpasswd2/sasldblistusers2 commands) or directly in the LDAP directory, in the latter case however the password hash must be set to {CLEARTEXT}&lt;br /&gt;&lt;br /&gt;I chose to store my passwords in the directory itself. Now, let's see the outcome.&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;&lt;br /&gt;$ ldapwhoami -U spitfire -Y DIGEST-MD5&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;SASL/DIGEST-MD5 authentication started&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;Please enter your password:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;SASL username: spitfire&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;SASL SSF: 128&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;SASL installing layers&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;dn:uid=spitfire,ou=people,dc=porta,dc=tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 153);"&gt;Result: Success (0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;$&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;GSSAPI for Kerberos&lt;br /&gt;&lt;/span&gt;SASL GSSAPI mechanism used in conjunction with Kerbeos V allows you to use SSO (Single Sign On). That is, you enter your password once only, when you request a kerberos ticket, and you can work on being fully authenticated. Next time you need to enter your password would be either when the ticket expires or if you destroy it. Practically, it creates less potential opportunities for the attackers to take over your password (e.g. by keylogging), but the users must be educated to lock their screens / logout when they leave the workplace for even short time.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Configuration&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;1. Let's start with changing the authz-regexp directive in slapd to the following format:&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;authz-regexp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    uid=([^,]*),cn=porta.tux,cn=gssapi,cn=auth&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;    uid=$1,ou=people,dc=porta,dc=tux&lt;/span&gt;&lt;br /&gt;2. You need to create a kerberos principal ldap/your.realm. Use &lt;span style="color: rgb(255, 255, 153);"&gt;addprinc, ktadd, cpw&lt;/span&gt; within kadmin.local to create it and export the kerberos keytab. Create another principal for your user (spitfire).&lt;br /&gt;3. Make sure your slapd can read keytab while running. Otherwise you won't be able to authenticate.&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;# chown root:ldap /etc/krb5.keytab&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;# chmod 660 /etc/krb5.keytab&lt;br /&gt;# /etc/init.d/slapd restart&lt;br /&gt;&lt;/span&gt;4. Let's try to authenticate with GSSAPI.&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;# ldapsearch&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;SASL/GSSAPI authentication started&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;ldap_sasl_interactive_bind_s: Local error (-2)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;        additional info: SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (No credentials cache found)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;# kinit spitfire/porta.tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;Password for spitfire/porta.tux@PORTA.TUX:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;# ldapwhoami&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;SASL/GSSAPI authentication started&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;SASL username: spitfire/porta.tux@PORTA.TUX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;SASL SSF: 56&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;SASL installing layers&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;dn:uid=spitfire/porta.tux,ou=people,dc=porta,dc=tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 51);"&gt;Result: Success (0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;# klist&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;Ticket cache: FILE:/tmp/krb5cc_0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;Default principal: spitfire/porta.tux@PORTA.TUX&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;Valid starting     Expires            Service principal&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;12/23/07 03:53:38  12/24/07 03:53:38  krbtgt/PORTA.TUX@PORTA.TUX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;12/23/07 03:53:50  12/24/07 03:53:38  ldap/porta.tux@PORTA.TUX&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Works OK. Note: I didn't have to enter my password while performing ldapwhoami.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5966278557903170357?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5966278557903170357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5966278557903170357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5966278557903170357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5966278557903170357'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/12/0x06-lpi-301-tightening-security.html' title='0x06. [LPIC-301] LDAP - Tightening security'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-6084318250740066645</id><published>2007-11-25T18:23:00.000Z</published><updated>2008-05-24T23:31:55.462+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x05. [LPIC-301] LDAP - make use of LDAP: nss_ldap and pam_ldap</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;Note: if you configure this for the first time, make sure you pick a proper Linux distribution (clients). I have tested it on different Linuces  and especially distros being "too user friendly" and those "security-enhanced" ones might have a little confusing pre-defined configuration and things won't go as described below, at least not quite.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As our directory is a little more secure than it used to be, we can start serving some sensitive data like personal information, preferences or, more importantly, login credentials. Creating an LDAP users database from scratch can be a tedious process, especially if you already have a ready /etc/passwd file or a NIS/NIS+ infrastructure. This is where PADL MigrationTools come in handy. The software can be downloaded from the &lt;a href="http://www.padl.com/Contents/OpenSourceSoftware.html"&gt;PADL website&lt;/a&gt;. Once we have our databases migrated, we can start pulling information about our user from the OpenLDAP server and authenticate them with pam_ldap, both plug-ins are downloadable from PADL.com.&lt;br /&gt;&lt;br /&gt;I will kick off with a few words of introduction to every package.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;MigrationTools&lt;/span&gt; &lt;/span&gt;- a collection of perl and shell scripts which help you convert your existing NIS, NIS+, NetInfo or flat file databases like fstab, hosts, services etc into ldap-readable LDIF format. It is also possible to dump these databases directly to the ldap server either with ldapadd (with running slapd) or with slapadd (slapd is down, dump goes directly into the database file).&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;MigrationTools do not require too much customization. You should remember to change $DEFAULT_MAIL_DOMAIN, $DEFAULT_BASE and  $DEFAULT_MAIL_HOST in  &lt;span style="font-style: italic;"&gt;migrate_common.ph&lt;/span&gt; according to your dc base, otherwise your LDIF entries will contain "dc=padl,dc=com" suffix.&lt;br /&gt;&lt;br /&gt;Let's say, I want to migrate two entries from my /etc/passwd file:&lt;br /&gt;&lt;table bg=""  style="color:LIGHTBLUE;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;porta&lt;/span&gt; MigrationTools-47 # &lt;span style="color: rgb(51, 255, 51);"&gt;grep -E "princess|spitfire" /etc/passwd &gt; passwd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;porta&lt;/span&gt; MigrationTools-47 # &lt;span style="color: rgb(51, 204, 0);"&gt;cat passwd&lt;/span&gt;&lt;br /&gt;princessnatalka:x:1001:100:Princess Natalka,1,085313373,087654321,Sharp:/home/princessnatalka:/bin/bash&lt;br /&gt;spitfire:x:1002:100:Spit Fire,2,(1231)1029384756,6574839201,If I was in WWII they'd call me spitfire:/home/spitfire:/bin/bash&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;porta&lt;/span&gt; MigrationTools-47 # &lt;span style="color: rgb(51, 255, 51);"&gt;./migrate_passwd.pl ./passwd passwd.ldif&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;porta&lt;/span&gt; MigrationTools-47 # &lt;span style="color: rgb(51, 204, 0);"&gt;cat passwd.ldif&lt;/span&gt;&lt;br /&gt;dn: uid=princessnatalka,ou=People,dc=padl,dc=com&lt;br /&gt;uid: princessnatalka&lt;br /&gt;cn: Princess Natalka&lt;br /&gt;objectClass: account&lt;br /&gt;objectClass: posixAccount&lt;br /&gt;objectClass: top&lt;br /&gt;objectClass: shadowAccount&lt;br /&gt;userPassword: {crypt}$1$fMFhgCEB$v44E8xfZA2PSIGv5.QXmY.&lt;br /&gt;shadowLastChange: 13849&lt;br /&gt;shadowMax: 99999&lt;br /&gt;shadowWarning: 7&lt;br /&gt;loginShell: /bin/bash&lt;br /&gt;uidNumber: 1001&lt;br /&gt;gidNumber: 100&lt;br /&gt;homeDirectory: /home/princessnatalka&lt;br /&gt;gecos: Princess Natalka,1,085313373,087654321,Sharp&lt;br /&gt;[...]&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;nss_ldap&lt;/span&gt;&lt;/span&gt; - This is a plug-in for Name Service Switch on a Linux / Solaris system. If you think you need to catch up with NSS, I recommend the manual (5) page for nsswitch.conf file. Basically, we want the system calls, e.g. struct passwd *getpwent(), to grab the information about users from LDAP if the  users are not found in /etc/passwd file. nss_ldap binds to the LDAP server, looks up the appropriate entry, translates the content into getpwent-readable format of username:password:uid:gid:gecos:home:shell and points the function to it.&lt;br /&gt;This library very often comes pre-compiled with the distribution. In case it's not, you can download it from PADL website and compile it.&lt;br /&gt;In order to enable nss_ldap you need to edit /etc/nsswitch.conf. An example file follows:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&gt;8---&gt;8---&gt;8---&gt;8---&gt;8---&gt;8---&gt;8---&gt;8---&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# /etc/nsswitch.conf:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;passwd:             files &lt;span style="color: rgb(102, 255, 153); font-weight: bold;"&gt;ldap&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;shadow:            files &lt;span style="font-weight: bold; color: rgb(102, 255, 153);"&gt;ldap&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;group:               files &lt;span style="color: rgb(102, 255, 153); font-weight: bold;"&gt;ldap&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;hosts:       files dns&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;networks:    files dns&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;[...]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;8&lt;---8&lt;---8&lt;---8&lt;---8&lt;---8&lt;---8&lt;---8&lt;---&lt;/span&gt;&lt;br /&gt;I have placed my "ldap" entries behind "files". As a result, if there are two accounts with the same posix name in /etc/passwd and LDAP database, NSS will read the local entry and ignore the one from LDAP. In other words, local entries have higher priority and the LDAP entries will be read in every time when there is no matching local account.&lt;br /&gt;&lt;br /&gt;nss_ldap configuration file is ldap.conf. Refer to the manual page for details.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;NOTE: If after changing your nsswitch.conf you are having hard times booting up you may want to set the &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 153);"&gt;bind_policy &lt;/span&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;to &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 153);"&gt;soft &lt;/span&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;in ldap.conf. It will soften the policy of reconnecting to an unavailable LDAP server. The default &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 153);"&gt;hard_open &lt;/span&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;keeps reconnecting thus preventing the system to boot. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, let's see the outcome of our changes:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;$ finger spitfire&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Login: spitfire                         Name: Spit Fire&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Directory: /home/spitfire               Shell: /bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Office: 2, (1231)1029384756             Home Phone: 657-483-9201&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Last login Sun Dec  2 18:11 (GMT) on pts/1 from 192.168.1.4&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;No Mail.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;No Plan.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On many systems nss_ldap is enough to authenticate an LDAP user on the local system. If you want to have extended functionality for LDAP users, e.g. password changing, keep reading...&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;pam_ldap&lt;/span&gt; - finally authenticating users. Fortunately, configuring PAM is quite easy, especially, if you have  common-[auth|password|account] files  in your /etc/pam.d/ directory. These files will be included into all authentication services as their common part. Please find my sample common-* files from an OpenSUSE installation below:&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;common-auth:&lt;/span&gt;&lt;br /&gt;auth    required        pam_env.so&lt;br /&gt;auth    sufficient      pam_ldap.so try_first_pass&lt;br /&gt;auth    required        pam_unix2.so&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;common-account:&lt;/span&gt;&lt;br /&gt;account sufficient      pam_ldap.so&lt;br /&gt;account required        pam_unix2.so&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;common-password:&lt;/span&gt;&lt;br /&gt;password        requisite       pam_pwcheck.so  nullok cracklib&lt;br /&gt;password        sufficient      pam_ldap.so     try_first_pass&lt;br /&gt;password        required        pam_unix2.so    nullok use_authtok&lt;br /&gt;&lt;br /&gt;Given an example of my sshd pam-aware daemon, if the configuration file looks like as follows...&lt;br /&gt;&lt;span style="color: rgb(255, 255, 204);"&gt;/etc/pam.d/sshd:&lt;/span&gt;&lt;br /&gt;#%PAM-1.0&lt;br /&gt;&lt;span style="color: rgb(204, 204, 204);"&gt;&lt;/span&gt;auth     requisite        pam_nologin.so&lt;br /&gt;auth     include          common-auth&lt;br /&gt;account  include       common-account&lt;br /&gt;password include     common-password&lt;br /&gt;session  required      pam_loginuid.so&lt;br /&gt;session  include        common-session&lt;br /&gt;&lt;br /&gt;... my sshd service will be fully LDAP enabled. The same about other services which include common-* files.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 153);"&gt;NOTE: It's a good idea to add &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 153);"&gt;use_first_pass&lt;/span&gt;&lt;span style="color: rgb(255, 255, 153);"&gt; or &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 255, 153);"&gt;try_first_pass&lt;/span&gt;&lt;span style="color: rgb(255, 255, 153);"&gt; options to pam_ldap.so in the PAM configuration files, otherwise both modules will ask you for your password separately. In the worst case, if you try to change your password over LDAP with the passwd command, you will be prompted for your password as many as 4 times!!! &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In order to be able to change passwords we should apply specific ACLs. This will be discussed in the next post, for now a very ugly ACL. Append these two lines to your slapd.conf&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;#---&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;access to *&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;        by * write&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;#---&lt;/span&gt;&lt;br /&gt;Let's perform a test...&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;$ ssh spitfire@princess&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Password:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Have a lot of fun...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;spitfire@princess:~&gt; passwd&lt;br /&gt;Changing password for spitfire.&lt;br /&gt;Enter login(LDAP) password:&lt;br /&gt;New Password:&lt;br /&gt;Reenter New Password:&lt;br /&gt;LDAP password information changed for spitfire&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-6084318250740066645?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/6084318250740066645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=6084318250740066645' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6084318250740066645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6084318250740066645'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/11/0x05-lpi-301-make-use-of-ldap-nssldap.html' title='0x05. [LPIC-301] LDAP - make use of LDAP: nss_ldap and pam_ldap'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8925260451854182545</id><published>2007-11-16T22:04:00.000Z</published><updated>2008-05-24T23:31:55.462+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x04. [LPIC-301] LDAP - Secure your directory</title><content type='html'>We have a working directory service. Let's search it through running tcpdump on another terminal.&lt;table bgcolor="darkred" cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr style="color: rgb(255, 204, 0);" text="yellow"&gt;&lt;td style="font-weight: bold;" text="yellow"&gt;# tcpdump -i ath0 -Avvv tcp -s 1000&lt;br /&gt;[...]&lt;br /&gt;22:37:19.725215 IP (tos 0x0, ttl  64, id 34532, offset 0, flags [DF], proto: TCP (6), length: 451) porta.tux.ldap &gt; princess-pc.tux.4714: P, cksum 0xe48c (correct), 107:506(399) ack 78 win 181 &lt;nop,nop,timestamp 347922="" 947172=""&gt;&lt;br /&gt;E.....@.@..............jW..Z~..?...........&lt;br /&gt;..O...s.0......d....#cn=kitchen,ou=rooms,dc=porta,dc=tux0..[0...cn1     ..kitchen0...objectClass1...top..room0..*..description1.......&lt;br /&gt;A kitchen, is a room or part of a room (sometimes called "kitchen area" or a "kitchenette") used or food preparation including cooking, and sometimes also for eating and entertaining guests, if the kitchen is large enough and designed to be used that way.&lt;br /&gt;(SOURCE: WIKIPEDIA)&lt;br /&gt;[...]&lt;/nop,nop,timestamp&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;The information is not secured in any way. An unsecured directory is not suitable for serving sensitive data. I'm going to enable basic security by configuring TLS.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;Enabling TLS&lt;/span&gt;&lt;br /&gt;In order to enable TLS you need to have a working OpenSSL installation. We use a perl script called CA.pl (depending on the distribution/installation the script lives in /etc/ssl/misc or /usr/lib/ssl/ or possible other locations).&lt;br /&gt;&lt;br /&gt;1. Generate a new certificate:&lt;br /&gt;&lt;table bgcolor="darkblue"  cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="color: rgb(51, 255, 255);"&gt; # cd /etc/ssl/misc&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt; # ./CA.pl -newcert&lt;/span&gt;&lt;br /&gt;Generating a 1024 bit RSA private key&lt;br /&gt;..............++++++&lt;br /&gt;.......++++++&lt;br /&gt;writing new private key to 'newkey.pem'&lt;br /&gt;Enter PEM pass phrase:&lt;br /&gt;Verifying - Enter PEM pass phrase:&lt;br /&gt;-----&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter '.', the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [AU]:IE&lt;br /&gt;State or Province Name (full name) [Some-State]:Dublin&lt;br /&gt;Locality Name (eg, city) []:Dublin&lt;br /&gt;Organization Name (eg, company) [Internet Widgits Pty Ltd]:OOZIE&lt;br /&gt;Organizational Unit Name (eg, section) []:&lt;br /&gt;Common Name (eg, YOUR name) []:porta.tux&lt;br /&gt;Email Address []:r00t@oozie.tux&lt;br /&gt;Certificate is in newcert.pem, private key is in newkey.pem&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt; #&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;2. Remove password from the newkey.pem file.&lt;br /&gt;CA.pl created a password protected certificate. In other words, the certificate is encrypted with the password. If you don't remove the password from the cert you will need to enter it every time slapd starts up. We don't want that...&lt;br /&gt;&lt;table bgcolor="darkblue"  cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="color: rgb(153, 255, 255);"&gt; # cat newkey.pem&lt;/span&gt;&lt;br /&gt;-----BEGIN RSA PRIVATE KEY-----&lt;br /&gt;Proc-Type: 4,ENCRYPTED&lt;br /&gt;DEK-Info: DES-EDE3-CBC,96736B31B990FBA6&lt;br /&gt;&lt;br /&gt;+sLcj1Uu98B/+2MAn51FhnOURbhE1fJDu/X1XHBn8Sg4zX4g7GcUmHFfCsrdR1Jq&lt;br /&gt;in/8l3T+cPrr448BWhvgf7tDksYlOZYLFnsleiFIrroAJ0vnSsiPxymJOa4zxqU7&lt;br /&gt;sd6eh/pRjjlX1EY7G0i+Xt91cq/nnVzqIeap+Co6rLiSDHPDqXbTyrm+md5HUpe1&lt;br /&gt;YDfgstSYdbTkDjxs3yx6oP54HYtDixiPm8JSjFjdo630vDg4m8xK3Ona1gsY+ZLh&lt;br /&gt;dAlBeRQpONNF4d7cx7Qa3i3J+qI/URMakyrNNFVJJNQeDst/sxYe8M+axykgm4H1&lt;br /&gt;J1Gy6vjKegp6eI2s+WbMwXp+E35NFQIxpuriJDK2QEU1ROyqlzZi1I5XmSye76kF&lt;br /&gt;LszVxJbkHGqACD7Edvlo+ZIPY3w4lh/yhpK5iiXWmiuSYLG1UZkc9Tl3nA6PqiB2&lt;br /&gt;z1xhfOxbiAKS4S/YIspaTFKbZovTwnl1DXXDA4/3ghM/m0j3sIoeMLwuqDhSSmY5&lt;br /&gt;2UvCv3lsCw2Fz6wOO6lghVEi6ZqzhrCVi2WneXFNavLeWIv0qUSZDGHQvS1/kjC0&lt;br /&gt;Mhw/9ybjgvYbZMd62uNiffIvIy2GHTx5jhIXZnUiYDZCjtOxzDAmMjcxxaVRN/Kf&lt;br /&gt;jVTM9NP6ZG/CaUl2hYjuOkNDmBUZ8H3RafnwoHuFmWMmihKG5O+mFwukql7llqcT&lt;br /&gt;kIthB5nbIsRxP6bgXbF0NvHkO9M+tSnamzaPuiwYs4bvfhYbX3GWSXyQ5323sjP7&lt;br /&gt;Ke+2/N0Ol+dLPONgdHmePf+FfM9anT0VgAxdf4pVs8TCbmxVNF/wrA==&lt;br /&gt;-----END RSA PRIVATE KEY-----&lt;br /&gt;#  &lt;span style="color: rgb(153, 255, 255);"&gt;openssl rsa -in newkey.pem -out newerkey.pem&lt;/span&gt;&lt;br /&gt;Enter pass phrase for newkey.pem:&lt;br /&gt;writing RSA key&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt; # cat newerkey.pem&lt;/span&gt;&lt;br /&gt;-----BEGIN RSA PRIVATE KEY-----&lt;br /&gt;MIICXQIBAAKBgQDBPNnk3UN4y1Gs+qgeRkPtb/GtdjG6CShW7L1Ch9DPjmm/d1ps&lt;br /&gt;MiSAk9+tqGc5u7cccERN3UWiBaBNk6aBqdrFqr3MWaV4Fm3ilnlxDAGEJJ/tdjnx&lt;br /&gt;Uxl37f/UffyOrBUUW1h6DkoEgIyWtGmCHeO0GhJEkCmvqqQ4TfcJHBSHaQIDAQAB&lt;br /&gt;AoGACev68CJgRYKDBhO0sCFBeZ6G1TY9ZWT0+kmbih/5G78fNOKG9Qk6EJQHJx5/&lt;br /&gt;dlpqE368MxdKbQBG89TB9uRmxCppWH7GoPuCzm7WV+/GtDAxisZMvSvW89ptHMOb&lt;br /&gt;Ev7FPwFvlr6ENrN+Woiz51GHGZhUBH7R7XuVRJ3uPM99v5ECQQD/nxCI9zwDoGhC&lt;br /&gt;exDSYTrvDIxC/WpLNxeGXrIdj9CHoku4M16hycKduZb5AOOwCUi8gG0uufFSIqW4&lt;br /&gt;pYqzKCaVAkEAwYYhN4cSwLs5O6p619FvQXbaZzv1huyEqjMcsTsrtJiv77Wj5f/m&lt;br /&gt;AciTA2upDA/kcqwtb7TzaKdKrNZYKeOMhQJBAPu+jMtHKbysmmF2z/9RMHhC1FQZ&lt;br /&gt;PTisHigAVMxWWVlq1cWoGbeee2NYZr3+ST6SNicnF+Af0fFBHBK4PdvpW+0CQQCI&lt;br /&gt;4OgJsF4RN9tpWlF86MN6WChuMDifcBb9kx1ONf3ZxM1cDOuaOH9k74scNj/hKjR4&lt;br /&gt;71NL2X74nKryyMCfEDVJAkBnNWLEgKWYkrxsTsVTekcGadNaKvY1gud//gQJ1RCM&lt;br /&gt;UfAX7wccENvVTU3DquarfXF639QjQ0k8CEj1W+dwa94K&lt;br /&gt;-----END RSA PRIVATE KEY-----&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;3. Move these files to one location and secure the permissions. It is important to change the ownership of the private key file to the user which OpenLDAP is running as, otherwise slapd won't start.&lt;br /&gt;&lt;table bgcolor="darkblue"  cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="color: rgb(153, 255, 255);"&gt; # mv newerkey.pem /etc/openldap/ldap-key.pem&lt;br /&gt;# mv newcert.pem /etc/openldap/ldap-cert.pem&lt;br /&gt;# chown ldap:ldap /etc/openldap/ldap-key.pem&lt;br /&gt;# chmod 600 /etc/openldap/ldap-key.pem&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;4. Get down to slapd configuration.&lt;br /&gt;&lt;div style="text-align: justify;"&gt;There are three necessary options we should specify in slapd.conf file.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TLSCipherSuite&lt;/span&gt; - defines what cryptographic algorithms the server is going to use. Possible values (if multiple are used, they are separated by a colon): HIGH, MEDIUM, +SSLv2, ...&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TLSCertificateFile and TLSCertificateKeyFile&lt;/span&gt; - these are pretty much self explanatory.&lt;br /&gt;You should append the following three lines to slapd.conf and restart the daemon:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;table bgcolor="gray"  cellspacing="1" width="100%" &gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;[...]&lt;span style="color: rgb(153, 255, 255);"&gt;&lt;br /&gt;TLSCipherSuite  HIGH&lt;br /&gt;TLSCertificateFile      /etc/openldap/ldap-cert.pem&lt;br /&gt;TLSCertificateKeyFile   /etc/openldap/ldap-key.pem&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We should now enable slapd to listen on ldaps port (636). It can be done by passing &lt;span style="font-weight: bold;"&gt;'-h ldaps:///'  &lt;/span&gt;to slapd while starting it, e.g. on GENTOO edit /etc/conf.d/slapd and type &lt;span style="font-weight: bold;"&gt;OPTS="-h ldaps:///"&lt;/span&gt;. This will do the trick and the next time you restart slapd it will listen on ldaps only. If you extend the argument to &lt;span style="font-weight: bold;"&gt;"-h 'ldaps:/// ldap://'"&lt;/span&gt; it will listen on both ports 389 and 636.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;5. Correct some lines in the ldap.conf on the client side.&lt;br /&gt;&lt;br /&gt;An example follows.&lt;br /&gt;&lt;table bgcolor="gray"  cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;##&lt;br /&gt;# ldap.conf&lt;br /&gt;## &lt;span style="color: rgb(153, 255, 255);"&gt;&lt;br /&gt;SSL START_TLS&lt;br /&gt;BASE dc=porta,dc=tux&lt;br /&gt;HOST porta.tux&lt;br /&gt;&lt;/span&gt;# If URI value is different than the CN on the certificate it may result&lt;br /&gt;# in error  (TLS: hostname does not match CN in peer certificate) in some configurations,&lt;br /&gt;#  when TLS_REQCERT is set to hard or is not specified at all.&lt;br /&gt;&lt;span style="color: rgb(153, 255, 255);"&gt;URI ldaps://porta.tux/&lt;br /&gt;&lt;br /&gt;TLS_CIPHER_SUITE HIGH&lt;br /&gt;TLS_REQCERT allow&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;6. Check now if things work and if the connection is encrypted:&lt;br /&gt;&lt;table bgcolor="darkred" cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr style="color: rgb(255, 204, 0);" text="yellow"&gt;&lt;td style="font-weight: bold;" text="yellow"&gt;# tcpdump -i ath0 -Avvv tcp -s 1000&lt;br /&gt;[...]&lt;br /&gt;22:20:22.252954 IP (tos 0x0, ttl  64, id 11062, offset 0, flags [DF], proto: TCP (6), length: 1500) porta.tux.ldaps &gt; princess-pc.tux.6376: . 2937:4385(1448) ack 517 win 108 &lt;nop,nop,timestamp&gt;&lt;br /&gt;E...+6@.@............|....I.9#.....l$......&lt;br /&gt;.x)........Bn.e..EaP9}.... ".}W,=evN.i!{...`=,.W.W/[..MIy/._.Lp.;~.G...L.y...v.Eh.E....5m.T,:.. pR..Wqj.y..._..v...j]..H...t..&gt;....IaV..-........P....=C...v......s*.....MS.&lt;br /&gt;...&lt;br /&gt;.NE.........]6.m.......b.\.c.   ..Y...z5..Aco... J0.+.....[=4VHc......k....q..... a)IB....l..t.&amp;amp;.d...d.91..qgE..6.......l.f2....nq...   ..!...D....A,.%4.XL..&amp;amp;..I..}..ETH..q..dx.Q..R.d....H)h.WFR.[..\...]J.k&gt;..\v.jpHF...W..T...M..U*t...C.D......!.+,...7.....m.. .....p......y..?cj...;....J.....oZ]...&amp;amp;.r.!~.^....0/.....J#...^.N.1`....y.*..4Je"...............[...5.9B..;..g/g......Q4.ZH.=.....f.y.(...\Gl.=......=...AW..A.._..s.E.w}s.0...8}...&lt;br /&gt;.._#(...vx.`ah...Q..CQC.X&gt;..........F..o{U....O.i.B.....06"..r.e..&lt;br /&gt;k^...V6..&lt;&amp;amp;X.[...n........Q...mJ. f.w3..        _nt...C.Z.kv....Y.....J..{}...;+.E      ..pI..c.#.;f6.dI..iP...&gt;.u..^.i..f.e.|....s.-.2.X..;.d#..&lt;br /&gt;[...]&lt;/nop,nop,timestamp&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;That looks much better.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;(Un)Setting rootdn and rootpw&lt;/span&gt;&lt;br /&gt;rootdn comes by default in slapd.conf with a clear-text password. Keeping it this way is not the best idea, because:&lt;br /&gt;- clear text passwords never are&lt;br /&gt;- no ACLs apply to rootdn (in our case "cn=Manager,dc=porta,dc=tux") so it's a common practice to remove rootdn from slapd.conf and use regular accounts for introducing changes to the directory.&lt;br /&gt;If you want to keep rootdn then changing the password should be done ASAP. This task can be accomplished with &lt;span style="font-weight: bold;"&gt;slappasswd&lt;/span&gt; program.&lt;br /&gt;&lt;table bgcolor="darkblue"  cellspacing="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="color: rgb(153, 255, 255);"&gt; porta # slappasswd -s 's3(r3t' -h {SSHA}&lt;br /&gt;{SSHA}HB7uA/XbtlVuDQ/ZF0jdJyWEe6E1jLc7&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; now ctrl+c, ctrl+v into slapd.conf&lt;br /&gt;If you use slappasswd with -s option, make sure it does not stay in your .bash_history ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8925260451854182545?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8925260451854182545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8925260451854182545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8925260451854182545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8925260451854182545'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/11/0x04-lpi-301-secure-your-directory.html' title='0x04. [LPIC-301] LDAP - Secure your directory'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-7871774863256475074</id><published>2007-11-10T23:43:00.000Z</published><updated>2008-05-24T23:31:55.463+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x03. [LPIC-301] LDAP - Entering data into OpenLDAP</title><content type='html'>&lt;div style="text-align: justify;"&gt;It's time to enrich the directory in data. We enter the data to the LDAP server with help of LDIF files. LDIF stands for &lt;span style="color: rgb(0, 204, 204);"&gt;LDAP Data Interchange Format&lt;/span&gt;. LDIF is described in detail in the following RFC documents: RFC2849, RFC4510, RFC4525.&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;br /&gt;The very first entry in the LDAP directory will be the top element of the Directory Information Tree, in my case &lt;span style="color: rgb(0, 204, 204);"&gt;dc=oozie,dc=tux&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;table bgcolor="gray" border="0" cellpadding="1" cellspacing="0" width="80%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;##&lt;br /&gt;# top.ldif&lt;br /&gt;##&lt;br /&gt;dn: dc=porta,dc=tux&lt;br /&gt;dc: porta&lt;br /&gt;objectClass: domain&lt;br /&gt;objectClass: top&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;First line specifies the distinguished name for the LDAP suffix. Second line specifies the necessary attribute specified in 'domain' objectClass, line 3. Line 4. is mandatory according to RFC2256:&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-style: italic;"&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;5.1. objectClass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;The values of the objectClass attribute describe the kind of object&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;which an entry represents.  The objectClass attribute is present in&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;every entry, with at least two values.  One of the values is either&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;"top" or "alias"&lt;/span&gt;&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;We can feed our OpenLDAP server with the LDIF above. For this purpose I use &lt;span style="color: rgb(255, 204, 0);"&gt;slapadd&lt;/span&gt; command. You should remember, that slapd should not be running at this time, otherwise you can get an error message complaining about the database being in use. Prior to using &lt;span style="color: rgb(255, 204, 0);"&gt;slapadd&lt;/span&gt; perform &lt;span style="color: rgb(255, 204, 0);"&gt;/etc/init.d/slapd stop&lt;/span&gt;, and then...&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux # slapadd -l top.ldif&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux #&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;... should do the trick if there are no error messages.&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@porta.tux # /etc/init.d/slapd start&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux # ldapsearch&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt; # extended LDIF&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# LDAPv3&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# base &lt;&gt; with scope subtree&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# filter: (objectclass=*)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# requesting: ALL&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# &lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;dn: dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;dc: &lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;objectClass: domain&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;objectClass: top&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# search result&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;search: 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;result: 0 Success&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# numResponses: 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;# numEntries: 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux #&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Works fine.&lt;br /&gt;We are now about to create a sample directory. As our OpenLDAP server is completely unsecure at this stage (clear text password and no encryption), data contained in the directory should be absolutely insensitive and non-confidential. Using cosine.schema, which contains the 'room' objectClass it's possible to create a directory of typical rooms one can come across in  everyday life along with their descriptions. The full LDIF file with the directory can be found here &lt;a href="http://oozie.fm.interia.pl/src/rooms.ldif" target="_BLANK"&gt;[rooms.ldif]&lt;/a&gt;. A short snippet below:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;table bgcolor="gray" border="0" cellpadding="1" cellspacing="0" width="80%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;####&lt;br /&gt;# rooms.ldif by OOZIE &lt;oozie@poczta.fm&gt;&lt;br /&gt;#&lt;br /&gt;# As per section 3.8 in RFC4524, I use room objectClass to create a&lt;br /&gt;# directory of typical room types.&lt;br /&gt;#&lt;br /&gt;#  3.8 [...]&lt;br /&gt;#&lt;br /&gt;#   The 'room' object class is used to define entries representing rooms.&lt;br /&gt;#   The 'cn' (commonName) attribute SHOULD be used for naming&lt;br /&gt;#   entries of this object class.&lt;br /&gt;#&lt;br /&gt;#      ( 0.9.2342.19200300.100.4.7 NAME 'room'&lt;br /&gt;#        SUP top STRUCTURAL&lt;br /&gt;#        MUST cn&lt;br /&gt;#        MAY ( roomNumber $ description $ seeAlso $ telephoneNumber ) )&lt;br /&gt;#&lt;br /&gt;#   The 'top' object class is described in [RFC4512].  The 'cn',&lt;br /&gt;#   'description', 'seeAlso', and 'telephoneNumber' attribute types are&lt;br /&gt;#   described in [RFC4519].  The 'roomNumber' attribute type is described&lt;br /&gt;#   in Section 2 of this document.&lt;br /&gt;#&lt;br /&gt;#  [...]&lt;br /&gt;#&lt;br /&gt;####&lt;br /&gt;&lt;br /&gt;dn: ou=rooms,dc=&lt;/oozie@poczta.fm&gt;porta&lt;oozie@poczta.fm&gt;,dc=tux&lt;br /&gt;ou: rooms&lt;br /&gt;objectClass: organizationalUnit&lt;br /&gt;objectClass: top&lt;br /&gt;&lt;br /&gt;dn: cn=kitchen,ou=rooms,dc=&lt;/oozie@poczta.fm&gt;porta&lt;oozie@poczta.fm&gt;,dc=tux&lt;br /&gt;cn: kitchen&lt;br /&gt;objectClass: top&lt;br /&gt;objectClass: room&lt;br /&gt;description: A kitchen, is a room or part of a room (sometimes called "kitchen area" or a "kitchenette") used for food preparation including cooking, and sometimes also for eating and entertaining guests, if the kitchen is large enough and designed to be used that way. (SOURCE: WIKIPEDIA)&lt;br /&gt;&lt;br /&gt;dn: cn=living room,ou=rooms,dc=&lt;/oozie@poczta.fm&gt;porta&lt;oozie@poczta.fm&gt;,dc=tux&lt;br /&gt;cn: living room&lt;br /&gt;objectClass: top&lt;br /&gt;objectClass: room&lt;br /&gt;description: A living room, also known as sitting room (especially in the UK), lounge room or lounge (in the United Kingdom and Australia), is a room for entertaining guests, reading, watching TV or other activities. The word Lounge is from the Latin, it was brought over later on by the French.&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;/oozie@poczta.fm&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Previously we used &lt;span style="color: rgb(255, 204, 0);"&gt;slapadd &lt;/span&gt;on the local server with slapd turned off.  Now we are going to add the entries from the LDIF file above on the client side while slapd is running on the server.&lt;br /&gt;&lt;/div&gt;1. Copy /etc/openldap/ldap.conf or /etc/ldap.conf to the same location on the client.&lt;br /&gt;2. Perform an anonymous search on the client with &lt;span style="color: rgb(255, 204, 0);"&gt;ldapsearch -x&lt;br /&gt;&lt;/span&gt;3. If it works fine, use the following command with the parameters according to your slapd.conf in order to add room entries:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux # ldapadd -x -f rooms.ldif -D "cn=Manager,dc=porta,dc=tux" -w secret&lt;br /&gt;adding new entry "cn=kitchen,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;adding new entry "cn=living room,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;adding new entry "cn=bathroom,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;adding new entry "cn=drawing room,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;adding new entry "cn=bedroom,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;adding new entry "cn=storage room,ou=rooms,dc=&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;,dc=tux"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;root@&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;porta&lt;/span&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;.tux #&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;... where &lt;span style="font-weight: bold;"&gt;-D&lt;/span&gt; specifies the rootdn from slapd.conf, what follows after &lt;span style="font-weight: bold;"&gt;-w&lt;/span&gt; is your password, &lt;span style="font-weight: bold;"&gt;-x&lt;/span&gt; tells to open a simple bind (no SASL), and &lt;span style="font-weight: bold;"&gt;-f&lt;/span&gt; tells ldapadd what LDIF file to get the data from.&lt;br /&gt;&lt;br /&gt;At this point I have a working directory service and we can start searching through it.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-7871774863256475074?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/7871774863256475074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=7871774863256475074' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7871774863256475074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/7871774863256475074'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/11/0x03-lpi-301-entering-data-into.html' title='0x03. [LPIC-301] LDAP - Entering data into OpenLDAP'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3783427632371057212</id><published>2007-10-29T22:10:00.000Z</published><updated>2008-05-24T23:31:55.464+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x02. [LPIC-301] LDAP - /etc/init.d/slapd start</title><content type='html'>In order to start our new server we need to look into the servers configuration file, /etc/openldap/slapd.conf, and configure the base. You should think of:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;base suffix for your directory, e.g. dc=oozie,dc=tux&lt;/li&gt;&lt;li&gt;which database backend you would like to use, e.g. bdb&lt;br /&gt;&lt;/li&gt;&lt;li&gt;a name for the person ruling the directory, so called rootdn, eg. Manager&lt;br /&gt;&lt;/li&gt;&lt;li&gt;a good password for rootdn&lt;/li&gt;&lt;/ul&gt;This is a very basic slapd.conf file:&lt;br /&gt;&lt;table bgcolor="gray" border="0" cellpadding="1" cellspacing="0" width="80%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;##&lt;br /&gt;#  My slapd.conf&lt;br /&gt;##&lt;br /&gt;include         /etc/openldap/schema/core.schema&lt;br /&gt;include         /etc/openldap/schema/cosine.schema&lt;br /&gt;include         /etc/openldap/schema/inetorgperson.schema&lt;br /&gt;#&lt;br /&gt;pidfile         /var/run/openldap/slapd.pid&lt;br /&gt;argsfile        /var/run/openldap/slapd.args&lt;br /&gt;#&lt;br /&gt;database        bdb&lt;br /&gt;suffix          "dc=oozie,dc=tux"&lt;br /&gt;rootdn          "cn=Manager,dc=oozie,dc=tux"&lt;br /&gt;rootpw          secret&lt;br /&gt;directory       /var/lib/openldap-data&lt;br /&gt;#&lt;br /&gt;password-hash   {CLEARTEXT}&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Configure also your /etc/openldap/ldap.conf or /etc/ldap.conf accordingly. This is how I do it:&lt;br /&gt;&lt;table bgcolor="gray" border="0" cellpadding="1" cellspacing="0" width="80%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;##&lt;br /&gt;#  My ldap.conf&lt;br /&gt;##&lt;br /&gt;&lt;br /&gt;BASE    dc=oozie,dc=tux&lt;br /&gt;HOST   192.168.1.2&lt;br /&gt;URI     ldap://192.168.1.2/&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Right now, a command &lt;span style="font-weight: bold; color: rgb(255, 204, 0);"&gt;/etc/init.d/slapd start&lt;/span&gt; should generate some files in &lt;span style="font-weight: bold;"&gt;/var/lib/openldap-data&lt;/span&gt; directory and start OpenLDAP server. The slapd is running, but it's completely empty. If you try to search it through with &lt;span style="font-weight: bold;"&gt;&lt;span style="color: rgb(255, 204, 0);"&gt;ldapsearch&lt;/span&gt;, &lt;/span&gt;it should give you error (32) - No such object.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3783427632371057212?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3783427632371057212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3783427632371057212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3783427632371057212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3783427632371057212'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/10/0x02-lpi-301-etcinitdslapd-start.html' title='0x02. [LPIC-301] LDAP - /etc/init.d/slapd start'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-1313470262329573935</id><published>2007-10-22T00:26:00.000+01:00</published><updated>2008-05-24T23:31:55.464+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x01. [LPIC-301] LDAP - Obtaining and building OpenLDAP</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:180%;"&gt;0. Obtaining&lt;br /&gt;&lt;/span&gt;According to OpenLDAP Admin Guide Version 2.3, you can obtain the software from the following locations:&lt;br /&gt;HTTP: &lt;a href="http://www.openldap.org/software/download/"&gt;http://www.openldap.org/software/download/&lt;/a&gt;&lt;br /&gt;FTP: &lt;a href="ftp://ftp.openldap.org/pub/OpenLDAP"&gt;ftp://ftp.openldap.org/pub/OpenLDAP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can get the software in two main series: release and stable. &lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/b&gt; &lt;a style="font-style: italic;" href="http://www.openldap.org/faq/data/cache/225.html"&gt;What is the difference between "release" and "stable" versions?&lt;/a&gt;  section on the projects website states:&lt;br /&gt;&lt;span style="color: rgb(255, 204, 0); font-style: italic;font-size:100%;" &gt;&lt;br /&gt;The term "release", as used on the download web page [...] refers to the lastest version of the OpenLDAP Software available for "general use".  &lt;/span&gt;&lt;span style="color: rgb(255, 204, 0); font-style: italic;font-size:100%;" &gt;The term "stable" refers to the last "general use" release that has demonstrated itself as being reliable in real world environments.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Before extracting the package, we should consider what are the requirements for the openLDAP. There is a number of packages that should be installed prior to building openLDAP. If you want to have an LDAPv3 compilant server then you should not forget about the following packages:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Transport Layer Security - &lt;a href="http://www.openssl.org/"&gt;http://www.openssl.org/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Kerberos - Either Heimdal or MIT Kerberos will do the trick.&lt;br /&gt;Heimdal - &lt;a href="http://www.pdc.kth.se/heimdal/"&gt;http://www.pdc.kth.se/heimdal&lt;br /&gt;&lt;/a&gt;MIT - &lt;a href="http://web.mit.edu/kerberos/"&gt;http://web.mit.edu/kerberos/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Cyrus SASL - &lt;a href="http://asg.web.cmu.edu/sasl/sasl-library.html"&gt;http://asg.web.cmu.edu/sasl/sasl-library.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Database Software. Sleepycat -&lt;br /&gt;&lt;a href="http://www.sleepycat.com/download/"&gt;http://www.sleepycat.com/download/&lt;/a&gt;&lt;a href="http://www.sleepycat.com/products/transactional.shtml"&gt;&lt;br /&gt;http://www.sleepycat.com/products/transactional.shtml&lt;/a&gt;&lt;/li&gt;&lt;li&gt;TCP Wrappers&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I presume from now on, that you have already downloaded the tarball, checked the md5sum and extracted the software.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;1. Configuring&lt;br /&gt;&lt;/span&gt;It's always a good idea to start by reading the INSTALL file. I leave you to it. Here we will focus on the &lt;span style="color: rgb(255, 204, 0);"&gt;configure&lt;/span&gt; script, more precisely on it's optional-packages and SLAPD switches.&lt;br /&gt;The script gives us a number of options for customization. It accepts the options in two ways:&lt;br /&gt;- parameters like --with-tls, --enable-slurpd&lt;br /&gt;- CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS, PATH can be accepted as environmental variables. We won't use this way here.&lt;br /&gt;&lt;br /&gt;You use 'configure' to enable or disable features in your OpenLDAP build. The general rule for enabling a particular feature is to add &lt;span style="font-weight: bold;"&gt;--enable-FEATURE&lt;/span&gt; to the command prompt before hitting enter. There is a similar rule for disabling functionality. Type &lt;span style="font-weight: bold;"&gt;--disable-FEATURE&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;--enable-FEATURE=no&lt;/span&gt; in order to disable FEATURE.&lt;br /&gt;&lt;br /&gt;The following features are enabled by default: debug, proctitle, slapd, cleartext, bdb, hdb, monitor, relay, syncprov.&lt;br /&gt;&lt;br /&gt;If the system detects support for the following features, they are activated automatically: syslog, ipv6, local, rewrite, ldbm-api, ldbm-type, slurpd, cyrus-sasl, fetch, threads, tls, yielding-select, mp, odbc&lt;br /&gt;&lt;br /&gt;For a little more detailed information try ./configure --help&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;2. Building&lt;br /&gt;&lt;/span&gt;The whole build process takes four steps.&lt;br /&gt;I. Configuration by running &lt;span style="color: rgb(255, 204, 0);"&gt;./configure&lt;/span&gt; script, talked&lt;br /&gt;II. Building dependencies by doing &lt;span style="color: rgb(255, 204, 0);"&gt;make depend&lt;/span&gt;&lt;br /&gt;III. Building the executables by running &lt;span style="color: rgb(255, 204, 0);"&gt;make&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;IIIa. Optionally, you can run a test - &lt;span style="color: rgb(255, 204, 0);"&gt;make test&lt;/span&gt;&lt;/span&gt;. If you fail, review your configuration.&lt;br /&gt;IV. Installing the software with &lt;span style="color: rgb(255, 204, 0);"&gt;make install&lt;/span&gt; with root privileges.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;That's it.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-1313470262329573935?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/1313470262329573935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=1313470262329573935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1313470262329573935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/1313470262329573935'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/10/0x01-lpi-301-obtaining-and-building.html' title='0x01. [LPIC-301] LDAP - Obtaining and building OpenLDAP'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-3085457053904784134</id><published>2007-10-06T23:45:00.004+01:00</published><updated>2008-05-24T23:31:55.465+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LDAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>0x00. [LPIC-301] Terms and definitions</title><content type='html'>&lt;div style="text-align: justify;"&gt;Before we start, it is a good idea to explain, at least briefly, some of the terms and definitions we need to know while preparing for LPI 301 examination. What you will find below is an extract from LPI 301 Detailed Objectives from the LPI website. I will put some more extensive explanations for the terms below as we go along with the material and also I will most likely modify this post a couple of times in order to extend the information included (or a total lack of information).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;LDAP and X.500 concepts&lt;/span&gt;&lt;br /&gt;The LPI 301 exam will require from us comprehensive knowledge about LDAP. Let's start with one frequently asked question: &lt;span style="font-weight: bold;"&gt;What is a "directory" and what's the difference between a directory and a database?&lt;/span&gt; In fact a directory is a specialized type of a database. Its main characteristic is that a directory is much more often read from or searched through rather than updated (written to). This allows a directory to specialize and optimize the search process. On the other hand a database can mostly hold an arbitrary data format, whereas a directory consists of objects, which are specialized data units. Classic examples of a directory are a phone book, an internal list of employees with all their personal data, or a book index in a library. Now, make sure you are also familiar with the following terms salad:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;Directory service&lt;/span&gt; is a software solution which stores and organizes information about network users and resources and helps administrators manage them, e.g. by controlling these users' access to the resources.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;Meta-Directory &lt;/span&gt;is a concept of a centralized directory containing all sorts of information, starting with personal data, authentication credentials, hardware listings, printer addresses, etc. By employing Metadirectories enterprises possibly save money and improve access control to resources. &lt;a href="http://www.opengroup.org/comm/the_message/magazine/mmv5n2/meta.htm"&gt;This article&lt;/a&gt; is a good reading if you are looking for more info.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153); font-weight: bold;"&gt;X.500&lt;/span&gt; standard &lt;/span&gt;is a set of protocols supporting directory services. It was invented in 1984 by International Telecommunication Union (CCITT). It consists of the following protocols:  Directory Access Protocol, Directory System Protocol, Directory Information Shadowing Protocol, Directory Operational Bindings Managment Protocol. It was developed with 7-layer OSI model in mind, although it's possible nowadays to run it on TCP/IP as well.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;LDAP&lt;/span&gt; stands for Lightweight Directory Access Protocol, because it's the 'lightweight' alternative to X.500 directory services. LDAP is based on the TCP/IP protocol.  According to Wikipedia Tim Howes,  Steve Kille and Wengyik Yeong started to work on LDAP in 1993.   LDAP and X.500 are constructed on Directory Information Tree skeleton.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;Directory Information Tree&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;- is the fundamental data skeleton for both the X.500 and LDAP implementations. Like many other data structures in computing world this one is also represented as a tree. An example of such can be found &lt;a style="font-weight: bold;" href="http://ict.udlap.mx/people/carlos/is346/images/directory-tree-hierachial.png" target="_blank"&gt;here&lt;/a&gt;. LDAP information model in a tree is built of entries.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153); font-weight: bold;"&gt;LDAP Entry - &lt;/span&gt;&lt;/span&gt;a directory entry that is a collection of attributes and has a unique &lt;term&gt;Distinguished Name&lt;/term&gt; (DN)&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153); font-weight: bold;"&gt;Distinguished Name&lt;/span&gt; - &lt;/span&gt;a directory entry name in it's absolute form. DN consist of RDN (Relative Distinguished Names) and the parents entry distinguished name, e.g.&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;uid=foobar&lt;/span&gt;,&lt;span style="color: rgb(51, 204, 255);"&gt;ou=People,dc=company,dc=org&lt;/span&gt;,&lt;br /&gt;where&lt;br /&gt;green  = RDN (it is distinguished within the organizational unit 'People')&lt;br /&gt;green + cyan = DN (it is uniquely distinguished within the whole directory)&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153); font-weight: bold;"&gt;LDAP Attribute - &lt;/span&gt;&lt;/span&gt;a basic data structue, consisting of two parts, namely a pair of a &lt;span style="font-style: italic;"&gt;type&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;value&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;objectClass -&lt;/span&gt;&lt;span style="color: rgb(51, 153, 153); font-style: italic; font-weight: bold;"&gt; &lt;/span&gt;is a special attribute that defines how a particular entry should look like, what attributes is it allowed to have and what syntax should be used in them. objectClasses are defined in &lt;span style="font-style: italic;"&gt;schema files.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;Schema&lt;/span&gt;&lt;span style="color: rgb(51, 153, 153); font-style: italic; font-weight: bold;"&gt; Files &lt;/span&gt;are skeleton for LDAP entries. They contain object classes and attributes requirements used by different DNs. Schema files normally reside in the /etc/openldap/schema directory.&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 153, 153); font-weight: bold;"&gt;White Pages schema&lt;/span&gt;&lt;span style="color: rgb(51, 153, 153);"&gt; &lt;/span&gt;is a data model describing the organization of entries in a directory service. The name comes from the white pages in a telephone book which contain information about individuals, as opposed to yellow pages revealing information about companies. The entries are sorted according to individuals location, alphabetical order of their names, etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Capacity planning&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold; font-style: italic; color: rgb(51, 153, 153);"&gt;Pretty Damn Quick&lt;/span&gt; (PDQ) is an open source version of performance diagnostics and capacity planing software. It's freely available for download from &lt;a href="http://www.perfdynamics.com/" target="_BLANK"&gt;http://www.perfdynamics.com/&lt;/a&gt; and CPAN as (PERL::PDQ). The software can predict the programs performance when under heavy load based on mathematical models. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-3085457053904784134?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/3085457053904784134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=3085457053904784134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3085457053904784134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/3085457053904784134'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/10/0x00-lpi-301-terms-and-definitions.html' title='0x00. [LPIC-301] Terms and definitions'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-8637507553868526490</id><published>2007-10-02T23:50:00.000+01:00</published><updated>2008-04-21T09:33:58.669+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='LPIC'/><title type='text'>Linux Professional Institute Certifications, Level 3</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_YxqJFnCxl14/RwLT5BwLUUI/AAAAAAAAABE/6AqsaxaniMY/s1600-h/lpi-logo.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_YxqJFnCxl14/RwLT5BwLUUI/AAAAAAAAABE/6AqsaxaniMY/s320/lpi-logo.png" alt="" id="BLOGGER_PHOTO_ID_5116885103322812738" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: justify;"&gt;Linux Professional Institute (&lt;a href="http://www.lpi.org/"&gt;http://www.lpi.org/&lt;/a&gt;) is a Linux certifying organization, officially founded in October 1999 in Canada. Their vendor-independent certifications have become popular and are acknowledged worldwide. We can read the following mission statement on LPI's website:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;LPI shall promote and certify essential skills on Linux &lt;/span&gt;&lt;span style="font-style: italic;"&gt;and Open Source technologies through the global delivery of comprehensive, top quality, vendor-independent exams.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Exams are held in partnered exam centers around the world. Each exam costs 125 Euro or $125 USD, depending on your location. There are three levels of certification, each consisting of two exams.&lt;ol&gt;&lt;li&gt;Level 1: 117-101 and 117-102 - cover basic skills for the Linux professional that are common across all distributions of Linux.&lt;/li&gt;&lt;li&gt;Level  117-201 and 117-202 - cover advanced skills for the Linux professional, also common across all distributions of Linux.&lt;/li&gt;&lt;li&gt;Level 3: 117-301 and 117-302 - test skills in authentication, troubleshooting, network integration and capacityplanning.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;The first two levels are quite easy to pass, all it takes is just a thorough read and some practice. For both of them you can find a plenty of resources across the whole internet, including test simulations and cheat-sheets. It's not so easy with the 3rd level anymore...Within the last year I managed to pass four exams, thus challenging myself to pass the third level during the upcoming year. I am going to prepare myself by blogging about it here in hope that somebody can make use of the information published. I would like to encourage everybody to learn with me, leave feedback and/or interesting ideas. I've just enabled an RSS feed just in case anybody wants to subscribe.&lt;br /&gt;&lt;br /&gt;The course starts next weekend.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-8637507553868526490?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/8637507553868526490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=8637507553868526490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8637507553868526490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/8637507553868526490'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/10/linux-professional-institute.html' title='Linux Professional Institute Certifications, Level 3'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_YxqJFnCxl14/RwLT5BwLUUI/AAAAAAAAABE/6AqsaxaniMY/s72-c/lpi-logo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-4486613592095498897</id><published>2007-09-01T22:20:00.002+01:00</published><updated>2008-04-21T09:33:58.670+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Where does E220 sell best?</title><content type='html'>&lt;a target="_blank" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_YxqJFnCxl14/RtnZlUC9gSI/AAAAAAAAAAc/gaHX6X8YByE/s1600-h/ranking1.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_YxqJFnCxl14/RtnZlUC9gSI/AAAAAAAAAAc/gaHX6X8YByE/s320/ranking1.png" alt="" id="BLOGGER_PHOTO_ID_5105350887660683554" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I was looking at my blogs stats (August) and found them quite interesting. Click the picture on the left side to see a compact ranking of countries that use HUAWEI E220 - visitors of this website. The order is descending. Looks like every seventh visitor is from Austria, which has a population of (according to Wikipedia) around 8 308 906 people only. This makes Austria an absolute no. 1 in this ranking.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-4486613592095498897?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/4486613592095498897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=4486613592095498897' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4486613592095498897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/4486613592095498897'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/09/who-is-using-huawei-e220.html' title='Where does E220 sell best?'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_YxqJFnCxl14/RtnZlUC9gSI/AAAAAAAAAAc/gaHX6X8YByE/s72-c/ranking1.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5178514574359927774</id><published>2007-06-28T16:53:00.002+01:00</published><updated>2011-04-07T11:00:30.700+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>HUAWEI E220 Statistics interface</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;Project moved to &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;&lt;a href="http://pyhumod.googlecode.com/"&gt;http://pyhumod.googlecode.com/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://pyhumod.ooz.ie/"&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;http://PyHumod.ooz.ie/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5178514574359927774?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5178514574359927774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5178514574359927774' title='183 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5178514574359927774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5178514574359927774'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/06/huawei-e220-statistics-interface.html' title='HUAWEI E220 Statistics interface'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>183</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-6473518473513330068</id><published>2007-06-12T23:41:00.002+01:00</published><updated>2011-04-07T10:37:31.730+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Huawei'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>HUAWEI E220 HSDPA 3G modem in Linux</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;a href="http://pyhumod.googlecode.com/" target="_blank"&gt;&lt;span style="font-size: 130%;"&gt;UPDATE: Try PyHumod, a Python Library that supports talking to Huawei modems&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Since Friday the 8&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;th&lt;/span&gt; of June I'm in possession of a &lt;a href="http://www.huawei.com/mobileweb/en/products/view.do?id=282" style="font-weight: bold;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;HUAWEI&lt;/span&gt; E220 modem&lt;/a&gt;, which is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;natively&lt;/span&gt; supported by Linux kernel and works fine in this system. It has some issues in kernel versions prior to 2.6.20. Different people apply different workarounds; one guy for instance had spread a funny "technical gossip" on the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;Internet&lt;/span&gt; (which does not deserve to be quoted here) on how to enable the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;USB&lt;/span&gt; serial port and I was truly astonished, when I saw how many people had picked up and applied this "gossip thing" in deep belief that it REALLY helps. Well, anyway I would also like to share my magic spells with you.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I run a little project, it's a package which enables &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;HUAWEI&lt;/span&gt; E220 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;HSDPA&lt;/span&gt; Modem on Linux distributions with Kernel prior to 2.6.20, but not only!!! Versions with newer kernel work too, but they probably do not require my &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;UDEV&lt;/span&gt; rule. However, if your kernel is  newer than 2.6.19, you can always take a look at the configuration files included, which will let you connect to the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_8"&gt;Internet&lt;/span&gt; within 3 minutes. (No exaggeration!)&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 180%;"&gt;&lt;span style="color: #33cc00; font-weight: bold;"&gt;DOWNLOAD &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;&lt;a href="http://oozie.fm.interia.pl/pro/huawei-e220/"&gt;&lt;/a&gt;&lt;span style="color: red;"&gt; &lt;a href="http://hackpospolita.webpark.pl/huawei.tar.bz2"&gt;huawei.tar.bz2&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Currently works fine with (tested on):&lt;br /&gt;&lt;span style="color: #009900; font-weight: bold;"&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;openSUSE&lt;/span&gt; 10.2 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-weight: bold;"&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;SUSE&lt;/span&gt; Linux 10.1&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="font-weight: bold;"&gt;Fedora Core 6&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="font-weight: bold;"&gt;Fedora Core 5&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: #cc6600;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;Ubuntu&lt;/span&gt; 7.04&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;Ubuntu&lt;/span&gt; 6.10&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: #cc6600;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;Ubuntu&lt;/span&gt; 6.06&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #cc0000;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="color: #cc6600;"&gt;&lt;span style="color: #ff6600;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;Mandriva&lt;/span&gt; Free2007Spring&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;The package includes configuration files for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;wvdial&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;pppd&lt;/span&gt;!!!&lt;br /&gt;&lt;br /&gt;More to come.&lt;br /&gt;&lt;br /&gt;Feedback in any form is very welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-6473518473513330068?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/6473518473513330068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=6473518473513330068' title='175 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6473518473513330068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/6473518473513330068'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/06/huawei-e220-hsdpa-3g-modem-in-linux.html' title='HUAWEI E220 HSDPA 3G modem in Linux'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>175</thr:total></entry><entry><id>tag:blogger.com,1999:blog-948616129588852269.post-5886264420783090767</id><published>2007-06-11T11:40:00.000+01:00</published><updated>2008-04-21T09:33:58.672+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Troubleshooting wireless adapters in Novell TEAM</title><content type='html'>&lt;div style="text-align: justify;"&gt;On 25th of May and a week later, on the 1st of June, I had a great pleasure of delivering a brief training on troubleshooting WiFi cards for openSUSE Support Team in Dublin. We went through the process of installing drivers and firmware for various adapters, afterwards we performed a proof of concept on how easily crackable a 128bit WEP encryption is. For that we used &lt;a href="http://www.aircrack-ng.org/"&gt;aircrack-ng&lt;/a&gt; suite strengthened by &lt;a href="http://www.cdc.informatik.tu-darmstadt.de/aircrack-ptw/"&gt;aircrack-ptw&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The short presentation in ODP format can be found &lt;a href="http://oozie.fm.interia.pl/data/wifi-cards.odp"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/948616129588852269-5886264420783090767?l=blog.ooz.ie' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.ooz.ie/feeds/5886264420783090767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=948616129588852269&amp;postID=5886264420783090767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5886264420783090767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/948616129588852269/posts/default/5886264420783090767'/><link rel='alternate' type='text/html' href='http://blog.ooz.ie/2007/06/troubleshooting-wireless-adapters-in.html' title='Troubleshooting wireless adapters in Novell TEAM'/><author><name>OOZIE</name><uri>http://www.blogger.com/profile/17638018979284286743</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
