<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Blog</title><link href="https://blog.tblein.eu/" rel="alternate"></link><link href="https://blog.tblein.eu/feeds/all.atom.xml" rel="self"></link><id>https://blog.tblein.eu/</id><updated>2016-11-12T00:00:00+01:00</updated><entry><title>Installing a specific version of Bioconductor</title><link href="https://blog.tblein.eu/development/2016/installing-a-specific-version-of-bioconductor/" rel="alternate"></link><published>2016-11-12T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-11-12:development/2016/installing-a-specific-version-of-bioconductor/</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="https://bioconductor.org"&gt;Bioconductor&lt;/a&gt; provide a list of R packages to
analyse high-throughput genomic data. Every six months a new version of
Bioconductor is released fixing the version of the included packages.
It is always nice to come back to the same version of packages that generated the
results.&lt;/p&gt;
&lt;p&gt;Bioconductor versions are bound to R versions. So depending of the version of
R you are using a limited number of Bioconductor versions are available. Using
the default installation method of the Bioconductor the last version available
for the R version is installed. We will see how to install a different version.&lt;/p&gt;
&lt;div class="section" id="install-a-specific-version-of-bioconductor"&gt;
&lt;h2&gt;Install a specific version of Bioconductor&lt;/h2&gt;
&lt;p&gt;To install a specific version of Bioconductor, we need to use the installer of
that version. To do so, we need to install the installer of the wondered
version. The installer is in the &lt;code&gt;BiocInstaller&lt;/code&gt; package we just need to
use the correct repository to install it.&lt;/p&gt;
&lt;p&gt;For example to install Bioconductor 3.1:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;install.packages&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;BiocInstaller&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 repos&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;http://bioconductor.org/packages/3.1/bioc&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then load the &lt;code&gt;BiocInstaller&lt;/code&gt; package as usual with &lt;code&gt;library&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;library&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;BiocInstaller&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then install Bioconductor packages as usual with then &lt;code&gt;biocLite()&lt;/code&gt;
function.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="downgrade-of-already-installed-packages"&gt;
&lt;h2&gt;Downgrade of already installed packages&lt;/h2&gt;
&lt;p&gt;In case you already install a more recent version of Bioconductor you can easily
downgrade the packages to fit the Bioconductor version.&lt;/p&gt;
&lt;p&gt;After loading the &lt;code&gt;BiocInstaller&lt;/code&gt; you can have information about the
Bioconductor installation with the &lt;code&gt;biocValid()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;&amp;gt; &lt;/span&gt;biocValid&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="go"&gt;* sessionInfo()&lt;/span&gt;

&lt;span class="go"&gt;R version 3.2.4 Revised (2016-03-16 r70336)&lt;/span&gt;
&lt;span class="go"&gt;Platform: x86_64-pc-linux-gnu (64-bit)&lt;/span&gt;
&lt;span class="go"&gt;Running under: Debian GNU/Linux 8 (jessie)&lt;/span&gt;

&lt;span class="go"&gt;locale:&lt;/span&gt;
&lt;span class="go"&gt; [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C&lt;/span&gt;
&lt;span class="go"&gt; [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8&lt;/span&gt;
&lt;span class="go"&gt; [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8&lt;/span&gt;
&lt;span class="go"&gt; [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C&lt;/span&gt;
&lt;span class="go"&gt; [9] LC_ADDRESS=C               LC_TELEPHONE=C&lt;/span&gt;
&lt;span class="go"&gt;[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C&lt;/span&gt;

&lt;span class="go"&gt;attached base packages:&lt;/span&gt;
&lt;span class="go"&gt;[1] stats     graphics  grDevices utils     datasets  methods   base&lt;/span&gt;

&lt;span class="go"&gt;other attached packages:&lt;/span&gt;
&lt;span class="go"&gt;[1] BiocInstaller_1.18.5&lt;/span&gt;

&lt;span class="go"&gt;loaded via a namespace (and not attached):&lt;/span&gt;
&lt;span class="go"&gt;[1] tools_3.2.4&lt;/span&gt;

&lt;span class="go"&gt;* Packages too new for Bioconductor version &amp;#39;3.1&amp;#39;&lt;/span&gt;

&lt;span class="go"&gt;                  Version  LibPath&lt;/span&gt;
&lt;span class="go"&gt;annotate          &amp;quot;1.48.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;AnnotationDbi     &amp;quot;1.32.3&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;Biobase           &amp;quot;2.30.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;BiocGenerics      &amp;quot;0.16.1&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;BiocParallel      &amp;quot;1.4.3&amp;quot;  &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;Biostrings        &amp;quot;2.38.4&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;DESeq2            &amp;quot;1.10.1&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;genefilter        &amp;quot;1.52.1&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;geneplotter       &amp;quot;1.48.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;GenomeInfoDb      &amp;quot;1.6.3&amp;quot;  &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;GenomicAlignments &amp;quot;1.6.3&amp;quot;  &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;GenomicRanges     &amp;quot;1.22.4&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;IRanges           &amp;quot;2.4.8&amp;quot;  &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;Rsamtools         &amp;quot;1.22.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;rtracklayer       &amp;quot;1.30.4&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;S4Vectors         &amp;quot;0.8.11&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;XVector           &amp;quot;0.10.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;
&lt;span class="go"&gt;zlibbioc          &amp;quot;1.16.0&amp;quot; &amp;quot;/home/tblein/bin/R_3.2.4/lib/R/library&amp;quot;&lt;/span&gt;

&lt;span class="go"&gt;downgrade with biocLite(c(&amp;quot;annotate&amp;quot;, &amp;quot;AnnotationDbi&amp;quot;, &amp;quot;Biobase&amp;quot;, &amp;quot;BiocGenerics&amp;quot;,&lt;/span&gt;
&lt;span class="go"&gt;  &amp;quot;BiocParallel&amp;quot;, &amp;quot;Biostrings&amp;quot;, &amp;quot;DESeq2&amp;quot;, &amp;quot;genefilter&amp;quot;, &amp;quot;geneplotter&amp;quot;,&lt;/span&gt;
&lt;span class="go"&gt;  &amp;quot;GenomeInfoDb&amp;quot;, &amp;quot;GenomicAlignments&amp;quot;, &amp;quot;GenomicRanges&amp;quot;, &amp;quot;IRanges&amp;quot;, &amp;quot;Rsamtools&amp;quot;,&lt;/span&gt;
&lt;span class="go"&gt;  &amp;quot;rtracklayer&amp;quot;, &amp;quot;S4Vectors&amp;quot;, &amp;quot;XVector&amp;quot;, &amp;quot;zlibbioc&amp;quot;))&lt;/span&gt;

&lt;span class="go"&gt;Erreur : 18 package(s) too new&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So as indicated by &lt;code&gt;biocValid()&lt;/code&gt;, to downgrade all the package you just
need to run the &lt;code&gt;biocLite()&lt;/code&gt; function with the packages you would like to
downgrade.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://bioconductor.org"&gt;Bioconductor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://stackoverflow.com/questions/19589064/downgrade-r-version-and-r-package-bioconductor"&gt;Downgrade R version and R package Bioconductor [duplicate]&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="R"></category><category term="Bioconductor"></category><category term="Version"></category><category term="Downgrade."></category></entry><entry><title>Automatic deployment of pelican website with GitLab - The local way</title><link href="https://blog.tblein.eu/server/2016/automatic-deployment-of-pelican-website-with-gitlab-the-local-way/" rel="alternate"></link><published>2016-08-27T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-27:server/2016/automatic-deployment-of-pelican-website-with-gitlab-the-local-way/</id><summary type="html">&lt;p&gt;We already saw a way to &lt;a class="reference external" href="https://blog.tblein.eu/server/2016/automatic-deployment-of-pelican-website-with-gitlab/"&gt;deploy our pelican website&lt;/a&gt;. To do it
we add a SSH private SSH key to the environment variables. That not so nice
since everybody that have access to the project can get the SSH private key.  We
will see here an other possibility to deploy our pelican website by mounting the
final repository directly inside the build environment.&lt;/p&gt;
&lt;p&gt;You will need to have functional installation of GitLab and GitLab Runner with
Docker. In addition we suppose that the required python are in the
&lt;code&gt;requirements.txt&lt;/code&gt; file. The build and deployment will be managed with
python and classical tools like &lt;code&gt;mv&lt;/code&gt;, so a minimal docker image with
python should be enough to do the job. The GitLab Runner should be on the
machine that serve the website.&lt;/p&gt;
&lt;div class="section" id="create-a-runner"&gt;
&lt;h2&gt;Create a runner&lt;/h2&gt;
&lt;p&gt;We will first create a runner that use docker that have python 2 installation
and the web destination folder mounted (in our case it will be
&lt;code&gt;/var/www&lt;/code&gt;).&lt;/p&gt;
&lt;div class="section" id="general-runner-registration"&gt;
&lt;h3&gt;General runner registration&lt;/h3&gt;
&lt;p&gt;If not already done, you will need to setup a runner for the project:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; gitlab-runner register
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Put the address of the coordinator. If GitLab is accessible trough &lt;a class="reference external" href="http://gitlab.com"&gt;http://gitlab.com&lt;/a&gt;,
it should be something like &lt;a class="reference external" href="http://gitlab.com/ci"&gt;http://gitlab.com/ci&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter then the token that will link GitLab and the runner:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;If you would like to have a shared runner go to the &lt;cite&gt;Admin Area&lt;/cite&gt;, then
&lt;cite&gt;Overview&lt;/cite&gt; and finally &lt;cite&gt;Runners&lt;/cite&gt;, to get the token.&lt;/li&gt;
&lt;li&gt;If you prefer to have a runner for the project, go in the configuration menu
of the projects and select &lt;cite&gt;Runners&lt;/cite&gt; and use the token of the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Give a name to your runner and eventually some tags. I suggest to had as tags
all the functionality of the runner. Indeed we can specify in the build system
to use only the runners that carry specified tags. In our example the tags will
be &lt;code&gt;python2&lt;/code&gt;, &lt;code&gt;www-mount&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Specify the executor as &lt;code&gt;docker&lt;/code&gt; and the docker image as
&lt;code&gt;python:2-alpine&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-the-mounted-volume"&gt;
&lt;h3&gt;Configuration of the mounted volume&lt;/h3&gt;
&lt;p&gt;At the creation of the runner, automatically a volume is created as cache
(&lt;code&gt;/cache&lt;/code&gt;). We will add an other one that will be linked to a real path on
the machine running the gitlab-ci-multi-runner.&lt;/p&gt;
&lt;p&gt;To do it we need to edit the &lt;code&gt;/etc/gitlab-runner/config.toml&lt;/code&gt;. Search the
runner you are interested and change the &lt;code&gt;volumes&lt;/code&gt; line as follow:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;volumes = [&amp;quot;/cache&amp;quot;, &amp;quot;/var/www:/var/www:rw&amp;quot;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Each time the runner will be executed the &lt;code&gt;/var/www&lt;/code&gt; folder of the host at
the same place in the container as read write.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="deployment"&gt;
&lt;h2&gt;Deployment&lt;/h2&gt;
&lt;p&gt;Here are the different steps for the deployment.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Clone the repository.&lt;/li&gt;
&lt;li&gt;First install dependencies with the help of pip and the
&lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Generate pelican website.&lt;/li&gt;
&lt;li&gt;Backup the old version of the website (just in case)&lt;/li&gt;
&lt;li&gt;Move the output directory in the destination&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="configuration-of-the-continuous-integration"&gt;
&lt;h3&gt;Configuration of the continuous integration&lt;/h3&gt;
&lt;p&gt;We will create a Gitlab continuous integration configuration file
(&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;) at the root of the repository. It is automatically
recognised by GitLab. The file is inspired from the one proposed by GitLab.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;image&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;python:2.7-alpine&lt;/span&gt;

&lt;span class="l l-Scalar l-Scalar-Plain"&gt;pages&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;tags&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;www-mount&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;python2&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;script&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;pip install -r requirements.txt&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;pelican -s publishconf.py&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;mv -f /var/www/website.domain /var/www/archives/website.domain.$(date &amp;quot;+%Y%m%d_%H%M%S&amp;quot;) || true&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;mv output /var/www/website.domain&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For the build we specify two tags here: &lt;code&gt;www-mount&lt;/code&gt; and &lt;code&gt;python2&lt;/code&gt;.
This will allow the build system to select the runner that have the same tags.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://gitlab.com/pages/pelican"&gt;pages / pelican&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md"&gt;gitlab-ci-multi-runner -- Advanced configuration&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="GitLab"></category><category term="pelican"></category><category term="deploy"></category><category term="Debian"></category><category term="Docker."></category></entry><entry><title>PHP activation for nginx</title><link href="https://blog.tblein.eu/server/2016/php-activation-for-nginx/" rel="alternate"></link><published>2016-08-20T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-20:server/2016/php-activation-for-nginx/</id><summary type="html">&lt;p&gt;We will see how to let nginx execute PHP scripts and display their results
instead of their content.&lt;/p&gt;
&lt;div class="section" id="configuration-of-php-fpm"&gt;
&lt;h2&gt;Configuration of PHP-FPM&lt;/h2&gt;
&lt;p&gt;Several possibility are available to execute PHP scripts Apache module, CGI,
FastCGI and FPM. The later is an adaptation of the FastCGI version for
heavy-loaded sites. It is the recommended installation to use with nginx.&lt;/p&gt;
&lt;p&gt;We will start by installing the FPM version of PHP5&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt install php5-fpm
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;nginx can discuss with the PHP-FPM process either through TCP socket or Unix
socket. Since we will suppose nginx and PHP-FPM are on the same machine, we will
use the Unix socket version.&lt;/p&gt;
&lt;p&gt;First we check the configuration in the PHP-FPM configuration file
(&lt;code&gt;php5/fpm/pool.d/www.conf&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;38 &lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/var/run/php5-fpm.sock&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then we restart the PHP-FPM service&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service php5-fpm restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-nginx"&gt;
&lt;h2&gt;Configuration of nginx&lt;/h2&gt;
&lt;p&gt;We say to nginx where to find the PHP socket and to pass it the PHP files
(extension &lt;code&gt;.php&lt;/code&gt;). We need to put the following lines in the vhost files
needing it. For the ease of the host configuration just put that lines in a new
file called &lt;code&gt;/etc/nginx/php.conf&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# pass the PHP scripts to PHP-FPM server listening on :code:`/var/run/php5-fpm.sock;`&lt;/span&gt;

&lt;span class="k"&gt;location&lt;/span&gt; &lt;span class="p"&gt;~&lt;/span&gt; &lt;span class="sr"&gt;\.php$&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;include&lt;/span&gt; &lt;span class="s"&gt;snippets/fastcgi-php.conf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# With php5-fpm:&lt;/span&gt;
    &lt;span class="kn"&gt;fastcgi_pass&lt;/span&gt; &lt;span class="s"&gt;unix:/var/run/php5-fpm.sock&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You will just need to include that file in the virtual host that need to execute
php scripts. For example for the default site
(&lt;code&gt;/etc/nginx/sites-available/default&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt; 1 &lt;/span&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt; 2 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt; &lt;span class="s"&gt;default_server&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 3 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="s"&gt;[::]:80&lt;/span&gt; &lt;span class="s"&gt;default_server&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 4 &lt;/span&gt;
&lt;span class="lineno"&gt; 5 &lt;/span&gt;    &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="s"&gt;/var/www/html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 6 &lt;/span&gt;
&lt;span class="lineno"&gt; 7 &lt;/span&gt;    &lt;span class="c1"&gt;# Add index.php to the list if you are using PHP&lt;/span&gt;
&lt;span class="lineno"&gt; 8 &lt;/span&gt;    &lt;span class="kn"&gt;index&lt;/span&gt; &lt;span class="s"&gt;index.html&lt;/span&gt; &lt;span class="s"&gt;index.htm&lt;/span&gt; &lt;span class="s"&gt;index.php&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 9 &lt;/span&gt;
&lt;span class="lineno"&gt;10 &lt;/span&gt;    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;11 &lt;/span&gt;
&lt;span class="lineno"&gt;12 &lt;/span&gt;    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt;13 &lt;/span&gt;        &lt;span class="c1"&gt;# First attempt to serve request as file, then&lt;/span&gt;
&lt;span class="lineno"&gt;14 &lt;/span&gt;        &lt;span class="c1"&gt;# as directory, then fall back to displaying a 404.&lt;/span&gt;
&lt;span class="lineno"&gt;15 &lt;/span&gt;        &lt;span class="kn"&gt;try_files&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt; &lt;span class="nv"&gt;$uri/&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;16 &lt;/span&gt;    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="lineno"&gt;17 &lt;/span&gt;    &lt;span class="kn"&gt;include&lt;/span&gt; &lt;span class="s"&gt;php.conf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;18 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A restart of nginx is then necessary to take the new configuration into account:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service nginx restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://www.guillaume-leduc.fr/projet-installation-configuration-nginx-php-fpm.html"&gt;Installation et configuration de Nginx et PHP-FPM pour CakePHP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://nl3.php.net/manual/en/install.fpm.php"&gt;FastCGI Process Manager (FPM)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="nginx"></category><category term="Debian"></category><category term="PHP"></category></entry><entry><title>Two factor authentication</title><link href="https://blog.tblein.eu/server/2016/two-factor-authentication/" rel="alternate"></link><published>2016-08-15T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-15:server/2016/two-factor-authentication/</id><summary type="html">&lt;p&gt;One time password are now spread in a lot of web services. They are valid only
for a session and therefore even if intercept they can be used only once. Two
methods are normalised by the &lt;a class="reference external" href="http://www.openauthentication.org/"&gt;Initiative For Open Authentication&lt;/a&gt; (OATH):&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;time based one-time password algorithm (TOTP) that is based on the combination
of time and a shared secret to generate the unique password.&lt;/li&gt;
&lt;li&gt;HMAC-based one-time password algorithm (HOTP) that is based on the combination
of number of connection and a shared secret to generate the unique password.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To be able to use it, the user will need to have an application most of the time
on her phone that generate the code asked by the server.  The two algorithms are
freely available as open standard and therefore numerous application are
available to use them. The most known one is &lt;a class="reference external" href="https://github.com/google/google-authenticator"&gt;Google Authenticator&lt;/a&gt; That provide both a PAM
module (for the setting on the server) and a phone application (for the user).
However other phone application are available such as &lt;a class="reference external" href="https://fedorahosted.org/freeotp/"&gt;FreeOTP&lt;/a&gt;&lt;/p&gt;
&lt;div class="section" id="installation-of-the-pam-module"&gt;
&lt;h2&gt;Installation of the PAM module&lt;/h2&gt;
&lt;p&gt;Google developed a PAM module implementing the OATH-TOTP and OATH-HOTP. Its
installation and configuration is simple. Since it is available in Debian
repository to install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt install libpam-google-authenticator
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After installation to use it on any PAM authentication module you need to a open
the correct file and add the following line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;auth required pam_google_authenticator.so nullok
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;nullok&lt;/code&gt; parameter allow the connection of the user without two factor
authentication setup to connect normally.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="activation-for-su"&gt;
&lt;h2&gt;Activation for &lt;code&gt;su&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Only need to madify the su PAM module in &lt;code&gt;/etc/pam.d/su&lt;/code&gt;. Add the
pam_google_authenticator line after pam_rootok.so&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# This allows root to su without passwords (normal operation)
auth       sufficient pam_rootok.so
auth       required     pam_google_authenticator.so nullok
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="activation-for-ssh-server"&gt;
&lt;h2&gt;Activation for SSH server&lt;/h2&gt;
&lt;p&gt;First configure SSH PAM authentication module in &lt;code&gt;/etc/pam.d/sshd&lt;/code&gt;. Had at
the end of the file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;auth required pam_google_authenticator.so nullok
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt; change the value of
&lt;code&gt;ChallengeResponseAuthentication&lt;/code&gt; from &lt;code&gt;no&lt;/code&gt; to &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication yes
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By default the authentication will be managed as follow:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;User that connect with a SSH key will log as usual&lt;/li&gt;
&lt;li&gt;User that log with a password will in addition need to respond to a OTP
challenge.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; ssh user@server
&lt;span class="go"&gt;Password:&lt;/span&gt;
&lt;span class="go"&gt;Verification code:&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-totp-for-an-user"&gt;
&lt;h2&gt;Setting TOTP for an user&lt;/h2&gt;
&lt;p&gt;We will see here how to setup TOTP parameter for an user. It will be used by any
PAM module where &lt;code&gt;pam_google_authenticator&lt;/code&gt; is activated.&lt;/p&gt;
&lt;p&gt;Login as the desired user and run &lt;code&gt;google-authenticator&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; google-authenticator

&lt;span class="go"&gt;Do you want authentication tokens to be time-based (y/n)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Answer &lt;cite&gt;yes&lt;/cite&gt; to the first question to have time based on one time password
(TOTP) or no to get HMAC-based one time password (HOTP). It will generate the
shared code and display in your console a QR code ready to be scanned by your
phone. If not displayed, you can open the link given to open the QR code. An
example output:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;https://www.google.com/chart?chs=200x200&amp;amp;chld=M|0&amp;amp;cht=qr&amp;amp;chl=otpauth://totp/user@server%3Fsecret%&lt;/span&gt;3DHENVXKRO4RFDSRDK

&lt;span class="go"&gt;Your new secret key is: HENVXKRO4RFDSRDK&lt;/span&gt;
&lt;span class="go"&gt;Your verification code is 580768&lt;/span&gt;
&lt;span class="go"&gt;Your emergency scratch codes are:&lt;/span&gt;
&lt;span class="go"&gt;28520578&lt;/span&gt;
&lt;span class="go"&gt;41297079&lt;/span&gt;
&lt;span class="go"&gt;99231833&lt;/span&gt;
&lt;span class="go"&gt;99978459&lt;/span&gt;
&lt;span class="go"&gt;29834705&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In addition to the key it give you a verification code. This is the code
generated at the time of QR code generation to be sure that is correctly
entered. It give you also 5 emergency scratch codes that can be used at any time
to login. They need of course to stored in a safe place.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Do you want me to update your &amp;quot;/home/user/.google_authenticator&amp;quot; file (y/n)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Answer &lt;cite&gt;yes&lt;/cite&gt; to allow the module to setup the needed file for the
authentication. Your secret key the different parameters and the emergency
scratch codes will be saved in this file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Do you want to disallow multiple uses of the same authentication&lt;/span&gt;
&lt;span class="go"&gt;token? This restricts you to one login about every 30s, but it increases&lt;/span&gt;
&lt;span class="go"&gt;your chances to notice or even prevent man-in-the-middle attacks (y/n)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Answer &lt;cite&gt;yes&lt;/cite&gt; to allow only one utilisation of each password. It will block you
to login twice in less than 30 seconds (default time resolution for password
generation).&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;By default, tokens are good for 30 seconds and in order to compensate for&lt;/span&gt;
&lt;span class="go"&gt;possible time-skew between the client and the server, we allow an extra&lt;/span&gt;
&lt;span class="go"&gt;token before and after the current time. If you experience problems with poor&lt;/span&gt;
&lt;span class="go"&gt;time synchronization, you can increase the window from its default&lt;/span&gt;
&lt;span class="go"&gt;size of 1:30min to about 4min. Do you want to do so (y/n)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Answer &lt;cite&gt;no&lt;/cite&gt;, the allowed timing of the password will be +/- 30 seconds. For most
of the case it will be largely sufficient.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;If the computer that you are logging into isn&amp;#39;t hardened against brute-force&lt;/span&gt;
&lt;span class="go"&gt;login attempts, you can enable rate-limiting for the authentication module.&lt;/span&gt;
&lt;span class="go"&gt;By default, this limits attackers to no more than 3 login attempts every 30s.&lt;/span&gt;
&lt;span class="go"&gt;Do you want to enable rate-limiting (y/n) y&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Answer &lt;cite&gt;yes&lt;/cite&gt;, it does not cost so much to strength the access even if the server
already have some protection against brute force attack (like fail2ban).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-14-04"&gt;How To Set Up Multi-Factor Authentication for SSH on Ubuntu 14.04&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://en.wikipedia.org/wiki/One-time_password"&gt;One-time password&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://changelog.complete.org/archives/9707-easily-improving-linux-security-with-two-factor-authentication"&gt;Easily Improving Linux Security with Two-Factor Authentication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="su"></category><category term="SSH"></category><category term="Debian"></category><category term="authentication"></category><category term="OATH-TOTP"></category><category term="OATH-HOTP"></category></entry><entry><title>Nginx as a proxy</title><link href="https://blog.tblein.eu/server/2016/nginx-as-a-proxy/" rel="alternate"></link><published>2016-08-13T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-13:server/2016/nginx-as-a-proxy/</id><summary type="html">&lt;p&gt;We will see how to setup Nginx as a proxy to other web server. I used this
configuration while transiting from lighttpd to Nginx. After installing Nginx
I setup it to redirect all the web traffic to the lighttpd serrver. The aimed is
to switch gradually from Nginx to lighttpd the different services served by
lighttpd we as little interruption as possible.&lt;/p&gt;
&lt;div class="section" id="setup-of-the-proxy-for-web-traffic"&gt;
&lt;h2&gt;Setup of the proxy for web traffic&lt;/h2&gt;
&lt;p&gt;An example of configuration file to transfer all request on port 80 to an other
web server listening on port 8080.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt; 1 &lt;/span&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt; 2 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 3 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="s"&gt;[::]:80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 4 &lt;/span&gt;    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt; 5 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt;  &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 6 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-For&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 7 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 8 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt;
&lt;span class="lineno"&gt; 9 &lt;/span&gt;        &lt;span class="s"&gt;http://127.0.0.1:8080/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;10 &lt;/span&gt;    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="lineno"&gt;11 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;proxy_set_header Host&lt;/code&gt; allow to tranfer address at which the proxy
had been reach. Therefore, if the server listening on port 8080 as virtualhost
they will work.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setup-of-the-proxy-for-encrypted-web-traffic"&gt;
&lt;h2&gt;Setup of the proxy for encrypted web traffic&lt;/h2&gt;
&lt;p&gt;This is an enhancement of the previous one that redirect the traffic of port 443
to a https server listening on port 8081. In our case the TLS encrypted
connection is setup on the proxy and the web server with letsencrypt and use the
same certificates.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt; 1 &lt;/span&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt; 2 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 3 &lt;/span&gt;    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="s"&gt;[::]:443&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 4 &lt;/span&gt;    &lt;span class="kn"&gt;ssl&lt;/span&gt; &lt;span class="no"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 5 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_protocols&lt;/span&gt; &lt;span class="s"&gt;TLSv1.2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 6 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_certificate&lt;/span&gt; &lt;span class="s"&gt;/etc/letsencrypt/live/mydomain.tld/fullchain.pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 7 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="s"&gt;/etc/letsencrypt/live/mydomain.tld/privkey.pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 8 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_dhparam&lt;/span&gt; &lt;span class="s"&gt;/etc/ssl/certs/dhparam.pem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt; 9 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_ecdh_curve&lt;/span&gt; &lt;span class="s"&gt;secp384r1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;10 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_prefer_server_ciphers&lt;/span&gt; &lt;span class="no"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;11 &lt;/span&gt;    &lt;span class="kn"&gt;ssl_ciphers&lt;/span&gt; &lt;span class="s"&gt;EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;12 &lt;/span&gt;    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt;13 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;14 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-For&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;15 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;16 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class="nv"&gt;$scheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;17 &lt;/span&gt;        &lt;span class="kn"&gt;add_header&lt;/span&gt; &lt;span class="s"&gt;Front-End-Https&lt;/span&gt; &lt;span class="no"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;18 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;https://127.0.0.1:8081/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;19 &lt;/span&gt;        &lt;span class="kn"&gt;proxy_redirect&lt;/span&gt; &lt;span class="no"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="lineno"&gt;20 &lt;/span&gt;    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="lineno"&gt;21 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://homeserver-diy.net/wiki/index.php?title=Utilisation_d%27Nginx_comme_reverse_proxy_avec_un_certificat_auto-sign%C3%A9,_Let%27s_Encrypt_et_un_chiffrement_fort"&gt;Utilisation d'Nginx comme reverse proxy avec un certificat auto-signé, Let's
Encrypt et un chiffrement fort&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Debian"></category><category term="Web"></category><category term="nginx"></category><category term="proxy"></category><category term="SSL"></category></entry><entry><title>Automatic deployment of pelican website with GitLab</title><link href="https://blog.tblein.eu/server/2016/automatic-deployment-of-pelican-website-with-gitlab/" rel="alternate"></link><published>2016-08-03T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-03:server/2016/automatic-deployment-of-pelican-website-with-gitlab/</id><summary type="html">&lt;p&gt;Using static site generator like &lt;a class="reference external" href="http://docs.getpelican.com"&gt;Pelican&lt;/a&gt;
involved to rebuild it each time you modify it. Modern software forge like
&lt;a class="reference external" href="https://about.gitlab.com/"&gt;GitLab&lt;/a&gt; are able not only to manage code
repositories but also make some continuous integration. Therefore they are able
to run some command after each commit such as test, or build. In our case we
will see how to rebuild and deploy our pelican website at each commit.&lt;/p&gt;
&lt;p&gt;You will need to have functional installation of GitLab and GitLab Runner with
Docker. In addition we suppose that the required python are in the
&lt;code&gt;requirements.txt&lt;/code&gt; file. The build and deployment will be managed with the
make and therefore the Pelican generated &lt;code&gt;Makefile&lt;/code&gt; should be correctly
setup and notably the SCP parameters that will be used.&lt;/p&gt;
&lt;div class="section" id="create-a-runner"&gt;
&lt;h2&gt;Create a runner&lt;/h2&gt;
&lt;p&gt;If not already done, you will need to setup a runner for the project:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; gitlab-runner register
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Put the address of the coordinator. If GitLab is accessible trough &lt;a class="reference external" href="http://gitlab.com"&gt;http://gitlab.com&lt;/a&gt;,
it should be something like &lt;a class="reference external" href="http://gitlab.com/ci"&gt;http://gitlab.com/ci&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter then the token that will link GitLab and the runner:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;If you would like to have a shared runner go to the &lt;cite&gt;Admin Area&lt;/cite&gt;, then
&lt;cite&gt;Overview&lt;/cite&gt; and finally &lt;cite&gt;Runners&lt;/cite&gt;, to get the token.&lt;/li&gt;
&lt;li&gt;If you prefer to have a runner for the project, go in the configuration menu
of the projects and select &lt;cite&gt;Runners&lt;/cite&gt; and use the token of the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Give a name to your runner and eventually some tags.&lt;/p&gt;
&lt;p&gt;Specify the executor as &lt;code&gt;docker&lt;/code&gt; and the docker image as
&lt;code&gt;python:2.7&lt;/code&gt;. This docker image not only include python but also some
development tools such as GNU Make.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="deployment"&gt;
&lt;h2&gt;Deployment&lt;/h2&gt;
&lt;p&gt;Here are the different steps for the deployment.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Clone the repository.&lt;/li&gt;
&lt;li&gt;First install dependencies with the help of pip and the
&lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Setup a SSH configuration directory with correct POSIX right (&lt;code&gt;~/.ssh&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Get the SSH public key of the server and had it to known_hosts with the
&lt;code&gt;ssh-keyscan&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;Create the required private key files (from &lt;code&gt;SSH_PRIVATE_KEY&lt;/code&gt;
environment variable). This will allow us to have it outside of the repository
and therefore secret.&lt;/li&gt;
&lt;li&gt;Generate pelican and upload to the ssh server with the help of &lt;code&gt;make&lt;/code&gt;
command.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="setup-of-the-private-ssh-key"&gt;
&lt;h3&gt;Setup of the private SSH key&lt;/h3&gt;
&lt;p&gt;To avoid to have the private SSH key in the repository and therefore able to be
read by everybody accessing it, we will save it in a GitLab Internal variable.&lt;/p&gt;
&lt;p&gt;Put the content of the private key in a variable named &lt;code&gt;SSH_PRIVATE_KEY&lt;/code&gt;.
For this in the configuration menu of the project select &lt;cite&gt;Variables&lt;/cite&gt; and create
a new one with the name &lt;cite&gt;SSH_PRIVATE_KEY&lt;/cite&gt; and put the content of &lt;code&gt;id_rsa&lt;/code&gt;
corresponding that is in between the &lt;code&gt;-----BEGIN RSA PRIVATE KEY-----&lt;/code&gt; and
&lt;code&gt;-----END RSA PRIVATE KEY-----&lt;/code&gt; as a value. This variables will be
specific to the project and available in the build environment. We will need to
past this key in the correct file to be able to use it for SSH connection.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-the-continuous-integration"&gt;
&lt;h3&gt;Configuration of the continuous integration&lt;/h3&gt;
&lt;p&gt;We will create a Gitlab continuous integration configuration file
(&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;) at the root of the repository. It is automatically
reconnised by GitLab. The file is inspired from the one proposed by GitLab.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;image&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;python:2&lt;/span&gt;

&lt;span class="l l-Scalar l-Scalar-Plain"&gt;pages&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="l l-Scalar l-Scalar-Plain"&gt;script&lt;/span&gt;&lt;span class="p p-Indicator"&gt;:&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;pip install -r requirements.txt&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;mkdir -p ~/.ssh&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;chmod 700 ~/.ssh&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;ssh-keyscan -t rsa domaine.tld &amp;gt; ~/.ssh/known_hosts&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;echo &amp;quot;-----BEGIN RSA PRIVATE KEY-----&amp;quot; &amp;gt; ~/.ssh/id_rsa&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;echo &amp;quot;$SSH_PRIVATE_KEY&amp;quot; &amp;gt;&amp;gt; ~/.ssh/id_rsa&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;echo &amp;quot;-----END RSA PRIVATE KEY-----&amp;quot; &amp;gt;&amp;gt; ~/.ssh/id_rsa&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;chmod 600 ~/.ssh/id_rsa&lt;/span&gt;
  &lt;span class="p p-Indicator"&gt;-&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;make ssh_upload&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://gitlab.com/pages/pelican"&gt;pages / pelican&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="GitLab"></category><category term="pelican"></category><category term="deploy"></category><category term="Debian"></category><category term="Docker."></category></entry><entry><title>Gitlab-runner installation</title><link href="https://blog.tblein.eu/server/2016/gitlab-runner-installation/" rel="alternate"></link><published>2016-08-03T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-08-03:server/2016/gitlab-runner-installation/</id><summary type="html">&lt;div class="section" id="installation-of-docker"&gt;
&lt;h2&gt;Installation of Docker&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://docs.docker.com/engine/installation/linux/debian/"&gt;https://docs.docker.com/engine/installation/linux/debian/&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="install-gitlab-ci-multi-runner"&gt;
&lt;h2&gt;Install gitlab-ci-multi-runner&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-repository.md"&gt;https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-repository.md&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add gitlab-runner user to docker group:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; gpasswd -a gitlab-runner docker
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Restart Docker service:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service docker restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="create-a-runner"&gt;
&lt;h2&gt;Create a runner&lt;/h2&gt;
&lt;p&gt;Register a runner&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; gitlab-runner register
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Put the address of the coordinator. If Gitlab is accessible trough &lt;a class="reference external" href="http://gitlab.com"&gt;http://gitlab.com&lt;/a&gt;,
it should be something like &lt;a class="reference external" href="http://gitlab.com/ci"&gt;http://gitlab.com/ci&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter then the token that will link Gitlab and the runner:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;If you would like to have a shared runner go to the &lt;cite&gt;Admin Area&lt;/cite&gt;, then
&lt;cite&gt;Overview&lt;/cite&gt; and finally &lt;cite&gt;Runners&lt;/cite&gt;, to get the token.&lt;/li&gt;
&lt;li&gt;If you prefer to have a runner for the project, go in the configuration menu
of the projects and select &lt;cite&gt;Runners&lt;/cite&gt; and use the token of the project.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Give a name to your runner and eventually some tags.&lt;/p&gt;
&lt;p&gt;Specify the executor as &lt;code&gt;docker&lt;/code&gt; and the docker image as &lt;code&gt;python:2&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="Git Lab"></category><category term="Git Lab Runner"></category><category term="deploy"></category><category term="Debian"></category></entry><entry><title>Easy firewall with ferm</title><link href="https://blog.tblein.eu/server/2016/Easy-firewall-with-ferm/" rel="alternate"></link><published>2016-07-27T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-27:server/2016/Easy-firewall-with-ferm/</id><summary type="html">&lt;p&gt;It is a simplify interface to &lt;code&gt;iptable&lt;/code&gt;, it allow therefore to configure
the firewall with rules easier to read than iptable ones.&lt;/p&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt install ferm
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration"&gt;
&lt;h2&gt;Configuration&lt;/h2&gt;
&lt;p&gt;The configuration takes place in the &lt;code&gt;/etc/ferm/ferm.conf&lt;/code&gt; file. By
default, only port 22 is open allowing SSH connexions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;proto&lt;/span&gt; &lt;span class="n"&gt;tcp&lt;/span&gt; &lt;span class="n"&gt;dport&lt;/span&gt; &lt;span class="n"&gt;ssh&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To open port you only need to enter similar rules. Port can be specified by its
number or by the name of the service that it is associated with it. To
determined the name of the service associated with a port you just have to look
inside the &lt;code&gt;/etc/services&lt;/code&gt; file.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://ferm.foo-projects.org"&gt;ferm - for Easy Rule Making&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="firewall"></category><category term="ferm"></category></entry><entry><title>Executing a command at login</title><link href="https://blog.tblein.eu/server/2016/Executing-a-command-at-login/" rel="alternate"></link><published>2016-07-26T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-26:server/2016/Executing-a-command-at-login/</id><summary type="html">&lt;p&gt;Under Linux, the connexion is handle by the PAM (Pluggable Authentication
Modules) authentication system. As is name said it, the functionality are spread
in different modules like authentication backend (like LDAP, NSS) or action to
do at connexion (like folder mounting).&lt;/p&gt;
&lt;div class="section" id="pam-exec"&gt;
&lt;h2&gt;pam_exec&lt;/h2&gt;
&lt;p&gt;The &lt;a class="reference external" href="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/sag-pam_exec.html"&gt;pam_exec&lt;/a&gt;
module allows to execute an arbitrary command while connecting. Therefore it is
possible to do what ever we want.&lt;/p&gt;
&lt;p&gt;To activate it you only need to add the following line in your
&lt;code&gt;/etc/pam.d/common-session&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;span class="err"&gt;session&lt;/span&gt;    &lt;span class="err"&gt;optional&lt;/span&gt;     &lt;span class="err"&gt;pam_exec.so&lt;/span&gt;    &lt;span class="err"&gt;command&lt;/span&gt;
&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;command&lt;/code&gt; by the name of the command to execute.&lt;/p&gt;
&lt;p&gt;Several environments variables are set so that can be used inside the program:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;$PAM_TYPE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_USER&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_RUSER&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_RHOST&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_SERVICE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_TTY&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="email-notification-of-a-connexion"&gt;
&lt;h2&gt;Email notification of a connexion&lt;/h2&gt;
&lt;p&gt;One of the classical function of this module is to send an email notification
while a user is login. For this we will create the
&lt;code&gt;/usr/local/bin/send-mail-on-login.sh&amp;gt;&lt;/code&gt; script with the following
functionality :
- only work at the opening of new connexions
- only for a limited number of user (for example &lt;code&gt;admin&lt;/code&gt; and &lt;code&gt;root&lt;/code&gt;)
- send by email the connexion information to the administrator (&lt;code&gt;admin&lt;/code&gt;)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;([&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_TYPE&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;open_session&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="o"&gt;([&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;root&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
     &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;admin&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]))&lt;/span&gt;
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;User: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Remote Host: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_RHOST&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Service: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_SERVICE&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;TTY: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_TTY&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Date: `date`&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Server: `uname -a`&amp;quot;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; mail -s &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_SERVICE&lt;/span&gt;&lt;span class="s2"&gt; login on `hostname -s` for account &lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; root
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Do not forget to let the script executable by running the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod + x /usr/local/bin/send-mail-on-login.sh
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And to modify &lt;code&gt;/etc/pam.d/common-session&lt;/code&gt; file accordingly:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;span class="err"&gt;session&lt;/span&gt;    &lt;span class="err"&gt;optional&lt;/span&gt;     &lt;span class="err"&gt;pam_exec.so&lt;/span&gt;    &lt;span class="err"&gt;/usr/local/bin/send-mail-on-login.sh&lt;/span&gt;
&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now at each connexion of &lt;code&gt;root&lt;/code&gt; or &lt;code&gt;admin&lt;/code&gt;, an email will be send to
the administrator. For example after a ssh connexion of &lt;code&gt;admin&lt;/code&gt; the
administrator will receive a email like the following one:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;User: admin&lt;/span&gt;
&lt;span class="go"&gt;Remote Host: dslb-000-000-000-000.pools.arcor-ip.net&lt;/span&gt;
&lt;span class="go"&gt;Service: sshd&lt;/span&gt;
&lt;span class="go"&gt;TTY: ssh&lt;/span&gt;
&lt;span class="go"&gt;Date: mercredi 22 juin 2011, 22:46:38 (UTC+0200)&lt;/span&gt;
&lt;span class="go"&gt;Server: Linux test 2.6.32-5-amd64 #1 SMP Mon Mar 7 21:35:22 UTC 2011 x86_64 GNU/Linux&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://linux-attitude.fr/post/pam_exec"&gt;Scripting avec pam_exec, notification de connexion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="connection"></category><category term="PAM"></category><category term="mail"></category></entry><entry><title>LDAP authentication for lighttpd</title><link href="https://blog.tblein.eu/server/2016/LDAP-authentication-for-lighttpd/" rel="alternate"></link><published>2016-07-26T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-26:server/2016/LDAP-authentication-for-lighttpd/</id><summary type="html">&lt;p&gt;Like a lot of web server, lighttpd can directly protect the access at certain
pages or full folders by a password. This password protection is independent of
web application that is protected like this. It's append before any access to
the web pages and therefore of the application. The login/password couple can be
set manually or looked inside a database. We will see here how to link with
a LDAP database.&lt;/p&gt;
&lt;div class="section" id="configuration-of-ldap-authentication"&gt;
&lt;h2&gt;Configuration of LDAP authentication&lt;/h2&gt;
&lt;p&gt;To setup our configuration, we will modify (or create if absent) the file
&lt;code&gt;/etc/lighttpd/conf-available/05-auth.conf&lt;/code&gt;. First we need to configure
the authentication mechanism. Here, it will be LDAP. All reference to other
authentication mechanism such as &lt;code&gt;plain&lt;/code&gt; should be removed:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;server.modules&lt;/span&gt;                &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_auth&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;auth.backend&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ldap&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.hostname&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.base-dn&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ou=People,dc=mydomain,dc=com&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.filter&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;(uid=$)&amp;quot;&lt;/span&gt;

&lt;span class="k"&gt;auth.backend.ldap.bind-dn&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;cn=user,dc=mydomain,dc=com&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.bind-pw&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;secret&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.hostname&lt;/code&gt;: server address&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.base-dn&lt;/code&gt;: tree were are the user saved&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.filter&lt;/code&gt;: filter to apply to obtain the users&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.bind-dn&lt;/code&gt;: login to use to bind to LDAP server&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.bind-pw&lt;/code&gt;: associated password&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;auth.backend.ldap.bind-dn&lt;/code&gt; and :code`auth.backend.ldap.bind-pw`
parameters are only necessary if the LDAP server require a specific account to
be able to access the different informations.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-folders-to-protect"&gt;
&lt;h2&gt;Configuration of folders to protect&lt;/h2&gt;
&lt;p&gt;Then we need to configure the folder that need to be protected by a password.
For example tout protect the contain of the two folder
&lt;code&gt;/repertoire_securise&lt;/code&gt;  and &lt;code&gt;/autre_repertoire_securise&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;auth.require&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/repertoire_securise/&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Password protected area 1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;valid-user&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="s2"&gt;&amp;quot;/autre_repertoire_securise/&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Password protected area 2&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;user=admin1|user=admin2&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Other folders could be added to the list likewise.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;method&lt;/code&gt;: method type asked to the browser for authentication
&lt;code&gt;basic&lt;/code&gt;, &lt;code&gt;plain&lt;/code&gt;, &lt;code&gt;digest&lt;/code&gt; or &lt;code&gt;htdigest&lt;/code&gt;. LDAP
authentication in Debian only work with basic (various error for the others)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;realm&lt;/code&gt;: Message to display in the connexion dialog box.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;require&lt;/code&gt;: limitation to some user; a list of users separated by
&lt;code&gt;|&lt;/code&gt; or &lt;code&gt;valid-user&lt;/code&gt; for any user of the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-activation"&gt;
&lt;h2&gt;Configuration activation&lt;/h2&gt;
&lt;p&gt;Like all configuration of lighttpd, to activate it you need to create a symbolic
link to the configuration file in &lt;code&gt;/etc/lighttpd/conf-enable&lt;/code&gt; and to
restart lighttpd:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ln -s /etc/lighttpd/conf-available/05-auth.conf /etc/lighttpd/conf-enabled/
&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/lighttpd restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModAuth"&gt;Module mod_auth - Using Authentication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Debian"></category><category term="LDAP"></category><category term="authentication"></category></entry><entry><title>PHP activation for lighttpd</title><link href="https://blog.tblein.eu/server/2016/PHP-activation-for-lighttpd/" rel="alternate"></link><published>2016-07-26T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-26:server/2016/PHP-activation-for-lighttpd/</id><summary type="html">&lt;p&gt;We will see how to let lighttpd execute PHP scripts and display their results
instead of their content.&lt;/p&gt;
&lt;div class="section" id="fastcgi-configuration-of-php5"&gt;
&lt;h2&gt;FastCGI configuration of PHP5&lt;/h2&gt;
&lt;p&gt;To execute PHP scripts, lighttpd can use the standardised interface CGI that is
used by web servers. It is an interface that allow easily the exchange between
a web server and a rending engine. Two version of this interface are available
in lighttpd, the classic one (CGI) and rapid one (FastCGI). We will use that
latest in our configuration.&lt;/p&gt;
&lt;p&gt;We will start by installing the CGI version of PHP5&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install php5-cgi
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The configuration take place in the
&lt;code&gt;/etc/lighttpd/conf-available/10-fastcgi.conf&lt;/code&gt; file. It should look like
the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_fastcgi&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;fastcgi.server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.php&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;
                     &lt;span class="s2"&gt;&amp;quot;bin-path&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/php-cgi&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="s2"&gt;&amp;quot;socket&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/tmp/php.socket&amp;quot;&lt;/span&gt;
                 &lt;span class="p"&gt;)))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The first line activate FastCGI. The rest associates the file that have
a &lt;code&gt;.php&lt;/code&gt; extension to PHP and render them using the CGI version of PHP5.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-activation"&gt;
&lt;h2&gt;Configuration activation&lt;/h2&gt;
&lt;p&gt;To activate the configuration you only need to create a symbolic link of that
file in &lt;code&gt;/etc/lighttpd/conf-enable&lt;/code&gt; folder:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A restart of lighttpd is then necessary to take the new configuration into account:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service lighttpd restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Debian"></category><category term="PHP"></category></entry><entry><title>Authentification via LDAP pour lighttpd</title><link href="https://blog.tblein.eu/server/2016/LDAP-authentication-for-lighttpd/index-fr.html" rel="alternate"></link><published>2016-07-26T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-26:server/2016/LDAP-authentication-for-lighttpd/index-fr.html</id><summary type="html">&lt;p&gt;Comme n'importe quel serveur web il est possible, avec lighttpd, de protéger
directement l'accès à certaines pages ou répertoires entier par un mot de passe.
Cette protection par mot de passe est indépendante de l'application web
sous-jacente. Elle s'effectue avant tout accès à la page et donc
à l'application. L'association login/mot de passe peut être faite manuellement
ou cherché dans une base de donnée. Nous allons voir ici comme faire cette
recherche dans une base LDAP.&lt;/p&gt;
&lt;div class="section" id="configuration-de-l-authentification-ldap"&gt;
&lt;h2&gt;Configuration de l'authentification LDAP&lt;/h2&gt;
&lt;p&gt;Nous allons effectué notre configuration dans le fichier
&lt;code&gt;/etc/lighttpd/conf-available/05-auth.conf&lt;/code&gt;. Il faut d'abord configurer
par quel mécanisme l'authentification va se faire. Dans le cas présenté ici, il
s'agira de l'utilisation de LDAP. Toute référence à un autre système
d'authentification comme &lt;code&gt;plain&lt;/code&gt; doit être commenté:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;server.modules&lt;/span&gt;                &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_auth&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;auth.backend&lt;/span&gt;                 &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ldap&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.hostname&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.base-dn&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ou=People,dc=mydomain,dc=com&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.filter&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;(uid=$)&amp;quot;&lt;/span&gt;

&lt;span class="k"&gt;auth.backend.ldap.bind-dn&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;cn=user,dc=mydomain,dc=com&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;auth.backend.ldap.bind-pw&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;secret&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.hostname&lt;/code&gt;: adresse du serveur&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.base-dn&lt;/code&gt;: arbre où sont stockés les utilisateurs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.filter&lt;/code&gt;: filtre à appliquer pour obtenir les utilisateurs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.bind-dn&lt;/code&gt;: identifiant à utiliser pour se connecter au serveur LDAP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;auth.backend.ldap.bind-pw&lt;/code&gt;: le mot de passe associé&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Les paramètres &lt;code&gt;auth.backend.ldap.bind-dn&lt;/code&gt; et
:code`auth.backend.ldap.bind-pw` ne sont nécessaires que si le serveur LDAP
requiert un compte pour pouvoir lire les différentes informations.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-des-repertoires-a-proteger"&gt;
&lt;h2&gt;Configuration des répertoires à protéger&lt;/h2&gt;
&lt;p&gt;Il convient ensuite de configurer les répertoire qui doivent être sous le
contrôle de mot de passe. Par exemple pour protéger le contenu de deux
répertoires &lt;code&gt;/repertoire_securise&lt;/code&gt; et &lt;code&gt;/autre_repertoire_securise&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;auth.require&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/repertoire_securise/&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Password protected area 1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;valid-user&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="s2"&gt;&amp;quot;/autre_repertoire_securise/&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Password protected area 2&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;user=admin1|user=admin2&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;D'autre répertoire peuvent êtres ajouté à le liste de la même façon.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;method&lt;/code&gt;: type de méthode demandé au navigateur pour l'authentification
basic, plain, digest ou htdigest. L'authentification LDAP sous Debian ne
marche qu'avec basic (erreur diverse pour les autres: non gestion pour plain
et digest)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;realm&lt;/code&gt;: message affiché dans la boite de dialogue de connection.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;require&lt;/code&gt;: limitation sur les utilisateurs: une liste d'utilisateur
séparés par &lt;code&gt;|&lt;/code&gt; ou &lt;code&gt;valid-user&lt;/code&gt; pour n'importe quel utilisateur de
la base.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="activation-de-la-configuration"&gt;
&lt;h2&gt;Activation de la configuration&lt;/h2&gt;
&lt;p&gt;Comme pour toutes les configurations de lighttpd, pour l'activer il convient de
créer un lien vers le fichier de configuration dans le répertoire
&lt;code&gt;/etc/lighttpd/conf-enable&lt;/code&gt; et de redémarrer lighttpd:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ln -s /etc/lighttpd/conf-available/05-auth.conf /etc/lighttpd/conf-enabled/
&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/lighttpd restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModAuth"&gt;Module mod_auth - Using Authentication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Debian"></category><category term="LDAP"></category><category term="authentication"></category></entry><entry><title>Activation de PHP pour lighttpd</title><link href="https://blog.tblein.eu/server/2016/PHP-activation-for-lighttpd/index-fr.html" rel="alternate"></link><published>2016-07-26T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-26:server/2016/PHP-activation-for-lighttpd/index-fr.html</id><summary type="html">&lt;p&gt;Nous allons voir comment faire pour que lighttpd exécute les scripts PHP et
affiche leur résultat au lieu de leur contenu.&lt;/p&gt;
&lt;div class="section" id="configuration-de-php5-en-fastcgi"&gt;
&lt;h2&gt;Configuration de PHP5 en FastCGI&lt;/h2&gt;
&lt;p&gt;Pour exécuter les scripts PHP, lighttpd peux utiliser l'interface standardisée
CGI utilisée par les serveurs web. C'est une interface qui permet l'échange
facile entre un serveur web et un moteur de rendu. Deux versions de cette
interface sont disponibles avec lighttpd: la classique (CGI) et une version
rapide (FastCGI). C'est cette dernière que nous allons utilisé.&lt;/p&gt;
&lt;p&gt;On commence par installer la version CGI de PHP5.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install php5-cgi
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La configuration se situe dans le fichier
&lt;code&gt;/etc/lighttpd/conf-available/10-fastcgi.conf&lt;/code&gt;. Il doit ressembler
à ceci&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_fastcgi&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;fastcgi.server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.php&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;
                     &lt;span class="s2"&gt;&amp;quot;bin-path&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/php-cgi&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="s2"&gt;&amp;quot;socket&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/tmp/php.socket&amp;quot;&lt;/span&gt;
                 &lt;span class="p"&gt;)))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La première ligne active FastCGI. Le reste associe les fichiers avec
l'extension &lt;code&gt;.php&lt;/code&gt; à PHP et les exécute  en utilisant la version CGI de
PHP5.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="activation-de-la-configuration"&gt;
&lt;h2&gt;Activation de la configuration&lt;/h2&gt;
&lt;p&gt;Pour l'activer il suffit de créer un lien de ce fichier dans le répertoire
&lt;code&gt;/etc/lighttpd/conf-enable&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Un redémarrage du serveur est ensuite nécessaire pour prendre en compte la
nouvelle configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service lighttpd restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Debian"></category><category term="PHP"></category></entry><entry><title>tar and archives manipulation</title><link href="https://blog.tblein.eu/client/2016/tar-and-archive-manipulation/" rel="alternate"></link><published>2016-07-25T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-25:client/2016/tar-and-archive-manipulation/</id><summary type="html">&lt;div class="section" id="archives-and-their-manipulation"&gt;
&lt;h2&gt;Archives and their manipulation&lt;/h2&gt;
&lt;p&gt;Archives files (&lt;code&gt;.tar&lt;/code&gt;) allow to group together files and folder and their
respective attributes in a single file.&lt;/p&gt;
&lt;p&gt;You have to note that the options of &lt;code&gt;tar&lt;/code&gt; utility can be passed without
the habitual preceding dash &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;
&lt;div class="section" id="general-options"&gt;
&lt;h3&gt;General options&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;f&lt;/code&gt; option (like &lt;em&gt;file&lt;/em&gt;) will be used to select the archive file to
use for the operation. If not specified, the data are written directly on
the &lt;code&gt;STDOUT&lt;/code&gt; (creation) and read from &lt;code&gt;STDIN&lt;/code&gt; (extraction).&lt;/p&gt;
&lt;p&gt;During the creation and extraction of archives the &lt;code&gt;v&lt;/code&gt; option (like
&lt;em&gt;verbose&lt;/em&gt;) allow the display of files that will be included/extracted by
&lt;code&gt;tar&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="creation"&gt;
&lt;h3&gt;Creation&lt;/h3&gt;
&lt;p&gt;To create the archive, you need to use the &lt;code&gt;c&lt;/code&gt; option (like &lt;em&gt;create&lt;/em&gt;).
Therefore to archive the &lt;code&gt;test&lt;/code&gt; folder in &lt;code&gt;test.tar&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cvf test.tar &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="extraction"&gt;
&lt;h3&gt;Extraction&lt;/h3&gt;
&lt;p&gt;The extraction itself use the &lt;code&gt;x&lt;/code&gt; option (like in &lt;em&gt;extract&lt;/em&gt;). Therefore to
extract the &lt;code&gt;test.tar&lt;/code&gt; archive :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar xvf test.tar
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="compressed-archives"&gt;
&lt;h2&gt;Compressed archives&lt;/h2&gt;
&lt;div class="section" id="gzip-compressed-archives"&gt;
&lt;h3&gt;&lt;code&gt;gzip&lt;/code&gt; compressed archives&lt;/h3&gt;
&lt;p&gt;The majority of archives are compressed and had the extension &lt;code&gt;.tar.gz&lt;/code&gt;.
They are archive files (&lt;code&gt;.tar&lt;/code&gt;) that are then compressed by the
&lt;code&gt;gzip&lt;/code&gt; utility (&lt;code&gt;.gz&lt;/code&gt;). Archive creation and extraction are done in
two successive steps. To facilitate the use of compression, &lt;code&gt;tar&lt;/code&gt; can
directly use &lt;code&gt;gzip&lt;/code&gt; with the &lt;code&gt;z&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;To compress at creation our folder in a compress archive &lt;code&gt;test.tar.gz&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar czvf test.tar.gz &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And to uncompress it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar xzvf test.tar.gz
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="other-compressions"&gt;
&lt;h3&gt;Other compressions&lt;/h3&gt;
&lt;p&gt;The archive files can be compressed by several compression algorithm. However,
&lt;code&gt;tar&lt;/code&gt; allow easily the use of some common algorithms by simply passing an
option as for &lt;code&gt;gzip&lt;/code&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;bzip2&lt;/code&gt;, with &lt;code&gt;j&lt;/code&gt; option (extension &lt;code&gt;.bzip2&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lzma&lt;/code&gt;, with &lt;code&gt;J&lt;/code&gt; option (extension &lt;code&gt;.xz&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lzip&lt;/code&gt;, with &lt;code&gt;--lzip&lt;/code&gt; option (extension &lt;code&gt;.lzip&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="automatic-detection-of-compression-algorithm"&gt;
&lt;h3&gt;Automatic detection of compression algorithm&lt;/h3&gt;
&lt;p&gt;To remember the different options for the different compression algorithms is
not always easy. &lt;code&gt;tar&lt;/code&gt; as a very nice option (&lt;code&gt;a&lt;/code&gt;) that allows
automatically to determine the right algorithm depending on the extension of the
file.&lt;/p&gt;
&lt;p&gt;Therefore to easily compress with &lt;code&gt;gzip&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cavf test.tar.gz &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or with &lt;code&gt;bzip2&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cavf test.tar.bzip2 &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</summary><category term="archives"></category><category term="tar"></category><category term="command line"></category><category term="compression"></category></entry><entry><title>tar et la manipulation d'archives</title><link href="https://blog.tblein.eu/client/2016/tar-and-archive-manipulation/index-fr.html" rel="alternate"></link><published>2016-07-25T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-25:client/2016/tar-and-archive-manipulation/index-fr.html</id><summary type="html">&lt;div class="section" id="les-archives-et-leur-manipulation"&gt;
&lt;h2&gt;Les archives et leur manipulation&lt;/h2&gt;
&lt;p&gt;Les fichiers d'archives (&lt;code&gt;.tar&lt;/code&gt;) permettent de regrouper un ensemble de
fichiers et répertoire ainsi que leurs attributs dans un seul fichier.&lt;/p&gt;
&lt;p&gt;Il est a noter que les options de l'utilitaire &lt;code&gt;tar&lt;/code&gt; ne sont pas
obligatoirement précédée du tiret &lt;code&gt;-&lt;/code&gt; habituel.&lt;/p&gt;
&lt;div class="section" id="options-communes"&gt;
&lt;h3&gt;Options communes&lt;/h3&gt;
&lt;p&gt;L'option &lt;code&gt;f&lt;/code&gt; (comme &lt;em&gt;file&lt;/em&gt;) quand a elle permet de spécifier le fichier de
l'archive à lire ou à écrire. Si elle n'est pas spécifiée, les données sont
écrites directement sur la &lt;code&gt;STDOUT&lt;/code&gt; (création) et lues à partir de
&lt;code&gt;STDIN&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Lors de la création et de la extraction de l'archive l'option &lt;code&gt;v&lt;/code&gt; (comme
&lt;em&gt;verbose&lt;/em&gt;) permet d'afficher les fichiers qui seront archivés ou extraits par
&lt;code&gt;tar&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="creation"&gt;
&lt;h3&gt;Création&lt;/h3&gt;
&lt;p&gt;Dans le cas de la création c'est l'option &lt;code&gt;c&lt;/code&gt; (comme &lt;em&gt;create&lt;/em&gt;) qui est
utilisée. Ainsi pour archiver le dossier &lt;code&gt;test&lt;/code&gt; dans l'archive
&lt;code&gt;test.tar&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cvf test.tar &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="extraction"&gt;
&lt;h3&gt;Extraction&lt;/h3&gt;
&lt;p&gt;L'extraction quand à elle fait appel à l'option &lt;code&gt;x&lt;/code&gt; (comme dans
&lt;em&gt;extract&lt;/em&gt;).  Ainsi pour extraire l'archive &lt;code&gt;test.tar&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar xvf test.tar
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="les-archives-compressees"&gt;
&lt;h2&gt;Les archives compressées&lt;/h2&gt;
&lt;div class="section" id="les-archives-compressees-avec-gzip"&gt;
&lt;h3&gt;Les archives compressées avec &lt;code&gt;gzip&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;La majorité des archives est compressée et possèdent l'extension
&lt;code&gt;.tar.gz&lt;/code&gt;.  Ce sont des fichiers d'archive (&lt;code&gt;.tar&lt;/code&gt;) qui sont ensuite
compressées par l'utilitaire &lt;code&gt;gzip&lt;/code&gt; (extension &lt;code&gt;.gz&lt;/code&gt;). La
création et extraction d'archives se font donc en deux étapes. Pour faciliter
l'utilisation de la compression, l'utilitaire &lt;code&gt;tar&lt;/code&gt; peut appeler
l'utilitaire &lt;code&gt;gzip&lt;/code&gt; via l'option &lt;code&gt;z&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Ainsi comme précédemment pour compressé notre dossier dans une archive
compressée par &lt;code&gt;gzip&lt;/code&gt; &lt;code&gt;test.tar.gz&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar czvf test.tar.gz &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Et pour la décompresser&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar xzvf test.tar.gz
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="les-autres-compressions"&gt;
&lt;h3&gt;Les autres compressions&lt;/h3&gt;
&lt;p&gt;Les fichiers d'archives peuvent être compressé par n'importe quel algorithme de
compression. Cependant &lt;code&gt;tar&lt;/code&gt; permet d'utiliser facilement quelques
algorithme de compression par simple passage d'option comme pour &lt;code&gt;gzip&lt;/code&gt; :&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;bzip2&lt;/code&gt;, avec l'option &lt;code&gt;j&lt;/code&gt; (extension &lt;code&gt;.bzip2&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lzma&lt;/code&gt;, avec l'option &lt;code&gt;J&lt;/code&gt; (extension &lt;code&gt;.xz&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lzip&lt;/code&gt;, avec l'option &lt;code&gt;--lzip&lt;/code&gt; (extension &lt;code&gt;.lzip&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="detection-automatique-de-l-algorithme-de-compression"&gt;
&lt;h3&gt;Détection automatique de l'algorithme de compression&lt;/h3&gt;
&lt;p&gt;Se souvenir des différents codes pour les différents algorithmes de compression
n'est pas toujours évident. &lt;code&gt;tar&lt;/code&gt; fourni une option (&lt;code&gt;a&lt;/code&gt;) qui permet
automatiquement de déterminer le bon algorithme en fonction de l'extension du
fichier.&lt;/p&gt;
&lt;p&gt;Ainsi pour compresser facilement en &lt;code&gt;gzip&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cavf test.tar.gz &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ou en &lt;code&gt;bzip2&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; tar cavf test.tar.bzip2 &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</summary><category term="archives"></category><category term="tar"></category><category term="command line"></category><category term="compression"></category></entry><entry><title>Serving Mercurial repositories trough lighttpd</title><link href="https://blog.tblein.eu/server/2016/hg_lighttpd/" rel="alternate"></link><published>2016-07-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-23:server/2016/hg_lighttpd/</id><summary type="html">&lt;p&gt;We will describe here how to publish a group of Mercurial repositories on a web
server. It will allow us to access it with a traditional web browser. For that
we will link the web server to Mercurial with CGI. Once a repository is setup it
is very easy to add others.&lt;/p&gt;
&lt;div class="section" id="pre-requirements"&gt;
&lt;h2&gt;Pre-requirements&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;a functioning web server (here we will base on lighttpd for the instructions) see
[[linux:debian:webserveur]] for its installation.&lt;/li&gt;
&lt;li&gt;a classical installation of Mercurial.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;hgwebdir.cgi&lt;/code&gt; or &lt;code&gt;hgwebdir.fcgi&lt;/code&gt; script include with your
version of Mercurial. On a Debian install, you can find it in the
&lt;code&gt;/usr/share/doc/mercurial/examples/&lt;/code&gt; folder. It is also directly
available on Mercurial website: &lt;a class="reference external" href="http://www.selenic.com/repo/hg-stable/raw-file/tip/hgwebdir.cgi"&gt;hgwebdir.cgi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In the case of use of the fastCGI version of the script
(&lt;code&gt;hgwebdir.fcgi&lt;/code&gt;) we should also install the &lt;code&gt;flup&lt;/code&gt; python module
(&lt;code&gt;python-flup&lt;/code&gt; pour Debian)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="repository-preparation"&gt;
&lt;h2&gt;Repository preparation&lt;/h2&gt;
&lt;p&gt;We will suppose that the repository is in the &lt;code&gt;/var/hg&lt;/code&gt; folder. First we
create the structure of the repository:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mkdir -p /var/hg/repos
&lt;span class="gp"&gt;#&lt;/span&gt; chown -R www-data:www-data /var/hg
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then we create the configuration file of the repository
&lt;code&gt;/var/hg/hgweb.config&lt;/code&gt; which will allow us to take into account the
different mercurial repositories that will be in the &lt;code&gt;repos&lt;/code&gt; sub-folder:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[collections]&lt;/span&gt;
&lt;span class="na"&gt;repos/&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;repos/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then we need to place the &lt;code&gt;hgwebdir.fcgi&lt;/code&gt; script (in case of FastCGI use)
or &lt;code&gt;hgwebdir.cgi&lt;/code&gt; script (in case of CGI use) and to let executable by the
web server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mkdir /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; cp hgwebdir.fcgi /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; chown -R www-data:www-data /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; chmod +x /var/hg/hgwebdir.fcgi
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="lighttpd-configuration"&gt;
&lt;h2&gt;lighttpd configuration&lt;/h2&gt;
&lt;div class="section" id="in-a-sub-directory-of-the-site"&gt;
&lt;h3&gt;In a sub-directory of the site&lt;/h3&gt;
&lt;p&gt;According to lighttpd documentation, we need to edit the
&lt;code&gt;/etc/lighttpd/lighttpd.conf&lt;/code&gt; configuration file or a file which will be
include at lighttpd start up.  In Debian you can create a file (for example
&lt;code&gt;50-hg.conf&lt;/code&gt;) in the &lt;code&gt;/etc/lighttpd/available-conf/&lt;/code&gt; folder. Then
create a symlink to that file in &lt;code&gt;/etc/lighttpd/enable-conf/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;First you need to include the requiered modules:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;1 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_cgi&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;2 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_rewrite&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Second, you have to configure the address rewriting so the access to the
sub-directories of &lt;code&gt;hg&lt;/code&gt; should use &lt;code&gt;hgwebdir.fcgi&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;3 &lt;/span&gt; &lt;span class="k"&gt;url.rewrite-once&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="lineno"&gt;4 &lt;/span&gt;   &lt;span class="s2"&gt;&amp;quot;^/hg([/?].*)?$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/hgwebdir.fcgi$1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="lineno"&gt;5 &lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally, passing the correct parameters to the CGI script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;6 &lt;/span&gt; &lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;^/hgwebdir.fcgi([/?].*)?$&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt;7 &lt;/span&gt;              &lt;span class="k"&gt;server.document-root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/var/hg/&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;8 &lt;/span&gt;              &lt;span class="k"&gt;cgi.assign&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.fcgi&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/python&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;9 &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="as-a-virtual-host"&gt;
&lt;h2&gt;As a virtual host&lt;/h2&gt;
&lt;p&gt;In that case, the repositories will be accessible directly at the root of the
host through an address like &lt;cite&gt;hg.example.com&lt;/cite&gt;.&lt;/p&gt;
&lt;p&gt;First, as before,  you need to include the requiered modules:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;1 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_cgi&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;2 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_rewrite&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Second, in that case we will configure that all access to &lt;cite&gt;hg.example.com&lt;/cite&gt; will
use the FastCGI script.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;3 &lt;/span&gt; &lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;host&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;hg.example.com&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt;4 &lt;/span&gt;     &lt;span class="k"&gt;server.document-root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/var/hg/&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;5 &lt;/span&gt;     &lt;span class="k"&gt;cgi.assign&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.fcgi&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/python&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;6 &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In that case, the addresses will show the name of the cript to use, that is
&lt;code&gt;hgwebdir.fcgi&lt;/code&gt;. As before we could can use the rewriting directive to
have sexier addresses, so without the name of the script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;7 &lt;/span&gt; &lt;span class="k"&gt;url.rewrite-once&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="lineno"&gt;8 &lt;/span&gt;     &lt;span class="s2"&gt;&amp;quot;^(/hgwebdir.fcgi/.*)$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;$1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;^(/.*)$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/hgwebdir.fcgi$1&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;9 &lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the Mercurial config file (&lt;code&gt;hgweb.config&lt;/code&gt;) you should also specify that
there is no prefix on the addresses:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;baseurl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="push-limitation"&gt;
&lt;h2&gt;Push limitation&lt;/h2&gt;
&lt;p&gt;The FastCGI/CGI script allow read but also write to the repositories. Therefore
to be able to limit the write (push) to only certian person two additionnal
modifications are requiered.&lt;/p&gt;
&lt;p&gt;First in the configuration file of the mercurial repository itself where you
want to put some limitation (&lt;code&gt;.hg/hgrc&lt;/code&gt;). In the web section, add the
names of the autorised users, or a star (&lt;code&gt;*&lt;/code&gt;) to allow everybody:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;allow_push&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;moimeme&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally in lighttpd configuration in the file where authentication are
specified:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;querystring&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;cmd=unbundle&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;auth.require&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;   &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Mercuial Repo&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;valid-user&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;During a push it may failed with the following error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;ssl required&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To allow pushes without SSL activated, just set it in the Mercurial
configuration file of the corresponding repository (&lt;code&gt;.hg/hgrc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;push_ssl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;false&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://mercurial.selenic.com/wiki/HgWebDirStepByStep"&gt;Publishing Repositories with hgwebdir.cgi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Mercurial"></category><category term="DVCS"></category></entry><entry><title>How to organise the source code of "templates"</title><link href="https://blog.tblein.eu/development/2016/how-to-organise-the-source-code-of-templates/" rel="alternate"></link><published>2016-07-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-23:development/2016/how-to-organise-the-source-code-of-templates/</id><summary type="html">&lt;p&gt;In C and C++, we normally separate the declaration and the definition of
a function in two separated files: the header file contain the declaration of
the function (&lt;code&gt;.h&lt;/code&gt; or &lt;code&gt;.hh&lt;/code&gt; file) and the source code itself which
contain the definition of the function (&lt;code&gt;.c&lt;/code&gt; or &lt;code&gt;.cpp&lt;/code&gt; file). When
we would like to do the same with function containing template we get an error
of type &lt;code&gt;undefined reference to&lt;/code&gt; when the function is first used in code.&lt;/p&gt;
&lt;div class="section" id="an-example"&gt;
&lt;h2&gt;An example&lt;/h2&gt;
&lt;p&gt;For example let's suppose that the &lt;code&gt;addition&lt;/code&gt; function return the sum of
two numbers of same type.&lt;/p&gt;
&lt;p&gt;First the header file (&lt;code&gt;addition.hh&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then the function source code (&lt;code&gt;addition.cc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally a small program using this function (&lt;code&gt;main.cc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;quot;addition.hh&amp;quot;&lt;/span&gt;&lt;span class="cp"&gt;&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While the code looks correct, the links creation will broke with the following
error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/tmp/ccEpROXj.o&lt;span class="o"&gt;(&lt;/span&gt;.text+0x17c&lt;span class="o"&gt;)&lt;/span&gt;: In &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;main&lt;span class="s1"&gt;&amp;#39;:&lt;/span&gt;
&lt;span class="s1"&gt;: undefined reference to `addition(int, int)&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="why"&gt;
&lt;h2&gt;Why?&lt;/h2&gt;
&lt;p&gt;There are different reasons that this error appear. It is mainly because
a template is not a function but a model used to generate the function. When it
used by a program to generate the real function, the definition should be known
and not only it's declaration.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="how-to-solved-it"&gt;
&lt;h2&gt;How to solved it.&lt;/h2&gt;
&lt;p&gt;There is several solution to that problem.&lt;/p&gt;
&lt;div class="section" id="the-insertion-of-the-definition-in-the-header-file"&gt;
&lt;h3&gt;The insertion of the definition in the header file.&lt;/h3&gt;
&lt;p&gt;The first one is to include the definition in the header file. For that, we only
need to fuse the two files (header and source code) in only one file or to
include the source code file with an &lt;code&gt;include&lt;/code&gt; preprocessing command at
the end of the header file. This solution is the easiest one, but not the
results is not so clean. Indeed, some compilers can increase dramatically the
size of the resulting binary.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="adding-a-template-specialisation"&gt;
&lt;h3&gt;Adding a template specialisation&lt;/h3&gt;
&lt;p&gt;FIXME: To be confirmed&lt;/p&gt;
&lt;p&gt;We can also add the declaration of the specialisation that we want in the source
code of the function.&lt;/p&gt;
&lt;p&gt;For example, for the previous &lt;code&gt;addition&lt;/code&gt; function, we can specify the
declaration for types &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt; and &lt;code&gt;double&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="by-using-the-export-keyword"&gt;
&lt;h3&gt;By using the &lt;code&gt;export&lt;/code&gt; keyword.&lt;/h3&gt;
&lt;p&gt;FIXME&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12"&gt;[35.12] Why can't I separate the definition of my templates class from it's
declaration and put it inside a .cpp file?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13"&gt;[35.13] How can I avoid linker errors with my template functions?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.14"&gt;[35.14] How does the C++ keyword export help with template linker errors?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="template"></category><category term="compilation error"></category><category term="C++"></category></entry><entry><title>abort: requirement 'fncache' not supported!</title><link href="https://blog.tblein.eu/development/2016/mercurial_fncache/" rel="alternate"></link><published>2016-07-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-23:development/2016/mercurial_fncache/</id><summary type="html">&lt;p&gt;It can append that when we try to access a &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; repository we got the following error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;abort: requirement &lt;span class="s1"&gt;&amp;#39;fncache&amp;#39;&lt;/span&gt; not supported!
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It append when a &amp;quot;too old&amp;quot; version of &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; is used. Indeed, from version
1.1, &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; used a new repository format (&lt;code&gt;fncache&lt;/code&gt;), which is no more readable
by the former versions. The reverse is not true, and newer version are able to
read old repositories.&lt;/p&gt;
&lt;p&gt;To solve the problem we can use a version of &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; able to read the two type
of repository and convert it to the old format using the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;hg --config format.usefncache&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt; clone --pull A B
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With &lt;code&gt;A&lt;/code&gt; the initial repository and &lt;code&gt;B&lt;/code&gt; the converted repository.&lt;/p&gt;
&lt;p&gt;To completely deactivate the new repository format, a modification the
configuration file of &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; is needed (&lt;code&gt;~/.hgrc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[format]&lt;/span&gt;
&lt;span class="na"&gt;usefncache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;False&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://mercurial.selenic.com/wiki/fncacheRepoFormat"&gt;fncacheRepoFormat&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Mercurial"></category><category term="fncache"></category><category term="DVCS"></category></entry><entry><title>Unrealated repository fusion (mercurial abort: repository is unrelated)</title><link href="https://blog.tblein.eu/development/2016/mercurial_repositories_fusion/" rel="alternate"></link><published>2016-07-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-23:development/2016/mercurial_repositories_fusion/</id><summary type="html">&lt;p&gt;When we try to include a repository in an other while they never had any common
point we got the following error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ hg push ../second
mercurial abort: repository is unrelated
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To go above it we need to force the fusion with the &lt;code&gt;-f&lt;/code&gt; option:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ hg push -f ../second
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.selenic.com/mercurial/hg.1.html"&gt;hg man page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Mercurial"></category><category term="fusion"></category><category term="DVCS"></category></entry><entry><title>Deconnected subversion with SVK</title><link href="https://blog.tblein.eu/development/2016/svk/" rel="alternate"></link><published>2016-07-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-23:development/2016/svk/</id><summary type="html">&lt;div class="section" id="svk-installation"&gt;
&lt;h2&gt;SVK installation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;apt-get install svk&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a local repository with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk depotmap --init&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="create-a-local-repository-mirror"&gt;
&lt;h2&gt;Create a local repository mirror&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk mirror svn://adresse_du_depot_distant.ex //local/nom_local_du_depot&lt;/span&gt;
&lt;span class="go"&gt;svk sync //local/nom_local_du_depot&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a workingcopy from the local repository mirror:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk checkout //local/nom_local_du_depot repertoire&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="local-use-of-svk"&gt;
&lt;h2&gt;Local use of SVK&lt;/h2&gt;
&lt;p&gt;Add some files/folders to version control&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk add fichier&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Commit to the loacl repository mirror&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk commit&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Push the modifications of the local mirror repository to the distant repository:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk push&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://articles.mongueurs.net/magazines/linuxmag94.html"&gt;SVK par les Mongueurs de Perl&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="SVN"></category><category term="DVCS"></category></entry><entry><title>Syncthing on server</title><link href="https://blog.tblein.eu/server/2016/syncthing/" rel="alternate"></link><published>2016-08-20T21:15:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2016-07-10:server/2016/syncthing/</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="http://syncthing.net"&gt;Syncthing&lt;/a&gt; is peer to peer synchronisation software
than run on a lot of platform. To be able to synchronise two devices they need
to be both up at the same time. At the moment Syncthing is aimed to be run as
a single user. Therefore if we want that several users are using it on the same
machine several adjustement will be need.&lt;/p&gt;
&lt;div class="section" id="syncthing-installation"&gt;
&lt;h2&gt;Syncthing installation&lt;/h2&gt;
&lt;p&gt;The installation of Syncthing is well describe on their web site, and more
particularly for Debian/Ubuntu with a dedicated repository
&lt;a class="reference external" href="http://apt.syncthing.net/"&gt;http://apt.syncthing.net/&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-for-an-user"&gt;
&lt;h2&gt;Configuration for an user&lt;/h2&gt;
&lt;div class="section" id="first-launch-and-connection-to-the-interface"&gt;
&lt;h3&gt;First launch and connection to the interface&lt;/h3&gt;
&lt;p&gt;Setup a proxy to acces the web interface:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; ssh -L 9090:127.0.0.1:8384 domaine.tld
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Launch synthing&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; syncthing
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Connect to the web interface  &lt;a class="reference external" href="http://localhost:9090"&gt;http://localhost:9090&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://docs.syncthing.net/users/firewall.html#remote-web-gui"&gt;https://docs.syncthing.net/users/firewall.html#remote-web-gui&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-syncthing"&gt;
&lt;h3&gt;Configuration of Syncthing&lt;/h3&gt;
&lt;p&gt;Change default configuration to allow multiple run of Syncthing (one per user).
The main parameters to change are the port that the instance of Syncthing will
use for first its web interface and second its connection.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Device Name: to have a idea of server and user&lt;/li&gt;
&lt;li&gt;Sync Protocol Listen Addresses: &lt;code&gt;tcp://:22001&lt;/code&gt; (by default &lt;code&gt;tcp://:22000&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;GUI Listen Addresses: &lt;code&gt;127.0.0.1:22002&lt;/code&gt; (by default &lt;code&gt;127.0.0.1:8384&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If on a server with direct connection to Internet deactivate &amp;quot;Enable NAT
traversal&amp;quot; and &amp;quot;Enable Relaying&amp;quot;.&lt;/p&gt;
&lt;p&gt;After restart you need to restart the ssh proxy with the new GUI Listen port:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; ssh -L 9090:127.0.0.1:22002 domain.tld
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="firewall"&gt;
&lt;h3&gt;Firewall&lt;/h3&gt;
&lt;p&gt;You will need to open the firewall to allow entry of the synchronisation so open
TCP port corresponding to &amp;quot;Sync Protocol Listen Addresses&amp;quot;. If you want a direct
access to the web interface without the SSH proxy you could open also the
corresponding port.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="user-setup-for-automatic-start"&gt;
&lt;h2&gt;User setup for automatic start&lt;/h2&gt;
&lt;p&gt;With the help of systemd&lt;/p&gt;
&lt;p&gt;If it does not exist create the systemd user directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; mkdir -p ~/.config/systemd/user/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create a Syncthing service file to setup the service from the example on the
Syncthing github:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; wget -O ~/.config/systemd/user/syncthing.service &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="go"&gt;    https://github.com/syncthing/syncthing/raw/master/etc/linux-systemd/user/syncthing.service&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should contain something like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Syncthing - Open Source Continuous File Synchronization&lt;/span&gt;
&lt;span class="na"&gt;Documentation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;man:syncthing(1)&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;network.target&lt;/span&gt;
&lt;span class="na"&gt;Wants&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;syncthing-inotify.service&lt;/span&gt;

&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/bin/syncthing -no-browser -no-restart -logflags=0&lt;/span&gt;
&lt;span class="na"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;on-failure&lt;/span&gt;
&lt;span class="na"&gt;SuccessExitStatus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;3 4&lt;/span&gt;
&lt;span class="na"&gt;RestartForceExitStatus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;3 4&lt;/span&gt;

&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;default.target&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Activate the script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; systemctl --user &lt;span class="nb"&gt;enable&lt;/span&gt; syncthing.service
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now you can start and stop Syncthing using systemd tools. Start Syncthing:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; systemctl --user start syncthing.service
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To allow the start without any connexion of the user as root:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; loginctl enable-linger USER
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We then create a crontab entry to start Syncthing at reboot of the computer
(crontab -e):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;@reboot systemctl --user is-active syncthing.service &amp;amp;&amp;gt;/dev/null || systemctl --user start syncthing.service &amp;amp;&amp;gt; /dev/null
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We first test that the service is not running before starting it.
We can also test regurlaly that the service is running and if not start it:&lt;/p&gt;
&lt;p&gt;To do it every hours:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;0   *   *   *   * systemctl --user is-active syncthing.service &amp;amp;&amp;gt;/dev/null || systemctl --user start syncthing.service &amp;amp;&amp;gt; /dev/null
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://syncthing.net"&gt;Syncthing web site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://docs.syncthing.net/users/autostart.html#using-systemd"&gt;Starting Syncthing automatically -- Using systemd&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://docs.syncthing.net/users/firewall.html"&gt;Firewall Setup&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="reference external" href="https://lists.debian.org/debian-user/2015/10/msg00647.html"&gt;Re: Starting systemd user services on boot on a Debian server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Debian"></category><category term="Syncthing"></category></entry><entry><title>Offline and caching of LDAP authentication</title><link href="https://blog.tblein.eu/server/2014/offline-and-caching-of-ldap-authentication/" rel="alternate"></link><published>2014-08-22T00:00:08+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2014-08-22:server/2014/offline-and-caching-of-ldap-authentication/</id><summary type="html">&lt;p&gt;Centralised authentication through LDAP is very useful. No matter the number of
machine that used it, the user have the same login and groups. When the user
change his password on one of the machine, the password is updated everywhere.
However in case of lack of connection with the LDAP server it is no more
possible to login. Here we will see how to configure &lt;a class="reference external" href="https://fedorahosted.org/sssd/"&gt;sssd&lt;/a&gt; to provide caching and offline support of
identity and authentication to the system.&lt;/p&gt;
&lt;p&gt;You will need to have a working LDAP server that is able to provide authentication.
On the client first install &lt;code&gt;sssd&lt;/code&gt; package:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install sssd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should also install &lt;code&gt;libpam-sss&lt;/code&gt; and &lt;code&gt;libnss-sss&lt;/code&gt; packages that
provide the binding for authentication and identity. Be sure to remove any other
caching server like &lt;code&gt;nscd&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;All the configuration is done in the &lt;code&gt;/etc/sssd/sssd.conf&lt;/code&gt; file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[sssd]&lt;/span&gt;
&lt;span class="na"&gt;config_file_version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;reconnection_retries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;3&lt;/span&gt;
&lt;span class="na"&gt;sbus_timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;30&lt;/span&gt;
&lt;span class="na"&gt;debug_level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;10&lt;/span&gt;

&lt;span class="na"&gt;services&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;nss, pam&lt;/span&gt;
&lt;span class="na"&gt;domains&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;EXAMPLE&lt;/span&gt;

&lt;span class="k"&gt;[nss]&lt;/span&gt;
&lt;span class="na"&gt;filter_groups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
&lt;span class="na"&gt;filter_users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;root&lt;/span&gt;
&lt;span class="na"&gt;reconnection_retries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;3&lt;/span&gt;

&lt;span class="k"&gt;[pam]&lt;/span&gt;
&lt;span class="na"&gt;reconnection_retries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;3&lt;/span&gt;

&lt;span class="k"&gt;[domain/EXAMPLE]&lt;/span&gt;
&lt;span class="na"&gt;enumerate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;cache_credentials&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;id_provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ldap&lt;/span&gt;
&lt;span class="na"&gt;auth_provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ldap&lt;/span&gt;
&lt;span class="na"&gt;chpass_provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ldap&lt;/span&gt;

&lt;span class="na"&gt;auth_provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ldap&lt;/span&gt;
&lt;span class="na"&gt;ldap_uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ldap://ldap.example.com/&lt;/span&gt;
&lt;span class="na"&gt;ldap_search_base&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;dc=example,dc=com&lt;/span&gt;
&lt;span class="na"&gt;ldap_tls_reqcert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;never&lt;/span&gt;
&lt;span class="na"&gt;ldap_tls_cacert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/etc/ssl/certs/ca-certificates.crt&lt;/span&gt;
&lt;span class="na"&gt;ldap_default_bind_dn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;cn=admin,dc=example,dc=com&lt;/span&gt;
&lt;span class="na"&gt;ldap_default_authtok_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;password&lt;/span&gt;
&lt;span class="na"&gt;ldap_default_authtok&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;xxxxxxxxx&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://fedorahosted.org/sssd/"&gt;SSSD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://sites.google.com/site/guenterbartsch/blog/debian7ldapauthenticationwithsssdtls"&gt;Debian 7 LDAP Authentication with SSSD, TLS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://wiki.samba.org/index.php/Local_user_management_and_authentication/sssd"&gt;Local user management and authentication/sssd&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://people.skolelinux.org/pere/blog/Caching_password__user_and_group_on_a_roaming_Debian_laptop.html"&gt;Caching password, user and group on a roaming Debian laptop&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="SSSD"></category><category term="Debian"></category><category term="LDAP"></category><category term="caching"></category><category term="offline"></category></entry><entry><title>Delete duplicate messages in Mutt</title><link href="https://blog.tblein.eu/client/2014/delete-duplicate-messages-in-mutt/" rel="alternate"></link><published>2014-01-29T13:13:59+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2014-01-29:client/2014/delete-duplicate-messages-in-mutt/</id><summary type="html">&lt;p&gt;Duplicated message in a mail box could append when consolidating to mailbox or
only by mistake. Since each message is identified by an unique message-id while
sending, duplicated message have the same message-id, and therefore can be
easily identified.&lt;/p&gt;
&lt;p&gt;To identify them with mutt, you need to configure it to thread duplicated
messages together when sorting by threads. This is done through the
&lt;code&gt;duplicate_threads&lt;/code&gt; configuration variable. If active, the duplicated messages
will be marked with an &lt;code&gt;=&lt;/code&gt; in the thread diagram.&lt;/p&gt;
&lt;p&gt;To activate it, put in your .muttrc the following line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nv"&gt;duplicate_threads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; yes
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or type in mutt &lt;code&gt;:set duplicate_threads = yes&lt;/code&gt;. To check if it is active, type in mutt &lt;code&gt;:set ?duplicate_threads&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Know to identify the duplicated messages you can use the &lt;code&gt;~=&lt;/code&gt; pattern and use it
for marking or deleting them.&lt;/p&gt;
&lt;p&gt;For example to tag all the duplicated messages type &lt;code&gt;T&lt;/code&gt; for tagging according to
a pattern and then &lt;code&gt;~=&lt;/code&gt; to select the duplicated messages in the folder. If you
want to delete them use &lt;code&gt;D&lt;/code&gt; for deleting according to a pattern and then &lt;code&gt;~=&lt;/code&gt; to
select the duplicated messages in the folder.&lt;/p&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://promberger.info/linux/2008/03/31/mutt-delete-duplicate-e-mail-messages/"&gt;Mutt: delete duplicate e-mail messages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.mutt.org/doc/manual/manual-6.html#duplicate_threads"&gt;Mutt duplicate_threads configuration variable&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.mutt.org/doc/manual/manual-4.html#patterns"&gt;Mutt Patterns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.mutt.org/doc/manual/manual-4.html#ss4.3"&gt;Mutt Using Tags&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Mutt"></category><category term="mail"></category><category term="duplicated"></category></entry><entry><title>Xerox Phaser 6010N on Debian 64bits, the multiarch way</title><link href="https://blog.tblein.eu/client/2013/xerox-phaser-6010n-on-debian-64bits-the-multiarch-way/" rel="alternate"></link><published>2013-03-03T20:34:06+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2013-03-03:client/2013/xerox-phaser-6010n-on-debian-64bits-the-multiarch-way/</id><summary type="html">&lt;p&gt;Xerox gives the drivers only for 32bits Linux boxes. We already saw how install
it with the help of the 32bits libraries (&lt;a class="reference external" href="https://blog.tblein.eu/client/2012/xerox-phaser-6010n-on-debian-64bits/"&gt;Xerox Phaser 6010N on Debian 64bits&lt;/a&gt;). However this method is now
depreciate in favour of the multiarch possibility.&lt;/p&gt;
&lt;p&gt;AMD64 processor are able to run any 32 bits programs. That why the installation
of a 32 bits OS is possible on that architecture (i386). Recently Debian provide
the possibility to had additional architecture to the OS. I the case of amd6'
architecture it will allow the installation of i386 packages on the system.&lt;/p&gt;
&lt;p&gt;By default, a 64 bits package will be installed. They are uncompress in specific
folder link to he architecture. Links to the classical emplacements. In adding
the i386 architecture, we will create an other emplacement to put the
corresponding package. This will allow us to run i386 software and libraries on
the amd64.&lt;/p&gt;
&lt;div class="section" id="adding-i386-architecture"&gt;
&lt;h2&gt;Adding i386 architecture&lt;/h2&gt;
&lt;p&gt;Add the i386 architecture:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# dpkg --add-architecture i386&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Update the package to take into account the i386 ones:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get update&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-of-the-xerox-drivers"&gt;
&lt;h2&gt;Installation of the Xerox drivers&lt;/h2&gt;
&lt;p&gt;Go to Xerox web site to download the &lt;a class="reference external" href="http://www.support.xerox.com/support/phaser-6010/downloads/enus.html?operatingSystem=linux"&gt;Phaser 6010 deb package on the Linux page&lt;/a&gt;.
Select English as language since the complete drivers are only available in
English.&lt;/p&gt;
&lt;p&gt;To install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# dpkg -i xerox-phaser-6000-6010_1.0-1_i386.deb&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that  you do not need to force the architecture since to i386.&lt;/p&gt;
&lt;p&gt;The installation will complain about an unmet dependency:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Sélection du paquet xerox-phaser-6000-6010 précédemment désélectionné.
&lt;span class="o"&gt;(&lt;/span&gt;Lecture de la base de données... &lt;span class="m"&gt;298522&lt;/span&gt; fichiers et répertoires déjà installés.&lt;span class="o"&gt;)&lt;/span&gt;
Dépaquetage de xerox-phaser-6000-6010 &lt;span class="o"&gt;(&lt;/span&gt;à partir de .../xerox-phaser-6000-6010_1.0-1_i386.deb&lt;span class="o"&gt;)&lt;/span&gt; ...
dpkg: des problèmes de dépendances empêchent la configuration de xerox-phaser-6000-6010 :
xerox-phaser-6000-6010 dépend de libcups2 &lt;span class="o"&gt;(&lt;/span&gt;&amp;gt;&lt;span class="o"&gt;=&lt;/span&gt; 1.2.7&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; libcupsys2 &lt;span class="o"&gt;(&lt;/span&gt;&amp;gt;&lt;span class="o"&gt;=&lt;/span&gt; 1.2.7&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; libcupsys2-gnutls10 &lt;span class="o"&gt;(&lt;/span&gt;&amp;gt;&lt;span class="o"&gt;=&lt;/span&gt; 1.1.23-1&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; cependant :
Le paquet libcups2:i386 n&lt;span class="s1"&gt;&amp;#39;est pas installé.&lt;/span&gt;

&lt;span class="s1"&gt;dpkg: erreur de traitement de xerox-phaser-6000-6010 (--install) :&lt;/span&gt;
&lt;span class="s1"&gt;problèmes de dépendances - laissé non configuré&lt;/span&gt;
&lt;span class="s1"&gt;Des erreurs ont été rencontrées pendant l&amp;#39;&lt;/span&gt;exécution :
xerox-phaser-6000-6010
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To solve it, we just need to install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install libcups2:i386&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configure-the-printer"&gt;
&lt;h2&gt;Configure the printer&lt;/h2&gt;
&lt;p&gt;Install and configure the printer with the proposed Xerox driver.&lt;/p&gt;
&lt;p&gt;In cups configure it as an &lt;code&gt;AppSocket/HP JetDirect&lt;/code&gt; printer. Enter the IP
of your printer and use the port 9100 as follow:
&lt;code&gt;socket://192.168.1.1:9100&lt;/code&gt;. Give a name, a description and location to
the printer In the driver selection select &lt;code&gt;Xerox&lt;/code&gt; as manufacturer and
&lt;code&gt;Xerox Phaser 6010N&lt;/code&gt; as model.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.debian.org/Multiarch/HOWTO"&gt;Multiarch HOWTO on Debian wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="32bits"></category><category term="64bits"></category><category term="cups"></category><category term="Xerox"></category><category term="Debian"></category><category term="multiarch"></category></entry><entry><title>OpenVPN server on OpenWRT box</title><link href="https://blog.tblein.eu/server/2013/openvpn-server-on-openwrt-box/" rel="alternate"></link><published>2013-03-03T19:07:52+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2013-03-03:server/2013/openvpn-server-on-openwrt-box/</id><summary type="html">&lt;p&gt;While you are away from home it is sometime needed to access some files on the
home file server. To protect it it is not directly available from the web. We
will see here how to create a secure connexion to connect from the web on your
OpenWRT box to be able be like at home.&lt;/p&gt;
&lt;div class="section" id="installation-of-openvpn"&gt;
&lt;h2&gt;Installation of OpenVPN&lt;/h2&gt;
&lt;p&gt;For this we will install an OpenVPN server that will allow us to create
a Virtual Private Network. Just install the &lt;code&gt;openvpn&lt;/code&gt; package with the web
interface or the help of &lt;code&gt;opkg&lt;/code&gt; on command line.&lt;/p&gt;
&lt;p&gt;To work, OpenVPN need several keys and certificates. To handle it, OpenVPN
community provide a set of script to easily create all what is needed. It is
called &lt;code&gt;easy-rsa&lt;/code&gt;. You can install the &lt;code&gt;openvpn-easy-rsa&lt;/code&gt; package on
your OpenWRT box or &lt;a class="reference external" href="https://github.com/OpenVPN/easy-rsa"&gt;download easy-rsa from the web&lt;/a&gt; on your unix computer to save place on
OpenWRT.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="keys-and-certificates-creation"&gt;
&lt;h2&gt;Keys and certificates creation&lt;/h2&gt;
&lt;p&gt;Go inside the easy-rsa folder (&lt;code&gt;/etc/easy-rsa/&lt;/code&gt; on OpenWRT). First edit vars
file inside easy-rsa to fit your requirements:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;export KEY_COUNTRY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;FR&amp;quot;&lt;/span&gt;
&lt;span class="na"&gt;export KEY_PROVINCE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;FR&amp;quot;&lt;/span&gt;
&lt;span class="na"&gt;export KEY_CITY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Paris&amp;quot;&lt;/span&gt;
&lt;span class="na"&gt;export KEY_ORG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;At Home&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then creates the keys that are needed to signed all the key and certificates
generated:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;./clean-all
./build-ca
./build-dh
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Create the server key and certificate:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;./build-key-server my_server_name
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Copy on the OpenVPN folder of the OpenWRT box the server files that where
generated in the &lt;code&gt;keys&lt;/code&gt; folder:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;cp ca.crt ca.key dh1024.pem my_servername_.crt my_server_name.key /etc/openvpn/
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;ca.crt&lt;/code&gt; is the Certificate Authority (CA) certificate. The
corresponding key is used to sign all the certificates and keys and it all to
check the validity of provided certificate.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dh1024.pem&lt;/code&gt; contains the Diffie-Hellman parameters for the server side
of an SSL/TLS connection.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;my_server_name.key&lt;/code&gt; is the key used by the server to decrypt the
messages from the client.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;my_server_name.crt&lt;/code&gt; is the certificate that the server provide to the
client to allow it to crypt the conection. It is signed by the CA to prove
that it is coming from the server.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then for each user create the corresponding key and certificate:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;./build-key user1
./build-key user2
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Give to each user the generated files: ca.crt, user_name.key user.name.crt. They
are the only needed files for them&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="open-the-correct-port-in-your-firewall"&gt;
&lt;h2&gt;Open the correct port in your firewall&lt;/h2&gt;
&lt;p&gt;You must open the 1194 port in the firewall to all the OpenVPN connection from
the WAN. You can do it through the web interface or by editing the
&lt;code&gt;/etc/config/firewall&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;rule&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;target&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ACCEPT&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;dest_port&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1194&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;src&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;wan&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;proto&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;tcpudp&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;family&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ipv4&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Do not forget to reload the firewall rules if you modify it on command line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/etc/init.d/firewall restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="server-configuration"&gt;
&lt;h2&gt;Server configuration&lt;/h2&gt;
&lt;p&gt;The configuration of OpenVPN is set in &lt;code&gt;/etc/config/openvpn&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;openvpn&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;lan&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;enable&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;port&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1194&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;proto&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;udp&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;dev&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;tap0&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ca&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/etc/openvpn/ca.crt&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;cert&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/etc/openvpn/server.crt&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;key&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/etc/openvpn/server.key&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;dh&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/etc/openvpn/dh1024.pem&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ifconfig_pool_persist&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/tmp/ipp.txt&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;keepalive&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;10 120&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;comp_lzo&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;persist_key&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;persist_tun&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;1&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;status&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;/tmp/openvpn-status.log&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;verb&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;3&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;server_bridge&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;192.168.1.1 255.255.255.0 192.168.1.200 192.168.1.219&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This configuration will allow the client to be part of the network handled by
the OpenWRT box. It will grab a IP i the range 192.168.1.200 to 192.168.1.219.&lt;/p&gt;
&lt;p&gt;To prevent that a local client to have an IP in that range we can modify the
&lt;code&gt;/etc/config/dhcp&lt;/code&gt; file to restrict the attribution of the IP in an non
overlapping range. Modify the lan section of that file like following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;dhcp&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;lan&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;interface&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;lan&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ignore&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;0&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;start&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;50&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;limit&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;150&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The local client will only have an IP in the range of 192.168.1.50 to 192.168.1.150.
Restart &lt;code&gt;dnsmasq&lt;/code&gt; to take it into account:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/etc/init.d/dnsmasq restart
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can start the server with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/etc/init.d/openvpn start
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To have it start automaticaly when the OpenWT box starts just run the following
command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/etc/init.d/openvpn &lt;span class="nb"&gt;enable&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="bridging-of-the-interfaces"&gt;
&lt;h2&gt;Bridging of the interfaces&lt;/h2&gt;
&lt;p&gt;To be able to link the OpenVPN tunnel, we need to bridge the interfaces. It an
be done in the web interface or in the &lt;code&gt;/etc/config/network&lt;/code&gt; file. In the
&lt;code&gt;lan&lt;/code&gt; section add &lt;code&gt;tap0&lt;/code&gt; to the &lt;code&gt;ifname&lt;/code&gt; option:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;interface&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;lan&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;type&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;bridge&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;proto&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;static&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ipaddr&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;192.168.1.1&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;netmask&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;255.255.255.0&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;_orig_ifname&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;eth0.0 wl0&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;_orig_bridge&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;true&amp;#39;&lt;/span&gt;
        &lt;span class="n"&gt;option&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;ifname&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="s"&gt;eth0.0 tap0&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="client-configuration"&gt;
&lt;h2&gt;Client configuration&lt;/h2&gt;
&lt;p&gt;Now that the OpenVPN server is running we just have to connect to it.  In
addition to the personal key and certificate and of the CA certificate the user
will need also a configuration file.  They should look like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# OpenVPN on bridge OpenWRT&lt;/span&gt;

client
tls-client
&lt;span class="c1"&gt;# Which device to use&lt;/span&gt;
dev tap
&lt;span class="c1"&gt;# Which protocol&lt;/span&gt;
proto udp
&lt;span class="c1"&gt;# The OpenWRT external address&lt;/span&gt;
remote x.x.x.x 1194

resolv-retry infinite
nobind

persist-tun
persist-key

&lt;span class="c1"&gt;# The different used keys&lt;/span&gt;
ca ca.crt
cert user1.crt
key user1.key

&lt;span class="c1"&gt;# Use compression&lt;/span&gt;
comp-lzo
&lt;span class="p"&gt;;&lt;/span&gt; verb 3
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now you should be able to connect to your home network from the web.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.openwrt.org/doc/howto/vpn.openvpn"&gt;Easy OpenVPN server setup guide&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="OpenWRT"></category><category term="OpenVPN"></category><category term="VPN"></category></entry><entry><title>RTSP through OpenWRT</title><link href="https://blog.tblein.eu/server/2013/rtsp-through-openwrt/" rel="alternate"></link><published>2013-03-03T17:36:49+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2013-03-03:server/2013/rtsp-through-openwrt/</id><summary type="html">&lt;p&gt;The French ISP Free provide TV over DSL. Some of the channels could be directly
seen on a computer through the RTSP protocol. However it is not something that
is working nicely through a home switch that is just behind the FreeBox DSL
router like an OpenWRT running box.&lt;/p&gt;
&lt;p&gt;Several solution exist on the net however major part of them required static
port forwarding linked with configuration of VLC (The recommended client). Here
we will see how to allow it without all this strong and static configuration
with the help of two kernel module that will track the RTSP connexion, open the
correct port in the firewall and routes the packet to the VLC client. These two
modules are &lt;code&gt;ip_nat_rtsp&lt;/code&gt; et &lt;code&gt;ip_conntrack_rtsp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To process only the &lt;code&gt;kmod-ipt-nathelper-extra&lt;/code&gt; package need to be
installed on the OpenWRT box. Do either through the web interface or through ssh
with the help of &lt;code&gt;opkg&lt;/code&gt;. After installation check that the two requiered
modules are loaded with the two following commands on the OpenWRT box:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;insmod ip_conntrack_rtsp
insmod ip_nat_rtsp
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If its answer that &lt;code&gt;insmod: a module named ip_nat_rtsp already exists&lt;/code&gt;, it
means that the module is already loaded.&lt;/p&gt;
&lt;p&gt;Now you just have to launch you preferred player and start watching.&lt;/p&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.boulaire.com/2009/03/openwrt-et-free-multiposte/"&gt;Openwrt et Free multiposte&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="OpenWRT"></category><category term="RTSP"></category><category term="Free.fr"></category><category term="multiposte"></category></entry><entry><title>OpenWRT wifi toggle</title><link href="https://blog.tblein.eu/server/2013/OpenWRT_wifi_toggle/" rel="alternate"></link><published>2013-03-03T17:01:46+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2013-03-03:server/2013/OpenWRT_wifi_toggle/</id><summary type="html">&lt;p&gt;The WRT54GL router has two buttons: one reset button and one called
&amp;quot;SecureEasySetup&amp;quot; or SES. After OpenWRT installation this two button do not
served. We will see how to give a role to the SES one to toggle the wifi on and
off.&lt;/p&gt;
&lt;div class="section" id="wifi-toggle-script"&gt;
&lt;h2&gt;Wifi toggle script&lt;/h2&gt;
&lt;p&gt;First we will create a script that allow us to change the wifi status. It will
activate the wifi when it is not and inactivate it otherwise. In addition it
will change the WLAN LED status according to the wifi status.&lt;/p&gt;
&lt;p&gt;For that, we will create the file &lt;code&gt;/sbin/woggle&lt;/code&gt; (for wifi toogle), that
contain:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;uci get wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; in
   1&lt;span class="o"&gt;)&lt;/span&gt; uci &lt;span class="nb"&gt;set&lt;/span&gt; wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="o"&gt;=&lt;/span&gt;0
      wifi
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &amp;gt; /proc/diag/led/ses_white
   &lt;span class="p"&gt;;;&lt;/span&gt;
   *&lt;span class="o"&gt;)&lt;/span&gt; uci &lt;span class="nb"&gt;set&lt;/span&gt; wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="o"&gt;=&lt;/span&gt;1
      wifi
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &amp;gt; /proc/diag/led/ses_white
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt; &amp;gt; /proc/diag/led/wlan
   &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The script first grabs the wifi status (&lt;code&gt;uci get
wireless.&amp;#64;wifi-device[0].disabled&lt;/code&gt;). If it deactivated (ie equal to &lt;code&gt;1&lt;/code&gt;),
it actives it and switch on the LED of the SES button. Otherwise it deactivates
the wifi switch off the LED of SES button and let the WLAN LED blink once.&lt;/p&gt;
&lt;p&gt;After creation do not forget to set it executable with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod +x /sbin/woggle
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To change the wifi status and test the command, you can run the script with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /sbin/woggle
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="link-with-the-ses-button"&gt;
&lt;h2&gt;Link with the SES button&lt;/h2&gt;
&lt;p&gt;Now that e have the script to toggle the wifi, we need to link it with the SES
button. Like this it will be execute each time the SES button is pressed.&lt;/p&gt;
&lt;p&gt;It is handle by the hotplug events. For this it is needed top create the
&lt;code&gt;button&lt;/code&gt; directory in the &lt;code&gt;/etc/hotplug.d&lt;/code&gt; directory. Then in that
newly created directory create a script with a name like the following
&lt;code&gt;01-radio-toggle&lt;/code&gt; contenting:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$BUTTON&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ses&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$ACTION&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;pressed&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="o"&gt;(&lt;/span&gt; sleep 1&lt;span class="p"&gt;;&lt;/span&gt; /sbin/woggle &lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now to activate or deactivate the wifi you only need to press the SES button.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.openwrt.org/doc/howto/wifitoggle"&gt;Wifi Toggle&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Wifi"></category><category term="OpenWRT"></category><category term="WRT54GL"></category></entry><entry><title>SyncML and Horde</title><link href="https://blog.tblein.eu/client/2012/syncml-and-horde/" rel="alternate"></link><published>2012-10-02T00:39:15+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-10-02:client/2012/syncml-and-horde/</id><summary type="html">&lt;p&gt;Horde is a groupware framework that combine a lot of PIM data. One of the major
problem with PIM data is to get them synchronized among different device. One of
the most used to do so is &lt;a class="reference external" href="http://en.wikipedia.org/wiki/SyncML"&gt;SyncML&lt;/a&gt; that
allow the two-way synchronization of PIM. Horde embeds a &lt;a class="reference external" href="http://en.wikipedia.org/wiki/SyncML"&gt;SyncML&lt;/a&gt; interface.&lt;/p&gt;
&lt;div class="section" id="evolution-and-its-pim-data-storage"&gt;
&lt;h2&gt;evolution and its PIM data storage&lt;/h2&gt;
&lt;p&gt;syncevolution is a software that allow the synchronization of the data contained
inside the evolution PIM data management software through SyncML. However, there
is no need to install evolution software to  be able to synchronize the data,
the storage used is independent to the presence or not of evolution and is using
widely used standard like &lt;a class="reference external" href="http://en.wikipedia.org/wiki/iCalendar"&gt;iCalendar&lt;/a&gt;
files for calendars.&lt;/p&gt;
&lt;p&gt;By default, they are stored in &lt;code&gt;~/.local/share/evolution/&lt;/code&gt; directories.
For example calendars are stored in the calendar sub-folder and tasks in the
tasks sub-folder, each of them as an unique &lt;a class="reference external" href="http://en.wikipedia.org/wiki/iCalendar"&gt;iCalendar&lt;/a&gt; file (respectively
&lt;code&gt;~/.local/share/evolution/calendar/system/calendar.ics&lt;/code&gt; and
&lt;code&gt;~/.local/share/evolution/tasks/system/tasks.ics&lt;/code&gt;)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;On Debian, syncevolution is packaged. Therefore, to install it&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install syncevolution&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It will also install [[!debpkg evolution-data-server]] package that will the
handling of the data in the format used by evolution.&lt;/p&gt;
&lt;p&gt;By default, syncevolution will synchronized the data between the different peers
and the evolution database. We will see how to synchronized it with Horde
database.&lt;/p&gt;
&lt;p&gt;The first thing is to create a new peer. For that we will use a template.  To
get the list of all templates available just enter the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ syncevolution --template ? &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can put what ever you want after the &lt;code&gt;?&lt;/code&gt; but something should be
specified otherwise you will get an error. Maybe a bug of the version used.&lt;/p&gt;
&lt;p&gt;It should return something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt; Available configuration templates &lt;span class="o"&gt;(&lt;/span&gt;clients and servers&lt;span class="o"&gt;)&lt;/span&gt;:
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    template &lt;span class="nv"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; template description
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;eGroupware&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.egroupware.org
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Funambol&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://my.funambol.com
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Google_Calendar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; event sync via CalDAV, use &lt;span class="k"&gt;for&lt;/span&gt; the &lt;span class="s1"&gt;&amp;#39;target-config@google-calendar&amp;#39;&lt;/span&gt; config
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Google_Contacts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; contact sync via SyncML, see http://www.google.com/support/mobile/bin/topic.py?topic&lt;span class="o"&gt;=&lt;/span&gt;22181
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Goosync&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.goosync.com/
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Memotoo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.memotoo.com
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Mobical&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; https://www.everdroid.com
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Nokia_N900&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Template &lt;span class="k"&gt;for&lt;/span&gt; all Nokia phones which support contacts, notes and combined tasks+events
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Oracle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.oracle.com/technology/products/beehive/index.html
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Ovi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.ovi.com
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;ScheduleWorld&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; server no longer in operation
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Sony_Ericsson_K750i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Template &lt;span class="k"&gt;for&lt;/span&gt; old Sony Ericsson phones, with separate databases &lt;span class="k"&gt;for&lt;/span&gt; contacts/events/tasks/memos and SyncML 1.1
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Sony_Ericsson_W595&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Template &lt;span class="k"&gt;for&lt;/span&gt; all current Sony Ericsson phones, with separate databases &lt;span class="k"&gt;for&lt;/span&gt; contacts/events/tasks/memos and SyncML 1.2
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;SyncEvolution&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.syncevolution.org
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;SyncEvolution_Client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; SyncEvolution server side template
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Synthesis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; http://www.synthesis.ch
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;WebDAV&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; contact and event sync using WebDAV, use &lt;span class="k"&gt;for&lt;/span&gt; the &lt;span class="s1"&gt;&amp;#39;target-config@&amp;lt;server&amp;gt;&amp;#39;&lt;/span&gt; config
&lt;span class="o"&gt;[&lt;/span&gt;INFO&lt;span class="o"&gt;]&lt;/span&gt;    &lt;span class="nv"&gt;Yahoo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; contact and event sync using WebDAV, use &lt;span class="k"&gt;for&lt;/span&gt; the &lt;span class="s1"&gt;&amp;#39;target-config@yahoo&amp;#39;&lt;/span&gt; config
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-of-the-access-to-the-horde-server"&gt;
&lt;h2&gt;Configuration of the access to the Horde server.&lt;/h2&gt;
&lt;p&gt;No template already exist for Horde, but the one for Funambol is working nicely
with minor adaptations.  To create a new pear called &lt;code&gt;MyHorde&lt;/code&gt; based on
Funambol template just run the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ syncevolution --template Funambol MyHorde
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It will set up several files and folders under the
&lt;code&gt;~/.config/syncevolution/default/peers/MyHorde&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;First edit &lt;code&gt;config.ini&lt;/code&gt; to setup the main connexion to the SyncML server
of Horde.&lt;/p&gt;
&lt;p&gt;The first value to change is &lt;code&gt;syncURL&lt;/code&gt; that specify the URL of the SyncML
server. Just addaped it to fit your horde server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;syncURL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;https://my.server.com/horde3/rpc.php&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then set the &lt;code&gt;username&lt;/code&gt; to be used to connect to the server and finally
choose to set up the &lt;code&gt;password&lt;/code&gt; either as plain text in the configuration
as the name of an environmental variable or as nothing to be asked for each
synchronization.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="adaptation-of-the-names-of-the-pim-resources"&gt;
&lt;h2&gt;Adaptation of the names of the PIM resources&lt;/h2&gt;
&lt;p&gt;Inside the &lt;code&gt;sources/&lt;/code&gt; are configured the different PIM data that can be
synchronized. syncevolution is able to synchronize the address book, the
calendar, the memos and the todo list each of them configured in the
&lt;code&gt;config.ini&lt;/code&gt; file of the corresponding  folder.&lt;/p&gt;
&lt;p&gt;Two main variables are set in these different files the first one &lt;code&gt;sync&lt;/code&gt;
specify if the resource should be sync and how (one way, two-way, etc…). The
second one &lt;code&gt;uri&lt;/code&gt; give the name of the resource on the server.&lt;/p&gt;
&lt;p&gt;Here are the setting I tested:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;addressbook&lt;/code&gt; and &lt;code&gt;memo&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;sync&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;disabled&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;calendar&lt;/code&gt; with&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;sync&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;two-way&lt;/span&gt;
&lt;span class="na"&gt;uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;event&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;todo&lt;/code&gt; with&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;sync&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;two-way&lt;/span&gt;
&lt;span class="na"&gt;uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;task&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To launch the synchronization simply launch syncevolution with the name of the
profile to use:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ syncevolution MyHorde
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That is!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.hermerschmidt.com/Linux/SyncML"&gt;Howto install SyncML enabled Horde 3.3 from Debian squeeze&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Horde"></category><category term="SyncML"></category><category term="syncevolution"></category><category term="Debian"></category></entry><entry><title>SOCK proxy for any application (Flash)</title><link href="https://blog.tblein.eu/client/2012/sock-proxy-for-any-application-flash/" rel="alternate"></link><published>2012-09-12T01:00:13+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-09-12:client/2012/sock-proxy-for-any-application-flash/</id><summary type="html">&lt;p&gt;Normally the plugins launch inside the web browser are using the proxy settings
of the browser. However, the Flash plugin is not taking it into account, if it
manage to find a direct Internet connexion. Therefore even your web browsing is
going through the proxy all the connexion initiated inside the Flash plugin are
not going through it, that may prevent the connexion if proxy is the only way to
go out or change the IP of connexion preventing a correct service.&lt;/p&gt;
&lt;div class="section" id="proxchains-the-wrapping-of-all-connexion-of-a-program-to-a-proxy"&gt;
&lt;h2&gt;proxchains the wrapping of all connexion of a program to a proxy&lt;/h2&gt;
&lt;p&gt;To work around it, a solution is to use a SOCKS wrapping library to wrap any
calls to the network stack with SOCKS wrappers and send them through the proxy.
proxychain is such a tool. To install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# sudo apt-get install proxychains&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can configure it in &lt;code&gt;/etc/proxychains.conf&lt;/code&gt; file. For example to use
the SOCK 5 proxy running on localhost listening on port 8080:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;dynamic_chain&lt;/span&gt;

&lt;span class="n"&gt;tcp_read_time_out&lt;/span&gt; &lt;span class="mi"&gt;15000&lt;/span&gt;
&lt;span class="n"&gt;tcp_connect_time_out&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;ProxyList&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;socks5&lt;/span&gt; &lt;span class="mf"&gt;127.0.0.1&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="ssh-as-a-sock-proxy"&gt;
&lt;h2&gt;SSH as a SOCK proxy&lt;/h2&gt;
&lt;p&gt;The classic way to have a SOCK 5 proxy server running locally is a SSH tunnel
that is launch with the &lt;code&gt;-D port&lt;/code&gt; option:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ssh -D &lt;span class="m"&gt;8080&lt;/span&gt; user@server.net
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This way all connexion going locally will be going out on &lt;code&gt;server.net&lt;/code&gt;.
The connexion need to be running so the launch application can use it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="loading-of-the-wrapping-for-a-program"&gt;
&lt;h2&gt;Loading of the wrapping for a program&lt;/h2&gt;
&lt;p&gt;proxychains manage to capture all the network calls by loading a specific
wrapping around the network call function. The easiest way to do it is just to
run the &lt;code&gt;proxychains&lt;/code&gt; program followed by the name of the program which
connexion need to be pass to the proxy. For example to launch Iceweasel:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ proxychains iceweasel
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="https://github.com/haad/proxychains"&gt;proxychains on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.dataparadis.net/osp/gnu-linux-server/proxy-server/socks-proxy-port-forwarding-through-ssh-tunnel-flash/"&gt;Socks Proxy, Port Forwarding through SSH Tunnel (Flash)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://jzila.com/?p=6"&gt;Hulu in Canada&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="ssh"></category><category term="proxy"></category><category term="flash"></category><category term="Debian"></category></entry><entry><title>LDAP authentication</title><link href="https://blog.tblein.eu/server/2012/ldap-authentication/" rel="alternate"></link><published>2012-09-07T00:49:16+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-09-07:server/2012/ldap-authentication/</id><summary type="html">&lt;p&gt;How to add ldap authentication to Debian server. It suppose that a running ldap
server  is running and that the ldap tree is filled correctly with account
informations.&lt;/p&gt;
&lt;div class="section" id="libnss-ldapd-installation"&gt;
&lt;h2&gt;libnss-ldapd installation&lt;/h2&gt;
&lt;p&gt;The client need the &lt;cite&gt;libnss-ldapd&lt;/cite&gt; package that is a fork of the historical
&lt;cite&gt;libnss-ldap&lt;/cite&gt; for better efficiency&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install libnss-ldapd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For the configuration it ask the following information:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;URI of the LDAP server. better as an IP to prevent any DNS resolution problem&lt;/li&gt;
&lt;li&gt;The root base where to look for the information (DN)&lt;/li&gt;
&lt;li&gt;The name services to configure: aliases, ethers, group, hosts, netgroup,
networks, passwd, protocols, rpc,services, shadow. for LDAP authentication
group, passwd and shadow should be selected.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="set-identification-credential-for-ldap-connexion"&gt;
&lt;h2&gt;Set identification credential for LDAP connexion&lt;/h2&gt;
&lt;p&gt;If the connexion to the LDAP server need an authentication you can specify it in
the &lt;code&gt;/etc/nslcd.conf&lt;/code&gt; file by uncommenting and adjusting the following
variables:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;binddn cn=nss,dc=example,dc=com
bindpw my_password
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After modification, restart nslcd service:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# /etc/init.d/nslcd restart&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="testing"&gt;
&lt;h2&gt;Testing&lt;/h2&gt;
&lt;p&gt;To test if it is working, we need to ask for information that are store locally
and in the LDAP server. To get information about account we need to use the
&lt;code&gt;getent&lt;/code&gt; command followed by the name of the database we want to retrieve.&lt;/p&gt;
&lt;p&gt;For example to retrieve all the content of the &lt;code&gt;passwd&lt;/code&gt; database we use
the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ getent passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
&lt;span class="o"&gt;[&lt;/span&gt;...&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It should show entries that are present on the local database but also in the
LDAP directory.&lt;/p&gt;
&lt;p&gt;We can also limit to a particular entry, like root account:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# getent passwd root&lt;/span&gt;
root:x:0:0:root:/root:/bin/bash
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And here for root group:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# getent group root&lt;/span&gt;
root:x:0:admin
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="home-directory-creation"&gt;
&lt;h2&gt;Home directory creation&lt;/h2&gt;
&lt;p&gt;The creation of the home directory is normally done when creating the user.
However for LDAP user they might not have been created on the current system and
therefore did not have any home directory. If you want that it is created
automatically at the connexion of the user if it does not exist you need to edit
the &lt;code&gt;/etc/pam.d/common-session&lt;/code&gt; file and add at the end the following
line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;session required        pam_mkhomedir.so skel=/etc/skel
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="references"&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.debian.org/LDAP/NSS"&gt;LDAP/NSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://arthurdejong.org/nss-pam-ldapd/setup"&gt;nss-pam-ld:how to set up LDAP authentication&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="authentication"></category><category term="LDAP"></category><category term="Debian"></category></entry><entry><title>New server setup</title><link href="https://blog.tblein.eu/server/2012/New-server-setup/" rel="alternate"></link><published>2012-09-07T00:16:15+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-09-07:server/2012/New-server-setup/</id><summary type="html">&lt;p&gt;Small process when we get a new installed with more eye-candy staff and
security.&lt;/p&gt;
&lt;div class="section" id="core-configuration"&gt;
&lt;h2&gt;Core configuration&lt;/h2&gt;
&lt;div class="section" id="locales-configuration"&gt;
&lt;h3&gt;Locales configuration&lt;/h3&gt;
&lt;p&gt;To setup the appropates locales on the system: the one that will be available
for the users.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; dpkg-reconfigure locales
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Select the local according to the language you want and the different encodings.
The more languages encoding you will selected the more time it will need to
generate them and the more disk space it will use.&lt;/p&gt;
&lt;p&gt;For example, to get French messages select the locales starting by &lt;code&gt;fr_FR&lt;/code&gt;
(French from France) for all encoding. The best encoding on Unix system is
UTF-8. On the second screen select the default language and encoding that will
be used by the system for example &lt;code&gt;fr_FR.UTF-8&lt;/code&gt;, to get message in French
by default.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="bash-configuration"&gt;
&lt;h3&gt;Bash configuration&lt;/h3&gt;
&lt;p&gt;The creation of a new user take the default configuration files that are present
in the &lt;code&gt;/etc/skel/&lt;/code&gt; folder.  However, by default the root user do not get
these files. Therefore to get a better bash shell for root with color prompt and
auto-completion we have to copy the &lt;code&gt;.bashrc&lt;/code&gt; manually:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; cp /etc/skel/.bashrc &lt;span class="nv"&gt;$HOME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By default the bash auto-completion is activated in that file.&lt;/p&gt;
&lt;p&gt;To activate the color prompt uncomment the line 39:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;39 &lt;/span&gt; &lt;span class="c1"&gt;#force_color_prompt=yes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to get&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;39 &lt;/span&gt; &lt;span class="nv"&gt;force_color_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yes
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Some commands can use color. To use it by default some alias could be activated
in the lines 78 and following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; -x /usr/bin/dircolors &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;test&lt;/span&gt; -r ~/.dircolors &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dircolors -b ~/.dircolors&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dircolors -b&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;ls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ls --color=auto&amp;#39;&lt;/span&gt;
    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;dir --color=auto&amp;#39;&lt;/span&gt;
    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;vdir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;vdir --color=auto&amp;#39;&lt;/span&gt;

    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;grep --color=auto&amp;#39;&lt;/span&gt;
    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;fgrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;fgrep --color=auto&amp;#39;&lt;/span&gt;
    &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;egrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;egrep --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Logout and login again to get it active, or source it to get active in the current shell:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# source $HOME/.bashrc&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="set-a-alias-address-for-root-account"&gt;
&lt;h3&gt;Set a alias address for root account&lt;/h3&gt;
&lt;p&gt;By default all system email are send to the root user. However, to avoid uneeded
root login it is a godd idea to redirect this email to an other account or
address. For that we need to modify &lt;code&gt;/etc/aliases&lt;/code&gt; so it contain the
following line:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;root:&lt;/span&gt; &lt;span class="err"&gt;nom@domain.com&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All email send to root will be send to this address.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="increase-the-security-of-the-system"&gt;
&lt;h2&gt;Increase the security of the system&lt;/h2&gt;
&lt;div class="section" id="system-upgrade"&gt;
&lt;h3&gt;System upgrade&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude update
&lt;span class="gp"&gt;#&lt;/span&gt; aptitude dist-upgrade
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To receive by email automatically available system upgrade, you need to install
&lt;code&gt;apticron&lt;/code&gt; package&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install apticron
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The message of possible upgrade will be send by email on a daily basis to root
by default&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="fail2ban-installation"&gt;
&lt;h3&gt;fail2ban installation&lt;/h3&gt;
&lt;p&gt;fail2ban is a daemon that is monitoring connexion attempt and blacklist
temporarily IP addresses after a certain amount of failed connexion from this
IP. This prevent brute force attack s, that try all possible password to enter
the system.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install fail2ban
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To configure it you have to edit the &lt;code&gt;/etc/fail2ban/fail.conf&lt;/code&gt; file.
Several modules are available for fail2ban and to activate them you need to go
to the end of the configuration file (around the line 74). Each module is called
a &lt;code&gt;JAIL&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Each &lt;code&gt;JAIL&lt;/code&gt; is setup the same way, like for example for &lt;code&gt;ssh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[ssh]&lt;/span&gt;
&lt;span class="na"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;port&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ssh&lt;/span&gt;
&lt;span class="na"&gt;filter&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;sshd&lt;/span&gt;
&lt;span class="na"&gt;logpath&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/var/log/auth.log&lt;/span&gt;
&lt;span class="na"&gt;maxretry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;6&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Its name is in between &lt;code&gt;[]&lt;/code&gt;, and the option &lt;code&gt;enable&lt;/code&gt; is set to true
to activate it. The port that have to be monitored is set with the &lt;code&gt;port&lt;/code&gt;
option, like the log file (&lt;code&gt;logpath&lt;/code&gt;) and the filter to use to interpret
it (&lt;code&gt;filter&lt;/code&gt;). Finally the number of error that is allowed before an IP
ban (&lt;code&gt;maxretry&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;By default the &lt;code&gt;ssh&lt;/code&gt; JAIL is activated. The &lt;code&gt;pam-generic&lt;/code&gt; JAIL allow
to block the user after error on the PAM module. The &lt;code&gt;ssh-ddos&lt;/code&gt; JAIL to
protect against deny of service attacks.&lt;/p&gt;
&lt;p&gt;To take into account the new configuration you need to restart the service with
the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service fail2ban restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="rkhunter-installation"&gt;
&lt;h3&gt;rkhunter installation&lt;/h3&gt;
&lt;p&gt;It is a software that search for rootkit by searching for modification of main
programs compared to safe stat and signature and to identify already known
rootkits.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install rkhunter
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="debsecan-installation"&gt;
&lt;h3&gt;debsecan installation&lt;/h3&gt;
&lt;p&gt;Check for security alerts on the web in relation with the system.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install debsecan
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To configure it run&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; dpkg-reconfigure debsecan
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Select the correct distribution, so the alert will be in relation to it.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.enyo.de/fw/software/debsecan/"&gt;debsecan web site&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="firewall-configuration-with-ferm"&gt;
&lt;h2&gt;Firewall configuration with ferm&lt;/h2&gt;
&lt;p&gt;See the corresponding article about &lt;a class="reference external" href="https://blog.tblein.eu/server/2016/Easy-firewall-with-ferm/"&gt;ferm&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="ssh-connexion-limitation"&gt;
&lt;h2&gt;SSH connexion limitation&lt;/h2&gt;
&lt;div class="alert alert-danger"&gt;
Do not deactivate the SSH connexion for the &lt;code&gt;root&lt;/code&gt; user without any
other account on the system: you will not be able to connect to the server
anymore.&lt;/div&gt;
&lt;p&gt;First create a user (&lt;code&gt;admin&lt;/code&gt; in this example) that will be able to connect as
&lt;code&gt;root&lt;/code&gt; after the deactivation of the SSH connexion for &lt;code&gt;root&lt;/code&gt; user.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; adduser admin
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When configured, the SSH connexion for &lt;code&gt;root&lt;/code&gt; user can be deactivated in
the &lt;cite&gt;/etc/ssh/sshd_config&lt;/cite&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;26 &lt;/span&gt; &lt;span class="err"&gt;PermitRootLogin&lt;/span&gt; &lt;span class="err"&gt;no&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Restart SSH server to take it into account.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/ssh restart
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="limitation-of-the-su-command-only-to-certain-users"&gt;
&lt;h3&gt;Limitation of the su command only to certain users&lt;/h3&gt;
&lt;div class="alert alert-danger"&gt;
It is highly suggested to keep a connected root console on the server until the
configuration is working et to confirmed that we can become root before
closing it. In case of error, it might prevent any connexion as root.&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;su&lt;/code&gt; command allow to change user in a console to execute a program.
The main case is the switch to &lt;code&gt;root&lt;/code&gt; for administration tasks. However,
it could be nice to limit this possibility to certain user. By default
&lt;code&gt;su&lt;/code&gt; can be executed by any user, assuming he knows the password of the
targeted user. It is possible to limit this possibility to a particular group by
modifying the PAM configuration file of su (&lt;code&gt;/etc/pam.d/su&lt;/code&gt;). The
following should be uncommented:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;15 &lt;/span&gt; &lt;span class="err"&gt;auth&lt;/span&gt;       &lt;span class="err"&gt;required&lt;/span&gt;   &lt;span class="err"&gt;pam_wheel.so&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By default, the user should belong to the &lt;code&gt;root&lt;/code&gt; group to be able to use
&lt;code&gt;su&lt;/code&gt;. Historically, the super-user group is called &lt;code&gt;wheel&lt;/code&gt; therefore
the name of the PAM module (see [[!wikipedia Wheel_(Unix_term)]] for more info).
It is possible to change the &lt;code&gt;wheel&lt;/code&gt; group to consider by adding the
&lt;code&gt;group=group_name&lt;/code&gt; option to the command. Therefore to set the &lt;code&gt;adm&lt;/code&gt;
group as &lt;code&gt;wheel&lt;/code&gt; group:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;15 &lt;/span&gt; &lt;span class="na"&gt;auth       required   pam_wheel.so group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;adm&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you just have to add the user you want to allow to connect as root in the
correct group. For example to add the &lt;code&gt;admin&lt;/code&gt; user to the &lt;code&gt;root&lt;/code&gt;
group:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; adduser admin root
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://howto.landure.fr/gnu-linux/debian-4-0-etch/complements-a-linstallation-dune-debian-4-0-etch"&gt;Compléments à l'installation d'une Debian 4.0 Etch ou 5.0 Lenny&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/doc/manuals/debian-reference/ch-tune.fr.html#s-wheel"&gt;Pourquoi GNU su ne supporte pas le groupe wheel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="security"></category><category term="setup"></category><category term="Debian"></category></entry><entry><title>po regex</title><link href="https://blog.tblein.eu/development/2012/po-regex/" rel="alternate"></link><published>2012-09-04T00:42:19+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-09-04:development/2012/po-regex/</id><summary type="html">&lt;p&gt;Some notes to be able to construct a small program able to apply a regex to
translated string of a po file&lt;/p&gt;
&lt;p&gt;Will be done certainly in python:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://pypi.python.org/pypi/polib"&gt;polib&lt;/a&gt; python module to be able to
handle the po files seems quite simple to use according to the &lt;a class="reference external" href="http://polib.readthedocs.org/en/latest/quickstart.html"&gt;Quick start
guide&lt;/a&gt;. In addition
&lt;a class="reference external" href="http://packages.debian.org/search?keywords=python-polib"&gt;polib is included in Debian
repository&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Finally the &lt;a class="reference external" href="http://docs.python.org/library/re.html"&gt;python regex module re&lt;/a&gt;. &lt;a class="reference external" href="http://docs.python.org/howto/regex"&gt;The official Howto on regex in
python&lt;/a&gt;. The regex are not set as in
perl but with a regex, the on the perl regex the two parts could be extract
easily.&lt;/li&gt;
&lt;li&gt;command line arguments parse with &lt;a class="reference external" href="http://docs.python.org/library/argparse"&gt;argparse&lt;/a&gt; as usual&lt;/li&gt;
&lt;/ul&gt;
</summary><category term="python"></category><category term="po"></category><category term="regex"></category></entry><entry><title>Redirecting sderr to a pipe</title><link href="https://blog.tblein.eu/development/2012/redirecting-sderr-to-a-pipe/" rel="alternate"></link><published>2012-07-31T11:36:06+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-07-31:development/2012/redirecting-sderr-to-a-pipe/</id><summary type="html">&lt;p&gt;Programs are sending message on two different steam of data: standard output and
standard error. Standard output, notes as &lt;code&gt;stdout&lt;/code&gt;,  is where the program
is writing the output data. Standard error or &lt;code&gt;stderr&lt;/code&gt; is to output the
error messages or diagnostics. With this two stream we can therefore separate
between these two kind of output and process them separately. A third stream of
data exist, that is standard input or stdin, which correspond to the entry of
data for a program.&lt;/p&gt;
&lt;p&gt;Classical shell programming involved to play with these different stream of
data, where the &lt;code&gt;stdout&lt;/code&gt; of one program is pipe to the &lt;code&gt;stdin&lt;/code&gt; of an
other program to get the desired functionality. One of this task is to filter
the output of a command with &lt;code&gt;grep&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$  ls -1
Desktop
Documents
Pictures
Videos
Download
Music
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$  ls -1 &lt;span class="p"&gt;|&lt;/span&gt; grep D
Desktop
Documents
Download
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However, pipe is only for redirection of &lt;code&gt;stdout&lt;/code&gt; to the &lt;code&gt;stdin&lt;/code&gt;.
Sometime we would like to filter the &lt;code&gt;stderr&lt;/code&gt; and not the &lt;code&gt;sdtout&lt;/code&gt;.
Therefore we need to redirect the stream so they can be processed correcrtly.&lt;/p&gt;
&lt;p&gt;First we can redirect &lt;code&gt;stderr&lt;/code&gt; to &lt;code&gt;stdout&lt;/code&gt; and mix the two output
that will be then filtered:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ myprog 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep something
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the same time we can destroy the output of &lt;code&gt;stdout&lt;/code&gt; and only keep
&lt;code&gt;stderr&lt;/code&gt; to be filtered:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ myprog 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &amp;gt; /dev/null &lt;span class="p"&gt;|&lt;/span&gt; grep something
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You have to be carefull in the order of the command since the following do not
seems to work as expected, both stream being redirected to /dev/null&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ myprog &amp;gt; /dev/null  2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;1&lt;span class="p"&gt;|&lt;/span&gt; grep something
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://mywiki.wooledge.org/BashFAQ/047"&gt;How can I redirect stderr to a pipe?&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="pipe"></category><category term="bash"></category></entry><entry><title>Mounting a ext formated disk on FreeBSD</title><link href="https://blog.tblein.eu/general/2012/mounting-a-ext-formated-disk-on-freebsd/" rel="alternate"></link><published>2012-07-27T18:16:53+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-07-27:general/2012/mounting-a-ext-formated-disk-on-freebsd/</id><summary type="html">&lt;p&gt;Disk naming are a little bit different between BSD and Linux. In addition ext2/ext3 file system are not so nicely support. However, you can mount your disk to read then.&lt;/p&gt;
&lt;div class="section" id="list-the-disk-available-on-the-system"&gt;
&lt;h2&gt;List the disk available on the system&lt;/h2&gt;
&lt;p&gt;To get the list of connected disk to the system enter the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;camcontrol devlist
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It will output something as follow:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;lt;VBOX HARDDISK 1.0&amp;gt;   at scbus0 target 0 lun 0 (ada0,pass0)
&amp;lt;VBOX CD-ROM 1.0&amp;gt;     at scbus1 target 0 lun 0 (pass1,cd0)
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To get the partitions available:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ls /dev/ada0*
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="mounting-the-filesystem"&gt;
&lt;h2&gt;Mounting the filesystem&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;mount -t ext2fs /dev/ad0s1 /mnt/linux
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="FreeBSD"></category><category term="ext"></category><category term="mounting"></category></entry><entry><title>Reinstallation of the same packages on Debian</title><link href="https://blog.tblein.eu/general/2012/reinstallation-of-the-same-packages-on-debian/" rel="alternate"></link><published>2012-07-27T18:16:53+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-07-27:general/2012/reinstallation-of-the-same-packages-on-debian/</id><summary type="html">&lt;p&gt;For the transfer of a Debian or Ubuntu machine, or to make a mirror of it, it is
often needed to reinstall the packages that are installed one one system on an
other one. We will explain it in here.&lt;/p&gt;
&lt;div class="section" id="the-dpkg-way-of-doing"&gt;
&lt;h2&gt;The dpkg way of doing&lt;/h2&gt;
&lt;p&gt;First of all, we need to grab the list of all installed package and save it in
a text file. Here we will save it in &lt;code&gt;installed_packages.txt&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# dpkg --get-selections &amp;gt; installed_packages.txt&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;installed_packages.txt&lt;/code&gt; file contain a list of package and their installation status:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;aalib1                                          deinstall
abiword-common                                  deinstall
acroread                                        install
acroread-debian-files                           install
acroread-escript                                install
acroread-plugins                                install
adduser                                         install
adept-notifier                                  deinstall
affix                                           install
akode                                           deinstall
akregator                                       install
alsa-base                                       install
alsa-oss                                        install
alsa-tools                                      install
 [...]
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After transferring the list of packages on the new system we need to load it
inside &lt;code&gt;dpkg&lt;/code&gt;, with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# dpkg --set-selections &amp;lt; mes_paquets&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, we need to say to apt-get to grab this selection to set the package to
install and remove:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get dselect-upgrade&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Finally a classical upgrade is required:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get dist-upgrade&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="the-aptitude-way-of-doing"&gt;
&lt;h2&gt;The aptitude way of doing&lt;/h2&gt;
&lt;p&gt;Grabs the only the manually installed packages on the current system in
&lt;code&gt;installed_packages.txt&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# aptitude search -F%p ~i\!~M &amp;gt; installed_packages.txt&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;installed_packages.txt&lt;/code&gt; file contain a list of package, without
status unlike for the dpkg way:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;aalib1
abiword-common
acroread
acroread-debian-files
acroread-escript
acroread-plugins
adduser
adept-notifier
affix
akode
akregator
alsa-base
alsa-oss
alsa-tools
 [...]
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After transferring the list of packages on the new system, we just have to give
it to aptitude or apt:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# aptitude install $(cat installed_packages.txt)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install $(cat installed_packages.txt)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The advantage of this method is that only the manually installed packages will
be installed, with corresponding dependency. It will therefore set correctly the
database use to detect the manually installed packages, and not with all the
packages that were installed on the first system.&lt;/p&gt;
&lt;/div&gt;
</summary><category term="Debian"></category><category term="dpkg"></category><category term="aptitude"></category><category term="installation"></category></entry><entry><title>Resource management links</title><link href="https://blog.tblein.eu/server/2012/resource-management-links/" rel="alternate"></link><published>2012-07-06T14:02:58+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-07-06:server/2012/resource-management-links/</id><summary type="html">&lt;p&gt;Description:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Simple Linux Utility for Resource Management (SLURM) is an open source,
fault-tolerant, and highly scalable  cluster management and job scheduling
system for large and small Linux clusters. SLURM requires no kernel
modifications for its operation and is relatively self-contained. As a cluster
resource manager, SLURM has three key functions. First, it allocates exclusive
and/or non-exclusive access to resources (compute nodes) to users for some
duration of time so they can perform work. Second, it provides a framework for
starting, executing, and monitoring work (normally a parallel job) on the set
of allocated nodes. Finally, it arbitrates contention for resources by
managing a queue of pending work.&lt;/p&gt;
&lt;p class="attribution"&gt;&amp;mdash;&lt;a class="reference external" href="http://www.schedmd.com/slurmdocs/slurm.html"&gt;SLURM: A Highly Scalable Resource Manager&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.schedmd.com/slurmdocs/slurm.html"&gt;SLURM: A Highly Scalable Resource Manager&lt;/a&gt; Official SLURM website&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.hpc2n.umu.se/batchsystem/examples_scripts"&gt;Example job submission files&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</summary><category term="SLURM"></category><category term="links"></category></entry><entry><title>po files handling</title><link href="https://blog.tblein.eu/development/2012/po_file_handling/" rel="alternate"></link><published>2012-07-05T22:41:31+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-07-05:development/2012/po_file_handling/</id><summary type="html">&lt;p&gt;po files are used by programs to translate the messages in different
languages. Thus they contain a list of all translatable strings
extracted from the code and their corresponding translation, in a given
language. Here are given some information to manipulate and few resources to
help the translation, mainly derived from experiments in for &lt;a class="reference external" href="http://www.debian.org/international/french/"&gt;Debian project
translation to French&lt;/a&gt;.&lt;/p&gt;
&lt;div class="section" id="file-formating"&gt;
&lt;h2&gt;File formating&lt;/h2&gt;
&lt;p&gt;For ease of reading text files on any type of screen it is common to limit the
size of their line to 80 characters. The following command allows to cut the
lines at 80 characters while maintaining the specific labeling of po files:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgcat fr.po -o fr.po
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can specify the length of a line to another value if necessary with the
&lt;code&gt;-w&lt;/code&gt; option. So to format a po file with 40 characters:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgcat -w40 fr.po -o fr.po
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="update-of-a-file-while-already-start-the-translation"&gt;
&lt;h3&gt;Update of a file while already start the translation&lt;/h3&gt;
&lt;p&gt;When translating sometimes the original po file have been updated while your
translation is not finished. The following command can update your po file
(fr.po) with new data from the new file (&lt;code&gt;fr.new.po&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgmerge --update --previous fr.po fr.new.po
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can continue on your translation on the updated &lt;code&gt;fr.po&lt;/code&gt; file.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;div class="section" id="general"&gt;
&lt;h3&gt;General&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Translation proposition database based on already translated FLOSS projects: &lt;a class="reference external" href="http://open-tran.eu/"&gt;http://open-tran.eu/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="debian-specific-french-translation-team"&gt;
&lt;h3&gt;Debian specific (French translation team)&lt;/h3&gt;
&lt;div class="section" id="help"&gt;
&lt;h4&gt;Help&lt;/h4&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/french/lexique"&gt;English-French lexicon&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/french/typographie"&gt;French Typography&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="status-and-coordination"&gt;
&lt;h4&gt;Status and coordination&lt;/h4&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://i18n.debian.net/debian-l10n/french/fr.by_status.html"&gt;French status and coordination page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po/fr"&gt;Status of PO files for language code: fr – French&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po-debconf/fr"&gt;Status of Debconf templates l10n with PO files for language code: fr – French&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po-debconf/pot"&gt;PO files for Debconf templates — Original files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/intl/l10n/po4a/fr"&gt;Status of PO files managed with po4a for language code: fr — French&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</summary><category term="po"></category><category term="l10n"></category><category term="tips"></category><category term="Debian"></category></entry><entry><title>LanguageTool for Vim</title><link href="https://blog.tblein.eu/client/2012/languagetool-for-vim/" rel="alternate"></link><published>2012-06-07T13:52:33+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-06-07:client/2012/languagetool-for-vim/</id><summary type="html">&lt;p&gt;&lt;a class="reference external" href="http://www.languagetool.org/"&gt;LanguageTool&lt;/a&gt; is an Open Source style and grammar
proofreading software. It is a good complement to the spell checking program
already in use in a lot of software.&lt;/p&gt;
&lt;p&gt;It is written in Java and aimed to be integrated easily in
OpenOffice.org/LibreOffice as a plugin. But it can also be used as a stand-alone
GUI application, embedded in other Java applications or as a server service.&lt;/p&gt;
&lt;p&gt;It exists also a command line interface that can be integrated as a tool inside
Vim.&lt;/p&gt;
&lt;div class="section" id="languagetool-installation"&gt;
&lt;h2&gt;LanguageTool installation&lt;/h2&gt;
&lt;p&gt;First of all download the last version of LanguageTool form &lt;a class="reference external" href="http://www.languagetool.org/"&gt;its website&lt;/a&gt;. It is under the form of
a OpenOffice.org/LibreOffice plugin, so with an &lt;code&gt;.oxt&lt;/code&gt; extension. In fact
it is a zip archive and for installing it you need to unzip it in the folder of
your choice. In our example we will install it in &lt;code&gt;~/lib/LanguageTool&lt;/code&gt;
directory.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ mkdir -p ~/lib/LanguageTool
$ mv LanguageTool-1.7.oxt ~/lib/LanguageTool/
$ &lt;span class="nb"&gt;cd&lt;/span&gt; ~/lib/LanguageTool
$ unzip LanguageTool-1.7.oxt
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To be able to run it you will need the version 6 of Java. Therefore if you do
not already have it just install it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install openjdk-6-jre&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-of-the-vim-binding"&gt;
&lt;h2&gt;Installation of the Vim binding&lt;/h2&gt;
&lt;p&gt;Thanks to Dominique Pellé a &lt;a class="reference external" href="http://www.vim.org/scripts/script.php?script_id=3223"&gt;Vim plugin exist&lt;/a&gt; to be able to run
LanguageTool from within Vim.&lt;/p&gt;
&lt;p&gt;Download the last version from &lt;a class="reference external" href="http://www.vim.org/scripts/script.php?script_id=3223"&gt;its description page&lt;/a&gt; and install it on your
&lt;cite&gt;.vim&lt;/cite&gt; directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ mkdir -p ~/.vim
$ &lt;span class="nb"&gt;cd&lt;/span&gt; ~/.vim
$ unzip /path-to/LanguageTool.zip
$ vim -c &lt;span class="s1"&gt;&amp;#39;helptags ~/.vim/doc&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you need to define the path to &lt;code&gt;LanguageTool.jar&lt;/code&gt; inside your
&lt;code&gt;.vimrc&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;let&lt;/span&gt; &lt;span class="n"&gt;g:languagetool_jar&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;/lib/LanguageTool/LanguageTool.jar&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="use-of-languagetool-inside-vim"&gt;
&lt;h2&gt;Use of LanguageTool inside Vim&lt;/h2&gt;
&lt;p&gt;You need to specify the language of your text inside Vim with command
&lt;code&gt;spelllang&lt;/code&gt;. For example to set the language to French enter &lt;code&gt;:set
spelllang=fr&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To run LanguageTool on the current buffer just run &lt;code&gt;:LanguageToolCheck&lt;/code&gt;.
If you use the example text of LanguageTool:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Paste your own text here... or check this text too see a few of the problems
that that LanguageTool can detect. Did you notice that their is no spelcheckin
included?
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Which should give you an output like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# java -jar /home/tblein/lib/LanguageTool/LanguageTool.jar -c utf-8 -d WHITESPACE_RULE,EN_QUOTES -l en --api /tmp/vtjmKYQ/3&lt;/span&gt;

&lt;span class="n"&gt;Error:&lt;/span&gt;      &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TOO_TO:1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;@&lt;/span&gt; &lt;span class="nv"&gt;1L&lt;/span&gt; &lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt;
&lt;span class="n"&gt;Message:&lt;/span&gt;    &lt;span class="n"&gt;Did&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;to see&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;Context:&lt;/span&gt;    &lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="n"&gt;ste&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;own&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;check&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="n"&gt;too&lt;/span&gt; &lt;span class="n"&gt;see&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;few&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;LanguageTool&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;Correction:&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;see&lt;/span&gt;

&lt;span class="n"&gt;Error:&lt;/span&gt;      &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;THEIR_IS:1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;@&lt;/span&gt; &lt;span class="nv"&gt;2L&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="n"&gt;C&lt;/span&gt;
&lt;span class="n"&gt;Message:&lt;/span&gt;    &lt;span class="n"&gt;Did&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;there&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;Context:&lt;/span&gt;    &lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="n"&gt;LanguageTool&lt;/span&gt; &lt;span class="n"&gt;can&lt;/span&gt; &lt;span class="n"&gt;detect&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Did&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;notice&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;their&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="nb"&gt;no&lt;/span&gt; &lt;span class="n"&gt;spelcheckin&lt;/span&gt; &lt;span class="n"&gt;included&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;Correction:&lt;/span&gt; &lt;span class="n"&gt;there&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.languagetool.org/"&gt;LanguageTool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.vim.org/scripts/script.php?script_id=3223"&gt;LanguageTool Vim plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Vim"></category><category term="LanguageTool"></category></entry><entry><title>Perl and UTF-8</title><link href="https://blog.tblein.eu/development/2012/perl-and-utf-8/" rel="alternate"></link><published>2012-05-08T01:20:03+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-05-08:development/2012/perl-and-utf-8/</id><summary type="html">&lt;p&gt;Like with python, the handling of [[!wikipedia UTF-8]] string in perl is not
straight forward since this language was not originally design to handle Unicode
strings of characters.&lt;/p&gt;
&lt;div class="section" id="correct-length-of-utf-8-string"&gt;
&lt;h2&gt;Correct length of UTF-8 string&lt;/h2&gt;
&lt;p&gt;[[!wikipedia ASCII]] characters are coded on 8bits that is on one octet. That
explain the limited number of different characters and the different encodings
according to language. Unicode try to solve it by encoding it on several
a dynamic number of octet depending of the characters. Therefore some characters
are only coded on one octet (the one that are present in the [[!wikipedia
ASCII]] set) some other on two octets.&lt;/p&gt;
&lt;p&gt;By default in perl the strings are [[!wikipedia ASCII]] and therefore to
determine their length with the length function it only count the number of
octet. That fit perfectly when the characters are coded only on one octet but in
a lot of language the some used characters are coded on several octets. The
length is therefore longer, for example in the following script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#! /usr/bin/env perl&lt;/span&gt;
&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;Ceci est une chaîne avec trois caractères codés sur deux octets&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="nb"&gt;length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ./test.pl
66
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In fact there are 63 characters in this string.&lt;/p&gt;
&lt;p&gt;To get the real string length a conversion of the format is needed. For that the
Encode module need to be use to decode the [[!wikipedia UTF-8]] string before
measuring its length:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#! /usr/bin/env perl&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;Encode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;Ceci est une chaîne avec trois caractères codés sur deux octets&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="nb"&gt;length&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;Encode::&lt;/span&gt;&lt;span class="n"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;$string&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ ./test.pl
63
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This time the correct size of the string is returned&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="wide-character-in-print"&gt;
&lt;h2&gt;Wide character in print&lt;/h2&gt;
&lt;p&gt;When printing some [[!wikipedia UTF-8]] string on the console it may append that
the following error appear:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Wide character in print at test.pl line 3.
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To remove of it just add the folling entry at the beginning of your script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.linuxask.com/questions/wide-character-in-print-warning-in-perl"&gt;Wide character in print… warning in Perl&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="perl"></category><category term="utf-8"></category></entry><entry><title>Installation of a CAcert certificate for lighttpd</title><link href="https://blog.tblein.eu/server/2012/installation-of-a-cacert-certificate-for-lighttpd/" rel="alternate"></link><published>2012-05-01T22:35:45+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-05-01:server/2012/installation-of-a-cacert-certificate-for-lighttpd/</id><summary type="html">&lt;p&gt;Here we will see how to set up a X.509 certificate signed by &lt;a class="reference external" href="http://www.cacert.org"&gt;CAcert&lt;/a&gt; on lighttpd web server&lt;/p&gt;
&lt;div class="section" id="tls-ssl"&gt;
&lt;h2&gt;TLS/SSL&lt;/h2&gt;
&lt;p&gt;[[!wikipedia Transport_Layer_Security]] best known as TLS/SSL is a cryptographic
protocol use on Internet to encrypt communications. It using both asymmetric
encryption for key exchange and symmetric encryption for the rest of the
communication. Therefore, one server private key and the corresponding server
certificate are needed.&lt;/p&gt;
&lt;p&gt;The confidentiality of the exchanges is mainly based on the certificate. To be
sure that we get the server certificate from the correct server it is be signed
by some [[!wikipedia Certificate_Authority]]. The [[!wikipedia
Certificate_Authority]] is often a third party that is recognize by the two
actors. The most known are [[!wikipedia VeriSign]], [[!wikipedia GoDaddy]] and
[[!wikipedia Comodo]]. However, they are quite expensives.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="get-a-signed-certificate-by-cacert"&gt;
&lt;h2&gt;Get a signed certificate by CAcert&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.cacert.org"&gt;CAcert&lt;/a&gt; is a community driven, Certificate Authority
that issues certificates to the public for free. To get a signed certificate
just register on the web site.&lt;/p&gt;
&lt;p&gt;You will need to install the &lt;code&gt;ssl-cert&lt;/code&gt; and &lt;code&gt;ca-certificates&lt;/code&gt; to be
able to generate the server private key and a certificate signing request (CSR).
To generate CAcert provide a small shell script &lt;a class="reference external" href="http://svn.cacert.org/CAcert/Software/CSRGenerator/csr"&gt;csr&lt;/a&gt;.  After downloading
it just run it and answer the questions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ csr.sh
Private Key and Certificate Signing Request Generator
This script was designed to suit the request format needed by
the CAcert Certificate Authority. www.CAcert.org

Short Hostname &lt;span class="o"&gt;(&lt;/span&gt;ie. imap big_srv www&lt;span class="o"&gt;)&lt;/span&gt;: www
FQDN/CommonName &lt;span class="o"&gt;(&lt;/span&gt;ie. www.example.com&lt;span class="o"&gt;)&lt;/span&gt; : *.example.com
Type SubjectAltNames &lt;span class="k"&gt;for&lt;/span&gt; the certificate, one per line. Enter a blank line to finish
SubjectAltName: DNS:*.example.com
SubjectAltName: DNS:
Running OpenSSL...
Generating a &lt;span class="m"&gt;2048&lt;/span&gt; bit RSA private key
......+++
...............................................................+++
writing new private key to &lt;span class="s1"&gt;&amp;#39;/home/user/www_privatekey.pem&amp;#39;&lt;/span&gt;
-----
Copy the following Certificate Request and paste into CAcert website to obtain a Certificate.
When you receive your certificate, you &lt;span class="s1"&gt;&amp;#39;should&amp;#39;&lt;/span&gt; name it something like www_server.pem

-----BEGIN CERTIFICATE REQUEST-----
MIIBzTCCATYCAQAwgYwxCzAJBgNVBAYTAmdiMQ8wDQYDVQQIEwZMb25kb24xDzAN
BgNVBAcTBkxvbmRvbjEZMBcGA1UEChMQU3BhY2VTdXJmZXIgTHRkLjEZMBcGA1UE
AxMQd3d3LnNwYWNlcmVnLmNvbTElMCMGCSqGSIb3DQEJARYWd2VibWFzdGVyQHNw
YWNlcmVnLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAywfuXnd348ot
iAcZ4RHFc509ImCTagKaNkiQ4xyijbPYP7H0UQ5iXqvojSIcbUOVhExqwqyqjCPm
7ZpON3IXktIcKAwPFvoqKkHuqTa8KMnZTSY8P7QILYHFd2Sd1l1arCrWv8HWb+qM
RHVTlviBaLAHQxnz28qKkYN09K0fw5cCAwEAAaAAMA0GCSqGSIb3DQEBBAUAA4GB
AFMgp2KkHQXMC1JbZf3AkIz7mrl4X21cRusTfd8ec3RuMZexGy76jMGFyPWVM69R
Fvpfiic8h28HrHube7pEPFpdUSj2cR4OZCAg5uqzN/ESwc4CtLzej7pWoDPpc/kv
hiJ/eGOxINKd39kCuzIS6zrvb2ihJth7jcmokezmrwjQ
-----END CERTIFICATE REQUEST-----

The Certificate request is also available in /home/user/www_csr.pem
The Private Key is stored in /home/user/www_privatekey.pem
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Submit your CSR to &lt;a class="reference external" href="www.cacert.org"&gt;CAcert web site&lt;/a&gt; and save the resulting
signed private key in a file in the &lt;code&gt;/etc/ssl/private&lt;/code&gt; folder:
&lt;code&gt;server_certificate.pem&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;-----BEGIN CERTIFICATE-----
MIIErjCCApagAwIBAgIDC65yMA0GCSqGSIb3DQEBBQUAMHkxEDAOBgNVBAoTB1Jv
b3QgQ0ExHjAcBdHA6Ly93d3cuY2FjZXgNVBAsTFWh0J0Lm9yZzEiMCAGA1UEAxMZ
Q0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSc3VwcG9y
dEBjYWNlcnQub3JnM5MMDUwMTEXDTEyMTAyODE5TcxOFoB4XDTEyMTcxOFowFjEU
MBIGA1UEAxQLKi50YmxlaW4uZXUwggEiMwAwggEKA0GCSqGSIb3DQEBAQUAA4IBD
Ip4P+pzo1lvNbCCorGUozI3Bh9f/hshftTb2P6Y0KAlja81jtK3fXz2am86NJ037
AoIBAQDDVCgRg/nWoZmE990WD5AxC0NvVQgOmCvuP84JSoDgzIgGbNiCspkNm3uB
gYw+B0JD7d0luyvrXu4nf5UG3lBeB0NUoYKNTfMYsBrwugNyukEegq7VMmzLo21t
FoDnUn/Dg6lEE08g5MXzTNqSQzL/60jrI7/A2mYdtOb3Pg20+GONN326kbeKK6EA
kaaN8R3tPVY1PNTG9HPAe8scIF3V3FXkqj6E2GuLcQZmfK9OmFdPzy9VvZ5RFGoA
abTFXA6xCT6Apfrpd04e0Fh18Dq+SvdmWS8Y6sBXUxL50GHTSBSMAggSgIDWujxi
OE2OdPEQjCUR9TOSVGBVT6JFzRkLXZ+8GJWELyQisUZDtcXN8Msy2wpdovSLf2QL
rTx0rBgl3DhoRmfPab4Vq8OZb+zlGf9armskX4JFWNejF9ZcIt65myv7P8yfucjT
tcbZRuw0DINpAxqDdK4B25RE6GF7AgMBAAGjgaEwgZ4wDAYDVR0TAQH/BAIwADA0
BgkqhkiG9w0BAQUFAAOCAgEAn3X9Xj4D+hNY0Gla5Q5fMtOOXhT253VtjubpdEcs
BgNVHSUELTArBggrBgEFBQcDAgYIKwYBBQUHAwEGCWCGSAGG+EIEAQYKKwYBBAGC
NwoDAzALBgNVHQ8EBAMCBaAwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdo
dHRwOi8vb2NzcC5jYWNlcnQub3JnLzAWBgNVHREEDzANggsqLnRibGVpbi5ldTAN
8ZBJBLxzNi5ipDDNRvJQKkd09tZ1JHqE+AdKLBpqi29exQp9AMEgZGw+ljibK3UD
ZV8oBRW1icLVNXunG2jY6hTWmP11baaAnTnELyknCtDYgH5t2KPDwpiLBQS5UNuc
+tFldPrs9kIUhCy/t//vKrlKiqg7JZuoEFhVgmjPpoQbHRwyHuiSW6IKqmwKWdA5
Kp0mVUUqfFDU+C+RjvKpeEtS3j7r3MDAo083KzJerI0YsOFxqJRZ3++mzOqY7Teu
uulk4GvV6re2GsuWWXKMPhK8Sz5jGEVYK7Wf7iGWTgwDJuicyRkjBHWFkfYlrL7V
/KZnak4lLEAOXYhwNnqHfrUiaDtvWhZXkYfrC4tRMSHRhKg9Kub1x3cGnhb/+Duq
GZI0M17BoQZZmPUGqpxm2NLyizwlH+hKyomKpBcX35kxeQLk3ilHuyb58zc4AWgg
&lt;span class="nv"&gt;NOI&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
-----END CERTIFICATE-----
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To check its validity run &lt;code&gt;openssl&lt;/code&gt; command with the action &lt;code&gt;verify&lt;/code&gt;
on it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ openssl verify server_certificat.pem
server_certificat.pem: OK
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You should get &lt;code&gt;OK&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="inclusion-of-the-certificate-to-be-handle-by-lighttpd"&gt;
&lt;h2&gt;Inclusion of the certificate to be handle by lighttpd&lt;/h2&gt;
&lt;p&gt;To be able to encrypt data with lighttpd the server certificate, the server
private key and the certificate authority certificate should be given to
lighttpd. The private key and the server certificate should be combined in one
file with a command like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# cat /etc/ssl/private/server_privatekey.pem /etc/ssl/certs/server_certificate.pem \&lt;/span&gt;
   &amp;gt; /etc/ssl/private/lighttpd.pem
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then change the access right of this file to readable only by the owner and the
group owner and writable by the owner. This very important to set it up like
this since anybody who have access to this file will be able to decrypt all the
encrypt traffic of the server.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# chgrp www-data /etc/ssl/private/lighttpd.pem&lt;/span&gt;
&lt;span class="c1"&gt;# chmod 640 /etc/ssl/private/lighttpd.pem&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you need to configure lighttpd for example in
&lt;code&gt;/etc/lighttpd/conf-enabled/10-ssl.conf&lt;/code&gt; on Debian to take into account
the certificate:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;$SERVER&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;socket&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;0.0.0.0:443&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;ssl.engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;enable&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;ssl.ca-file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/share/ca-certificates/cacert.org/cacert.org.crt&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;ssl.pemfile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/etc/ssl/private/lighttpd.pem&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;ssl.cipher-list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;ssl.honor-cipher-order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;enable&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;ssl.ca-file&lt;/code&gt; entry specify the certificate authority certificate and
&lt;code&gt;ssl.pemfile&lt;/code&gt; the server privat key and certificate file.&lt;/p&gt;
&lt;p&gt;You just need to restart lighttpd and your certificate should be available.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# /etc/init.d/lighttpd restart&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.flexion.org/linux/cacert-certificate/"&gt;Get a Certificate from CACert&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.cacert.org"&gt;CAcert&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.system-linux.eu/index.php?post/2009/12/04/Certificat-x509-pour-votre-Apache"&gt;Certificat x509 pour votre Apache&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="CAcert"></category><category term="lighttpd"></category><category term="Debian"></category></entry><entry><title>Preventing multiple executions of a Makefile</title><link href="https://blog.tblein.eu/development/2012/preventing-multiple-executions-of-a-makefile/" rel="alternate"></link><published>2012-05-01T17:21:48+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-05-01:development/2012/preventing-multiple-executions-of-a-makefile/</id><summary type="html">&lt;p&gt;Often the automatic builds are controlled by the &lt;code&gt;make&lt;/code&gt; tools using the
rules defined in so named &lt;code&gt;Makefile&lt;/code&gt;. &lt;code&gt;make&lt;/code&gt; is very nice since it
allow a smooth control of the build with a direct link with dependencies.
Therefore only what is need to be build is built. A rule is executed only when the
dependencies are younger than the target for that rule.&lt;/p&gt;
&lt;p&gt;To automate the builds regularly the construction might be run regularly via
&lt;code&gt;cron&lt;/code&gt; jobs. However, if the time in between the &lt;code&gt;make&lt;/code&gt; runs is
smaller than the time required to perform a particular task, this task will be
run several time and filled the resources of the computer. To prevent it we can
setup a protection on the &lt;code&gt;Makefile&lt;/code&gt; to prevent it to be executed several
times at a given time.&lt;/p&gt;
&lt;div class="section" id="lock-file"&gt;
&lt;h2&gt;Lock file&lt;/h2&gt;
&lt;p&gt;To prevent the multiple execution of the &lt;code&gt;Makefile&lt;/code&gt; we will use a so called lock
file. When the &lt;code&gt;Makefile&lt;/code&gt; is execute it will create a file with a particular name.
This is our lock file. When it finish to execute, it just delete this file. In case
the &lt;code&gt;Makefile&lt;/code&gt; is run a second time in parallel, it will see that the lock file
exist and stop the processing.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-up-lock-files-inside-a-makefile"&gt;
&lt;h2&gt;Setting up lock files inside a Makefile&lt;/h2&gt;
&lt;p&gt;To determine the existence of the file we will use the unix command &lt;code&gt;ls&lt;/code&gt;
that will return the name of the lock file if it exist else nothing. We will
catch it in a make variable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;LOCKFILEEXIST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;shell ls &lt;span class="k"&gt;$(&lt;/span&gt;LOCKFILE&lt;span class="k"&gt;)&lt;/span&gt; 2&amp;gt; /dev/null&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then we test if this variable is empty or not. In case it is not empty, we exit
with an error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;ifneq ($(LOCKFILEEXIST), )&lt;/span&gt;
&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;error&lt;/span&gt; &amp;quot;&lt;span class="nv"&gt;already&lt;/span&gt; &lt;span class="nv"&gt;running&lt;/span&gt;&amp;quot;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="cp"&gt;endif&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In case we the lock file does not exist we continue the process and set the lock
file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;shell&lt;/span&gt; &lt;span class="nv"&gt;touch&lt;/span&gt; &lt;span class="k"&gt;$&lt;/span&gt;(&lt;span class="nv"&gt;LOCKFILE&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then follow the rest of the &lt;code&gt;Makefile&lt;/code&gt; like usual. We just need to remove the lock
file at the end of the rpocessing. For this we add it at the end of the all
rules that is the main run.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    @echo &lt;span class="s2"&gt;&amp;quot;processed&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;$(&lt;/span&gt;shell rm -f &lt;span class="k"&gt;$(&lt;/span&gt;LOCKFILE&lt;span class="k"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command should be add to all rules that terminate the run, otherwise future
run might be blocked even no &lt;code&gt;Makefile&lt;/code&gt; is running&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="testing-it"&gt;
&lt;h2&gt;Testing it&lt;/h2&gt;
&lt;p&gt;The final test &lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c"&gt;# Definition of the lockfile&lt;/span&gt;
&lt;span class="nv"&gt;LOCKFILE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;test.lock&amp;quot;&lt;/span&gt;

&lt;span class="c"&gt;# Search for the lock file&lt;/span&gt;
&lt;span class="nv"&gt;LOCKFILEEXIST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;shell ls &lt;span class="k"&gt;$(&lt;/span&gt;LOCKFILE&lt;span class="k"&gt;)&lt;/span&gt; 2&amp;gt; /dev/null&lt;span class="k"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# if the lock file exist exit&lt;/span&gt;
&lt;span class="cp"&gt;ifneq ($(LOCKFILEEXIST), )&lt;/span&gt;
&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;error&lt;/span&gt; &amp;quot;&lt;span class="nv"&gt;already&lt;/span&gt; &lt;span class="nv"&gt;running&lt;/span&gt;&amp;quot;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="cp"&gt;endif&lt;/span&gt;

&lt;span class="c"&gt;# Create the lock file&lt;/span&gt;
&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;shell&lt;/span&gt; &lt;span class="nv"&gt;touch&lt;/span&gt; &lt;span class="k"&gt;$&lt;/span&gt;(&lt;span class="nv"&gt;LOCKFILE&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# process and remove the lock file&lt;/span&gt;
&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    @echo &lt;span class="s2"&gt;&amp;quot;processed&amp;quot;&lt;/span&gt;
    &lt;span class="k"&gt;$(&lt;/span&gt;shell rm -f &lt;span class="k"&gt;$(&lt;/span&gt;LOCKFILE&lt;span class="k"&gt;))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Without any lock file the execution is done and like this several time:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ make all
processed
$ make all
processed
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When a lock file exist the Makefile stop with an error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ touch test.lock
$ make all
 Makefile:5: *** &lt;span class="s2"&gt;&amp;quot;already running&amp;quot;&lt;/span&gt;. Stop.
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="Makefile"></category><category term="multiprocessing"></category></entry><entry><title>Writting UTF-8 strings in python</title><link href="https://blog.tblein.eu/development/2012/writting-utf-8-strings-in-python/" rel="alternate"></link><published>2012-05-01T14:48:48+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-05-01:development/2012/writting-utf-8-strings-in-python/</id><summary type="html">&lt;p&gt;When processing some strings in python you may have to deal with special
characters. You test your code with some output on the standard output and
everything is working. However when you want to write your string you have
complains like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ne"&gt;UnicodeError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ascii&lt;/span&gt; &lt;span class="n"&gt;codec&lt;/span&gt; &lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;t decode byte 0x85 in position 255: oridinal not in range(128)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="what-is-the-problem"&gt;
&lt;h2&gt;What is the problem?&lt;/h2&gt;
&lt;p&gt;The problem comes from the fact that when writing in the file, python use the
[[!wikipedia ASCII]] coding that code characters on 8bits and have only 128
different characters, while your string is encodes with a higher number of
characters. On most current Unix the default character encoding is [[!wikipedia
UTF-8]] that code characters with a variable number of bits. So it may appends
that some of the characters you want to write are no more in the set of
[[!wikipedia ASCII]]. There is no problem when printing on the standard output,
because your console is certainly in [[!wikipedia UTF-8]] also.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="how-to-solve-it"&gt;
&lt;h2&gt;How to solve it?&lt;/h2&gt;
&lt;p&gt;In python there are to sort of structures that handle list of characters:
strings and unicode. The strings are using [[!wikipedia ASCII]] and unicode are
using Unicode as their name shows it.&lt;/p&gt;
&lt;p&gt;To be able to write a string encodes with [[!wikipedia UTF-8]] you first need to
transform it as unicode.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;my_utf8_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;A string with some UTF-8 characters °&amp;quot;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;my_utf8_string&lt;/span&gt;
&lt;span class="s1"&gt;&amp;#39;A string with some UTF-8 characters &lt;/span&gt;&lt;span class="se"&gt;\xc2\xb0&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;converted_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;unicode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_utf8_string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;converted_string&lt;/span&gt;
&lt;span class="s1"&gt;u&amp;#39;A string with some UTF-8 characters &lt;/span&gt;&lt;span class="se"&gt;\xb0&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then you need to open the file as [[!wikipedia UTF-8]] with the &lt;code&gt;codecs&lt;/code&gt;
python module and save your unicode string as with a normal file handling.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;codecs&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;codecs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/tmp/test&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;w&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;outFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;outFile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;converted_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That's all.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="resources"&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.evanjones.ca/python-utf8.html"&gt;How to Use UTF-8 with Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://docs.python.org/library/codecs.html"&gt;codecs — Codec registry and base classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://docs.python.org/library/string.html"&gt;string — Common string operations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://docs.python.org/library/unicodedata.html"&gt;unicodedata — Unicode Database&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="python"></category><category term="UTF-8"></category></entry><entry><title>Xerox Phaser 6010N on Debian 64bits</title><link href="https://blog.tblein.eu/client/2012/xerox-phaser-6010n-on-debian-64bits/" rel="alternate"></link><published>2012-04-30T22:22:38+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-04-30:client/2012/xerox-phaser-6010n-on-debian-64bits/</id><summary type="html">&lt;p&gt;Xerox gives the drivers only for 32bits Linux boxes. The installation of the
drivers under 64bits is not strait forward, therefore here is a small guide on
how to install a Xerox Phaser 6010N on Debian Wheezy 64bits (amd64). It should
work similarly on any Squeeze box.&lt;/p&gt;
&lt;div class="section" id="for-the-inpatients"&gt;
&lt;h2&gt;For the inpatients&lt;/h2&gt;
&lt;p&gt;Here is the fast content:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;install core 32bits libraries (&lt;code&gt;ia32bits&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;install manually a 32bits version of the &lt;code&gt;libcupsimage2&lt;/code&gt; library in
&lt;code&gt;/usr/lib32/&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;install the Xerox Phaser 6010 32bits package;&lt;/li&gt;
&lt;li&gt;configure the printer with the driver.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-of-32bits-libraries"&gt;
&lt;h2&gt;Installation of 32bits libraries&lt;/h2&gt;
&lt;p&gt;If not already done install the core 32bits libraries on your 64bits
installation with the following command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# apt-get install ia32-libs&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-of-the-xerox-drivers"&gt;
&lt;h2&gt;Installation of the Xerox drivers&lt;/h2&gt;
&lt;p&gt;Go to Xerox web site to download the &lt;a class="reference external" href="http://www.support.xerox.com/support/phaser-6010/downloads/enus.html?operatingSystem=linux"&gt;Phaser 6010 deb package on the Linux page&lt;/a&gt;.
Select English as language since the complete drivers are only available in
English.&lt;/p&gt;
&lt;p&gt;To install it you need to force the architecture since it is a 32bits (i386)
package:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# dpkg -i --force-architecture xerox-phaser-6000-6010_1.0-1_i386.deb&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configure-the-printer"&gt;
&lt;h2&gt;Configure the printer&lt;/h2&gt;
&lt;p&gt;Install and configure the printer with the proposed Xerox driver. Normally until
know you should not get any error. However when trying to print it cannot
success.&lt;/p&gt;
&lt;p&gt;In Cups logs you can see that a library is missing: libcupsimage.so.2&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-of-a-32bits-version-of-libcupsimage2"&gt;
&lt;h2&gt;Installation of a 32bits version of libcupsimage2&lt;/h2&gt;
&lt;p&gt;libcupsimage is not included by default in the 32bits library of Debian
therefore you will need to install it by hand. For that just go to Debian web
site and download the 32bits package of
&lt;a class="reference external" href="http://packages.debian.org/wheezy/i386/libcupsimage2/download"&gt;libcupsimage2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Uncompress it in a temporary folder (&lt;code&gt;ia32&lt;/code&gt; for example) with the following
command&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ dpkg -X libcupsimage2_1.5.2-5_i386.deb ia32/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You need then to copy the library at its correct place as root (/usr/lib32):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# cp ia32/usr/lib/i386-linux-gnu/libcupsimage.so.2 /usr/lib32/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To take it into account you need to update the library used by the dynamic
linker just run the following command as root:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# ldconfig&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can launch another print and that time it should work.&lt;/p&gt;
&lt;div class="alert alert-warning"&gt;
You have to be careful since the library was not installed with the package
manager therefore it will not be automatically updated.&lt;/div&gt;
&lt;/div&gt;
</summary><category term="32bits"></category><category term="64bits"></category><category term="cups"></category><category term="Xerox"></category><category term="Debian"></category></entry><entry><title>PDF manipulation on command line</title><link href="https://blog.tblein.eu/client/2012/pdf-manipulation-on-command-line/" rel="alternate"></link><published>2012-04-26T10:23:16+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2012-04-26:client/2012/pdf-manipulation-on-command-line/</id><summary type="html">&lt;div class="section" id="tools"&gt;
&lt;h2&gt;Tools&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/"&gt;Pdftk&lt;/a&gt; a general
command line tool box&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam"&gt;PDFjam&lt;/a&gt;
a set of shell script using the pdfpages LaTeX package for pdf processing&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="command-examples"&gt;
&lt;h2&gt;Command examples&lt;/h2&gt;
&lt;div class="section" id="combines-different-pdf-in-one-pdftk"&gt;
&lt;h3&gt;Combines different pdf in one (Pdftk)&lt;/h3&gt;
&lt;p&gt;Fixed list the order of input file is important, combine &lt;cite&gt;1.pdf&lt;/cite&gt;, &lt;cite&gt;2.pdf&lt;/cite&gt; and &lt;cite&gt;3.pdf&lt;/cite&gt; in &lt;cite&gt;123.pdf&lt;/cite&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All the pdf of the directory by alphabetic order in &lt;cite&gt;all.pdf&lt;/cite&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pdftk *.pdf cat output all.pdf
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="puts-several-page-on-one-sheet-pdfjam"&gt;
&lt;h3&gt;Puts several page on one sheet (PDFjam)&lt;/h3&gt;
&lt;p&gt;Two page per sheet on top of each other&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pdfnup --nup 1x2 input.pdf
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Two page per sheet on side by side&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pdfnup --nup 2x1 input.pdf
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h3&gt;Sources&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.pdflabs.com/docs/pdftk-cli-examples/"&gt;Official Pdftk examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</summary><category term="cli"></category><category term="pdf"></category></entry><entry><title>Installation d'un serveur OpenVPN</title><link href="https://blog.tblein.eu/server/2011/Installation-of-an-OpenVPN-server/index-fr.html" rel="alternate"></link><published>2011-09-05T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-09-05:server/2011/Installation-of-an-OpenVPN-server/index-fr.html</id><summary type="html">&lt;div class="section" id="installation-du-serveur"&gt;
&lt;h2&gt;Installation du serveur&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install openvpn
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="generation-des-certificats-et-cles"&gt;
&lt;h2&gt;Génération des certificats et clés&lt;/h2&gt;
&lt;p&gt;Tout se passe dans le repertoire
&lt;code&gt;/usr/share/doc/openvpn/examples/easy-rsa/2.0/&lt;/code&gt; Pour s'y rendre:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/share/doc/openvpn/examples/easy-rsa/2.0/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ensuite il faut modifier les valeurs du fichier &lt;code&gt;vars&lt;/code&gt; en accord avec nos
paramètres avec notamment:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;64 &lt;/span&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;KEY_COUNTRY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;FR&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;65 &lt;/span&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;KEY_PROVINCE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;France&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;66 &lt;/span&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;KEY_CITY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Petaouchnok&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;67 &lt;/span&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;KEY_ORG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Ma Boite&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;68 &lt;/span&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;KEY_EMAIL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;ma@maboite.fr&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;une fois le fichier &lt;code&gt;vars&lt;/code&gt; complété il faut initialisé les variables
à l'aide de la commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;source&lt;/span&gt; vars
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une remise à zéro de la génération de certificat dans le sous dossier
&lt;code&gt;keys&lt;/code&gt; s'effectue à l'aide de la commande suivante :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ./clean-all
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="generation-du-certificat-et-de-la-cle-de-lautorite-de-certification-ca"&gt;
&lt;h3&gt;Génération du certificat et de la clé de l’autorité de certification (CA)&lt;/h3&gt;
&lt;p&gt;Il s'agit du certificat principal du serveur qui va être utilisé par tous les
nœud pour la signature des différents certificats et clés. Ainsi en utilisant la
clé le certificat va pouvoir contrôler la provenance des certificats présentés
par les clients.  Pour les générer :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ./build-ca
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il suffit de répondre par défaut au questions qui ont été pré-remplies par le
fichier &lt;code&gt;vars&lt;/code&gt;. Seul l'entrée &lt;code&gt;Common Name&lt;/code&gt; n'est pas remplie. Il
s'agit du nom du serveur. Le certificat est créé dans le fichier
&lt;code&gt;keys/ca.crt&lt;/code&gt; et la clé correspondantes dans le fichier
&lt;code&gt;keys/ca.key&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="generation-du-certificat-et-de-la-cle-du-serveur"&gt;
&lt;h3&gt;Génération du certificat et de la clé du serveur&lt;/h3&gt;
&lt;p&gt;Il s'agit du certificat et de la clé qui permettront d'identifier le serveur. Le
script suivant permet de générer la clé &lt;code&gt;NomDuServeur.key&lt;/code&gt; et le
certificat &lt;code&gt;NomDuServeur.crt&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ./build-key-server NomDuServeur
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Vers la fin de ce script il est demandé un mot de passe. Si un mot de passe est
entré, à chaque démarrage du serveur OpenVPN il faudra entrer ce mot de passe.
Dans le cas contraire il n'y en aura pas besoin, mais une personne possédant la
clé pourra l'utiliser sans contrainte.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="generation-du-certificat-et-de-la-cle-pour-chaque-client"&gt;
&lt;h3&gt;Génération du certificat et de la clé pour chaque client&lt;/h3&gt;
&lt;p&gt;Pour les clients un script comparable existe. Ainsi pour obtenir le certificat
et la clé pour un client &lt;code&gt;lambda&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ./build-key lambda
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La clé &lt;code&gt;keys/lambda.key&lt;/code&gt; et le certificat &lt;code&gt;keys/lambda.crt&lt;/code&gt; sont
ainsi créer. Comme précédemment pour la clé du serveur concernant le mot de
passe. Il faut répéter cette procédure pour chaque client différents.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="creation-du-parametre-diffie-hellman"&gt;
&lt;h3&gt;Création du paramètre Diffie Hellman&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ./build-dh
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;qui va créer le fichier &lt;code&gt;keys/dh1024.pem&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-du-serveur-openvpn"&gt;
&lt;h2&gt;Configuration du serveur OpenVPN&lt;/h2&gt;
&lt;p&gt;Il faut déplacer les certificats et la clé créés pour le serveur dans le
répertoire principale de OpenVPN (code:&lt;cite&gt;/etc/openvpn/&lt;/cite&gt;), a savoir le certificat
et la clé de l’autorité de certification (code:&lt;cite&gt;ca.crt&lt;/cite&gt; et &lt;code&gt;ca.key&lt;/code&gt;), le
certificat et la clé spécifiques du serveur (code:&lt;cite&gt;NomDuServeur.crt&lt;/cite&gt; et
&lt;code&gt;NomDuServeur.key&lt;/code&gt;) et le fichier du paramettre de Diffie Hellman
(code:&lt;cite&gt;dh1024.pem&lt;/cite&gt;)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/ca.crt /etc/openvpn/
&lt;span class="gp"&gt;#&lt;/span&gt; cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/ca.key /etc/openvpn/
&lt;span class="gp"&gt;#&lt;/span&gt; cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/NomDuServeur.crt /etc/openvpn/
&lt;span class="gp"&gt;#&lt;/span&gt; cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/NomDuServeur.key /etc/openvpn/
&lt;span class="gp"&gt;#&lt;/span&gt; cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem /etc/openvpn/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une fois les différents fichier en place il faut créer un fichier de
configuration pour le serveur. Pour cela le plus simple est de partir à partir
du fichier d'exemple contenu dans&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/share/doc/openvpn/examples/sample-config-files/
&lt;span class="gp"&gt;#&lt;/span&gt; gunzip server.conf.gz
&lt;span class="gp"&gt;#&lt;/span&gt; cp server.conf /etc/openvpn/
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-du-serveur-comme-point-d-acces"&gt;
&lt;h2&gt;Configuration du serveur comme point d'accés&lt;/h2&gt;
&lt;div class="section" id="configuration-du-pare-feux-ferm"&gt;
&lt;h3&gt;Configuration du pare-feux ferm&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Mise en place du NAT des adresses:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;POSTROUTING&lt;/span&gt; &lt;span class="n"&gt;saddr&lt;/span&gt; &lt;span class="mf"&gt;10.8.0.0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;255.255.255.0&lt;/span&gt; &lt;span class="n"&gt;MASQUERADE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Autoriser les connexions depuis l'interface du vpn dans la table filter et la chaine INPUT :&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;interface&lt;/span&gt; &lt;span class="n"&gt;tun0&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Autoriser le transfert de paquets venant du vpn chaine FORWARD :&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;interface&lt;/span&gt; &lt;span class="n"&gt;tun0&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="autoriser-le-forward-ipv4"&gt;
&lt;h3&gt;Autoriser le forward IPv4&lt;/h3&gt;
&lt;p&gt;De manière temporaire:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &amp;gt; /proc/sys/net/ipv4/ip_forward
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;De manière permanente en définisant dans le fichier &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; l'option &lt;code&gt;net.ipv4.ip_forward&lt;/code&gt; à 1:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;net.ipv4.ip_forward&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.coagul.org/spip.php?article422"&gt;Installation OpenVPN 2.01 sur une Debian Etch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://howto.landure.fr/gnu-linux/debian-4-0-etch/installer-et-configurer-openvpn-sur-debian-4-0-etch"&gt;Installer et configurer OpenVPN sur Debian 4.0 Etch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.cacert.org/wiki/OpenWRT"&gt;OpenWRT sur CACert Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.frogdev.info/openvpn.php"&gt;OPENVPN sur frogdev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.lea-linux.org/documentations/index.php/Point_d'accès_sécurisé_par_OpenVPN"&gt;Point d'accès sécurisé par OpenVPN sur Léa-Linux&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="VPN"></category><category term="Debian"></category><category term="OpenVPN"></category></entry><entry><title>Installation d'un serveur pptpd</title><link href="https://blog.tblein.eu/server/2011/Installation-of-a-pptpd-server/index-fr.html" rel="alternate"></link><published>2011-08-30T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-08-30:server/2011/Installation-of-a-pptpd-server/index-fr.html</id><summary type="html">&lt;p&gt;PTP est un protocole de tunnel de point à point permettant de créer des réseaux
privés [[wp&amp;gt;Point-to-Point_Tunneling_Protocol]]. Conçut par Microsoft, il est
moins robuste que les solutions VPN récentes comme OpenVPN, IPSec mais
a l'avantage d'être implémenté d'office dans Windows et est plus facilement
accessible que les autres solution de VPN sur certains appareils (HP TouchPad).
Nous alons voir ici comme le mettre en place sur un serveur Debian (Squeeze) en
utilisant le serveur poptop (paquet &lt;code&gt;pptpd&lt;/code&gt;).&lt;/p&gt;
&lt;div class="section" id="installation-et-configuration-du-serveur"&gt;
&lt;h2&gt;Installation et configuration du serveur&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install pptpd
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="adresses"&gt;
&lt;h3&gt;Adresses&lt;/h3&gt;
&lt;p&gt;La configuration a lieu dans le fichier &lt;code&gt;/etc/pptpd.conf&lt;/code&gt;. Vous devez
y préciser l'adresse IP privé du serveur ainsi que la plage d'adresse IP
utilisées par les clients. Par exemple pour un serveur ayant pour adresse privé
10.8.1.1 et des clients entre les adresses IP 10.8.1.10 à 10.8.1.20:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;localip&lt;/span&gt; &lt;span class="err"&gt;10.8.1.1&lt;/span&gt;
&lt;span class="err"&gt;remoteip&lt;/span&gt; &lt;span class="err"&gt;10.8.1.10-20&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="utilisateurs"&gt;
&lt;h3&gt;Utilisateurs&lt;/h3&gt;
&lt;p&gt;Pour se connecter au serveur les utilisateurs doivent spécifié un nom
d'utilisateur et un mot de passe. Ils sont spécifiés dans le fichier
&lt;code&gt;/etc/ppp/chap-secrets&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pour cela pour et pour chaque utilisateur il suffit d'ajouter une ligne comme la
suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;client&lt;/span&gt;    &lt;span class="err"&gt;server&lt;/span&gt;  &lt;span class="err"&gt;secret&lt;/span&gt;          &lt;span class="err"&gt;IP&lt;/span&gt; &lt;span class="err"&gt;addresses&lt;/span&gt;
&lt;span class="err"&gt;monlogin&lt;/span&gt;    &lt;span class="err"&gt;*&lt;/span&gt;     &lt;span class="err"&gt;monmotdepasse&lt;/span&gt;       &lt;span class="err"&gt;*&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="regles-du-pare-feux"&gt;
&lt;h2&gt;Règles du pare feux&lt;/h2&gt;
&lt;p&gt;Le VPN ppptp utilise le port 1723 il faut donc l'ouvrir pour pouvoir s'y
connecter. Ainsi avec &lt;code&gt;ferm&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;INPUT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;proto&lt;/span&gt; &lt;span class="n"&gt;tcp&lt;/span&gt; &lt;span class="n"&gt;dport&lt;/span&gt; &lt;span class="mi"&gt;1723&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une fois les utilisateurs connectés et si vous considérez que vos utilisateurs
sont sures vous pouvez ouvrir les ports en provenance du VPN:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;INPUT&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;interface&lt;/span&gt; &lt;span class="n"&gt;ppp0&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="acces-internet-a-travers-le-vpn"&gt;
&lt;h2&gt;Accès internet à travers le VPN&lt;/h2&gt;
&lt;p&gt;Cela permet aux utilisateurs du VPN d'accéder au reste du réseau et internet
à travers le VPN.&lt;/p&gt;
&lt;div class="section" id="activation-du-transfert-des-paquets-ip-au-niveau-du-noyau"&gt;
&lt;h3&gt;Activation du transfert des paquets IP au niveau du noyau&lt;/h3&gt;
&lt;p&gt;Cela s'effectue via la commande suivante&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &amp;gt; /proc/sys/net/ipv4/ip_forward
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour le rendre permanent il suffit de décommenter
dans le fichier &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; la ligne&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;net.ipv4.ip_forward&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="id1"&gt;
&lt;h3&gt;Règles du pare-feux&lt;/h3&gt;
&lt;p&gt;Dans un premier temps il faut autoriser le transfert de paquets IP en provenance
du VPN. Par exemple avec ferm:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;FORWARD&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;interface&lt;/span&gt; &lt;span class="n"&gt;ppp0&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ain si la translation d'adresse en provenance des adresses du réseau VPN. Par exemple avec ferm&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="n"&gt;nat&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chain&lt;/span&gt; &lt;span class="n"&gt;POSTROUTING&lt;/span&gt; &lt;span class="n"&gt;saddr&lt;/span&gt; &lt;span class="mf"&gt;10.8.1.0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;255.255.255.0&lt;/span&gt; &lt;span class="n"&gt;MASQUERADE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="mise-en-place-d-un-serveur-dns"&gt;
&lt;h2&gt;Mise en place d'un serveur DNS&lt;/h2&gt;
&lt;p&gt;Lors des connexions internet le serveur DNS est primordial pour associer les URL
avec les adresses IP correspondantes. Afin que les clients puissent utiliser un
service DNS facilement il est possible d'installer le cache de DNS
&lt;code&gt;dnsmasq&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install dnsmasq
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-d-un-client-sous-linux"&gt;
&lt;h2&gt;Configuration d'un client sous Linux&lt;/h2&gt;
&lt;p&gt;Pour se connecter au VPN depuis Linux il suffit d'installer le paquet
&lt;code&gt;pptp-linux&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install pptp-linux
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La configuration se fait dans les fichiers du répertoire &lt;code&gt;/etc/ppp&lt;/code&gt;. Les
mots de passe et accès sont spécifiés dans le même fichier que pour le serveur
à savoir &lt;code&gt;/etc/ppp/chap-secrets&lt;/code&gt;. Ainsi comme pour l'utilisateur du VPN
précédent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;client    server  secret          IP addresses
monlogin   PPTP   monmotdepasse       *
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ensuite pour facilité la création du tunnel il faut créer un fichier
(&lt;code&gt;mon_vpn&lt;/code&gt; dans notre exemple) dans le répertoire &lt;code&gt;/etc/ppp/peers/&lt;/code&gt;
contenant par exemple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;pty &lt;span class="s2"&gt;&amp;quot;pptp mon_vpn.example.net --nolaunchpppd&amp;quot;&lt;/span&gt;
name tblein
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam mon_vpn
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On initialise le tunnel via la commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; pon mon_vpn
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour l'arrêter :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; poff mon_vpn
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Afin que les connexions passe par le tunnel il suffit de modifier les routes par
défaut.&lt;/p&gt;
&lt;p&gt;TODO&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://blog.sumostyle.net/robg/2010/01/01/setting-up-pptpd-on-debian-lenny/"&gt;Setting up pptpd on debian (lenny)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://pptpclient.sourceforge.net/howto-debian.phtml"&gt;PPTP Client Debian HOWTO&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Debian"></category><category term="PTP"></category><category term="VPN"></category><category term="pptpd"></category></entry><entry><title>Exécuter une commande lors de la connexion</title><link href="https://blog.tblein.eu/server/2011/Executing-a-command-at-login/index-fr.html" rel="alternate"></link><published>2016-07-27T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-06-14:server/2011/Executing-a-command-at-login/index-fr.html</id><summary type="html">&lt;p&gt;Sous Linux la connexion est gérée par le système d’authentification PAM
(Pluggable Authentication Modules). Comme son nom l'indique tout se passe dans
différents modules qui permettent d'ajouter des fonctions comme différents
systèmes pour l’authentification (LDAP, NSS) ou alors des fonction à exécuter
lors de la connexion (montage de répertoires).&lt;/p&gt;
&lt;div class="section" id="pam-exec"&gt;
&lt;h2&gt;pam_exec&lt;/h2&gt;
&lt;p&gt;Le module &lt;a class="reference external" href="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/sag-pam_exec.html"&gt;pam_exec&lt;/a&gt;
permet d'exécuter une commande arbitraire lors de la connexion. Il est donc de
faire tout ce que l'on veut.&lt;/p&gt;
&lt;p&gt;Pour l'activer il suffit d'ajouter la ligne suivante dans votre fichier
&lt;code&gt;/etc/pam.d/common-session&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;span class="err"&gt;session&lt;/span&gt;    &lt;span class="err"&gt;optional&lt;/span&gt;     &lt;span class="err"&gt;pam_exec.so&lt;/span&gt;    &lt;span class="err"&gt;commande&lt;/span&gt;
&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Remplacer &lt;code&gt;commande&lt;/code&gt; par la commande à exécuter.&lt;/p&gt;
&lt;p&gt;Plusieurs variables d'environnements sont spécialement définies:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;$PAM_TYPE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_USER&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_RUSER&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_RHOST&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_SERVICE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$PAM_TTY&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="notification-de-connexion-par-email"&gt;
&lt;h2&gt;Notification de connexion par email&lt;/h2&gt;
&lt;p&gt;Une des fonction classiques de ce module est d'avoir une notification par
email lors d'une connexion. Pour cela il suffit de créer un script
&lt;code&gt;/usr/local/bin/send-mail-on-login.sh&amp;gt;&lt;/code&gt; qui :
- ne prendra en compte que les ouvertures de nouvelles connexions
- limitera à un nombre limité d'utilisateur (&lt;code&gt;admin&lt;/code&gt; et &lt;code&gt;root&lt;/code&gt; ici)
- Envoi les information par mail à l'administrateur&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;([&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_TYPE&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;open_session&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="o"&gt;([&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;root&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
     &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; !&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;admin&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]))&lt;/span&gt;
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;User: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Remote Host: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_RHOST&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Service: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_SERVICE&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;TTY: &lt;/span&gt;&lt;span class="nv"&gt;$PAM_TTY&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Date: `date`&amp;quot;&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Server: `uname -a`&amp;quot;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; mail -s &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$PAM_SERVICE&lt;/span&gt;&lt;span class="s2"&gt; login on `hostname -s` for account &lt;/span&gt;&lt;span class="nv"&gt;$PAM_USER&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; root
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ne pas oublier de le rendre executable à l'aide de la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod + x /usr/local/bin/send-mail-on-login.sh
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;et de modifier le fichier &lt;code&gt;/etc/pam.d/common-session&lt;/code&gt; en accord:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;span class="err"&gt;session&lt;/span&gt;    &lt;span class="err"&gt;optional&lt;/span&gt;     &lt;span class="err"&gt;pam_exec.so&lt;/span&gt;    &lt;span class="err"&gt;/usr/local/bin/send-mail-on-login.sh&lt;/span&gt;
&lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Maintenant à chaque connexion de &lt;code&gt;root&lt;/code&gt; ou &lt;code&gt;admin&lt;/code&gt;, un email sera
envoyer à l'administrateur. Par exemple pour une connexion d'&lt;code&gt;admin&lt;/code&gt; en
ssh&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;User: admin&lt;/span&gt;
&lt;span class="go"&gt;Remote Host: dslb-000-000-000-000.pools.arcor-ip.net&lt;/span&gt;
&lt;span class="go"&gt;Service: sshd&lt;/span&gt;
&lt;span class="go"&gt;TTY: ssh&lt;/span&gt;
&lt;span class="go"&gt;Date: mercredi 22 juin 2011, 22:46:38 (UTC+0200)&lt;/span&gt;
&lt;span class="go"&gt;Server: Linux test 2.6.32-5-amd64 #1 SMP Mon Mar 7 21:35:22 UTC 2011 x86_64 GNU/Linux&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="source"&gt;
&lt;h2&gt;Source&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://linux-attitude.fr/post/pam_exec"&gt;Scripting avec pam_exec, notification de connexion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="connection"></category><category term="PAM"></category><category term="mail"></category></entry><entry><title>Activation désactivation du wifi avec OpenWRT</title><link href="https://blog.tblein.eu/server/2011/OpenWRT_wifi_toggle/index-fr.html" rel="alternate"></link><published>2011-06-14T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-06-14:server/2011/OpenWRT_wifi_toggle/index-fr.html</id><summary type="html">&lt;p&gt;Le routeur WRT54GL possede deux boutons: un bouton de réinitialisation et un
bouton SecureEasySetup. Lors de l'installation d'OpenWRT c'est bouton ne servent
à rien. Voici comment leur donner une utilité comme activer et désactiver le
wifi.&lt;/p&gt;
&lt;div class="section" id="script-d-activation-desactivation-du-wifi"&gt;
&lt;h2&gt;Script d'activation/désactivation du wifi&lt;/h2&gt;
&lt;p&gt;Dans un premier nous allons créer un script qui permettent de changer l'état du
wifi. C'est à dire l'activer s'il est éteint et l'inactiver dans le cas
contraire.&lt;/p&gt;
&lt;p&gt;Pour cela il suffit de créer le fichier &lt;code&gt;/sbin/woggle&lt;/code&gt; (ou avec un autre
nom). Contenant ceci:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;uci get wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; in
   1&lt;span class="o"&gt;)&lt;/span&gt; uci &lt;span class="nb"&gt;set&lt;/span&gt; wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="o"&gt;=&lt;/span&gt;0
      wifi
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &amp;gt; /proc/diag/led/ses_white
   &lt;span class="p"&gt;;;&lt;/span&gt;
   *&lt;span class="o"&gt;)&lt;/span&gt; uci &lt;span class="nb"&gt;set&lt;/span&gt; wireless.@wifi-device&lt;span class="o"&gt;[&lt;/span&gt;0&lt;span class="o"&gt;]&lt;/span&gt;.disabled&lt;span class="o"&gt;=&lt;/span&gt;1
      wifi
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &amp;gt; /proc/diag/led/ses_white
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt; &amp;gt; /proc/diag/led/wlan
   &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Le script commence par récupérer l'état du wifi (&lt;code&gt;uci get
wireless.&amp;#64;wifi-device[0].disabled&lt;/code&gt;). S'il est désactivé (égale à &lt;code&gt;1&lt;/code&gt;), il
l'active et allume la LED du bouton SES. Dans le cas contraire il le désactive
et éteint les LED du bouton SES et du wifi.&lt;/p&gt;
&lt;p&gt;Il ne faut pas oublier de le rendre exécutable avec la commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod +x /sbin/woggle
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour changer l'état du wifi il suffit de lancer le script sur la ligne de commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;root@openwrt:#&lt;/span&gt; /sbin/woggle
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="lien-avec-le-bouton-ses"&gt;
&lt;h2&gt;Lien avec le bouton SES&lt;/h2&gt;
&lt;p&gt;Maintenant que nous avons un script qui change l'état du wifi il suffit de le
lier au bouton SES, pour qu'il soit exécuter chaque fois que ce bouton est
pressé.&lt;/p&gt;
&lt;p&gt;Pour cela cela se passe via la gestion des événements hotplug.  Il faut créer un
répertoir &lt;code&gt;button&lt;/code&gt; dans le repertoire &lt;code&gt;/etc/hotplug.d&lt;/code&gt; et créer ensuite un
script nommer par exemple &lt;code&gt;01-radio-toggle&lt;/code&gt;, contenant ceci:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$BUTTON&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;ses&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$ACTION&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;pressed&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="o"&gt;(&lt;/span&gt; sleep 1&lt;span class="p"&gt;;&lt;/span&gt; /sbin/woggle &lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Maintenant pour activer ou désactiver le wifi il suffit d'appuyer sur le bouton
SES.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;p&gt;[[&lt;a class="reference external" href="http://wiki.openwrt.org/doc/howto"&gt;http://wiki.openwrt.org/doc/howto&lt;/a&gt;/wifitoggle|Wifi Toggle]]&lt;/p&gt;
&lt;/div&gt;
</summary><category term="Wifi"></category><category term="OpenWRT"></category><category term="WRT54GL"></category></entry><entry><title>Lenteur avec le driver ath9k et le noyau 2.6.38 en wifi 802.11n</title><link href="https://blog.tblein.eu/client/2011/lenteur-avec-le-driver-ath9k-et-le-noyau-2638-en-wifi-80211n/index-fr.html" rel="alternate"></link><published>2011-05-12T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-05-12:client/2011/lenteur-avec-le-driver-ath9k-et-le-noyau-2638-en-wifi-80211n/index-fr.html</id><summary type="html">&lt;p&gt;Le passage au noyau 2.6.38 a une conséquence fâcheuse pour les cartes wifi
utilisant le module ath9k en 802.11n: une diminution drastique du débit. Voici
comment y remédier temporairement. Ce problème ne semble pas apparaître lors de
l'utilisation d'autre norme que le wifi 802.11n comme le 802.11g.&lt;/p&gt;
&lt;p&gt;Il suffit de créer le fichier de configuration du module ath9k
&lt;code&gt;/etc/modprobe.d/ath9k.conf&lt;/code&gt; et y mettre la ligne suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;options ath9k &lt;span class="nv"&gt;nohwcrypt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Un rechargement du module ou un redémarage de l'ordinateur devrait résoudre le
problème.&lt;/p&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://forums.debian.net/viewtopic.php?f=7&amp;amp;t=62979"&gt;ath9k snail slow wtih 2.6.38&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://forums.archlinux.fr/topic7944.html"&gt;[Wifi] Lenteur depuis kernel 2.6.38 (contourné)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="ath9k"></category><category term="2.6.38"></category><category term="Wifi"></category></entry><entry><title>Installation d'un serveur SMTP avec Postfix</title><link href="https://blog.tblein.eu/server/2011/SMTP-server-installation-with-Postfix/index-fr.html" rel="alternate"></link><published>2011-01-20T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-01-20:server/2011/SMTP-server-installation-with-Postfix/index-fr.html</id><summary type="html">&lt;p&gt;Installation du serveur SMTP Postfix pour recevoir et envoyer des email sur un
serveur.&lt;/p&gt;
&lt;div class="section" id="installation-et-configuration-de-base"&gt;
&lt;h2&gt;Installation et configuration de base&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install postfix
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Répondre aux question en accord avec la configuration. Les descriptions
associées à chaque paramètre sont explicites. Par défault c'est le format
mailbox qui est utilisé pour stocké les messages. Pour changer en Maildir il
suffit d'ajouter la ligne suivante au fichier de configuration principal de
postfix &lt;code&gt;/etc/postfix/main.cf&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;home_mailbox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;Maildir/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Dans cet exemple les mails seront sauvegarder sous le format Maildir (c'est
à dire un message par fichier) dans le dossier Maildir du répertoire personnel
de l'utilisateur.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="securisation"&gt;
&lt;h2&gt;Sécurisation&lt;/h2&gt;
&lt;p&gt;Plusieurs astuces de configuration permettent de bloquer une partie messages non
solicités via des règles simples à ajouter à son fichier
&lt;code&gt;/etc/postfix/main.cf&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;Ne pas vérifier si l'utilisateur existe sur le système:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;disable_vrfy_command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;yes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;N'accepter les messages entrant que d'un serveur s'autentifiant complètement:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;smtpd_helo_required&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;yes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Restriction de receptions via analyse des informations de l'expéditeur:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;smtpd_sender_restrictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&lt;/span&gt;
&lt;span class="s"&gt;    permit_mynetworks,            # Autorise les envois depuis le même domaine&lt;/span&gt;
&lt;span class="s"&gt;    permit_sasl_authenticated,    # Autorise les envois si authentifié&lt;/span&gt;
&lt;span class="s"&gt;    reject_non_fqdn_sender,       # Rejete si l&amp;#39;expéditeur ne fourni pas un nom completement qualifié&lt;/span&gt;
&lt;span class="s"&gt;    reject_unknown_sender_domain, # Rejete si cela provient d&amp;#39;un nom de domaine inconnue&lt;/span&gt;
&lt;span class="s"&gt;    permit                        # Sinon autorise&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Restriction sur le réseau d'envoie du mail&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;smtp_client_restrictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&lt;/span&gt;
&lt;span class="s"&gt;    permit_mynetworks,                                # Autorise les envois depuis le même domaine&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client blackholes.easynet.nl,          # Différentes Blacklists&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client cbl.abuseat.org,&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client proxies.blackholes.wirehub.net,&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client bl.spamcop.net,&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client sbl.spamhaus.org,&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client dnsbl.njabl.org,&lt;/span&gt;
&lt;span class="s"&gt;    reject_rbl_client list.dsbl.org,&lt;/span&gt;
&lt;span class="s"&gt;    permit&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Un redémarage du service postfix est nécessaire pour prendre en compte la nouvelle configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service postfix restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="mail"></category><category term="Postfix"></category><category term="SMTP"></category></entry><entry><title>Manipulation de fichiers po</title><link href="https://blog.tblein.eu/development/2011/po_file_handling/index-fr.html" rel="alternate"></link><published>2011-01-17T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2011-01-17:development/2011/po_file_handling/index-fr.html</id><summary type="html">&lt;p&gt;Les fichiers po sont utilisés par les programmes afin de traduire les messages
dans différentes langues. Ainsi ils contiennent une liste de toutes les chaînes
traduisibles extraites du code, et la traduction qui correspond pour une langue
donnée. Ici sont données quelques informations pour les manipuler ainsi que
quelques ressources d'aide à la traduction, principalement extraites
d'expériences issues du Projet de traduction Debian et plus particulièrement de
l'&lt;a class="reference external" href="http://www.debian.org/international/french/"&gt;équipe francophone&lt;/a&gt;.&lt;/p&gt;
&lt;div class="section" id="file-formating"&gt;
&lt;h2&gt;File formating&lt;/h2&gt;
&lt;p&gt;Pour faciliter la lectures des fichiers textes sur tout type d'écran il est
usuel de limiter la taille de leur ligne à 80 caractères. Pur les fichier po la
commande suivante permet ainsi de couper les lignes à 80 caractères tout en
conservant le marquage spécifique de ces fichiers:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgcat fr.po -o fr.po
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il est possible de spécifier la longueur de la ligne à une autre valeur si
nécessaire avec l'option &lt;code&gt;-w&lt;/code&gt;. Ainsi pour formater un fichier po pour
limiter les lignes à 40 caractères&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgcat -w40 fr.po -o fr.po
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="update-of-a-file-while-already-start-the-translation"&gt;
&lt;h3&gt;Update of a file while already start the translation&lt;/h3&gt;
&lt;p&gt;Lors des traductions il arrive que le fichier po d'origine ai été mise à jour
alors que votre traduction n'est pas fini. La commande suivanre permet de mettre
à jour votre fichier po (&lt;code&gt;fr.po&lt;/code&gt;) avec les nouvelles données issue du
nouveau fichier po (&lt;code&gt;fr.new.po&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ msgmerge --update --previous fr.po fr.new.po
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Vous pouvez ainsi continuer votre traduction sur le fichier &lt;code&gt;fr.po&lt;/code&gt; mise
à jour.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="ressources"&gt;
&lt;h2&gt;Ressources&lt;/h2&gt;
&lt;div class="section" id="general"&gt;
&lt;h3&gt;Général&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Base de données de propositions de traduction, construite à partir des traduction des projets libre: &lt;a class="reference external" href="http://open-tran.eu/"&gt;http://open-tran.eu/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="specifiques-a-debian-equipe-de-traduction-francaise"&gt;
&lt;h3&gt;Spécifiques à Debian (Equipe de traduction française)&lt;/h3&gt;
&lt;div class="section" id="informations"&gt;
&lt;h4&gt;Informations&lt;/h4&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/french/lexique"&gt;Lexique anglais-français&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/french/typographie"&gt;Typographie française&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="status-and-coordination"&gt;
&lt;h4&gt;Status and coordination&lt;/h4&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://i18n.debian.net/debian-l10n/french/fr.by_status.html"&gt;Statut de la coordination des traductions françaises&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po/fr"&gt;État des fichiers PO pour la langue de code : fr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po-debconf/fr"&gt;État d'avancement de la localisation des questionnaires Debconf grâce aux fichiers PO pour le code langue : fr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/international/l10n/po-debconf/pot"&gt;Fichiers PO pour les questionnaires Debconf — Fichiers originaux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/intl/l10n/po4a/fr"&gt;Status of PO files managed with po4a for language code: fr&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</summary><category term="po"></category><category term="l10n"></category><category term="tips"></category><category term="Debian"></category></entry><entry><title>Fournir des dépôts Mercurial à travers lighttpd</title><link href="https://blog.tblein.eu/server/2010/hg_lighttpd/index-fr.html" rel="alternate"></link><published>2010-05-07T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-05-07:server/2010/hg_lighttpd/index-fr.html</id><summary type="html">&lt;p&gt;Voici comment publier un ensemble de dépôt Mercurial sur un serveur et pouvoir
y accéder via CGI et donc un navigateur web classique. Une fois le dépôt
installer il est très facile d'y créer de nouveaux dépôts.&lt;/p&gt;
&lt;div class="section" id="pre-requis"&gt;
&lt;h2&gt;Pré-requis&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;un serveur web fonctionnel (ici nous nous baseront sur lighttpd) voir
[[linux:debian:webserveur]] pour son installation sur Debian.&lt;/li&gt;
&lt;li&gt;une installation de Mercurial classique&lt;/li&gt;
&lt;li&gt;le script &lt;code&gt;hgwebdir.cgi&lt;/code&gt; ou &lt;code&gt;hgwebdir.fcgi&lt;/code&gt; inclus avec votre
version de Mercurial. Dans une installation Debian il est situé dans le
dossier &lt;code&gt;/usr/share/doc/mercurial/examples/&lt;/code&gt;. Il est également
disponible à sur le site de Mercurial : &lt;a class="reference external" href="http://www.selenic.com/repo/hg-stable/raw-file/tip/hgwebdir.cgi"&gt;hgwebdir.cgi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Dans le cas de l'utilisation de la version fastCGI du script (hgwebdir.fcgi)
il faut également installer le module python &lt;code&gt;flup&lt;/code&gt; (&lt;code&gt;python-flup&lt;/code&gt;
pour Debian)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="preparation-du-depot"&gt;
&lt;h2&gt;Préparation du dépôt&lt;/h2&gt;
&lt;p&gt;Nous supposerons que le dépôt Mercurial sera situé dans le dossier &lt;code&gt;/var/hg&lt;/code&gt;.
Nous allons dans un premier temps créer la structure du dépôt&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mkdir -p /var/hg/repos
&lt;span class="gp"&gt;#&lt;/span&gt; chown -R www-data:www-data /var/hg
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Nous allons ensuite créer le fichier de configuration du dépôt
&lt;code&gt;/var/hg/hgweb.config&lt;/code&gt; qui nous permettra de prendre en compte les
différents dépôts contenus dans le sous répertoire &lt;code&gt;repos&lt;/code&gt; ():&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[collections]&lt;/span&gt;
&lt;span class="na"&gt;repos/&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;repos/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ensuite il faut placer le script &lt;code&gt;hgwebdir.fcgi&lt;/code&gt; (dans le cas d'une
utilisation de FastCGI) ou &lt;code&gt;hgwebdir.cgi&lt;/code&gt; (dans le cas d'une utilisation
de CGI) et de le rendre exécutable par le serveur web&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mkdir /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; cp hgwebdir.fcgi /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; chown -R www-data:www-data /var/hg
&lt;span class="gp"&gt;#&lt;/span&gt; chmod +x /var/hg/hgwebdir.fcgi
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-de-lighttpd"&gt;
&lt;h2&gt;Configuration de lighttpd&lt;/h2&gt;
&lt;div class="section" id="dans-un-sous-repertoire-du-site"&gt;
&lt;h3&gt;Dans un sous répertoire du site&lt;/h3&gt;
&lt;p&gt;Suivant la configuration de lighttpd, il faut éditer le fichier de configuration
&lt;code&gt;/etc/lighttpd/lighttpd.conf&lt;/code&gt; ou alors un fichier qui sera inclus lors du
lancement de lighttpd (&lt;code&gt;50-hg.conf&lt;/code&gt;). Sous Debian il suffit de créer un
fichier dans le dossier &lt;code&gt;/etc/lighttpd/available-conf/&lt;/code&gt; et de faire un
lien vers ce fichier dans &lt;code&gt;/etc/lighttpd/enable-conf/&lt;/code&gt;. Dans un premier il
faut inclure les modules nécessaires&amp;nbsp;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;1 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_cgi&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;2 &lt;/span&gt; &lt;span class="k"&gt;server.modules&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;mod_rewrite&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Dans un second temps, il faut configurer la réécriture des adresses afin que les
accès aux sous répertoire &lt;code&gt;hg&lt;/code&gt; ou &lt;code&gt;mercurial&lt;/code&gt; pour utiliser
&lt;code&gt;hgwebdir.fcgi&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;3 &lt;/span&gt; &lt;span class="k"&gt;url.rewrite-once&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="lineno"&gt;4 &lt;/span&gt;   &lt;span class="s2"&gt;&amp;quot;^/hg([/?].*)?$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/hgwebdir.fcgi$1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="lineno"&gt;5 &lt;/span&gt;    &lt;span class="s2"&gt;&amp;quot;^/mercurial([/?].*)?$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/hgwebdir.fcgi$1&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;6 &lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enfin passer les paramètres au scripts cgi:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt; 7 &lt;/span&gt; &lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;^/hgwebdir.fcgi([/?].*)?$&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt; 8 &lt;/span&gt;              &lt;span class="k"&gt;server.document-root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/var/hg/&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt; 9 &lt;/span&gt;              &lt;span class="k"&gt;cgi.assign&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.fcgi&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/python&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;10 &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="dans-un-hote-virtuel"&gt;
&lt;h2&gt;Dans un hôte virtuel&lt;/h2&gt;
&lt;p&gt;Dans ce cas les dépôts seront accessible directement à la racine de l'hôte va
une adresse du type &lt;cite&gt;hg.example.com&lt;/cite&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;1 &lt;/span&gt; &lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;host&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;hg.example.com&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="lineno"&gt;2 &lt;/span&gt;     &lt;span class="k"&gt;server.document-root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/var/hg/&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;3 &lt;/span&gt;     &lt;span class="k"&gt;cgi.assign&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.fcgi&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/bin/python&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;4 &lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Dans ce cas les adresses afficheront le nom du script utilisé à savoir
&lt;code&gt;hgwebdir.fcgi&lt;/code&gt;. Il est possible rendre les adresses plus esthétiques en
enlevant cette portion. Pour cela dans la configuration de l'hôte il suffit
d'ajouter ne règle de réécriture :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;url.rewrite-once&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;&amp;quot;^(/hgwebdir.fcgi/.*)$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;$1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;^(/.*)$&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/hgwebdir.fcgi$1&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il faut également modifier le fichier &lt;code&gt;hgweb.config&lt;/code&gt; pour que les adresses
générées ne possèdent plus le nom du script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;baseurl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="limitation-des-push"&gt;
&lt;h2&gt;Limitation des push&lt;/h2&gt;
&lt;p&gt;Afin de pouvoir limiter les push à certaines personnes il faut modifier deux
fichiers de configurations. Tout d'abord le fichiers de configuration du dépôt
lui même (&lt;code&gt;.hg/hgrc&lt;/code&gt;). Dans la section web il faut ajouter le nom des
utilisateurs que l'on veut autoriser, ou alors une étoile (''*'') pour autoriser
tout le monde:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;allow_push&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;moimeme&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enfin pour lighttpd il faut rajouter les lignes suivantes dans le fichiers
gérant l'authentification:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;querystring&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;cmd=unbundle&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;auth.require&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;   &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;method&amp;quot;&lt;/span&gt;  &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;basic&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;realm&amp;quot;&lt;/span&gt;   &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Mercuial Repo&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="s2"&gt;&amp;quot;require&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;valid-user&amp;quot;&lt;/span&gt;
                        &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lors des push il se peut que cela echou avec l'erreur suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;ssl required&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;pour autoriser les push sans ssl il faut l'activer dans le fichier de
configuration du dépôt dans la section web (&lt;code&gt;.hg/hgrc&lt;/code&gt;) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[web]&lt;/span&gt;
&lt;span class="na"&gt;push_ssl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;false&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://mercurial.selenic.com/wiki/HgWebDirStepByStep"&gt;Publishing Repositories with hgwebdir.cgi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="lighttpd"></category><category term="Mercurial"></category><category term="DVCS"></category></entry><entry><title>abort: requirement 'fncache' not supported!</title><link href="https://blog.tblein.eu/development/2010/mercurial_fncache/index-fr.html" rel="alternate"></link><published>2010-04-01T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-04-01:development/2010/mercurial_fncache/index-fr.html</id><summary type="html">&lt;p&gt;Il peut arriver que lors de l'accès à un dépôt &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; d'avoir l'erreur suivante :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;abort: requirement &lt;span class="s1"&gt;&amp;#39;fncache&amp;#39;&lt;/span&gt; not supported!
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Cela arrive lors de l'utilisation d'une version &amp;quot;trop ancienne&amp;quot; de &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt;.
En effet, à partir de la version 1.1, &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; utilise un nouveau format de
dépôt (&lt;code&gt;fncache&lt;/code&gt;), qui n'est pas lisible par les versions antérieures. Par
contre les anciens dépôts restent lisibles par ces nouvelles versions. Pour
y remédier il faut convertir ce format de dépôt via la commande suivante en
utilisant un &lt;a class="reference external" href="http://mercurial.selenic.com"&gt;Mercurial&lt;/a&gt; postérieur à 1.1 :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;hg --config format.usefncache&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt; clone --pull A B
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Avec &lt;code&gt;A&lt;/code&gt; le dépôt initial et &lt;code&gt;B&lt;/code&gt; le dépôt converti.&lt;/p&gt;
&lt;p&gt;Pour désactivé ce format de dépôt pour toutes nouvelles créations de dépôt, il
suffit d'ajouter dans le fichier de configuration (&lt;code&gt;~/.hgrc&lt;/code&gt;) :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[format]&lt;/span&gt;
&lt;span class="na"&gt;usefncache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;False&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://mercurial.selenic.com/wiki/fncacheRepoFormat"&gt;fncacheRepoFormat&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Mercurial"></category><category term="fncache"></category><category term="DVCS"></category></entry><entry><title>Fusion de dépots sans aucun rapport (mercurial abort: repository is unrelated)</title><link href="https://blog.tblein.eu/development/2010/mercurial_repositories_fusion/index-fr.html" rel="alternate"></link><published>2010-04-01T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-04-01:development/2010/mercurial_repositories_fusion/index-fr.html</id><summary type="html">&lt;p&gt;Lorsque l'on essaye d'inclure un dépôt dans un autre alors qu'ils n'ont jamais
rien eu en commun on obtient l'erreur suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ hg push ../second
mercurial abort: repository is unrelated
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour passer outre il suffit de forcer la fusion avec l'option &lt;code&gt;-f&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ hg push -f ../second
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.selenic.com/mercurial/hg.1.html"&gt;hg man page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Mercurial"></category><category term="fusion"></category><category term="DVCS"></category></entry><entry><title>Nouvelle installation d'un serveur</title><link href="https://blog.tblein.eu/server/2010/New-server-setup/index-fr.html" rel="alternate"></link><published>2010-03-10T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-03-10:server/2010/New-server-setup/index-fr.html</id><summary type="html">&lt;p&gt;Une petite procedure pour configurer/améliorer un serveur fraichement installé
sous Debian.&lt;/p&gt;
&lt;div class="section" id="configuration-de-base"&gt;
&lt;h2&gt;Configuration de base&lt;/h2&gt;
&lt;div class="section" id="configuration-des-locales"&gt;
&lt;h3&gt;Configuration des locales&lt;/h3&gt;
&lt;p&gt;Pour installer les locales sur le système: celles qui seront disponibles pour
les utilisateurs.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; dpkg-reconfigure locales
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sélectionnez les locales en fonction des langues que vous voullez et les
différent encodage de charactères. Plus vous sélectionnerez de langue et
d'encodage plus cela prendra de temps à générer et plus cela occupera d'espace
disque.&lt;/p&gt;
&lt;p&gt;Par exemple pour obtenir les message en français séléctionnez les locales
commençant par &lt;code&gt;fr_FR&lt;/code&gt; (français de France) et tout les encodages. Le
meilleur encodage pour Unix est UTF-8. Sur le second écran choisissez la langue
et l'encodage par défaut qui sera utilisé par le système par exemple
&lt;code&gt;fr.FR.UTF-8&lt;/code&gt;, pour avoir les messages en français par défaut.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-de-bash"&gt;
&lt;h3&gt;Configuration de bash&lt;/h3&gt;
&lt;p&gt;La création d'un nouvel utilisateur utilise les fichiers de configuration par
défaut qui sont présents dans le dossier &lt;code&gt;/etc/skel/&lt;/code&gt;. Cependant, par
défaut l'utilisateur root n'obteint pas ces fichiers. Pour obtenir une meilleure
configuration du shell bash pour root avec par exemple un prompt en couleur et
l'autocomplétion nous allons copier manuellement &lt;code&gt;.bashrc&lt;/code&gt; :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; cp /etc/skel/.bashrc &lt;span class="nv"&gt;$HOME&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ainsi l'auto-complétion de bash marche.&lt;/p&gt;
&lt;p&gt;Pour avoir la couleur du prompt il faut décommenter la ligne 39.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;39 &lt;/span&gt; &lt;span class="c1"&gt;#force_color_prompt=yes&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;et obtenir:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;39 &lt;/span&gt; &lt;span class="nv"&gt;force_color_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yes
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On peut également décommenter dans les lignes 78 et suivantes les configuration
de couleur pour quelques commandes&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;78 &lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; -x /usr/bin/dircolors &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="lineno"&gt;79 &lt;/span&gt;     &lt;span class="nb"&gt;test&lt;/span&gt; -r ~/.dircolors &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dircolors -b ~/.dircolors&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dircolors -b&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;80 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;ls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ls --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;81 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;dir --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;82 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;vdir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;vdir --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;83 &lt;/span&gt;
&lt;span class="lineno"&gt;84 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;grep --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;85 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;fgrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;fgrep --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;86 &lt;/span&gt;     &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;egrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;egrep --color=auto&amp;#39;&lt;/span&gt;
&lt;span class="lineno"&gt;87 &lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configurer-les-alias-pour-le-compte-root"&gt;
&lt;h3&gt;Configurer les alias pour le compte root&lt;/h3&gt;
&lt;p&gt;Par défaut tous les mails système sont envoyés à l'utilisateur root. Cependant,
pour éviter des connexion intempestive de root, il est de bonne augure de
rediriger les emails vers un autre compte ou adresse. Pour cela il suffit de
modifier le fichier &lt;code&gt;/etc/aliases&lt;/code&gt; pour qu'il contienne la ligne suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;root:&lt;/span&gt; &lt;span class="err"&gt;nom@domain.com&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Tous les emails envoyés à root seront redirigés vers l'adresse &lt;a class="reference external" href="mailto:nom&amp;#64;domain.com"&gt;nom&amp;#64;domain.com&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="securisation-du-systeme"&gt;
&lt;h2&gt;Sécurisation du système&lt;/h2&gt;
&lt;div class="section" id="mise-a-jour-du-systeme"&gt;
&lt;h3&gt;Mise à jour du système&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude update
&lt;span class="gp"&gt;#&lt;/span&gt; aptitude dist-upgrade
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour recevoir automatiquement les annonce de mise à jour du système il faut
installer le paquet &lt;code&gt;apticron&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install apticron
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les possible mises à jour du système seront envoyé par mail à &lt;code&gt;root&lt;/code&gt; tous
les jours.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-de-fail2ban"&gt;
&lt;h3&gt;Installation de fail2ban&lt;/h3&gt;
&lt;p&gt;fail2ban est un programme qui permet de blacklister temporairement une adresse
IP lorsqu'elle est utilisée pour tenter de rentrer sur le site &amp;quot;en force&amp;quot; c'est
à dire en essayant des mots de passe jusqu'à trouver le bon. En pratique
fail2ban scrute les fichier de log et après un certain nombre d'échec de
connexion, l'adresse IP est blacklister&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install fail2ban
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il se configure dans le fichier &lt;code&gt;/etc/fail2ban/fail.conf&lt;/code&gt;.  Quelques
modules supplémentaires existent pour fail2ban pour les activer il faut se
reporter à la fin du fichier de configuration (à partir de la ligne 74). Chaque
module est appelé un &lt;code&gt;JAIL&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Chaque &lt;code&gt;JAIL&lt;/code&gt; se présente de façon similaire comme par exemple &lt;code&gt;ssh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[ssh]&lt;/span&gt;
&lt;span class="na"&gt;enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;port&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ssh&lt;/span&gt;
&lt;span class="na"&gt;filter&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;sshd&lt;/span&gt;
&lt;span class="na"&gt;logpath&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;/var/log/auth.log&lt;/span&gt;
&lt;span class="na"&gt;maxretry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;6&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Son nom entre &lt;code&gt;[]&lt;/code&gt;, s'il est activé ou nom (&lt;code&gt;enable&lt;/code&gt;). Quel port
fail2ban doit surveiller (&lt;code&gt;port&lt;/code&gt;). Le fichier de log à surveiller
(&lt;code&gt;logpath&lt;/code&gt;) et le filtre à appliquer pour n'obtenir que le service voulu
(&lt;code&gt;filter&lt;/code&gt;). Et enfin le nombre d'erreurs toléré (&lt;code&gt;maxretry&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Par défaut le JAIL &lt;code&gt;ssh&lt;/code&gt; est activé. Le JAIL &lt;code&gt;pam-generic&lt;/code&gt; permet de
bloquer via l'identification d'erreur via l'utilisation de PAM. Le JAIL
&lt;code&gt;ssh-ddos&lt;/code&gt; permet une protection contre une attaque de type défaut de
service&lt;/p&gt;
&lt;p&gt;Pour prendre en compte la nouvelle configuration il faut redémarrer le service
à l'aide la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service fail2ban restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-de-rkhunter"&gt;
&lt;h3&gt;Installation de rkhunter&lt;/h3&gt;
&lt;p&gt;Il s'agit d'un programme qui recherche les rootkit en recherchant les
modifications des principaux programmes par comparaison avec un état sain et des
signatures ainsi que l'identification de rootkit déjà connus.  Voir son
installation et configuration sur la page dédiée: &lt;a class="reference external" href="https://blog.tblein.eu/server/2009/rkhunter/"&gt;rkunter&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="installation-de-debsecan"&gt;
&lt;h3&gt;Installation de debsecan&lt;/h3&gt;
&lt;p&gt;Vérifie les alertes de sécurités sur internet en rapport avec le système:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install debsecan
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour le configurer il suffit d'exécuter la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; dpkg-reconfigure debsecan
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lors de la configuration, sélectionner la bonne distribution. Les autres
questions se comprennent facilement.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.enyo.de/fw/software/debsecan/"&gt;Site web de debsecan&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-du-pare-feu-avec-ferm"&gt;
&lt;h2&gt;Configuration du pare-feu avec ferm&lt;/h2&gt;
&lt;p&gt;Consultez l'article correspondant à propos de &lt;a class="reference external" href="https://blog.tblein.eu/server/2009/Easy-firewall-with-ferm/index-fr.html"&gt;ferm&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="limitation-des-connexions-ssh"&gt;
&lt;h2&gt;Limitation des connexions SSH&lt;/h2&gt;
&lt;div class="alert alert-danger"&gt;
Ne pas désactivé la connexion du super-utilisateur sans la présence d'un
autre compte: il serait alors impossible de se connecter au serveur&lt;/div&gt;
&lt;p&gt;Création d'un utilisateur administrateur (&lt;code&gt;admin&lt;/code&gt; dans notre exemple) qui
pourra se connecter en &lt;code&gt;root&lt;/code&gt; après désactivation de la connexion SSH pour
&lt;code&gt;root&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; adduser admin
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une fois configuré, la connexion SSH de root peut être désactivée dans le fichier &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;26 &lt;/span&gt; &lt;span class="err"&gt;PermitRootLogin&lt;/span&gt; &lt;span class="err"&gt;no&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Redémarrez le serveur SSH pour le prendre ne compte.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/ssh restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="limitation-de-la-commande-su-a-certains-utilisateurs"&gt;
&lt;h2&gt;Limitation de la commande su à certains utilisateurs&lt;/h2&gt;
&lt;div class="alert alert-danger"&gt;
Il est fortement conseillé de rester connecté avec une console en root tout
au long de la configuration et de vérifier que tout marche bien avant de la
fermée: en cas d'erreur il se peut que l'accés à un shell super-utilisateur
soit impossible.&lt;/div&gt;
&lt;p&gt;La commande &lt;code&gt;su&lt;/code&gt; permet de se substitué à un autre utilisateur pour
exécuter certain programme. L'exemple le plus courant et le passage en
super-utilisateur pour effectué des taches d'administration. Cependant il peut
être bon de limiter l'accès à cette commande à certains utilisateurs. Par défaut
&lt;code&gt;su&lt;/code&gt; est donc lisible et exécutable par tout le monde. Cependant il est
possible de restreindre à un groupe la connexion en modifiant le fichier de
configuration PAM de &lt;code&gt;su&lt;/code&gt;. Il faut décommenter la ligne suivante dans le
fichier &lt;code&gt;/etc/pam.d/su&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;15 &lt;/span&gt; &lt;span class="err"&gt;auth&lt;/span&gt;       &lt;span class="err"&gt;required&lt;/span&gt;   &lt;span class="err"&gt;pam_wheel.so&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Par défaut il faut appartenir au groupe &lt;code&gt;root&lt;/code&gt; pour pouvoir utiliser
&lt;code&gt;su&lt;/code&gt;. Historiquement ce groupe de super-utilisateur sur UNIX porte le nom
de &lt;code&gt;wheel&lt;/code&gt; d'où le nom du module PAM (voir [[wp&amp;gt;Wheel_(Unix_term)]]). Il
est possible de changer le groupe d'utilisateur correspondant à &lt;code&gt;wheel&lt;/code&gt; en
ajoutant l'option &lt;code&gt;group=nom_group&lt;/code&gt;. Ainsi pour définir le groupe
&lt;code&gt;adm&lt;/code&gt; comme le groupe &lt;code&gt;wheel&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;15 &lt;/span&gt; &lt;span class="na"&gt;auth       required   pam_wheel.so group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;adm&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il suffit d'ajouter ensuite les utilisateurs autorisé au groupe &lt;code&gt;root&lt;/code&gt;, comme
par exemple l'utilisateur &lt;code&gt;admin&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; adduser admin root
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://howto.landure.fr/gnu-linux/debian-4-0-etch/complements-a-linstallation-dune-debian-4-0-etch"&gt;Compléments à l'installation d'une Debian 4.0 Etch ou 5.0 Lenny&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.debian.org/doc/manuals/debian-reference/ch-tune.fr.html#s-wheel"&gt;Pourquoi GNU su ne supporte pas le groupe wheel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="security"></category><category term="setup"></category><category term="Debian"></category></entry><entry><title>bdb_equality_candidates: (uid) not indexed</title><link href="https://blog.tblein.eu/server/2010/bdb_equality_candidates---uid--not-indexed/index-fr.html" rel="alternate"></link><published>2010-03-09T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-03-09:server/2010/bdb_equality_candidates---uid--not-indexed/index-fr.html</id><summary type="html">&lt;p&gt;Il arrive que dans les fichier journaux (syslog) des messages comme suivant apparaissent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Mar  9 14:56:13 kimsufi slapd[2187]: &amp;lt;= bdb_equality_candidates: (uid) not indexed&lt;/span&gt;
&lt;span class="go"&gt;Mar  9 14:59:20 kimsufi slapd[23640]: &amp;lt;= bdb_equality_candidates: (gidNumber) not indexed&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Comme le dit le message il s'agit d'erreur parce que certains attributs ne sont
pas indexés. Pour les indexer, il suffit de le demander à OpenLDAP en modifiant
le fichier &lt;code&gt;/etc/ldap/slapd.conf&lt;/code&gt; pour ajouter les index manquant:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;index&lt;/span&gt; &lt;span class="err"&gt;ou,cn,sn,uid&lt;/span&gt;  &lt;span class="err"&gt;pres,sub,eq&lt;/span&gt;
&lt;span class="err"&gt;index&lt;/span&gt; &lt;span class="err"&gt;uidNumber,gidNumber,memberUid&lt;/span&gt;     &lt;span class="err"&gt;eq,pres&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Dans un second temps il faut construire ces index. Pour ceci il convient dans un
premier temps d'arréter le service OpenLDAP:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/slapd stop
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;De génerer les index avec la commande &lt;code&gt;slapdindex&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; slapindex
&lt;span class="go"&gt;  WARNING!&lt;/span&gt;
&lt;span class="go"&gt;  Runnig as root!&lt;/span&gt;
&lt;span class="go"&gt;  There&amp;#39;s a fair chance slapd will fail to start.&lt;/span&gt;
&lt;span class="go"&gt;  Check file permissions!&lt;/span&gt;
&lt;span class="go"&gt;  /etc/ldap/slapd.conf: line 128: rootdn is always granted unlimited privileges.&lt;/span&gt;
&lt;span class="go"&gt;  /etc/ldap/slapd.conf: line 145: rootdn is always granted unlimited privileges.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il convient ensuite de donner les droits à l'utilisateur openldap de lire et
écrire les fichiers de la base:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chown openldap:openldap /var/lib/ldap/*
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Puis dans un dernier temps de redémaré le service OpenLDAP:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/slapd start
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les messages d'erreurs devraient disparaitres des fichiers de log. Si d'autres
index manquent, les rajouter en fonction.&lt;/p&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://help.ubuntu.com/community/OpenLDAP-SambaPDC-OrgInfo-Posix"&gt;OpenLDAP-SambaPDC-OrgInfo-Posix&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="bdb_equality_candidates"></category><category term="log"></category><category term="LDAP"></category></entry><entry><title>Installation d'un dépôt subversion</title><link href="https://blog.tblein.eu/server/2010/Installation-of-a-SVN-repository/index-fr.html" rel="alternate"></link><published>2010-02-11T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-02-11:server/2010/Installation-of-a-SVN-repository/index-fr.html</id><summary type="html">&lt;div class="section" id="installation-de-subversion"&gt;
&lt;h2&gt;Installation de subversion&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt-get install subversion subversion-tools
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="acces-distant-au-depot-via-svnserve"&gt;
&lt;h2&gt;Accès distant au dépot via &lt;code&gt;svnserve&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;svnserve est un serveur inclut dans subversion. Aucun paquet supplémentaire n'est necessaire.
Ajout d'un utilisateur &lt;code&gt;svn&lt;/code&gt; pour lancer &lt;code&gt;svnserve&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; adduser svn --system
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les dépôts seront stockés dans le dossier &lt;code&gt;/home/svn/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pour permettre l'accès au dépôt il faut démarrer le serveur svnserve. Pour cela
le petit script &lt;code&gt;svn&lt;/code&gt; suivant placé dans &lt;code&gt;/etc/init.d&lt;/code&gt; va permettre de le
démarer comme n'importe quel autre serveur.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt; 1 &lt;/span&gt; &lt;span class="c1"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="lineno"&gt; 2 &lt;/span&gt; &lt;span class="c1"&gt;# /etc/init.d/svn: set up the svnserve server&lt;/span&gt;
&lt;span class="lineno"&gt; 3 &lt;/span&gt; &lt;span class="c1"&gt;### BEGIN INIT INFO&lt;/span&gt;
&lt;span class="lineno"&gt; 4 &lt;/span&gt; &lt;span class="c1"&gt;# Provides:          svn&lt;/span&gt;
&lt;span class="lineno"&gt; 5 &lt;/span&gt; &lt;span class="c1"&gt;# Required-Start:    $local_fs&lt;/span&gt;
&lt;span class="lineno"&gt; 6 &lt;/span&gt; &lt;span class="c1"&gt;# Required-Stop:     $local_fs&lt;/span&gt;
&lt;span class="lineno"&gt; 7 &lt;/span&gt; &lt;span class="c1"&gt;# Should-Start:      $named&lt;/span&gt;
&lt;span class="lineno"&gt; 8 &lt;/span&gt; &lt;span class="c1"&gt;# Should-Stop:       $named&lt;/span&gt;
&lt;span class="lineno"&gt; 9 &lt;/span&gt; &lt;span class="c1"&gt;# Default-Start:     S&lt;/span&gt;
&lt;span class="lineno"&gt;10 &lt;/span&gt; &lt;span class="c1"&gt;# Default-Stop:&lt;/span&gt;
&lt;span class="lineno"&gt;11 &lt;/span&gt; &lt;span class="c1"&gt;### END INIT INFO&lt;/span&gt;
&lt;span class="lineno"&gt;12 &lt;/span&gt;
&lt;span class="lineno"&gt;13 &lt;/span&gt; &lt;span class="nb"&gt;set&lt;/span&gt; -e
&lt;span class="lineno"&gt;14 &lt;/span&gt;
&lt;span class="lineno"&gt;15 &lt;/span&gt; &lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/bin:/usr/bin:/sbin:/usr/sbin
&lt;span class="lineno"&gt;16 &lt;/span&gt; &lt;span class="nv"&gt;SOCKET_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/tmp/.X11-unix
&lt;span class="lineno"&gt;17 &lt;/span&gt; &lt;span class="nv"&gt;ICE_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/tmp/.ICE-unix
&lt;span class="lineno"&gt;18 &lt;/span&gt;
&lt;span class="lineno"&gt;19 &lt;/span&gt; . /lib/lsb/init-functions
&lt;span class="lineno"&gt;20 &lt;/span&gt; . /etc/default/rcS
&lt;span class="lineno"&gt;21 &lt;/span&gt;
&lt;span class="lineno"&gt;22 &lt;/span&gt; &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; in
&lt;span class="lineno"&gt;23 &lt;/span&gt; start&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;24 &lt;/span&gt;       log_daemon_msg &lt;span class="s2"&gt;&amp;quot;Starting svnserve daemon&amp;quot;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;svnserve&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;25 &lt;/span&gt;       start-stop-daemon --start --quiet --background --pidfile /var/run/svnserve.pid --make-pidfile --exec &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="lineno"&gt;26 &lt;/span&gt;       /usr/bin/svnserve -c svn:svn -- -d --listen-port &lt;span class="m"&gt;3690&lt;/span&gt; -r /home/svn
&lt;span class="lineno"&gt;27 &lt;/span&gt;       log_end_msg &lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="lineno"&gt;28 &lt;/span&gt;       &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="lineno"&gt;29 &lt;/span&gt; stop&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;30 &lt;/span&gt;       log_daemon_msg &lt;span class="s2"&gt;&amp;quot;Stopping svnserve daemon&amp;quot;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;svnserve&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;31 &lt;/span&gt;       killall svnserve
&lt;span class="lineno"&gt;32 &lt;/span&gt;       log_end_msg &lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="lineno"&gt;33 &lt;/span&gt;       rm -f /var/run/svnserve.pid
&lt;span class="lineno"&gt;34 &lt;/span&gt;       &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="lineno"&gt;35 &lt;/span&gt;
&lt;span class="lineno"&gt;36 &lt;/span&gt; *&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="lineno"&gt;37 &lt;/span&gt;       &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Usage: /etc/init.d/rsync {start|stop}&amp;quot;&lt;/span&gt;
&lt;span class="lineno"&gt;38 &lt;/span&gt;       &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="lineno"&gt;39 &lt;/span&gt;       &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="lineno"&gt;40 &lt;/span&gt; &lt;span class="k"&gt;esac&lt;/span&gt;
&lt;span class="lineno"&gt;41 &lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt; 0
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour arrêter le serveur la commande &lt;code&gt;start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/svnserve.pid&lt;/code&gt; aurait du suffir, cependant il y a  une petite erreur lors de la création du fichier pid de l'application ce qui ne permet pas d'arrêter svnserve.&lt;/p&gt;
&lt;p&gt;Le fichier &lt;code&gt;/etc/init.d/svn&lt;/code&gt; doit être executable.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod +x /etc/init.d/svn
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour démarer svnserve:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service svn start
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="ajout-d-un-depot"&gt;
&lt;h2&gt;Ajout d'un dépôt&lt;/h2&gt;
&lt;p&gt;La commande &lt;code&gt;svnadmin&lt;/code&gt; permet d'administrer les dépôts subversion.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /home/svn
&lt;span class="gp"&gt;#&lt;/span&gt; svnadmin create nouveau_depot
&lt;span class="gp"&gt;#&lt;/span&gt; chown -R svn:svn nouveau_depot
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="configuration-du-depot-pour-svnserve"&gt;
&lt;h3&gt;Configuration du dépôt pour svnserve&lt;/h3&gt;
&lt;p&gt;Le fichier &lt;code&gt;/home/svn/nouveau_depot/conf/svnserve.conf&lt;/code&gt; permet de
configurer les options d'accès du dépôts via SVNserve.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[general]&lt;/span&gt;
&lt;span class="na"&gt;anon-access&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
&lt;span class="na"&gt;auth-access&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
&lt;span class="na"&gt;password-db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;passwd&lt;/span&gt;
&lt;span class="na"&gt;realm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;Mon dépôt SVN&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les autorisation de lecture/écriture sur le dépôt sont définies via les
variables &lt;code&gt;anon-access&lt;/code&gt; pour les utilisateurs non authentifiés et
&lt;code&gt;auth-access&lt;/code&gt; pour les utilisateurs authentifiés. Trois valeurs peuvent
être utilisées:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;none&lt;/code&gt;: aucun accès .&lt;/li&gt;
&lt;li&gt;&lt;code&gt;read&lt;/code&gt;: accès en lecture seule&lt;/li&gt;
&lt;li&gt;&lt;code&gt;write&lt;/code&gt;: accès en lecture/écriture&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;L'option &lt;code&gt;realm&lt;/code&gt; permet de spécifier un nom pour le dépôt et l'option
&lt;code&gt;password-db&lt;/code&gt; de spécifier où seront stockées les logins et mots de passe
des utilisateurs.&lt;/p&gt;
&lt;p&gt;Le fichier &lt;code&gt;password&lt;/code&gt; ressemble à ceci:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[users]&lt;/span&gt;
&lt;span class="na"&gt;login&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;mot_de_passe&lt;/span&gt;
&lt;span class="na"&gt;login&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;mot_de_passe&lt;/span&gt;
&lt;span class="na"&gt;login&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;mot_de_passe&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://wiki.sharlaan.net/howto:svnserve"&gt;howto:svnserve&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="SVN"></category><category term="remote"></category><category term="Debian"></category></entry><entry><title>Comment organiser le code sources des "templates"</title><link href="https://blog.tblein.eu/development/2010/how-to-organise-the-source-code-of-templates/index-fr.html" rel="alternate"></link><published>2010-02-11T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-02-11:development/2010/how-to-organise-the-source-code-of-templates/index-fr.html</id><summary type="html">&lt;p&gt;En C et C++ il est habituel de séparer la déclaration d'une fonction et sa
définition dans deux fichier séparés: l'entête contenant la déclaration (fichier
&lt;code&gt;.h&lt;/code&gt; ou &lt;code&gt;.hh&lt;/code&gt;) et le code source proprement dit contenant sa
définition (fichier &lt;code&gt;.c&lt;/code&gt; ou &lt;code&gt;.cpp&lt;/code&gt;). Lorsque l'on veut faire la
même chose avec une fonction utilisant un template, on obtient une erreur du
type &amp;quot;undefined reference to&amp;quot; lors de la première utilisation de la fonction
dans le code.&lt;/p&gt;
&lt;div class="section" id="un-exemple"&gt;
&lt;h2&gt;Un exemple&lt;/h2&gt;
&lt;p&gt;Par exemple supposons la fonction &lt;code&gt;addition&lt;/code&gt; qui retourne la somme de deux nombre de même type:&lt;/p&gt;
&lt;p&gt;Tout d'abord le fichier d'entete (&lt;code&gt;addition.hh&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Le code source de la fonction (&lt;code&gt;addition.cc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une portion de code utilisant cette fonction (&lt;code&gt;main.cc&lt;/code&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;quot;addition.hh&amp;quot;&lt;/span&gt;&lt;span class="cp"&gt;&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Bien que le code semble correct, la création de lien va échouer avec l'erreur:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/tmp/ccEpROXj.o&lt;span class="o"&gt;(&lt;/span&gt;.text+0x17c&lt;span class="o"&gt;)&lt;/span&gt;: In &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;main&lt;span class="s1"&gt;&amp;#39;:&lt;/span&gt;
&lt;span class="s1"&gt;: undefined reference to `addition(int, int)&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="le-pourquoi"&gt;
&lt;h2&gt;Le pourquoi&lt;/h2&gt;
&lt;p&gt;Il y a différentes raisons pour lesquels cette erreur apparait. Il s'agit
principalement du fait qu'un template n'est pas une fonction mais un modèle
utilisé pour générer la fonction. Lorsqu'il est utilisé dans un programme pour
générer une fonction, la définition dois être connue et non seulement la
déclaration.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="comment-s-en-sortir"&gt;
&lt;h2&gt;Comment s'en sortir&lt;/h2&gt;
&lt;p&gt;Il existe plusieurs solutions à ce problème.&lt;/p&gt;
&lt;div class="section" id="insertion-de-la-definition-dans-le-fichier-d-entete"&gt;
&lt;h3&gt;Insertion de la définition dans le fichier d'entête&lt;/h3&gt;
&lt;p&gt;La première consiste à inclure la définition dans le fichier d'entête. Pour cela
il suffit de fusionner les deux fichiers entête et code source dans un seul
fichier ou alors inclure le fichier du code source via une commande
&lt;code&gt;include&lt;/code&gt; de preprocessing à la fin du fichier d'entête. Cette solution
est la plus simple mais le résultat n'est pas forcément très propre. En effet
certains compilateur peuvent entrainer une augmentation dramatique de la taille
de l'exécutable.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="ajout-d-une-specialisation-du-template"&gt;
&lt;h3&gt;Ajout d'une spécialisation du template&lt;/h3&gt;
&lt;p&gt;FIXME: A confirmer&lt;/p&gt;
&lt;p&gt;On peut également ajouter les déclaration des spécialisations que l'on veut
utiliser dans le fichier source de la fonction.&lt;/p&gt;
&lt;p&gt;Par exemple en reprenant le fichier source de notre fonction addition, on spécifier les déclarations pour les types &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt; et &lt;code&gt;double&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;addition&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="utilisation-du-mot-clef-export"&gt;
&lt;h3&gt;Utilisation du mot clef &lt;code&gt;export&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;FIXME&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12"&gt;[35.12] Why can't I separate the definition of my templates class from it's
declaration and put it inside a .cpp file?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13"&gt;[35.13] How can I avoid linker errors with my template functions?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.14"&gt;[35.14] How does the C++ keyword export help with template linker errors?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="template"></category><category term="compilation error"></category><category term="C++"></category></entry><entry><title>Subversion déconnecter avec SVK</title><link href="https://blog.tblein.eu/development/2010/svk/index-fr.html" rel="alternate"></link><published>2010-02-11T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-02-11:development/2010/svk/index-fr.html</id><summary type="html">&lt;div class="section" id="installation-de-svk"&gt;
&lt;h2&gt;Installation de SVK&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;apt-get install svk&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Création d'un dépôt local via la commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk depotmap --init&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="creer-un-miroir-local"&gt;
&lt;h2&gt;Créer un miroir local&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk mirror svn://adresse_du_depot_distant.ex //local/nom_local_du_depot&lt;/span&gt;
&lt;span class="go"&gt;svk sync //local/nom_local_du_depot&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Création d'une copie de travail à partir du dépôt local&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk checkout //local/nom_local_du_depot repertoire&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="utilisation-de-svk-en-local"&gt;
&lt;h2&gt;Utilisation de SVK en local&lt;/h2&gt;
&lt;p&gt;Ajout de fichiers/dossiers à versionner&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk add fichier&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Commit vers le dépôt locale&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk commit&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Envoie des modifications du dépôt local vers le dépôt distant:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;svk push&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://articles.mongueurs.net/magazines/linuxmag94.html"&gt;SVK par les Mongueurs de Perl&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="SVN"></category><category term="DVCS"></category></entry><entry><title>C++ links</title><link href="https://blog.tblein.eu/development/2010/c-links/" rel="alternate"></link><published>2010-09-09T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2010-02-09:development/2010/c-links/</id><summary type="html">&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.parashift.com/c++-faq-lite/index.html"&gt;C++ FAQ LITE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://stackoverflow.com/questions/9410/how-do-you-pass-a-function-as-a-parameter-in-c"&gt;How do you pass a function as a parameter in C?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</summary><category term="links"></category><category term="C++"></category></entry><entry><title>Installation d'un serveur LDAP pour authentification</title><link href="https://blog.tblein.eu/server/2009/Installation-of-a-LDAP-server-for-authentication/index-fr.html" rel="alternate"></link><published>2009-06-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-23:server/2009/Installation-of-a-LDAP-server-for-authentication/index-fr.html</id><summary type="html">&lt;div class="section" id="installation-du-serveur-ldap"&gt;
&lt;h2&gt;Installation du serveur LDAP&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install slapd ldap-utils
&lt;span class="gp"&gt;#&lt;/span&gt; dpkg-reconfigure slapd
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Suivre les recommandations&lt;/p&gt;
&lt;p&gt;On crée ensuite la structure de l'annuaire pour accueillir les utilisateurs et
les groupes. Pour cela on crée le fichier &lt;code&gt;/tmp/base.ldif&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;dn: ou=People,dc=mondomaine,dc=tld
ou: People
objectClass: top
objectClass: organizationalUnit

dn: ou=Group,dc=mondomaine,dc=tld
ou: Group
objectClass: top
objectClass: organizationalUnit
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On l'importe ensuite dans l'annuaire:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ldapadd -D &lt;span class="s1"&gt;&amp;#39;cn=admin, dc=mondomaine, dc=tld&amp;#39;&lt;/span&gt; -c -x -W -f /tmp/base.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="recuperation-des-utilisateurs-et-groupes-actuels"&gt;
&lt;h2&gt;Récupération des utilisateurs et groupes actuels&lt;/h2&gt;
&lt;p&gt;Pour cela on va utiliser une série de scripts permettant contenus dans le paquet
&lt;code&gt;migrationtools&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install migrationtools
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Éditer le fichier &lt;code&gt;/etc/migrationtools/migrate_common.pl&lt;/code&gt; et suivre les
recommandations de &lt;a class="reference external" href="http://wiki.gcu.info/doku.php?id=linux:auth_ldap"&gt;http://wiki.gcu.info/doku.php?id=linux:auth_ldap&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Récupération des information d'utilisateur et de groupe du système dans un
fichier LDIF permettant un import facile dans l'annuaire LDAP:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/share/migrationtools
&lt;span class="gp"&gt;#&lt;/span&gt; ./migrate_passwd.pl /etc/passwd &lt;span class="p"&gt;|&lt;/span&gt; grep -v &lt;span class="s1"&gt;&amp;#39;objectClass: account&amp;#39;&lt;/span&gt; &amp;gt; /tmp/passwd.ldif
&lt;span class="gp"&gt;#&lt;/span&gt; ./migrate_group.pl /etc/group /tmp/group.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les utilisateurs qui seront inclus dans l'annuaire sont enregistrés dans le
fichier &lt;code&gt;/tmp/passwd.ldif&lt;/code&gt; et les groupes dans &lt;code&gt;/tmp/group.ldif&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Ajouter pour chaque utilisateur&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;objectClass: account
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Avant les autres &lt;code&gt;objectClass&lt;/code&gt;, sinon erreur lors de l'import du type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;ldap_add: Object class violation (65)&lt;/span&gt;
&lt;span class="go"&gt;additional info: no structural object class provided&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On ajoute ensuite les utilisateurs et groupes dans l'annuaire:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ldapadd -D &lt;span class="s1"&gt;&amp;#39;cn=admin, dc=mondomaine, dc=tld&amp;#39;&lt;/span&gt; -c -x -W -f /tmp/passwd.ldif
&lt;span class="gp"&gt;#&lt;/span&gt; ldapadd -D &lt;span class="s1"&gt;&amp;#39;cn=admin, dc=mondomaine, dc=tld&amp;#39;&lt;/span&gt; -c -x -W -f /tmp/group.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="utilisateur-en-lecture-de-la-base-pour-authentification"&gt;
&lt;h2&gt;Utilisateur en lecture de la base pour authentification&lt;/h2&gt;
&lt;p&gt;Éditer &lt;code&gt;/etc/ldap/slapd.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rootdn          &amp;quot;cn=admin,dc=mondomaine,dc=tld&amp;quot;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service slapd restart
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Création des information de l'utilisateur &lt;code&gt;nss&lt;/code&gt; dans un nouveau fichier
&lt;code&gt;/tmp/nss.ldif&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;dn: cn=nss,dc=mondomaine,dc=tld
objectClass: organizationalRole
objectClass: simpleSecurityObject
cn: nss
description: LDAP NSS user for user-lookups
userPassword:
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Obtention du mot de passe:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;slappasswd -h {CRYPT}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ajout de l'utilisateur de lecture:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;ldapadd -D &amp;#39;cn=admin, dc=mondomaine, dc=tld&amp;#39; -c -x -W -f /tmp/nss.ldif&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="LDAP"></category><category term="authentication"></category><category term="Debian"></category></entry><entry><title>Installation de phpLDAPadmin pour lighttpd</title><link href="https://blog.tblein.eu/server/2009/Installation-of-phpLDAPadmin-with-lighttpd/index-fr.html" rel="alternate"></link><published>2009-06-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-23:server/2009/Installation-of-phpLDAPadmin-with-lighttpd/index-fr.html</id><summary type="html">&lt;p&gt;L'installation du serveur lighttpd avec PHP5 est nécessaire (voir &lt;a class="reference external" href="https://blog.tblein.eu/server/2016/PHP-activation-for-lighttpd/index-fr.html"&gt;Activation de
PHP pour lighttpd&lt;/a&gt;)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install phpldapadmin
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les scripts de phpLDAPadmin sont situés dans le dossier
&lt;code&gt;/usr/share/phpldapadmin&lt;/code&gt;. Pour y avoir accès il suffit de créer le
fichier de configuration
&lt;code&gt;/etc/lighttpd/conf-available/50-phpldapadmin.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# Alias for phpLDAPadmin directory&lt;/span&gt;
&lt;span class="k"&gt;alias.url&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s2"&gt;&amp;quot;/phpldapadmin&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/usr/share/phpldapadmin&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Disallow access to libraries&lt;/span&gt;
&lt;span class="nb"&gt;$HTTP&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;url&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;^/phpldapadmin/lib&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;url.access-deny&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enfin pour l'activer un simple lien dans le dossier
&lt;code&gt;/etc/lighttpd/conf-enable/&lt;/code&gt; et un redémarrage du serveur web&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; ln -s /etc/lighttpd/conf-available/50-phpldapadmin.conf /etc/lighttpd/conf-enabled/
&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/lighttpd restart
&lt;/pre&gt;&lt;/div&gt;
</summary><category term="LDAP"></category><category term="lighttpd"></category><category term="phpLDAPadmin"></category></entry><entry><title>Sauvegarde et restauration d'un serveur LDAP</title><link href="https://blog.tblein.eu/server/2009/LDAP-server-backup-restore/index-fr.html" rel="alternate"></link><published>2009-06-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-23:server/2009/LDAP-server-backup-restore/index-fr.html</id><summary type="html">&lt;div class="section" id="sauvegarde-des-donnees-d-un-serveur-ldap"&gt;
&lt;h2&gt;Sauvegarde des données d'un serveur LDAP&lt;/h2&gt;
&lt;p&gt;Pour cela il suffit de sauvegarder la base dans un fichier LDIF. Le dump de la
base LDAP s'effectue à l'aide de la commande &lt;code&gt;slapcat&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; slapcat &amp;gt; base.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="restauration-des-donnees-d-un-serveur-ldap"&gt;
&lt;h2&gt;Restauration des données d'un serveur LDAP&lt;/h2&gt;
&lt;p&gt;Pour charger le fichier dans le serveur il faut utiliser la commande
&lt;code&gt;slapadd&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; service slapd stop
&lt;span class="gp"&gt;#&lt;/span&gt; slapadd &amp;lt; base.ldif
&lt;span class="gp"&gt;#&lt;/span&gt; service slapd start
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Le serveur de destination doit posséder un schéma de base lui permettant de
prendre en charge les données du fichier sous peine d'un message d'erreur.&lt;/p&gt;
&lt;p&gt;De même si des entrées existent déjà dans la base de destination, l'importation
s'arrêtera.&lt;/p&gt;
&lt;/div&gt;
</summary><category term="LDAP"></category><category term="backup"></category><category term="restore"></category></entry><entry><title>Sécurisation des dossiers temporaires</title><link href="https://blog.tblein.eu/server/2009/securing-tmp-folders/index-fr.html" rel="alternate"></link><published>2009-06-23T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-23:server/2009/securing-tmp-folders/index-fr.html</id><summary type="html">&lt;p&gt;Le dossier &lt;code&gt;/tmp&lt;/code&gt; est l'un des rares dossier du système qui soit
accessible en écriture par tout le monde. Les utilisateur comme les services.
Cependant beaucoup de vers utilisent des failles des application web pour
déposer un fichier sur le serveur et arrive donc dans ce fameux dossier
temporaire d'où le fichier peut être exécuter.&lt;/p&gt;
&lt;p&gt;Afin de s'en prémunir il suffit de rendre le dossier temporaire non exécutable.&lt;/p&gt;
&lt;div class="section" id="monage-du-dossier-tmp-en-lecture-ecriture-seules"&gt;
&lt;h2&gt;Monage du dossier &lt;code&gt;/tmp&lt;/code&gt; en lecture/écriture seules&lt;/h2&gt;
&lt;p&gt;Pour inactivé l'exécution globalement dans un  répertoire, il faut que cela
concerne toute une partition. Il y a donc deux possibilité: soit le répertoire
&lt;code&gt;/tmp&lt;/code&gt; est déjà une partition à part soit il faut en crée une pour lui.
Plutôt que de reformater complètement le disque pour créer cette partition, il
est possible de transformer un fichier en partition &lt;code&gt;loopback&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Pour cela il faut d'abord créer ce fichier comme dans l'article &lt;a class="reference external" href="https://blog.tblein.eu/general/2009/creation-de-fichier-image-disque-et-montage/index-fr.html"&gt;Création de
fichier image disque et montage&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Pour monter le fichier automatiquement au démarrage il suffit d'ajouter la ligne suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;/fichier_temporaire&lt;/span&gt; &lt;span class="err"&gt;/tmp&lt;/span&gt; &lt;span class="err"&gt;ext3&lt;/span&gt; &lt;span class="err"&gt;loop,noexec,nosuid,nodev,rw&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Où &lt;code&gt;fichier_temporaire&lt;/code&gt; est le chemin complet vers le fichier contenant la
partition destiné au répertoire temporaire. Les options
&lt;code&gt;noexec,nosuid,nodev&lt;/code&gt; permettent de bloquer l'exécution sur cette
partition.&lt;/p&gt;
&lt;p&gt;Dans le cas ou le dossier temporaire serait déjà sur une partition séparée,
l'ajout des options &lt;code&gt;noexec,nosuid,nodev&lt;/code&gt; pour l'entrée du fichier
&lt;code&gt;/etc/fstab&lt;/code&gt; correspondante permettra de bloquer l'exécution sur cette
partition.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="dpkg-et-erreur-d-execution"&gt;
&lt;h2&gt;DPKG et erreur d'exécution&lt;/h2&gt;
&lt;p&gt;Lors de l'installation de paquets, les scripts de configurations sont placé dans
le répertoire &lt;code&gt;/tmp&lt;/code&gt; et exécutés. Cependant comme l'exécution est bloqué
il ne peuvent pas se configurer renvoyant une erreur semblable à la suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Can&amp;#39;t exec &amp;quot;/tmp/quota.config.26141&amp;quot;: Permission non accordée at /usr/share/perl/5.8/IPC/Open3.pm line 168&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lors de l'installation de paquets il faut donc rendre exécutable le répertoire
temporaire via la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mount -o remount,exec /tmp
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enfin, une fois les paquets installé la partition est de nouveau rendue non
exécutable via la commande:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mount -o remount,noexec /tmp
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il est possible de demander à &lt;code&gt;dpkg&lt;/code&gt; de se débrouiller tout seul pour
faire ce changement de permission sur le répertoire &lt;code&gt;/tmp&lt;/code&gt; via un petit
script de . Pour cela il suffit de modifier le fichier
&lt;code&gt;/etc/apt/apt.conf.d/70debconf&lt;/code&gt; pour qu'il ressemble à ceci:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;//changement des permission d&amp;#39;exécution du répertoire /tmp&lt;/span&gt;
&lt;span class="n"&gt;DPkg&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Pre&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Pkgs&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;mount -o remount,exec /tmp; /usr/sbin/dpkg-preconfigure --apt || true&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;};&lt;/span&gt;
&lt;span class="n"&gt;DPkg&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Invoke&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;mount -o remount,noexec /tmp&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;};&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Une configuration analogue peut être effectuée avec le répertoire &lt;code&gt;/var&lt;/code&gt;.
Cependant vue la taille que ce répertoire peut atteindre lors de l'utilisation
d'un serveur web il est conseillé d'utiliser une vraie partition et non un
fichier loopback. Il faut également modifier le fichier
&lt;code&gt;/etc/apt/apt.conf.d/70debconf&lt;/code&gt;, dpkg utilisant le répertoire
&lt;code&gt;/var/cache/apt/&lt;/code&gt; pour dépaqueter les paquets:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;//changement des permission d&amp;#39;exécution du répertoire /tmp&lt;/span&gt;
&lt;span class="n"&gt;DPkg&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Pre&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Install&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Pkgs&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;mount -o remount,exec /tmp; mount -o remount,exec /var; /usr/sbin/dpkg-preconfigure --apt || true&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;};&lt;/span&gt;
&lt;span class="n"&gt;DPkg&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Invoke&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;mount -o remount,noexec /tmp; mount -o remount,noexec /var;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;};&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://howto.landure.fr/gnu-linux/debian-4-0-etch/securiser-votre-dossier-temporaire"&gt;Sécuriser votre dossier temporaire&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.linuxaide.org/index.php/APT_avec_/tmp_en_noexec"&gt;APT avec /tmp en noexec&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="security"></category><category term="temporary folders"></category><category term="Debian"></category><category term="dpkg"></category></entry><entry><title>Création de fichier image disque et montage</title><link href="https://blog.tblein.eu/general/2009/creation-de-fichier-image-disque-et-montage/index-fr.html" rel="alternate"></link><published>2009-06-22T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-22:general/2009/creation-de-fichier-image-disque-et-montage/index-fr.html</id><summary type="html">&lt;p&gt;Création d'une image disque de 1 Go à trou (utilisation réelle d'espace disque
en fonction des besoins).&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; dd &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/dev/null &lt;span class="nv"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;image &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nv"&gt;bs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1G &lt;span class="nv"&gt;seek&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Formatage de l'image en ext3&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; /sbin/mkfs.ext3 -F image
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Montage de l'image dans le répertoire &lt;code&gt;loop/&lt;/code&gt; (à adapter suivant le
besoin) en tant que &lt;code&gt;root&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mount image loop/ -o loop
&lt;/pre&gt;&lt;/div&gt;
</summary><category term="Partition"></category></entry><entry><title>rkhunter</title><link href="https://blog.tblein.eu/server/2009/rkhunter/" rel="alternate"></link><published>2009-06-22T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-22:server/2009/rkhunter/</id><summary type="html">&lt;p&gt;Pour chercher les rootkits présents sur le système et autre vers.&lt;/p&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; aptitude install rkunter
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La configuration à lieu dans le fichier &lt;code&gt;/etc/rkhunter.conf&lt;/code&gt;. Par défaut
certains tests sont inactivés comme par exemple &lt;code&gt;hidden_procs&lt;/code&gt; qui
a besoin du paquet &lt;code&gt;unhide&lt;/code&gt;. Pour l'activer il suffit de l'enlever de la
liste &lt;code&gt;DISABLE_TESTS&lt;/code&gt; (ligne 199).&lt;/p&gt;
&lt;p&gt;De même la vérification des paquet via le système de paquet est désactivé par
défaut sur Debian puisqu'il met beaucoup de temps. Pour l'activer il faut
activer l'option &lt;code&gt;PKGMGR&lt;/code&gt; dans &lt;code&gt;/etc/rkhunter.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;257 &lt;/span&gt;&lt;span class="na"&gt;PKGMGR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;DPKG&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="proc-modules"&gt;
&lt;h2&gt;/proc/modules&lt;/h2&gt;
&lt;p&gt;Sur le serveur RPS d'OVH il n'y a pas le fichier &lt;code&gt;/proc/modules&lt;/code&gt; ceci
entraine un avertissement lors des test. Pour empêcher que cela apparaisse en
permanence il suffit de désactivé ce test a l'aide de la variable
&lt;code&gt;DISABLE_TESTS&lt;/code&gt; auquel il faut ajouter la valeur &lt;code&gt;os_specific&lt;/code&gt; dans
&lt;code&gt;/etc/rkhunter&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;199 &lt;/span&gt;&lt;span class="na"&gt;DISABLE_TEST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;os_specific&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a class="reference external" href="http://osdir.com/ml/security.rkhunter.user/2007-07/msg00029.html"&gt;Message de la liste donnant la solution&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="probleme-lors-de-la-mise-a-jour-de-paquet"&gt;
&lt;h2&gt;Problème lors de la mise à jour de paquet&lt;/h2&gt;
&lt;p&gt;Lors de la mise à jour de paquets, certains fichiers peuvent être modifié et ne
plus correspondre à ce que rkhunter avait détecté précédemment. Cela entraine
donc des avertissements du style:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;Warning: The file properties have changed:&lt;/span&gt;
&lt;span class="go"&gt;         File: /sbin/syslogd&lt;/span&gt;
&lt;span class="go"&gt;         Current inode: 563364    Stored inode: 563394&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour mettre à jour la base de rkhunter concernant le suivi des modifications de
fichier, il suffit de lancer la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;rkhunter --propupd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Cela peut être automatisé à chaque installation de paquet via un script lancé
par le système de paquet. Pour cela il suffit de créer le fichier
&lt;code&gt;/etc/apt/apt.conf.d/90rkhunter&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Update rkhunter file signatures databases after running dpkg.&lt;/span&gt;
&lt;span class="n"&gt;DPkg&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Invoke&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s"&gt;&amp;quot;if [ -x /usr/bin/rkhunter ]; then if [ $(/usr/bin/rkhunter --help | /bin/grep &amp;quot;&lt;/span&gt;&lt;span class="n"&gt;propupd&lt;/span&gt;&lt;span class="s"&gt;&amp;quot; | /usr/bin/wc -l) -gt 0 ]; then /usr/bin/rkhunter --propupd; fi; fi&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
</summary><category term="security"></category><category term="rootkit"></category></entry><entry><title>Pare-feu facile avec ferm</title><link href="https://blog.tblein.eu/server/2009/Easy-firewall-with-ferm/index-fr.html" rel="alternate"></link><published>2009-06-22T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-06-22:server/2009/Easy-firewall-with-ferm/index-fr.html</id><summary type="html">&lt;p&gt;Il s'agit d'une interface simplifié à &lt;code&gt;iptable&lt;/code&gt;, qui permet donc de
configurer le pare-feu avec des règles plus lisible qu'iptable&lt;/p&gt;
&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt install ferm
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration"&gt;
&lt;h2&gt;Configuration&lt;/h2&gt;
&lt;p&gt;la configuration se situe dans le fichier &lt;code&gt;/etc/ferm/ferm.conf&lt;/code&gt;. Par
défaut, seul le port 22 est ouvert permettant les connexion ssh:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;proto&lt;/span&gt; &lt;span class="n"&gt;tcp&lt;/span&gt; &lt;span class="n"&gt;dport&lt;/span&gt; &lt;span class="n"&gt;ssh&lt;/span&gt; &lt;span class="n"&gt;ACCEPT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour ouvrir les port il suffit d'entrer des règles comparables. le port peut
être spécifié soit via son numéro soit par le service qui lui est associé. Afin
de déterminé quel service est associé à quel port il suffit de chercher les
equivalences dans le fichier &lt;code&gt;/etc/services&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://ferm.foo-projects.org"&gt;ferm - for Easy Rule Making&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="firewall"></category><category term="ferm"></category></entry><entry><title>Démarrage parallèle avec insserv</title><link href="https://blog.tblein.eu/server/2009/parallel-boot-start-with-insserv/index-fr.html" rel="alternate"></link><published>2009-05-07T00:00:00+02:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-05-07:server/2009/parallel-boot-start-with-insserv/index-fr.html</id><summary type="html">&lt;p&gt;Par défaut les services des systèmes Linux démarrent les uns après les autres.
Un moyen de gagner du temps lors du démarrage est de lancer les différent
services en parallèle ce qui évite de devoir attendre qu'un service ait fini de
démarrer pour en lancer d'autre.&lt;/p&gt;
&lt;p&gt;Pour cela il faut modifier l'option &lt;code&gt;CONCURRENCY&lt;/code&gt; dans le fichier
&lt;code&gt;/etc/init.d/rc&lt;/code&gt;. Par défaut elle est désactivée:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="lineno"&gt;39 &lt;/span&gt; &lt;span class="k"&gt;[...]&lt;/span&gt;
&lt;span class="lineno"&gt;40 &lt;/span&gt; &lt;span class="na"&gt;CONCURRENCY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;none&lt;/span&gt;
&lt;span class="lineno"&gt;41 &lt;/span&gt;&lt;span class="s"&gt; [...]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Cette option peut prendre trois valeurs différentes:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;none&lt;/code&gt;: désactivation de l'option de démarrage concurrentiel&lt;/li&gt;
&lt;li&gt;&lt;code&gt;startpar&lt;/code&gt;: les services sont lancés en parallèle mais leur sortie reste
en série.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shell&lt;/code&gt;: les services sont lancés en parallèle dans des shell différents
ainsi les sorties sont aussi parallélisées.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus la parallélisation augmente plus le temps de démarrage est raccourci.&lt;/p&gt;
&lt;p&gt;Cependant certains services doivent être lancés après d'autre. Pour cela il faut
réordonnancer les services pour être sur de ne pas démarrer un service tant que
les pré-requis ne sont pas remplis. Par exemple le service de mise à jour de
leur sur les serveur distant doit être lancé qu'une fois la connexion réseau
établie.&lt;/p&gt;
&lt;p&gt;Le paquet &lt;code&gt;insserv&lt;/code&gt; permet de calculer les dépendances des différents
scripts de démarrage, et ainsi de créer la hiérarchie nécessaire. Une fois
installé il faut lancé la commande suivante en root pour optimiser les scripts
init:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; update-bootsystem-insserv
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lors d'une mise à jour du système des messages d'avertissement similaire au
suivant peuvent apparaitre:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;insserv: warning: current start runlevel(s) (0 6) of script `umountroot&amp;#39; overwrites defaults (empty).&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Cela veut simplement dire que l'ordre de lancement d'un ou plusieurs scripts
init ont été modifiés lors de l'installation d'un ou plusieurs paquets. Il
suffit de relancer la commande &lt;code&gt;update-bootsystem-insserv&lt;/code&gt; pour refaire le
calcul de hiérarchie t faire disparaitre ces messages d'avertissement.&lt;/p&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://macsim.labolinux.net/index.php/post/2009/04/27/Accélérer-le-boot-d-ubuntu-et-debian"&gt;Accélérer le boot de debian et ubuntu par Macsim&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="boot"></category><category term="insserv"></category><category term="Debian"></category><category term="parallel"></category></entry><entry><title>GPG et APT</title><link href="https://blog.tblein.eu/general/2009/GPG_and_APT/index-fr.html" rel="alternate"></link><published>2009-03-03T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-03-03:general/2009/GPG_and_APT/index-fr.html</id><summary type="html">&lt;p&gt;Comment ajouter une clé de chiffrement pour vérifier la signature des paquets
d'un dépôt le système de gestion de paquets apt-get&lt;/p&gt;
&lt;div class="section" id="introduction"&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Une petite erreur du style :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;W: GPG error: http://debian.ens-cachan.fr stable Release:&lt;/span&gt;
&lt;span class="go"&gt;Les signatures suivantes n&amp;#39;ont pas pu être vérifiées car la clé publique n&amp;#39;est pas disponible : NO_PUBKEY 010908312D230C5F&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Il s'agit d'une fonctionnalité du système d'apt-get permettant de garantir
l'authenticité des serveurs de mise à jour Debian. Chaque paquets est signé
à l'aide d'une clé de chiffrement. Avant sont installation la signature du
paquet va être vérifiée en la comparant à celle obtenue localement. Pour
y remédier il faut récupérer la clé de chiffrement.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="recuperation-de-la-cle-en-ligne-de-commande-apt-key"&gt;
&lt;h2&gt;Récupération de la clé en ligne de commande: apt-key&lt;/h2&gt;
&lt;p&gt;Dans un premier temps la clé va être récupérée sur un des serveurs de clés
à l'aide de la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; gpg --keyserver hkp://wwwkeys.eu.pgp.net --recv-keys 010908312D230C5F
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Vous pouvez utiliser un autre serveur de clés. En principe ils se synchronisent
entre eux. Remplacer l'identificant de la clé par celui demandé par le système
apt-get.&lt;/p&gt;
&lt;p&gt;Ensuite vous devez l’importer dans le système de paquetage apt-get à l’aide de
la ligne suivante si vous utilisez sudo :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; gpg --armor --export 010908312D230C5F &lt;span class="p"&gt;|&lt;/span&gt; sudo apt-key add -
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;sinon en tant que super-utilisateur:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; gpg --armor --export 010908312D230C5F &lt;span class="p"&gt;|&lt;/span&gt; apt-key add -
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;La clé peut être maintenant utiliser par le système de gestion de paquets.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="interface-graphique-du-gestionnaire-de-cle-pour-apt-get-gui-apt-key"&gt;
&lt;h2&gt;Interface graphique du gestionnaire de clé pour apt-get: gui-apt-key&lt;/h2&gt;
&lt;p&gt;Il existe depuis quelque temps une interface graphique à apt-key : &lt;a class="reference external" href="http://www.infodrom.org/projects/gui-apt-key/"&gt;gui-apt-key&lt;/a&gt;. Pour le moment cette
interface est uniquement disponible dans Etch. Vous pouvez l'installer
à l'aide de votre gestionnaire de paquets préféré ou à l'aide de la commande
suivante si vous utilisé sudo:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; sudo apt-get install gui-apt-key
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;ou en temps que super-utilisateur:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt-get install gui-apt-key
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;L'interface est ensuite intuitive: recopiez l'indentifiant de la clé dans le
champ &amp;quot;ID de la clé&amp;quot; et cliquez sur &amp;quot;Ajouter&amp;quot;. Et la clé est ajoutée
automatiquement.&lt;/p&gt;
&lt;/div&gt;
</summary><category term="Debian"></category><category term="APT"></category><category term="GPG"></category></entry><entry><title>Partage de fichier avec Network File System (NFS)</title><link href="https://blog.tblein.eu/server/2009/File-sharing-with-NFS/" rel="alternate"></link><published>2009-03-02T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-03-02:server/2009/File-sharing-with-NFS/</id><summary type="html">&lt;div class="section" id="installation-du-serveur-nfsv4"&gt;
&lt;h2&gt;Installation du serveur NFSv4&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; apt-get install nfs-kernel-server nfs-common portmap
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les configurations s'effectue dans le fichier &lt;code&gt;/etc/exports&lt;/code&gt;. La version
4 du protocole NFS permet de monter les répertoires partagés à partir d'une
racine virtuelle. Il faut ajouter la ligne suivante au fichier
&lt;code&gt;/etc/exports&lt;/code&gt; pour que cette racine virtuelle soit &lt;code&gt;/exports&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;/export       192.168.1.0/24(rw,fsid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;0,insecure,no_subtree_check)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration"&gt;
&lt;h2&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Les sous répertoires du répertoire &lt;code&gt;/exports&lt;/code&gt; seront donc partagés. Ainsi
pour partager un nouveau répertoires il suffit de l'ajouter au répertoire
&lt;code&gt;/exports&lt;/code&gt; à l'aide de la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mount --bind /home /exports/home
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Afin que ce partage soit effectif à chaque démarrage du système il faut ajouter
la ligne suivante dans le fichier &lt;code&gt;/etc/fstab&lt;/code&gt; du serveur:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;/home&lt;/span&gt;           &lt;span class="err"&gt;/exports/home&lt;/span&gt;   &lt;span class="err"&gt;none&lt;/span&gt;    &lt;span class="err"&gt;rw,bind&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;   &lt;span class="err"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Les règles de partage de ce répertoire se font de la même façon qu'avec la
version 3 de NFS via l'édition du fichier &lt;code&gt;/etc/exports&lt;/code&gt;. Chaque ligne
commence par le chemin absolue du répertoire à partager suivie d'une liste des
clients avec le détail de configuration.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;/exports/home&lt;/span&gt;    &lt;span class="err"&gt;192.168.1.0/24(rw,nohide,sync,insecure,root_squash,no_subtree_check)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour prendre en compte les différents points de montage il faut redémarrer le
serveur NFS avec la commande suivante:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; /etc/init.d/nfs-kernel-server restart
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="montage"&gt;
&lt;h2&gt;Montage&lt;/h2&gt;
&lt;p&gt;Pour monter le système de fichier NFS sur le système de fichier du client il
suffit d'utiliser la commande suivante qui va nous permettre de monter la
totalité des répertoires exportés:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mount -t nfs4 192.168.1.15:/ /media/nfs
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Pour rendre ce montage définitif la ligne suivante doit être ajouter au fichier
&lt;code&gt;/ect/fstab&lt;/code&gt; de la machine cliente:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;server:/home&lt;/span&gt; &lt;span class="err"&gt;/home&lt;/span&gt; &lt;span class="err"&gt;nfs4&lt;/span&gt; &lt;span class="err"&gt;rw&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://www.crazysquirrel.com/computing/debian/servers/setting-up-nfs4.jspx"&gt;Setting up NFSv4&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="share"></category><category term="NFS"></category><category term="Debian"></category><category term="files"></category></entry><entry><title>Configuration de carte wifi à base de chipset ISL38xx</title><link href="https://blog.tblein.eu/client/2009/ISL38xx-chipset-based-wifi-card-configuration/index-fr.html" rel="alternate"></link><published>2009-02-16T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-02-16:client/2009/ISL38xx-chipset-based-wifi-card-configuration/index-fr.html</id><summary type="html">&lt;p&gt;Pour ces cartes wifi, le driver &lt;a class="reference external" href="http://prism54.org"&gt;Prism54&lt;/a&gt; pour linux est
nécessaire. Pour fonctionner un firmware doit être charger sur la carte wifi.
Les modules Prism54 sont inclus dans le noyau linux, il suffit juste d'installer
le firmware.&lt;/p&gt;
&lt;div class="section" id="le-projet-prism54"&gt;
&lt;h2&gt;Le projet Prism54&lt;/h2&gt;
&lt;p&gt;Il existe plusieurs partie pour faire fonctionner la carte wifi:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;code&gt;islsm&lt;/code&gt; un driver linux supportant les cartes à base de ISL3886/ISL3887
(également connus sous le nom de cartes &lt;cite&gt;newmacs&lt;/cite&gt; ou &lt;cite&gt;softmac&lt;/cite&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;FreeMAC&lt;/code&gt; un firmware sous licence GPL pour toute les cartes à base de
puce Conexant.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="firmware"&gt;
&lt;h2&gt;Firmware&lt;/h2&gt;
&lt;p&gt;Les prérequis pour utiliser le driver sont un noyau 2.6 ainsi que hotplug.  Le
firmware à utiliser est à copier dans le repertoire
&lt;code&gt;/usr/lib/hotplug/firmware/&lt;/code&gt;. l'ensemble des firmware pour les différentes
cartes sont disponibles &lt;a class="reference external" href="http://prism54.org/newdrivers.html"&gt;sur le site du projet Prism54&lt;/a&gt;.&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Dans le cas d'une clé USB de première génération il faut utilisé le driver
2.5.6.0 et le copié sous le nom &lt;code&gt;isl3890usb&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Dans le cas d'une clé USB de deuxième génération il faut utilisé le driver
2.5.8.0 et le copié sous le nom &lt;code&gt;isl3887usb&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Dans le cas d'une carte PCI ou PCMCIA il faut utilisé le driver 2.7.0.0 et le
copié sous le nom &lt;code&gt;isl3886&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;En cas de doute il suffit de copier l'ensemble des firmwares, le driver choisira
le bon lors de l'initialisation de la carte.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://prism54.org"&gt;Le site du projet Prism54&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://prism54.org/newdrivers.html"&gt;Liste des cartes supportèes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://islsm.org/wiki/doku.php?id=re:quickstart_guide_to_running_freemac"&gt;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="Wifi"></category><category term="ISL38xx"></category></entry><entry><title>Donner un nom à une partition avec e2label</title><link href="https://blog.tblein.eu/general/2009/Naming-partition-with-e2label/index-fr.html" rel="alternate"></link><published>2009-02-16T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-02-16:general/2009/Naming-partition-with-e2label/index-fr.html</id><summary type="html">&lt;p&gt;Lors du montage des partitions le chemin d'accès au périphérique est
généralement utilisé pour référencer une partition, à savoir cette ligne est
présente dans votre fichier &lt;code&gt;/etc/fstab&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt;    &amp;lt;type&amp;gt;  &amp;lt;options&amp;gt;       &amp;lt;dump&amp;gt;  &amp;lt;pass&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt;/dev/hda2&lt;/span&gt;       &lt;span class="err"&gt;/mount/point&lt;/span&gt;     &lt;span class="err"&gt;ext3&lt;/span&gt;    &lt;span class="err"&gt;defaults&lt;/span&gt;         &lt;span class="err"&gt;0&lt;/span&gt;       &lt;span class="err"&gt;0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Ce style d'identification trouve ses limites lorsqu'il s'agit de périphérique
amovible: il ne possède pas toujours le même nom. Il est possible d'attribuer
une étiquette aux partition ext2/ext3  l'aide de l'utilitaire &lt;code&gt;e2label&lt;/code&gt;.
Ainsi la partition peut être retrouver via son étiquette.&lt;/p&gt;
&lt;div class="section" id="ajout-d-une-etiquette"&gt;
&lt;h2&gt;Ajout d'une étiquette&lt;/h2&gt;
&lt;p&gt;Pour ajouter une étiquette à une partition, tapez la commande suivante en tant
que root :&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; e2label /dev/hdaX étiquette
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;hda&lt;/code&gt; correspond au périphérique (hda, hdb, sda, sdb, ...), &lt;code&gt;X&lt;/code&gt; au
numéro de partition, et &lt;code&gt;étiquette&lt;/code&gt; à l'étiquette utilisée.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="reference-dans-etc-fstab"&gt;
&lt;h2&gt;Référence dans /etc/fstab&lt;/h2&gt;
&lt;p&gt;Une fois l'étiquette alouée, le fichier &lt;code&gt;/etc/fstab&lt;/code&gt; peut être modifié.
Pour cela la référence au périférique devient &lt;code&gt;LABEL=étiquette&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# &amp;lt;file system&amp;gt; &amp;lt;mount point&amp;gt;   &amp;lt;type&amp;gt;  &amp;lt;options&amp;gt;       &amp;lt;dump&amp;gt;  &amp;lt;pass&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;LABEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;etiquette /mount/point   ext3   defaults   0 0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Où &lt;code&gt;etiquette&lt;/code&gt; est l'étiquette de la partition et /mount/point le
répertoire où la partition doit être montée.&lt;/p&gt;
&lt;/div&gt;
</summary><category term="Partition"></category><category term="e2label"></category></entry><entry><title>Jygraphe: Partage de gros fichiers personnel</title><link href="https://blog.tblein.eu/server/2009/Personnal-big-file-share-with-Jyraphe/index-fr.html" rel="alternate"></link><published>2009-02-16T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-02-16:server/2009/Personnal-big-file-share-with-Jyraphe/index-fr.html</id><summary type="html">&lt;div class="section" id="installation"&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;Récupérer l'archive de Jyraphe et la décompresser&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;$&lt;/span&gt; wget http://download.gna.org/jyraphe/jyraphe-0.3.tar.gz
&lt;span class="gp"&gt;$&lt;/span&gt; tar xvzf jyraphe-0.3.tar.gz
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;En tant que super-utilisateur déplacer dans un répertoire accessible par le
serveur et changement de droit pour être éditable par le serveur.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mv jyraphe-0.3/pub /var/www/jyraphe
&lt;span class="gp"&gt;#&lt;/span&gt; chown www-data:www-data /var/www/jyraphe/
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration"&gt;
&lt;h2&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Lancer le script d'installation en allant à l'adresse
&lt;a class="reference external" href="http://votreserveur/jyraphe"&gt;http://votreserveur/jyraphe&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Créez le dossier qui contiendra les fichiers à télécharger&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;mkdir /var/www/jyraphe/var-********&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Empêchez l'écriture du fichier de configuration et supprimez le script
d'installation&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; chmod &lt;span class="m"&gt;500&lt;/span&gt; /var/www/jyraphe/lib/config.local.php
&lt;span class="gp"&gt;#&lt;/span&gt; rm /var/www/jyraphe/install.php
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="configuration-de-la-taille-maximal-des-fichiers"&gt;
&lt;h2&gt;Configuration de la taille maximal des fichiers&lt;/h2&gt;
&lt;p&gt;Réglez la taille maximal d'upload des fichiers en mofifiant le fichier
&lt;code&gt;php.ini&lt;/code&gt;. Pour la version CGI, &lt;code&gt;/etc/php5/cgi/php.ini&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;; Maximum size of POST data that PHP will accept.&lt;/span&gt;
&lt;span class="na"&gt;post_max_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;100M&lt;/span&gt;

&lt;span class="k"&gt;[...]&lt;/span&gt;

&lt;span class="c1"&gt;; Maximum allowed size for uploaded files.&lt;/span&gt;
&lt;span class="na"&gt;upload_max_filesize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;100M&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Redémarrez le serveur web pour prendre en compte le changement par exemple pour
lighttpd:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;/etc/init.d/lighttpd restart&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="http://home.gna.org/jyraphe/"&gt;site web de Jygraphe&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</summary><category term="PHP"></category><category term="share"></category><category term="big files"></category></entry><entry><title>Configuration du son d'une carte ATI azalia</title><link href="https://blog.tblein.eu/client/2009/Sound-configuration-of-ATI-azalia-card/index-fr.html" rel="alternate"></link><published>2009-02-16T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-02-16:client/2009/Sound-configuration-of-ATI-azalia-card/index-fr.html</id><summary type="html">&lt;p&gt;Ordinateur Dell Latitude D531, carte son ATI SBx00 azalia, debian Lenny: pas de
son...  Solution: la carte fonctionne avec des drivers ALSA pour Suse. Voici les
étapes à suivre.&lt;/p&gt;
&lt;div class="section" id="telecharger-les-dernieres-versions"&gt;
&lt;h2&gt;Télécharger les dernières versions&lt;/h2&gt;
&lt;p&gt;Il s'agit de télécharger les dernières versions d'&lt;code&gt;alsa-lib&lt;/code&gt;,
&lt;code&gt;alsa-utils&lt;/code&gt; et &lt;code&gt;alsa-driver&lt;/code&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.alsa-project.org/main/index.php/Main_Page"&gt;alsa-lib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.alsa-project.org/main/index.php/Main_Page"&gt;alsa-utils&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="ftp://ftp.suse.com/pub/projects/alsa/snapshot/driver/"&gt;alsa-driver&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(on suppose que ces fichiers ont été sauvegardés dans ~/downloads)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="copier-ces-fichiers-dans-les-bons-repertoires"&gt;
&lt;h2&gt;Copier ces fichiers dans les bons répertoires&lt;/h2&gt;
&lt;p&gt;Taper dans la console:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; mkdir -p /usr/src/alsa
&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/src/alsa
&lt;span class="gp"&gt;#&lt;/span&gt; cp ~/downloads/alsa* .
&lt;span class="gp"&gt;#&lt;/span&gt; tar xjf alsa-driver*.bz2
&lt;span class="gp"&gt;#&lt;/span&gt; tar xjf alsa-lib*.tar.bz2
&lt;span class="gp"&gt;#&lt;/span&gt; tar xjf alsa-utils*.tar.bz2
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Remplacer les * par les noms exacts des fichiers téléchargés&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="compiler-et-installer-alsa-driver"&gt;
&lt;h2&gt;Compiler et installer alsa-driver&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; alsa-driver*
&lt;span class="gp"&gt;#&lt;/span&gt; ./configure --with-cards&lt;span class="o"&gt;=&lt;/span&gt;hda-intel --with-kernel&lt;span class="o"&gt;=&lt;/span&gt;/usr/src/linux-headers-&lt;span class="k"&gt;$(&lt;/span&gt;uname -r&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="gp"&gt;#&lt;/span&gt; make
&lt;span class="gp"&gt;#&lt;/span&gt; make install
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="compiler-et-installer-alsa-lib"&gt;
&lt;h2&gt;Compiler et installer alsa-lib&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ../alsa-lib*
&lt;span class="gp"&gt;#&lt;/span&gt; ./configure
&lt;span class="gp"&gt;#&lt;/span&gt; make
&lt;span class="gp"&gt;#&lt;/span&gt; make install
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="compiler-et-installer-alsa-utils"&gt;
&lt;h2&gt;Compiler et installer alsa-utils&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="gp"&gt;#&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ../alsa-utils*
&lt;span class="gp"&gt;#&lt;/span&gt; ./configure
&lt;span class="gp"&gt;#&lt;/span&gt; make
&lt;span class="gp"&gt;#&lt;/span&gt; make install
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enfin rebooter. Et au démarrage, le son est là!!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://forum.ubuntu-fr.org/viewtopic.php?id=142519"&gt;le problème et la solution décrits ci-dessus traités sur un forum ubuntu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://help.ubuntu.com/community/HdaIntelSoundHowto"&gt;la page détaillant le mode d'emploi pour la compilation et l'installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/128085"&gt;la page où le bug est signalé et où la solution des drivers Suse est
identifiée (cf. le post d'Eduardo Guardiola)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="ALSA"></category><category term="ATI"></category><category term="azalia"></category><category term="Sound"></category><category term="Dell"></category></entry><entry><title>Sauvegarde de fichiers avec Rsync</title><link href="https://blog.tblein.eu/client/2009/file-backup-with-rsync/index-fr.html" rel="alternate"></link><published>2009-02-16T00:00:00+01:00</published><author><name>Thomas Blein</name></author><id>tag:blog.tblein.eu,2009-02-16:client/2009/file-backup-with-rsync/index-fr.html</id><summary type="html">&lt;p&gt;La sauvegarde de fichiers a toujours été un des points a ne pas négliger.
Personne n'est à l'abri d'une défaillance qui entraîne une perte de données. Le
logiciel Rsync permet de facilité cette tache. Nous allons voir ici comment le
mettre en oeuvre.&lt;/p&gt;
&lt;div class="section" id="rsync"&gt;
&lt;h2&gt;Rsync&lt;/h2&gt;
&lt;p&gt;Rsync est un utilitaire open source qui permet de synchroniser des fichiers et
répertoires entre deux endroits en minimisant le transfert de données. En effet
Rsync ne transfert que la différence entre deux séries de fichiers.\ Il est
téléchargeable sur le site officiel ou est accessible via le gestionnaire de
paquet de votre distribution.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sauvegarde-dans-un-autre-repertoire-du-meme-ordinateur"&gt;
&lt;h2&gt;Sauvegarde dans un autre répertoire du même ordinateur&lt;/h2&gt;
&lt;p&gt;Rsync est un logiciel en ligne de commande et s'utilise simplement comme ceci:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;rsync [OPTION] /repertoire/origine/ /repertoire/sauvegarde/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Remplacez bien entendu &lt;code&gt;/repertoire/origine/&lt;/code&gt; par le répertoire que vous
voulez sauvegarder et ;code:&lt;cite&gt;/repertoire/sauvegarde/&lt;/cite&gt; par le répertoire ou sera
stocké la copie de sauvegarde.&lt;/p&gt;
&lt;p&gt;Les différentes options peuvent être obtenue via la page de manuel de Rsync (man
Rsync). Nous allons voir les principales:&lt;/p&gt;
&lt;table class="table"&gt;
&lt;colgroup&gt;
&lt;col width="30%" /&gt;
&lt;col width="70%" /&gt;
&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-r, --recursive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;permet d'agir sur les différents sous-répertoires&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-l, --links&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;copie les liens symboliques comme des liens symboliques&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-p, --perms&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;conserve les permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-t, --times&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;conserve les dates de modification des fichiers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-g, --group&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;conserve le groupe du fichier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-o, --owner&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;conserve le propriétaire du fichier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-a, --archive&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;mode archive équivalent à -rlptgoD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;--delete&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;supprime les fichiers du répertoire de destination
quand ils sont absent du répertoire d'origine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;-v, --verbose&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;mode verbeux: rsync dit tout ce qu'il fait&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A l'aide de ces options vous pouvez facilement faire une copie de vos fichiers
d'un répertoire vers un autre.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sauvegarde-incrementale"&gt;
&lt;h2&gt;Sauvegarde incrémentale&lt;/h2&gt;
&lt;p&gt;Rsync vous permet de sauvegarder les fichiers modifiés ou supprimés. Vous
obtenez cette action en utilisant l'option &lt;code&gt;-b&lt;/code&gt; ou &lt;code&gt;--backup&lt;/code&gt;. Par défaut le
fichier modifié est renommé en y ajoutant un suffixe &lt;code&gt;~&lt;/code&gt; ainsi le fichier
&lt;code&gt;exemple.txt&lt;/code&gt; sera sauvegarder en &lt;code&gt;exemple.txt~&lt;/code&gt;. Vous pouvez changer ce
suffixe via l'option &lt;code&gt;--suffix=SUFFIX&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Les sauvegardes des fichiers peuvent être déplacés dans un autre répertoire que
vous pouvez spécifier à l'aide l'option &lt;code&gt;--backup-dir=DIR&lt;/code&gt;. Dans ce cas le
suffixe n'est pas ajouté au fichier sauvegardé sauf si vous le précisez.A l'aide
de cette dernière option et avec un petit script vous pouvez mettre en place une
sauvegarde incrémentale. C'est à dire qu'à chaque sauvegarde de fichier modifié
ou supprimé se fait dans un répertoire différent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;rsync -av --delete -b --backup-dir=/repertoire/sauvegarde/`date +%Y-%m-%d` \&lt;/span&gt;
&lt;span class="go"&gt;    /repertoire/origine/ /repertoire/sauvegarde/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A chaque sauvegarde un répertoire de sauvegarde est créé dans
&lt;code&gt;/repertoire/sauvegarde/&lt;/code&gt; de la forme &lt;code&gt;annee-mois-jour&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sauvegarde-distante"&gt;
&lt;h2&gt;Sauvegarde distante&lt;/h2&gt;
&lt;p&gt;Nous avons vu jusqu'à maintenant la sauvegarde dans un autre dossier du même
ordinateur. Rsync permet également de faire des sauvegarde sur un ordinateur
distant comme un serveur de sauvegarde par exemple. L'ordinateur distant doit
avoir rsync installé pour que cela fonctionne. Pour cela il peut utiliser une
connexion SSH:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;rsync -av ssh /repertoire/origine utilisateur@serveur:/repertoire/sauvegarde/&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Le mot de passe de l'utilisateur sera demandé comme pour toute connexion SSH.&lt;/p&gt;
&lt;p&gt;Vous pouvez aussi mettre en place une connexion SSH sans mot de passe (par
comparaison de clés) pour pouvoir automatiser la sauvegarde.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="sources"&gt;
&lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.jdmz.net/ssh"&gt;Using Rsync and SSH&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference external" href="http://www.linuxfocus.org/Francais/March2004/article326.shtml"&gt;Rsync: le meilleur des systèmes de sauvegarde&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</summary><category term="rsync"></category><category term="backup"></category></entry></feed>