New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add have authorized key matcher #75

Merged
merged 4 commits into from May 2, 2013

Conversation

Projects
None yet
2 participants
@TakatoshiMaeda
Contributor

TakatoshiMaeda commented May 1, 2013

Hello.
I had added the following matcher.

  • Check user has in the authorizedkey the public key.

My environment success all specs.(Mac OS X 10.8.2)
It was confirmed that it is run successfully on CentOS6.3.
Other environments is not able to test yet...sorry...
But Rspec is all green.

Please confirm.
Thank you.

TakatoshiMaeda added some commits May 1, 2013

Add spec have_authorized_key matcher.
for check user do have a ssh authorized_key.
Add have_authorized_key matcher.
for check user do have a ssh authorozed_key.

TakatoshiMaeda added some commits May 2, 2013

SSH publickey test data comment changed.
To be able to understand the test data at a glance
Add remove ssh publickey comment code and shellscript refactoring.
・Refactoring a shellscript to check the SSH public key.
・Commands spec is changed for new command test.
・Before check remove ssh publickey comment.
@TakatoshiMaeda

This comment has been minimized.

Show comment
Hide comment
@TakatoshiMaeda

TakatoshiMaeda May 2, 2013

Contributor

Hello.

I was fixed a place where it has been pointed out.

I changed the regular expression only one place.

  def check_authorized_key user, key
    # Supports only when EOL has a blank.
    key.sub!(/\s+\S*$/, '') if key.match(/^\S+\s+\S+\s+\S*$/)                                                                                                                                                                                                           
    "grep -w '#{key}' ~#{user}/.ssh/authorized_keys"
  end

I think EOL has a blank only when not good case.
but, this case when ssh login success.
I thought the test should be successful if can log in with SSH.

My environment success all specs.(Mac OS X 10.8.2)
It was confirmed that it is run successfully on CentOS6.3.
(commentedkey, uncommentedkey, EOL has a blank only case)
Other environments is not able to test yet...sorry...
But Rspec is all green.

Please confirm.
Thank you:-)

Contributor

TakatoshiMaeda commented May 2, 2013

Hello.

I was fixed a place where it has been pointed out.

I changed the regular expression only one place.

  def check_authorized_key user, key
    # Supports only when EOL has a blank.
    key.sub!(/\s+\S*$/, '') if key.match(/^\S+\s+\S+\s+\S*$/)                                                                                                                                                                                                           
    "grep -w '#{key}' ~#{user}/.ssh/authorized_keys"
  end

I think EOL has a blank only when not good case.
but, this case when ssh login success.
I thought the test should be successful if can log in with SSH.

My environment success all specs.(Mac OS X 10.8.2)
It was confirmed that it is run successfully on CentOS6.3.
(commentedkey, uncommentedkey, EOL has a blank only case)
Other environments is not able to test yet...sorry...
But Rspec is all green.

Please confirm.
Thank you:-)

@mizzy mizzy merged commit 2a9f04c into mizzy:master May 2, 2013

1 check passed

default The Travis build passed
Details
@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy May 2, 2013

Owner

LGTM. Thnaks!

Owner

mizzy commented May 2, 2013

LGTM. Thnaks!

@TakatoshiMaeda TakatoshiMaeda deleted the TakatoshiMaeda:add_have_authorized_key_matcher branch May 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment