Mining Bits and Knowledge
Artigos com o marcador lock
Dobrando o Gnome Keyring Com o Python – Parte 7
15/02/11
| This post is also available in English |
Alguns posts atrás eu falei sobre duas formas de resolver um problema com o Python & Gnome Keyring. A primeira forma (apresentada aqui) propôs criar uma classe que “envolve” a libgnome-keyring e a cada requisição ela destranca e tranca o chaveiro. Essa não é a forma mais perfeita e permitia a exploração de algumas falhas de segurança. A segunda solução, e também a mais elegante, é criar uma outra classe para “envolver” libgnome-keyring e adiciona a funcionalidade de temporizador de inatividade.
Neste post eu irei mostrar um exemplo de implementação. O código apresentado aqui está baseado na último código que postei. Eu alterei somente algumas linhas adicionando uma janela GTK para simular uma aplicação. Vamos ver o código:
Dobrando o Gnome Keyring Com o Python – Parte 6
01/02/11
| This post is also available in English |
Continuando a partir do último post, irei mostrar como podemos implementar uma “wrapper class” para mudar o comportamento do Gnome Keyring. Esta não é a forma mais segura, uma vez que armazenamos a senha do chaveiro em uma variável. Mas essa abordagem é muito melhor do que deixar o chaveiro aberto para várias outras aplicações consultarem os seus dados.
Primeiramente temos que criar um a classe para gerenciar o chaveiro. Ela será responsável por:
- consulstar os keyrings existentes;
- criar chaveiros;
- deletar chaveiros;
- alterar o keyring default;
- trancar todos os chaveiros.
Após isso, precisamos de uma classe para “envolver” o chaveiros. Uma vez que o chaveiro possui diversas funcionalidades e não é minha intenção recriar todas elas eu irei mostrar somente as essenciais. Desta forma, minha classe estará apta a:
- tranchar o chaveiro;
- destrancar o chaveiro;
- mostrar se o chaveiro está ou não trancado;
- listar o identificador dos itens que compõem o chaveiro;
- dar acesso ao GnomeKeyringInfo;
- mudar a senha do chaveiro;
- listar os atributos dos itens que compõem o chaveiro;
- retornar a senha dos itens que compõem o chaveiro.
Dobrando o Gnome Keyring Com o Python – Parte 5
31/01/11
| This post is also available in English |
Segundo a linha do meu último post, existe uma “falha de segurança” no Gnome Keyring. Ainda bem que há um mecanismo que nos traz um pouco de paz. A API do Gnome Keyring (ligbnome-keyring) nós provê uma forca de “trancar” uma chaveiro específico usando os métodos: set_lock_on_idle and set_lock_timeout.
De acordo com a documentação da API do Gnome Keyring (disponível somente em C) o método set_lock_on_idle recebe um valor booleano (True of False), o qual define se um chaveiro específico deveria ou não ser “trancado” após um tempo de inatividade. O método set_lock_timeout define após quantos segundos o chaveiro seria considerado como inativo. Uma vez que não consegui encontrar nenhuma exemplo de uso e eu não muito menos ajuda com a comunidade/desenvolvedores eu imagino que a utilização correta para esse método ser algo assim:
Bending Gnome Keyring with Python – Part 7
02/06/10
| Este post também está disponível em Português |
In a couple of posts ago I talked about two ways to solve a Gnome Keyring issue in Python. The fist way (demonstrated here), was to create o simple class that wraps the libgnome-keyring and in each request it lock and unlock the Gnome Keyring. It wasn’t perfect and had some security issues but at least kept your Keyring securely locked. The second solution, and also the most elegant, is to create a class that wraps the libgnome-keyring and mimics the idle timeout.
In this post I’ll show an example of implementation. The code presented here is based in my last post code. I just changed a few lines and added a GTK Window that mimics an application. Let’s see the code:
Bending Gnome Keyring with Python – Part 6
27/05/10
| Este post também está disponível em Português |
Following my last post lines, I’ll show today how we can implement a wrapper class to “control” the Gnome Keyring. This isn’t the most secure way, since we store the keyring password in a variable. But is better then let your keyring open for all other applications.
First we need to create a class that creates a “Keyring Manager”, responsible for:
- consulting the existing keyrings;
- create keyrings;
- delete keyrings;
- set the default keyring;
- lock all keyrings.
Secondly, we need a wrapper for the Keyring. Since the keyring has many features and is not my intention to wrap all those I’ll just show the essentials. My keyring wrapper is able to:
- lock the keyring;
- unlock the keyring;
- show if the keyring is locked
- list it’s item ids;
- give access to the GnomeKeyringInfo;
- change the keyring password;
- list the keyring’s item attributes;
- show the keyring’s item secret.
Bending Gnome Keyring with Python – Part 5
14/05/10
| Este post também está disponível em Português |
Following the last line from my preview post, there is a secure flaw in the Gnome Keyring. Hopefully there is a security mechanism that brings us some peace. The Gnome Keyring API (ligbnome-keyring) give us a way to lock an specific keyring using the following methods: set_lock_on_idle and set_lock_timeout.
According to the libgnome-keyring API documentation (only available in C) the set_lock_on_idle method receives a boolean value (True of False), which define if the defined keyring should or shouldn’t be locked when idle. The set_lock_timeout method defines after how many seconds the keyring should be considered idle. Since I couldn’t find any usage example and I couldn’t get any help with the community/developers I assumed that the correct usage for this method should be something like this:





