5. Atualizações de segurança de versão estável¶
5.1. Corrigindo uma falha de segurança no Ubuntu¶
5.1.1. Introdução¶
Fixing security bugs in Ubuntu is not really any different than fixing a regular bug in Ubuntu, and it is assumed that you are familiar with patching normal bugs. To demonstrate where things are different, we will be updating the dbus package in Ubuntu 12.04 LTS (Precise Pangolin) for a security update.
5.1.2. Obtendo o fonte¶
In this example, we already know we want to fix the dbus package in Ubuntu
12.04 LTS (Precise Pangolin). So first you need to determine the version of the
package you want to download. We can use the rmadison
to help with this:
$ rmadison dbus | grep precise
dbus | 1.4.18-1ubuntu1 | precise | source, amd64, armel, armhf, i386, powerpc
dbus | 1.4.18-1ubuntu1.4 | precise-security | source, amd64, armel, armhf, i386, powerpc
dbus | 1.4.18-1ubuntu1.4 | precise-updates | source, amd64, armel, armhf, i386, powerpc
Typically you will want to choose the highest version for the release you want to patch that is not in -proposed or -backports. Since we are updating Precise’s dbus, you’ll download 1.4.18-1ubuntu1.4 from precise-updates:
$ bzr branch ubuntu:precise-updates/dbus
5.1.3. Aplicando um patch no código fonte¶
Now that we have the source package, we need to patch it to fix the
vulnerability. You may use whatever patch method that is appropriate for the
package, but this example will use edit-patch
(from the ubuntu-dev-tools
package). edit-patch
is the easiest way to patch packages and it is
basically a wrapper around every other patch system you can imagine.
Para criar seu patch usando edit-patch
:
$ cd dbus
$ edit-patch 99-fix-a-vulnerability
Isto irá aplicar os patches existentes e colocar o pacote em um diretório temporário. Agora edite os arquivos necessários para corrigir a vulnerabilidade. Frequentemente, o upstream terá fornecido um patch, então você pode aplicá-lo:
$ patch -p1 < /home/user/dbus-vulnerability.diff
Depois de fazer as mudanças necessárias, é só pressionar Ctrl-D ou digitar “exit” para sair temporariamente do shell.
5.1.4. Formatando o registro de alteração e os patches¶
After applying your patches you will want to update the changelog. The dch
command is used to edit the debian/changelog
file and edit-patch
will
launch dch
automatically after un-applying all the patches. If you are not
using edit-patch
, you can launch dch -i
manually. Unlike with regular
patches, you should use the following format (note the distribution name uses
precise-security since this is a security update for Precise) for security
updates:
dbus (1.4.18-2ubuntu1.5) precise-security; urgency=low
* SECURITY UPDATE: [DESCRIBE VULNERABILITY HERE]
- debian/patches/99-fix-a-vulnerability.patch: [DESCRIBE CHANGES HERE]
- [CVE IDENTIFIER]
- [LINK TO UPSTREAM BUG OR SECURITY NOTICE]
- LP: #[BUG NUMBER]
...
Atualize o seu patch para que use tags apropriadas. Seu patch deve ter no mínimo a orígem, descrição e tags bug-Ubuntu. Por exemplo, edite debian/patches/99-fix-a-vulnerability.patch para ter algo como:
## Description: [DESCRIBE VULNERABILITY HERE]
## Origin/Author: [COMMIT ID, URL OR EMAIL ADDRESS OF AUTHOR]
## Bug: [UPSTREAM BUG URL]
## Bug-Ubuntu: https://launchpad.net/bugs/[BUG NUMBER]
Index: dbus-1.4.18/dbus/dbus-marshal-validate.c
...
Várias vulnerabilidades podem ser corrigidas no mesmo envio de segurança; apenas certifique-se de usar patches diferentes para vulnerabilidades diferentes.
5.1.5. Testar e enviar o seu trabalho¶
Neste ponto, o processo é o mesmo que para corrigir um erro comum no Ubuntu. Especificamente, você deve:
Construir seu pacote e verificar se compilou sem erros e sem quaisquer avisos de compilador
Atualizar para a nova versão do pacote de uma versão anterior
Verifique se o novo pacotes corrige a vulnerabilidade e não introduz nenhuma regressão
Envie seu trabalho via proposta de mesclagem do Launchpad, registre um erro no Launchpad assegurando-se de marcar o erro como erro de segurança e inscreva-se no “ubuntu-security-sponsors”.
Se a vulnerabilidade de segurança não é pública ainda então não adicione a proposta de mesclagem e certifique-se de que você marcou a falha como privada.
The filed bug should include a Test Case, i.e. a comment which clearly shows how to recreate the bug by running the old version then how to ensure the bug no longer exists in the new version.
The bug report should also confirm that the issue is fixed in Ubuntu versions newer than the one with the proposed fix (in the above example newer than Precise). If the issue is not fixed in newer Ubuntu versions you should prepare updates for those versions too.
5.2. Atualizações de versão estável¶
We also allow updates to releases where a package has a high impact bug such as a severe regression from a previous release or a bug which could cause data loss. Due to the potential for such updates to themselves introduce bugs we only allow this where the change can be easily understood and verified.
O processo para atualizações de versões estáveis é o mesmo que o processo para falhas de seguranção, exceto que você deve registrar “ubuntu-sru” no relatório de erro.
The update will go into the proposed
archive (for example
precise-proposed
) where it will need to be checked that it fixes the problem
and does not introduce new problems. After a week without reported problems it
can be moved to updates
.
See the Stable Release Updates wiki page for more information.