<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=188.66.17.97</id>
	<title>Maemo Wiki Mirror - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=188.66.17.97"/>
	<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php/Special:Contributions/188.66.17.97"/>
	<updated>2026-04-22T04:48:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=Device_management_using_Bcfg2&amp;diff=6020</id>
		<title>Device management using Bcfg2</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=Device_management_using_Bcfg2&amp;diff=6020"/>
		<updated>2010-04-05T09:03:51Z</updated>

		<summary type="html">&lt;p&gt;188.66.17.97: /* Device management? Why bother? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article contains information about using [http://trac.mcs.anl.gov/projects/bcfg2 Bcfg2], an open source configuration management system in management of Maemo based devices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Note!&amp;lt;/font&amp;gt; At this phase, although the title says otherwise, instructions given in this article do NOT constitute a device management solution. At the moment these instructions only guide to &#039;&#039;&#039;experiment&#039;&#039;&#039; device management using Bcfg2.&lt;br /&gt;
&lt;br /&gt;
== Scope and terminology ==&lt;br /&gt;
&lt;br /&gt;
Scope of the article is using Bcfg2 to manage Maemo devices of employees at a fairly large company, where the number of devices is counted on hundreds or thousands. In a private use, or in small companies things covered here hardly make any sense.&lt;br /&gt;
&lt;br /&gt;
In the remainder if this document, following terminology is used&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Term&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| Device&lt;br /&gt;
| Maemo based handset, such as [[Nokia N900]]&lt;br /&gt;
|-&lt;br /&gt;
| Device management&lt;br /&gt;
| Generally used term for configuration management which takes place on Devices&lt;br /&gt;
|-&lt;br /&gt;
| Enterprise&lt;br /&gt;
| A large company ot other organization that wants employees to ba able to acces company IT systems using Maemo based devices&lt;br /&gt;
|-&lt;br /&gt;
| Desktop computer&lt;br /&gt;
| A full-size computer (traditional desktop or laptop) used to access corporate IT systems&lt;br /&gt;
|-&lt;br /&gt;
| Enterprise configuration&lt;br /&gt;
| A set of applications and configuration values which the Enterprise wants to deploy into the Device as a prerequisite for accessing corporate IT systems. Usually includes hardening the device security. &lt;br /&gt;
|-&lt;br /&gt;
| Provisioning&lt;br /&gt;
| The process which equips the Device with Enterprise configuration&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Instructions given in this article are tested on [[Open development/Maemo roadmap/Fremantle|Fremantle]]. They may work on other releases as well, but probably not.&lt;br /&gt;
&lt;br /&gt;
=== Recommended reading ===&lt;br /&gt;
&lt;br /&gt;
Basic use and concepts of Bcfg2 are not in the scope of this article. To get familiar with Bcfg2, following reading is recommended:&lt;br /&gt;
&lt;br /&gt;
*[http://www.linuxlinks.com/article/20100222155850632/ConfigurationManagement.html 7 of the Best Free Linux Configuration Management Tools]&lt;br /&gt;
* [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Bcfg2Doc Bcfg2 documentation]&lt;br /&gt;
&lt;br /&gt;
82L4Ov  &amp;lt;a href=&amp;quot;http://qafelndythqr.com/&amp;quot;&amp;gt;qafelndythqr&amp;lt;/a&amp;gt;, [url=http://juyyqzdrvwzl.com/]juyyqzdrvwzl[/url], [link=http://revkmdpkyzys.com/]revkmdpkyzys[/link], http://gcthxthjrqdl.com/&lt;br /&gt;
&lt;br /&gt;
== Why Bcfg2? ==&lt;br /&gt;
&lt;br /&gt;
Openness is at heart of the Maemo philosophy. Thus, using an Open Source configuration management system seems a logical choice to try out.&lt;br /&gt;
&lt;br /&gt;
Bcfg2 was chosen as the first candidate to try-out because &lt;br /&gt;
&lt;br /&gt;
* Architecture is server-centric. Processing is performed at the server end as much as possible. This makes the client lightweight. It makes it also simpler and less frequently changing.&lt;br /&gt;
* Device management is a special use case for a software like this. They are all geared more for server and desktop management. Thus, fair amount of customization is anticipated. Bcfg2 has very flexible plugin architecture where most of it&#039;s core functionality implemented as plugins.  This makes it very customization-friendly, nearly all components are replaceable&lt;br /&gt;
* Anticipation of customization  puts lot of weight to implementation language. Bcfg2 is written in Python, which suits the author best.&lt;br /&gt;
&lt;br /&gt;
That said, there is no reason why other configuration management systems such as CFEngine or Puppet wouldn&#039;t work as well. (Actually, Puppet was tried out, got successfully running at the Device. Only it did not communicate with the server. This is possibly caused by the SSL problem discussed later. That&#039;s was the point where lack of author&#039;s Ruby skills kicked in :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Getting Bcfg2 up and running ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;A word of warning&amp;lt;/font&amp;gt;: Configuration management is complicated task. Learning Bcfg2 and the concepts behind it does take some time and effort. Do NOT by try to manage Maemo clients as your first Bcfg2 rehearsal. Instead, familiarize yourself with Bcfg2 first using &amp;quot;ordinary&amp;quot; computers  as clients.&lt;br /&gt;
&lt;br /&gt;
=== Problems with Bcfg2 in Maemo ===&lt;br /&gt;
&lt;br /&gt;
At the moment there are some problems we need to work around in order to  install Bcfg2 client into Device. &lt;br /&gt;
&lt;br /&gt;
# Lack of proper SSL support&lt;br /&gt;
#* Bcfg2 prior to 1.0 used Python implementation of SSL called tlslite. At 1.0 tlslite war replaced with Python 2.6 built-in SSL module&lt;br /&gt;
#* Bcfg2 has internal fallback to use M2crypto module if SSL module fails&lt;br /&gt;
#* Maemo (Fremantle), however, has Python 2.5, which has no SSL module and no M2crypto module either&lt;br /&gt;
#** There is actually already [https://bugs.maemo.org/show_bug.cgi?id=5102 bug report] filed about the problem. However, the original problem (importing SSL module) was never solved, the problem the reporter faces seems to be worked around other way&lt;br /&gt;
#* Possible workarounds:&lt;br /&gt;
#** Compile [http://pypi.python.org/pypi/ssl/SSL SSL 1.15] module into Python 2.5&lt;br /&gt;
#** Compile M2crypto module into Python 2.5&lt;br /&gt;
#*** Both fail into lack of complete set of OpenSSL development headers&lt;br /&gt;
#** Re-include tlslib into Bcfg2&lt;br /&gt;
#*** Possible, however there will be no server identity validation&lt;br /&gt;
#** Use Bcfg2 prior to 1.0 in Device&lt;br /&gt;
#*** Possible, however there will be no server identity validation&lt;br /&gt;
#* Contributions welcome&lt;br /&gt;
# Bcfg2 is not packaged for Maemo &lt;br /&gt;
#* Must be installed from source&lt;br /&gt;
# There is no good way for bootstrapping right now&lt;br /&gt;
#* Installation must be performed from Device command line&lt;br /&gt;
&lt;br /&gt;
=== Server installation ===&lt;br /&gt;
&lt;br /&gt;
Download and install version 1.0.1 following instructions found at [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Download Bcfg2 web site]&lt;br /&gt;
&lt;br /&gt;
Note that the server should reside in a network the Device is able to access.&lt;br /&gt;
&lt;br /&gt;
=== Client installation ===&lt;br /&gt;
&lt;br /&gt;
==== Option 1: Install old version ====&lt;br /&gt;
&lt;br /&gt;
Download [http://ftp.mcs.anl.gov/pub/bcfg/archive/bcfg2-0.9.6.tar.gz bcfg2-0.9.6] in to the Device. Open terminal window and install Bcfg2 by entering following commands&lt;br /&gt;
&lt;br /&gt;
 apt-get install python&lt;br /&gt;
 tar zxvf bcfg2-0.9.6.tar.gz&lt;br /&gt;
 cd bcfg2-0.9.6&lt;br /&gt;
 python setup.py install --install-layout deb --record /root/bcfg2files&lt;br /&gt;
&lt;br /&gt;
==== Option 2: Install current version ====&lt;br /&gt;
&lt;br /&gt;
This option is somewhat more complicated since we need to re-include tlslib into Bcfg2&lt;br /&gt;
&lt;br /&gt;
Download [http://ftp.mcs.anl.gov/pub/bcfg/archive/bcfg2-0.9.6.tar.gz bcfg2-0.9.6] and [http://ftp.mcs.anl.gov/pub/bcfg/archive/bcfg2-1.0.1.tar.gz bcfg2-1.0.1] both. Extract them:&lt;br /&gt;
&lt;br /&gt;
 tar zxvf bcfg2-0.9.6.tar.gz &lt;br /&gt;
 tar zxvf bcfg2-1.0.1.tar.gz&lt;br /&gt;
&lt;br /&gt;
Get tlslib and from older version&lt;br /&gt;
&lt;br /&gt;
 cp -r bcfg2-0.9.6/src/lib/tlslite bcfg2-1.0.1/src/lib&lt;br /&gt;
&lt;br /&gt;
Download [http://trac.mcs.anl.gov/projects/bcfg2/browser/trunk/bcfg2/src/lib/Proxy.py?rev=5168&amp;amp;format=txt this version] of Proxy.py from Bcfg2 site and save it as &amp;lt;code&amp;gt;bcfg2-1.0.1/src/lib/Proxy.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;bcfg2-1.0.1/src/lib/Proxy.py&amp;lt;/code&amp;gt;. Add dummy placeholders &amp;lt;code&amp;gt;ca&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;allowedServerCNs&amp;lt;/code&amp;gt; into ComponentProxy definition so it looks like below:&lt;br /&gt;
&lt;br /&gt;
 def ComponentProxy (url, user=None, password=None, fingerprint=None,&lt;br /&gt;
                     key=None, ca=None, allowedServerCNs=None, cert=None):&lt;br /&gt;
&lt;br /&gt;
Edit &amp;lt;code&amp;gt;bcfg2-1.0.1/setup.py&amp;lt;/code&amp;gt;&lt;br /&gt;
Add the packages &amp;lt;code&amp;gt;Bcfg2.tlslite&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Bcfg2.tlslite.integration&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Bcfg2.tlslite.utils&amp;lt;/code&amp;gt; back into the packages list in setup.py, as seen in [https://trac.mcs.anl.gov/projects/bcfg2/browser/trunk/bcfg2/setup.py?rev=5182 here]&lt;br /&gt;
&lt;br /&gt;
Repackage the source directory&lt;br /&gt;
&lt;br /&gt;
 tar zcvf bcfg2-1.0.1-mod.tar.gz bcfg2-1.0.1&lt;br /&gt;
&lt;br /&gt;
Transfer &amp;lt;code&amp;gt;bcfg2-1.0.1-mod.tar.gz&amp;lt;/code&amp;gt; to the Device. Open (at Device) terminal window and install Bcfg2 by entering following commands&lt;br /&gt;
&lt;br /&gt;
 apt-get install python&lt;br /&gt;
 tar zxvf bcfg2-1.0.1-mod.tar.gz&lt;br /&gt;
 cd bcfg2-1.0.1&lt;br /&gt;
 python setup.py install --install-layout deb --record /root/bcfg2files&lt;br /&gt;
&lt;br /&gt;
=== Installation notes ===&lt;br /&gt;
&lt;br /&gt;
Reinstalling Bcfg2: Remove &amp;lt;code&amp;gt;bcfg2-1.0.1/build&amp;lt;/code&amp;gt; directory before re-run of &amp;lt;code&amp;gt;setup.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Removing Bcfg2: remove files listed at &amp;lt;code&amp;gt;/root/bcfg2files&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simple sample configuration ===&lt;br /&gt;
&lt;br /&gt;
In the following we create a simple configuration at the Bcfg2 server, just to make you get on board quicker (empty configurations are not very illustrative). In the sample configuration we do three things:&lt;br /&gt;
* Manage the content of a simple file &amp;lt;code&amp;gt;/etc/simple&amp;lt;/code&amp;gt;&lt;br /&gt;
* Manage the content of a file &amp;lt;code&amp;gt;/etc/bcfg2.info&amp;lt;/code&amp;gt; using template&lt;br /&gt;
* Run a simple action, a shell command &amp;lt;code&amp;gt;ls / &amp;gt; /tmp/foobar&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Throughout this article we assume the configuration repository is at default location &amp;lt;code&amp;gt;/var/lib/bcfg2&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/Metadata/groups.xml&amp;lt;/code&amp;gt; to contain following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Groups&amp;gt;&lt;br /&gt;
     &amp;lt;Group name=&#039;armel&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;Group name=&#039;linux&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;Group name=&#039;deb&#039;&amp;gt;&lt;br /&gt;
         &amp;lt;Group name=&#039;linux&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;/Group&amp;gt;&lt;br /&gt;
     &amp;lt;Group name=&#039;maemo&#039;&amp;gt;&lt;br /&gt;
         &amp;lt;Group name=&#039;deb&#039;/&amp;gt;&lt;br /&gt;
         &amp;lt;Bundle name=&#039;sample&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;/Group&amp;gt;&lt;br /&gt;
     &amp;lt;Group name=&#039;fremantle&#039;&amp;gt;&lt;br /&gt;
         &amp;lt;Group name=&#039;maemo&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;/Group&amp;gt;&lt;br /&gt;
 &amp;lt;/Groups&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/Bundler/sample.xml&amp;lt;/code&amp;gt; to contain following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Bundle name=&#039;sample&#039;&amp;gt;&lt;br /&gt;
     &amp;lt;ConfigFile name=&#039;/etc/simple&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;ConfigFile name=&#039;/etc/bcfg2.info&#039;/&amp;gt;&lt;br /&gt;
     &amp;lt;BoundAction name=&amp;quot;simple&amp;quot; timing=&#039;post&#039; when=&#039;always&#039; status=&#039;check&#039; command=&amp;quot;ls / &amp;gt; /tmp/foobar&amp;quot;/&amp;gt;&lt;br /&gt;
 &amp;lt;/Bundle&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/Cfg/etc/simple/simple&amp;lt;/code&amp;gt; to contain following (Create directories as needed):&lt;br /&gt;
&lt;br /&gt;
 This is a simple file&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/Cfg/etc/simple/simple&amp;lt;/code&amp;gt; to contain following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;FileInfo&amp;gt;&lt;br /&gt;
     &amp;lt;Info owner=&#039;root&#039; group=&#039;root&#039; perms=&#039;0644&#039; encoding=&#039;ascii&#039;/&amp;gt;&lt;br /&gt;
 &amp;lt;/FileInfo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/TCheetah/etc/bcfg2.info/template&amp;lt;/code&amp;gt; to contain following (Create directories as needed):&lt;br /&gt;
&lt;br /&gt;
 Hostname: $self.metadata.hostname&lt;br /&gt;
 Uuid: $self.metadata.uuid&lt;br /&gt;
 Password: $self.metadata.password&lt;br /&gt;
 Profile: $self.metadata.profile&lt;br /&gt;
 Groups: #echo &#039;,&#039;.join($self.metadata.groups)#&lt;br /&gt;
 Bundles: #echo &#039;,&#039;.join($self.metadata.bundles)#&lt;br /&gt;
&lt;br /&gt;
Edit file &amp;lt;code&amp;gt;/var/lib/bcfg2/TCheetah/etc/bcfg2.info/info.xml&amp;lt;/code&amp;gt; to contain following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;FileInfo&amp;gt;&lt;br /&gt;
     &amp;lt;Info owner=&#039;root&#039; group=&#039;root&#039; perms=&#039;0644&#039; encoding=&#039;ascii&#039;/&amp;gt;&lt;br /&gt;
 &amp;lt;/FileInfo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Some explanation: ==== &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Bcfg2 builds the configuration using layered approach:&lt;br /&gt;
&lt;br /&gt;
* Metadata (roughly: &amp;quot;which kind of configuration should be where&amp;quot;)&lt;br /&gt;
* Abstract (roughly: what should be configured)&lt;br /&gt;
* Literal (roughly: how exactly that &amp;quot;what&amp;quot; should be achieved)&lt;br /&gt;
&lt;br /&gt;
In this example, we have two instances of the same abstract configuration item (ConfigFile). They are however handled by two different literal configuration generators, Cfg, which handles simple files and TCheetah which handles more complicated files using built-in Cheetah templating engine.&lt;br /&gt;
&lt;br /&gt;
One thing to like in Bcfg2 is that it does not mandate things too much. Third item is an example of that. Bcfg2 allows short-circuiting the Literal layer processing altogether by adding &amp;quot;Bound&amp;quot; in front of the keyword. In a simple cases where what we want exactly is already known already at abstract level this can simplify things.&lt;br /&gt;
&lt;br /&gt;
=== Hooking the Device and Bcfg2 server together ===&lt;br /&gt;
&lt;br /&gt;
At server, add following line into &amp;lt;code&amp;gt;/var/lib/bcfg2/Metadata/clients.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Client uuid=&amp;quot;foo&amp;quot; name=&amp;quot;bar&amp;quot; profile=&amp;quot;maemo&amp;quot; password=&amp;quot;xyzzy&amp;quot; pingable=&amp;quot;N&amp;quot; location=&amp;quot;floating&amp;quot; auth=&amp;quot;cert+password&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
No need to restart the Bcfg2 server, it picks the changes on the fly. Next, at the Device, edit the file  &amp;lt;code&amp;gt;/etc/bcfg2.conf&amp;lt;/code&amp;gt; to look like following:&lt;br /&gt;
&lt;br /&gt;
 [communication]&lt;br /&gt;
 protocol = xmlrpc/ssl&lt;br /&gt;
 user = foo&lt;br /&gt;
 password = xyzzy&lt;br /&gt;
 &lt;br /&gt;
 [components]&lt;br /&gt;
 bcfg2 = https://bcfg2server.example.com:6789&lt;br /&gt;
&lt;br /&gt;
Now you should be able to invoke Bcfg2 client and make first connection to the server using command&lt;br /&gt;
&lt;br /&gt;
 bcfg2 -I&lt;br /&gt;
&lt;br /&gt;
You should now be prompted a confirmation for three configuration item defined in the sample configuration, due to use of &amp;lt;code&amp;gt;-I&amp;lt;/code&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix: Hints on Bcfg2 usage ==&lt;br /&gt;
&lt;br /&gt;
=== Autogroup probe ===&lt;br /&gt;
&lt;br /&gt;
Bcfg2 is able to automatically determine group memberships using probes. [http://wiki.maemo.org/Image:Autogroup.sh Here] is a sample probe code which recognizes Maemo devices among many other computers. Just put the code into a file at Probes directory, for example, &amp;lt;code&amp;gt;/var/lib/bcfg2/Probes/autogroup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At Bcfg2 web site is another [http://trac.mcs.anl.gov/projects/bcfg2/wiki/Plugins/Probes/examples/group example] of autogroup probe code. This code does not recognize Maemo but might do better work with some other platforms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
This is the &amp;quot;dont look here&amp;quot; part, stuff under construction&lt;br /&gt;
&lt;br /&gt;
MaemoAPT package driver&lt;br /&gt;
# Maemo does not have debsums utility&lt;br /&gt;
#* Causes APT package driver not to load&lt;br /&gt;
&lt;br /&gt;
[[Category:Power users]]&lt;/div&gt;</summary>
		<author><name>188.66.17.97</name></author>
	</entry>
</feed>