This repository has been archived by the owner on Aug 29, 2018. It is now read-only.
[origin_ui_112] Kerberos principal support #481
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,14 @@ module Rest | |
class Key < Base | ||
define_attr :name, :type, :content | ||
|
||
def is_ssh? | ||
type != 'krb5-principal' | ||
end | ||
|
||
def is_kerberos? | ||
type == 'krb5-principal' | ||
end | ||
|
||
def update(type, content) | ||
debug "Updating key #{self.name}" | ||
rest_method "UPDATE", :type => type, :content => content | ||
|
@@ -14,17 +22,21 @@ def destroy | |
end | ||
alias :delete :destroy | ||
|
||
def principal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels smelly but not sure what you can do. I think part of the problem is that the client code assumes that SSH keys can be passed to Openssl and just work - maybe we should relax that a bit. Hard to say. |
||
content if is_kerberos? | ||
end | ||
|
||
def fingerprint | ||
@fingerprint ||= begin | ||
public_key = Net::SSH::KeyFactory.load_data_public_key("#{type} #{content}") | ||
public_key.fingerprint | ||
rescue NotImplementedError, OpenSSL::PKey::PKeyError => e | ||
'Invalid key' | ||
end | ||
end if is_ssh? | ||
end | ||
|
||
def visible_to_ssh? | ||
Net::SSH::Authentication::Agent.connect.identities. | ||
is_ssh? and Net::SSH::Authentication::Agent.connect.identities. | ||
find{ |i| fingerprint == i.fingerprint }.present? rescue false | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm... this seems smelly. Not sure what else you can do, but it's a bit wierd.