Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !5261

Merged
Created 11 years ago by Administrator@rootOwner

ssh keys publically available for sysadmins via http, the github way

  • Overview 43
  • Commits 11
  • Changes 6

Created by: devaroop

Very helpful feature for sysadmins to get user ssh-keys and append in servers. For example:

http://github.com/devaroop.keys

After this merge, gitlab users will be able to use it the same way:

http://<gitlab_host>/<username>.keys

More information about its advantages: http://thechangelog.com/github-exposes-public-ssh-keys-for-its-users/

Duplicates: #5260 which is closed

Loading
Loading

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @jacobvosmaer Can you force the tests to re-run? Since rubygems seems to had a hick-up

    By Administrator on 2013-10-03T12:46:27 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop Maybe its an idea to force to user to at least log in to the gitlab system? So the keys wont be public for everyone to see?

    By Administrator on 2013-10-03T12:47:42 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jacobvosmaer

    @jvanbaarsen I just spent 15 minutes cursing Travis; I do not know how to re-trigger a build.

    By Administrator on 2013-10-03T13:12:05 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @jacobvosmaer Ah ok, i think only @randx can do it (since he is the project owner) :disappointed:

    By Administrator on 2013-10-03T13:16:47 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @jvanbaarsen - The reason for it to be public is to cater sysadmins do a wget / curl and append it to the ssh keys file. GitHub implements it the same way. Try: https://github.com/jvanbaarsen.keys without logging in.

    @randx - Kindly re-trigger the travis build, it choked because of a connection timeout. :(

    By Administrator on 2013-10-03T18:18:55 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop Ok clear, can you maybe also provide test coverage for this feature?

    By Administrator on 2013-10-03T18:30:01 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dzaporozhets

    I think API is a better place for such functionality

    By Administrator on 2013-10-04T11:28:59 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @randx : Agreed. API certainly provides the functionality. It provides additional information for the keys like id, description, etc., BUT at the cost of user authentication(private token).

    The whole point here is to help sysadmin's get the keys without asking the end user / authenticate / use any API. This feature in GitHub was very helpful and we wanted it on GitLab too. It helps a lot.

    By Administrator on 2013-10-05T10:00:35 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop I personally dont like the fact that there will be no authentication at all. Github is more for opensource etc. Gitlab is more for private code hosting. What do you think @randx ?

    By Administrator on 2013-10-05T10:03:46 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @jvanbaarsen : True. Its for robust private hosting. But what mischief can someone do by sneaking others ssh-public-keys? It is not reversible to get its priv key, moreover, if he uses them in his server, he is digging his own grave :).

    By Administrator on 2013-10-05T10:30:23 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop I think you're right :-) :thumbsup: for this PR

    By Administrator on 2013-10-29T09:48:37 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dosire

    I think this functionality is scary on first sight but makes a lot of sense. In many companies it is very hard to find the public keys of your other team members. It would be very nice if you can find them in GitLab. All the user profiles should contain a link to http://<gitlab_host>/.keys

    By Administrator on 2013-12-04T09:22:24 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @dosire Yeah i agree! It would be a great addition :smile:

    By Administrator on 2013-12-04T17:32:39 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dosire

    We like this functionality and would so like to see the following:

    • The keys should be available to anyone without authentication.
    • When keys are added to GitLab they should be stripped of any comments before performing validation and storing in the database. People can use the existing key title to identify the key.

    By Administrator on 2013-12-05T08:20:33 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: atomaka

    @dosire For clarification, the second bullet is a change to current mechanics and the comment should never be stored in the "key" field of the "keys" table in the database?

    By Administrator on 2013-12-20T21:29:30 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dosire

    @atomaka Exactly!

    By Administrator on 2014-01-06T16:30:36 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop Can you please take a look at the comments provided by @dosire?

    By Administrator on 2014-01-29T17:08:31 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @jvanbaarsen , @dosire :

    • The keys should be available to anyone without authentication.

    A) Yes the keys are available to anyone without authentication.

    • When keys are added to GitLab they should be stripped of any comments before performing validation and storing in the database. People can use the existing key title to identify the key.

    A) The current feature does not change anything on how the keys are inserted, it just fetches what is in the db and shows it to the user in plain text. Just like: https://github.com/devaroop.keys or https://github.com/dosire.keys

    By Administrator on 2014-01-30T06:05:56 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: tuminoid

    :thumbsup: for idea, but needs a rebase, plus tests at least.

    By Administrator on 2014-01-30T06:20:18 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop I agree with @tuminoid it needs some tests.

    By Administrator on 2014-01-30T15:00:36 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    Tests are now added.

    By Administrator on 2014-02-06T09:17:47 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dosire

    @devaroop Thanks!

    @randx Can you review this, looks clean to me.

    By Administrator on 2014-02-06T09:27:58 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: jvanbaarsen

    @devaroop Can you change the CHANGELOG entry? Its added for 6.2 at the moment :smile: And can you maybe take a look at integration specs?

    By Administrator on 2014-02-06T10:02:50 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @jvanbaarsen : CHANGELOG entry modified, branch is now in sync with master branch for ease of merge. Thanks.

    By Administrator on 2014-02-06T14:24:59 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    CHANGELOG
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: jvanbaarsen

      This is from the rebase?

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    CHANGELOG
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: devaroop

      I think its a manual merge error, let me quickly remove it.

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    CHANGELOG
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: devaroop

      @jvanbaarsen : Done.

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    CHANGELOG
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: jvanbaarsen

      @devaroop thanks :smile: :heart: for this pr!

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/controllers/profiles/keys_controller.rb
    32 33 format.js { render nothing: true }
    33 34 end
    34 35 end
    36
    37 # Get all keys of a user(params[:username]) in a text format
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      Please add space between # and first word. Also start comment with capital letter

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/controllers/profiles/keys_controller.rb
    32 33 format.js { render nothing: true }
    33 34 end
    34 35 end
    36
    37 # Get all keys of a user(params[:username]) in a text format
    38 # Helpful for sysadmins to put in respective servers
    39 def get_keys
    40 if params[:username].present?
    41 begin
    42 user = User.find_by_username(params[:username])
    43 if user.present?
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      if else instead of ? and :

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/models/user.rb
    435 435 def short_website_url
    436 436 website_url.gsub(/https?:\/\//, '')
    437 437 end
    438
    439 def all_ssh_keys
    440 keys.map(&:key)
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      please follow https://github.com/bbatsov/ruby-style-guide

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/models/user.rb
    435 435 def short_website_url
    436 436 website_url.gsub(/https?:\/\//, '')
    437 437 end
    438
    439 def all_ssh_keys
    440 keys.map(&:key)
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      also dont use name variables like x

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    config/routes.rb
    12 12 API::API.logger Rails.logger
    13 13 mount API::API => '/api'
    14 14
    15 # Get all keys of user
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      same about comment

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/controllers/profiles/keys_controller.rb
    32 33 format.js { render nothing: true }
    33 34 end
    34 35 end
    36
    37 # Get all keys of a user(params[:username]) in a text format
    38 # Helpful for sysadmins to put in respective servers
    39 def get_keys
    40 if params[:username].present?
    41 begin
    42 user = User.find_by_username(params[:username])
    43 if user.present?
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      also use ruby 1.9 hash style please

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    app/controllers/profiles/keys_controller.rb
    32 33 format.js { render nothing: true }
    33 34 end
    34 35 end
    36
    37 # Get all keys of a user(params[:username]) in a text format
    38 # Helpful for sysadmins to put in respective servers
    39 def get_keys
    40 if params[:username].present?
    41 begin
    42 user = User.find_by_username(params[:username])
    43 if user.present?
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      also why you use join('\n') twice?

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dzaporozhets

    @devaroop please make changes according to review so we can merge this one

    By Administrator on 2014-02-11T11:18:25 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @randx the code is re factored as suggested. Kindly do the needful.

    By Administrator on 2014-02-11T13:41:21 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    spec/models/user_spec.rb
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      remove this newline please

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    spec/models/user_spec.rb
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      remove this spaces please

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 4b9c28bc 11 years ago
    spec/models/user_spec.rb
    Unable to load the diff
    • Administrator
      Administrator @root · 11 years ago
      Owner

      Created by: dzaporozhets

      remove this newline please

      By Administrator on 2014-02-11T15:42:44 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dzaporozhets

    @devaroop thank you! Please remove few newlines and we are ready for merge :)

    By Administrator on 2014-02-11T15:05:29 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: devaroop

    @randx done. Is neat now :)

    By Administrator on 2014-02-11T15:44:14 (imported from GitLab project)

  • Administrator
    Administrator @root · 11 years ago
    Owner

    Created by: dosire

    Awesome work @devaroop and @randx !

    By Administrator on 2014-02-11T19:51:58 (imported from GitLab project)

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
Assign to
0 Reviewers
Request review from
Milestone
No milestone
None
None
Time tracking
0
Labels
None
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
participants
Reference:
Source branch: github/fork/devaroop/retrieve_ssh_keys_by_ssh

    0 pending comments