Mind Bending

Mining Bits and Knowledge

MindBending at Twitter Mind Bending at Google Plus Mind Bending - Facebook RSS Feed em Português Full RSS Feed... Magnun at GitHub E-mail

  • Início
  • Languages
    • English
    • Português
  • Projects
    • Beholder
    • Tiamat
    • USBManager
  • Series
    • Bending Gnome Keyring with Python
    • Python e Udisks
    • PyCon 2011 Highlights
    • Dobrando o Gnome Keyring Com o Python
    • Python and Udisks
    • Destaques da PyCon 2011
    • Instalando e Configurando o Arch Linux
  • About Me
6
D1X-Rebirth in Arch and Ubuntu
descent1
D1X-Rebirth in Arch and Ubuntu
Learn how to install D1X-Rebirth, remake of Descent 1, in Arch Linux and Ubuntu. And learn why Arch Linux is much easier then Ubuntu too!
Gnome Shell and GTk3 Themes
gnome-themes
Gnome Shell and GTk3 Themes
Take a look at some nice Gnome Shell and GTK3 Themes...

Bending Gnome Keyring with Python – Part 7

02/06/10

Escrito por Magnun em Mind Bending in English

4341 comentáriohttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-7%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+72010-06-02+23%3A59%3A14Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D434

This is part 7 of 7 in the series Bending Gnome Keyring with Python
pt-br 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:

Mais >

bending, code, gnome, keyring, lock, passwords, Python, security, Tiamat, timeout, tutorial, wrapper

Bending Gnome Keyring with Python – Part 6

27/05/10

Escrito por Magnun em Mind Bending in English

4291 comentáriohttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-6%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+62010-05-27+17%3A57%3A48Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D429

This is part 6 of 7 in the series Bending Gnome Keyring with Python
pt-br 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.

Mais >

bending, code, gnome, keyring, lock, passwords, Python, security, Tiamat, tutorial, wrapper

Bending Gnome Keyring with Python – Part 5

14/05/10

Escrito por Magnun em Mind Bending in English

4233 comentárioshttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-5%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+52010-05-14+15%3A12%3A26Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D423

This is part 5 of 7 in the series Bending Gnome Keyring with Python
pt-br 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:

Mais >

bending, bug, gnome, idle, keyring, lock, passwords, Python, security, Tiamat, tutorial

Bending Gnome Keyring with Python – Part 4

31/03/10

Escrito por Magnun em Mind Bending in English

4063 comentárioshttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-4%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+42010-03-31+15%3A47%3A00Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D406

This is part 4 of 7 in the series Bending Gnome Keyring with Python
pt-br Este post também está disponível em Português

Keeping the last subject, today I’ll write a little about the Gnome Keyring security. As presented in the last post, the Gnome Keyring is responsible for storing users sensitive information in encrypted databases called keyrings. I’ve shown how to create an Keyring and store some secrets. But now I ask, are those information secure? They may be or not, it’s up to you.

There is a recurrent discussion about the Gnome Keyring behavior. When we log on, the Session Manager unlock the default keyring with your logon password to prevent many popups asking the user if they wan’t to grant access to a certain application. Many people may say this is a security flaw, I don’t totally agree. Gnome Keyring also uses the application name to ensure the permission. Let’s see an example. I’ll suppose we’re developing an certain application called  ‘MyApp’ and it will create a simple keyring. The following snippet would do the trick:

Mais >

application, bending, find, gnome, keyring, name, passwords, path, Python, seahorse, security, Tiamat, tutorial

Bending Gnome Keyring with Python – Part 3

24/03/10

Escrito por Magnun em Mind Bending in English

3812 comentárioshttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-3%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+32010-03-24+19%3A01%3A46Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D381

This is part 3 of 7 in the series Bending Gnome Keyring with Python
pt-br Este post também está disponível em Português

In the last post I’ve shown how to create keyrings using python and mentioned a slightly difference from the “seahorse password storing process”. Well, it happens that, when we start to dig this difference isn’t so small. Using seahorse every keyring item is created with the “Update if Exists” flag as False, so you can create identical keyring items. This is not a safe approach and can result in an inconsistent keyring. But as we use the “Update if Exists” flag set as True, something unexpected happens:

#!/usr/bin/env python

import gnomekeyring as gk
import glib

APP_NAME = 'MyApp'
KEYRING_NAME = 'MyKeyring'

glib.set_application_name(APP_NAME)

keyrings = gk.list_keyring_names_sync()

# If this keyring already exist, let's remove it
if KEYRING_NAME in keyrings:
    # Gnome Keyring Daemon may ask for a password here
    gk.delete_sync(KEYRING_NAME)

# If anyone asks, the password is 'mypasswd'
gk.create_sync(KEYRING_NAME, 'mypasswd')

id = gk.item_create_sync(KEYRING_NAME, gk.ITEM_GENERIC_SECRET, 'magnun@Neptune:22', {'application':APP_NAME}, 'passwd', True)
print 'New host added (key=%i)'%(key)

id = gk.item_create_sync(KEYRING_NAME, gk.ITEM_GENERIC_SECRET, 'guest@Neptune:22', {'application':APP_NAME}, 'passwd', True)
print 'New host added (key=%i)'%(key)

id = gk.item_create_sync(KEYRING_NAME, gk.ITEM_GENERIC_SECRET, 'magnun@Jupiter:22', {'application':APP_NAME}, 'passwd', True)
print 'New host added (id=%i)'%(id)

Save this as my_keyring_creator.py and run it.

Mais >

bending, find, gnome, keyring, passwords, Python, seach, seahorse, store, Tiamat, tutorial, username

Bending Gnome Keyring with Python – Part 2

20/03/10

Escrito por Magnun em Mind Bending in English

2912 comentárioshttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-2%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+22010-03-20+06%3A50%3A02Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D291

This is part 2 of 7 in the series Bending Gnome Keyring with Python
pt-br Este post também está disponível em Português

In the last post we started introducing how the Gnome Keyring works. I showed how to create a keyring and its items using Seahorse, now I’m going to show how to do it using Python. In order to interact with Gnome Keyring from Python we need python-gnomekeyring installed. Let’s start bending…

Exploring Gnome Keyring

As a first step, I’ll show how to “explore” Gnome Keyring. A good start is ensure that the Gnome keyring Daemon is available using the is_available method. To search through existing keyrings we can use the list_keyring_names_sync method. If you test this from a Python Console you will notice an recurrent warning “g_set_application_name not set”, an example:

>>> import gnomekeyring as gk
>>> gk.list_keyring_names_sync()

** (process:1737): WARNING **: g_set_application_name not set.
['login', 'MyKeyring', 'session']
>>>

This happens because the daemon requests information about which application is trying to access the Gnome Keyring info and as a Python Console we don’t have any application name. To solve this, we can import the gobject library and use the method set_application_name. Below, there is a simple keyring listing example:

Mais >

bending, gnome, keyring, passwords, Python, seahorse, ssh, store, Tiamat, tutorial, username

Bending Gnome Keyring with Python – Part 1

17/03/10

Escrito por Magnun em Mind Bending in English

2503 comentárioshttp%3A%2F%2Fwww.mindbending.org%2Fbending-gnome-keyring-with-python-part-1%2FBending+Gnome+Keyring+with+Python+%E2%80%93+Part+12010-03-18+00%3A15%3A41Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D250

This is part 1 of 7 in the series Bending Gnome Keyring with Python
pt-br Este post também está disponível em Português

In the last days, I was working in Tiamat and faced the need to store SSH and Telnet passwords. I don’t even hesitated, one name came to my mind: Gnome Keyring. It’s easy, it’s secure and have Python binding, what was missing?! Know how to use it. Before we start bending, I’d like to discuss a little about how some applications store your passwords.

It’s common to find applications that stores passwords “incorrectly” and “insecurely”. It’s easy to find IM (Internet Messengers), e-mail and other clients that stores the user’s password in a hidden config file in the user’s home. Isn’t hard to find out that the passwords are in plain text. Some times this password config file receives a “little protection”, it’s applied a password to the password. This means that the password is obfuscated with a reversible algorithm by a “master password”. This isn’t correct! It gives us the felling of false security, they seem to be encrypted but aren’t! With a little brutal force is possible to unveil the user’s passwords.

A perfect example is Pidgin. The famous IM client stores your password at /home/<username>/.purple/accounts.xml. Don’t believe me?! Look here. Still don’t believe yeah? The pidgin development team spoke about it here. Let me quote the first paragraph:

Mais >

bending, Empaphy, gnome, introduction, keyring, passwords, pidgin, Python, seahorse, ssh, store, Tiamat, tutorial, username

Bending the World!

16/03/10

Escrito por Magnun em Mind Bending in English

1731 comentáriohttp%3A%2F%2Fwww.mindbending.org%2Fbending-the-world%2FBending+the+World%212010-03-16+21%3A09%3A29Magnunhttp%3A%2F%2Fblogs.codecommunity.org%2Fmindbending%2F%3Fp%3D173

pt-br Este post também está disponível em Português

Hello there, and welcome to Mind Bending!

I’m pleased to announce the beginning of this blog! Many must be wondering who am I, so I posted a brief description of who I am and what I do here. In advance I’ll say that I’m no important person and I don’t master anything, I’ll just use this blog to post some news I found relevant, as a journal to my projects and to document some nice things I found out. I’ll commonly post about things related to FOSS and GNU/Linux that I like, lots of Python codes, games and sporadically something about drawings.

Before someone asks, “why Mind Bending”. Well, mind bending have many definitions:

  1. Something very difficult to understand; complex;
  2. Strenuous mind activity;
  3. Something that intensely alters one’s state of consciousness and mind;

Mais >

bending, development, foss, gtk, hello world, mind, Projects, pygtk, Python, softwares, Tiamat, usbmanager
« Primeira...«23456
  • Pesquisar

    • Arquivos
    • Marcadores
    • Categorias
    • Arch Linux (21)
    • Games (4)
    • Git (4)
    • Gnome (22)
    • Languages (147)
      • Mind Bending em Português (90)
      • Mind Bending in English (58)
    • Linux (3)
    • Music (3)
    • Música (5)
    • No Category (2)
    • Project logs (24)
      • Tiamat (13)
      • USBManager (10)
    • Python (55)
    • Ubuntu (7)
    • VIM (6)
    • Xfce (1)
    arch bending blog code dbus debian design devicekit empathy games git gnome gnome3 gnome 3 gnome 3.0 gnome shell instalação keyring linux lock música news pacman palestra passwords pycon2011 pygi pygtk Python seahorse security ssh store Tiamat tutorial twitter ubuntu udisks usbmanager username vídeos video VIM wrapper yaourt
    • April 2012 (4)
    • March 2012 (2)
    • February 2012 (1)
    • January 2012 (6)
    • December 2011 (9)
    • November 2011 (5)
    • October 2011 (9)
    • September 2011 (13)
    • August 2011 (12)
    • July 2011 (15)
    • June 2011 (8)
    • May 2011 (7)
    • April 2011 (8)
    • March 2011 (26)
    • February 2011 (3)
    • January 2011 (3)
    • December 2010 (4)
    • October 2010 (2)
    • September 2010 (1)
    • June 2010 (1)
    • May 2010 (2)
    • March 2010 (6)
  • Registro do usuário






    • Cadastre-se
    • Perdeu a senha?
  • Series

    • Bending Gnome Keyring with Python (7)
    • Destaques da PyCon 2011 (7)
    • Dobrando o Gnome Keyring Com o Python (7)
    • Git Is For All (1)
    • Git para Todos (1)
    • Instalando e Configurando o Arch Linux (4)
    • PyCon 2011 Highlights (7)
    • Python and Udisks (5)
    • Python e Udisks (5)
  • Lista de Links

    • Planeta Arch Linux Brasil
    • Planeta GNU/Linux Brasil
    • Renda Bordô
  • Parceiros

    Berlotto Blog Cstropz.net
    SejaLivre.org Ad Square
  • Ad Square Ad Square
  • Tags

    arch bending blog code dbus debian design devicekit empathy games git gnome gnome3 gnome 3 gnome 3.0 gnome shell instalação keyring linux lock música news pacman palestra passwords pycon2011 pygi pygtk Python seahorse security ssh store Tiamat tutorial twitter ubuntu udisks usbmanager username vídeos video VIM wrapper yaourt
  • Tweets

    Carregando tweets...
    Siga-me no Twitter!
    • I am GNOME
    • GNU Meditate
    • Mind Bending
Tema Mystique por digitalnature | Movido a WordPress
RSS Feeds XHTML 1.1 Topo
RP

Mind Bending / Log in Stop SOPA