formigarafa / robotito

Terminal shell accessible through a jabber connection
MIT License
72 stars 18 forks source link

Detailed setup for newbie #12

Open stanbar opened 5 years ago

stanbar commented 5 years ago

Hello. I'm quite new in the jabber/xmpp world. I created account on jabber.org and jabber.at let's say raspberry@jabber.org for running on my raspberry, and client@jabber.at for clients.

My credentials will looks like:

# Robo-TiTO connects to Jabber using these settings.
BOT_LOGIN         = "raspberry@jabber.org"
BOT_PASSWORD      = "password"
BOT_JABBER_HOST_SERVER = 'jabber.org'
BOT_JABBER_SERVER_PORT = 5222

# Robo-TiTO only accepts commands from contacts listed on AllowedUsers array.
PASSWD = {
  "client@jabber.at" => "base32secret_for_one_time_passwords",
}

I'm using Google Auth for my personal gmail account, but I don't get how can I get/generate base32secret_for_one_time_passwords ?

If I left it as it is: then the raspberry respond to me:

client: pwd rasperry: Unknown User: pwd

client: whoami raspberry: Unknown User: whoami

and so on...

formigarafa commented 5 years ago

Hello @stasbar, I will come back to help you as soon as I have a computer in hand to reproduce the steps required. Probably tonight (in about 12 hours).

stanbar commented 5 years ago

I generated some random base32 string and used it in my Google auth and in credentials.rb

➜  robotito-1.0.0 cat config/credentials.rb
# Robo-TiTO connects to Jabber using these settings.
BOT_LOGIN         = "raspberry@conversations.im"
BOT_PASSWORD      = "password"
BOT_JABBER_HOST_SERVER = 'conversations.im'
BOT_JABBER_SERVER_PORT = 5222

# Robo-TiTO only accepts commands from contacts listed on AllowedUsers array.
PASSWD = {
        "stasbar" => "JBZW4YLLMFVXKZDEMJ3HGYTCONUHG2DTNBZWU43KONVHG2TTNJZWUYLLNNQWWYLLMFVXG2DYNBUHQ==="
}

Then when I started interaction with the server

Client: stasbar Raspberry: Welcome, stasbar. Please send authentication. Client: 348468

Meanwhile:

./robotitod run
Connecting...
Connected.
/var/lib/gems/2.3.0/gems/rotp-3.3.0/lib/rotp/base32.rb:43:in `decode_quint': Invalid Base32 Character - '=' (ROTP::Base32::Base32Error)

I removed '=' chars from the key and restarted.

./robotitod run
Connecting...
Connected.

At this point the server is not responding to any message, it doesn't even send Unknown User: stasbar

Atlas974 commented 5 years ago

Hello, I don't understand how to setup : PASSWD = { "username" => "base32secret_for_one_time_passwords", } Can you provide more detailed instructions?

Atlas974 commented 5 years ago

Hello, I don't understand how to setup : PASSWD = { "username" => "base32secret_for_one_time_passwords", } Can you provide more detailed instructions?

Edit: I managed to make it work! Even if I didn't understand how.... Basically "base32secret_for_one_time_passwords" can be anything, right?

JarnoThierolf commented 5 years ago

As far as I understood it must be base32 conform. So that means upper-case letters A–Z and digits 2–7 are allowed. https://en.wikipedia.org/wiki/Base32

Atlas974 commented 5 years ago

As far as I understood it must be base32 conform. So that means upper-case letters A–Z and digits 2–7 are allowed. https://en.wikipedia.org/wiki/Base32

For sure, I was talking about how Google Authenticator works (so I made some research). I used Python to generate my key if it helps some of them: https://riptutorial.com/python/example/27071/encoding-and-decoding-base32