github-auth 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba2efedd769fc2ec5fc8aacfe3b4dc953bbb7452
4
- data.tar.gz: 16c7b8ca303579763af15ad0a8a30da805f59708
3
+ metadata.gz: ae6c8829c44543ade8a4ee209b00af812e1282d4
4
+ data.tar.gz: b01479f59d0ee0626f6b8d53b0d5271b0c8d5115
5
5
  SHA512:
6
- metadata.gz: afa9ef34522861aee155e9fcbb2bc6b86c68ebcd5df7631b3b203a38007ba4a39c0297ee4ab524a1f9226a55d636b6a3d436b984ecc13cb655e5af1a58614c31
7
- data.tar.gz: 15977ad54d76b221cc83e6c1874fa3f4e527007b9a4a6d43e3012d626bea94f0dd63802f03a1a98303391884c61fbf40a86231b271ab09f021057df3859df4d6
6
+ metadata.gz: 7292a8368140bce7bac19bc704d0cccc0ddada1dbe3eeeb8603ac93907b1d294fd7facfac30069ff86776e2da31597bd025b1b15d10934ef701004633fa4bdcd
7
+ data.tar.gz: f79c42a9d9c078e168111a3ade0ada1362362c167dbaa793c5702ce297a4bcb72d230af3a1f1fbeceb483a318603ba63aa5991b5753a95cf17b11bf81f7c8f48
data/README.md CHANGED
@@ -5,16 +5,19 @@
5
5
 
6
6
  ## Description
7
7
 
8
- If you decide to [`#pairwithme`](https://twitter.com/search?q=pairwithme),
9
- we'll probably be SSHing into my laptop, your laptop, or some laptop in the
10
- sky. Since I'd rather not send you a password over email or Skype, we'll use
11
- public key authentication.
8
+ If you agree to [\#pairwithme](https://twitter.com/search?q=pairwithme), we'll
9
+ probably be SSHing into my laptop, your laptop, or some laptop in the sky.
10
+ Sharing passwords over email is no fun, so we'll use public key authentication
11
+ to keep things fun, fast, and secure.
12
12
 
13
- `gh-auth` allows you to easily add and remove any Github user's public ssh keys
14
- from your [`authorized_keys`](http://en.wikipedia.org/wiki/Ssh-agent) file.
13
+ `gh-auth` allows you to quickly add and remove any Github user's public ssh
14
+ keys from your [`authorized_keys`](http://en.wikipedia.org/wiki/Ssh-agent)
15
+ file.
15
16
 
16
- Let's say you'd like to pair with me. Awesome! To allow me to ssh into your
17
- machine, just run:
17
+ Let's see how this works.
18
+
19
+ After you've [installed](#installation) `gh-auth`, you can give me ssh access
20
+ with:
18
21
 
19
22
  ```bash
20
23
  $ gh-auth add chrishunt
@@ -44,7 +47,7 @@ Removing 2 key(s) from '/Users/chris/.ssh/authorized_keys'
44
47
  ## Usage
45
48
 
46
49
  ```bash
47
- usage: gh-auth [add|remove] <username>
50
+ usage: gh-auth [--version] [add|remove] <username>
48
51
  ```
49
52
 
50
53
  ## Installation
@@ -55,7 +58,7 @@ Install the `github-auth` gem:
55
58
  $ gem install github-auth
56
59
 
57
60
  $ gh-auth
58
- usage: gh-auth [add|remove] <username>
61
+ usage: gh-auth [--version] [add|remove] <username>
59
62
  ```
60
63
 
61
64
  ### SSH Public Key Authentication (Mac OS X)
@@ -77,7 +80,7 @@ $ chmod 600 ~/.ssh/authorized_keys
77
80
  ### Verification
78
81
 
79
82
  If you'd like to verify that everything is working as expected, you can test
80
- right from your machine.
83
+ locally on your own machine.
81
84
 
82
85
  First, authorized yourself for ssh. (Make sure to replace 'chrishunt' with
83
86
  *your* Github username)
@@ -87,8 +90,8 @@ $ gh-auth add chrishunt
87
90
  Adding 2 key(s) to '/Users/chris/.ssh/authorized_keys'
88
91
  ```
89
92
 
90
- Next, open an SSH session to your machine with public key authentication. It
91
- should work just fine.
93
+ Now that your keys are added, verify that you can open an SSH session to your
94
+ machine with public key authentication:
92
95
 
93
96
  ```bash
94
97
  $ ssh -o PreferredAuthentications=publickey localhost
@@ -96,15 +99,15 @@ $ ssh -o PreferredAuthentications=publickey localhost
96
99
  (localhost)$
97
100
  ```
98
101
 
99
- Now remove your public keys from the keys file:
102
+ Next, remove your public keys from the keys file:
100
103
 
101
104
  ```bash
102
105
  $ gh-auth remove chrishunt
103
106
  Removing 2 key(s) from '/Users/chris/.ssh/authorized_keys'
104
107
  ```
105
108
 
106
- You should no longer be able to login to the machine since the keys have been
107
- removed.
109
+ Since you've removed your keys, verify now that you can no longer login to your
110
+ machine with public key authentication:
108
111
 
109
112
  ```bash
110
113
  $ ssh -o PreferredAuthentications=publickey localhost
@@ -112,11 +115,71 @@ $ ssh -o PreferredAuthentications=publickey localhost
112
115
  > Permission denied (publickey,keyboard-interactive)
113
116
  ```
114
117
 
118
+ ## Troubleshooting
119
+
120
+ ### How do people actually connect to my machine?
121
+
122
+ Good question! Others will connect to your machine using ssh:
123
+
124
+ ```bash
125
+ $ ssh username@external-ip-address
126
+ ```
127
+
128
+ ### What username do I use?
129
+
130
+ The `username` is going to be the same username that you used to add the keys.
131
+ In most cases, it's a good idea to create a new `pair` account and use that
132
+ account for all pairings. You don't want strangers reading your email!
133
+
134
+ Once you've created the pair account, you can switch to it yourself in a
135
+ terminal with:
136
+
137
+ ```bash
138
+ $ su - pair
139
+ ```
140
+
141
+ ### How do I get my external IP?
142
+
143
+ You can get your external IP address with:
144
+
145
+ ```bash
146
+ $ curl http://remote-ip.herokuapp.com
147
+ ```
148
+
149
+ ### It's still not working! :(
150
+
151
+ In almost all cases, your laptop is not directly plugged into your modem.
152
+ You're on a wirelress network or plugged directly into a router or switch. This
153
+ means the external IP address that your pair is connecting to is not your
154
+ machine, it's actually your router.
155
+
156
+ You can tell your router to forward ssh connections to your machine by enabling
157
+ [port forwarding](http://en.wikipedia.org/wiki/Port_forwarding). You will want
158
+ to forward port `22` (ssh) to the local IP address of your machine.
159
+
160
+ If port `22` is already forwarded to another machine or you want to change
161
+ things up, you can have ssh listen on another port and have your pair connect
162
+ with:
163
+
164
+ ```bash
165
+ ssh -p <port> username@external-ip-address
166
+ ```
167
+
168
+ ### I can't enable port forwarding, my boss won't let me. Can I still pair?
169
+
170
+ Yes! A nice solution to this is to have a machine **somewhere else** that both
171
+ of you can ssh into. Place this machine on a network that you *do* have the
172
+ ability to forward ports. Maybe this machine is at home, a friend's house, or
173
+ at a company your worked for in the past that forgot to turn it off.
174
+
175
+ If this isn't possible, then you can use a VPS provider like
176
+ [Linode](http://www.linode.com) to setup a pairing machine in the cloud.
177
+
115
178
  ## Contributing
116
179
 
117
180
  1. Fork it
118
181
  2. Create your feature branch (`git checkout -b my-new-feature`)
119
- 3. Commit your changes (`git commit -am 'Add some feature'`)
182
+ 3. Commit your changes, with tests (`git commit -am 'Add some feature'`)
120
183
  4. Run the tests (`bundle exec rake spec`)
121
184
  5. Push to the branch (`git push origin my-new-feature`)
122
185
  6. Create new Pull Request
data/Rakefile CHANGED
@@ -1,9 +1,16 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'cane/rake_task'
3
4
 
4
5
  desc 'Run all tests'
5
- RSpec::Core::RakeTask.new(:spec) do |t|
6
- t.rspec_opts = '--color --order random'
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = '--color --order random'
8
+ end
9
+
10
+ desc 'Check code quality'
11
+ Cane::RakeTask.new(:quality) do |task|
12
+ task.abc_max = 9
7
13
  end
8
14
 
9
15
  task default: :spec
16
+ task default: :quality
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'cane'
24
25
  spec.add_development_dependency 'coveralls'
25
26
  spec.add_development_dependency 'sinatra'
26
27
  spec.add_development_dependency 'thin'
@@ -1,4 +1,5 @@
1
1
  module Github::Auth
2
+ # Command Line Interface for parsing and executing commands
2
3
  class CLI
3
4
  attr_reader :command, :usernames
4
5
 
@@ -1,6 +1,7 @@
1
1
  require 'httparty'
2
2
 
3
3
  module Github::Auth
4
+ # Client for fetching public SSH keys using the Github API
4
5
  class KeysClient
5
6
  attr_reader :username, :hostname
6
7
 
@@ -1,4 +1,5 @@
1
1
  module Github::Auth
2
+ # Write and delete keys from the authorized_keys file
2
3
  class KeysFile
3
4
  attr_reader :path
4
5
 
@@ -1,5 +1,5 @@
1
1
  module Github
2
2
  module Auth
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-25 00:00:00.000000000 Z
11
+ date: 2013-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cane
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: coveralls
57
71
  requirement: !ruby/object:Gem::Requirement