You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "lppedd (via GitHub)" <gi...@apache.org> on 2023/03/10 23:37:20 UTC

[GitHub] [maven-scm-publish-plugin] lppedd opened a new pull request, #18: Support using an SSH private key as auth mechanism

lppedd opened a new pull request, #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18

   This enhancements brings support for using an SSH key (+ optional passphrase) as an authentication mechanism.  
   Extremely useful in case the work is done over GitHub Enterprise instances.
   
   Configuration example:
   
   ```xml
   <distributionManagement>
     <site>
       <id>my-server-id</id>
       <url>scm:jgit:git@my-domain:my-org/my-repo.git</url>
     </site>
   </distributionManagement>
   ...
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-scm-publish-plugin</artifactId>
     <version>3.2.0-SNAPSHOT</version>
     <configuration>
       <serverId>my-server-id</serverId>
       <scmBranch>gh-pages</scmBranch>
     </configuration>
   </plugin>
   ```
   
   And in `settings.xml`:
   
   ```xml
   <servers>
     <server>
       <id>my-server-id</id>
       <privateKey>${user.home}/.ssh/id_rsa</privateKey>
       <passphrase>your-optional-passphrase</passphrase>
     </server>
   </servers>
   ```
   
   Note the `jgit` provider used in the `distributionManagement.site.url` element. This is needed as `jgit` is the only provider that currently supports using a private key.
   
   The change is so small I don't even think it's worth creating a Jira issue tbh.
   
   ---
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MSCMPUBLISH) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [X] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MSCMPUBLISH-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MSCMPUBLISH-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify -Prun-its` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [X] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] bmarwell commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "bmarwell (via GitHub)" <gi...@apache.org>.
bmarwell commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1493109271

   @lppedd I second what @elharo says. Do you have a JIRA account or should I just create an issue for you?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] bmarwell commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "bmarwell (via GitHub)" <gi...@apache.org>.
bmarwell commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1464923107

   The correct place would be the user's settings.xml file. But I'm not sure of there's a place for it yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1464923685

   > The correct place would be the user's settings.xml file
   
   In terms of security it's definitely better, I agree.  
   But can't we say the same about `username` and `password`, which are parameters on this mojo already?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] bmarwell commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "bmarwell (via GitHub)" <gi...@apache.org>.
bmarwell commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1464875968

   Thanks! Do you think you could add a junit test? There are sshd mock servers you could use.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] elharo commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1484289983

   This needs a JIRA issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support using an SSH private key as auth mechanism [maven-scm-publish-plugin]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1925258517

   This would implicitly be solved via #29.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1464920727

   Also on another note: do you think I should add the `privateKey` and `passphrase` parameters to the mojo?
   
   They might be useful in case a user wants to override them at build time with a property.  
   I might need them too now that I'm thinking about it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1465186433

   Minimal usage example from a Jenkins declarative pipeline, where `your-app-jenkins` are _GitHub App_ credentials.
   
   ```groovy
   stage('Publish site') {
     environment {
       CREDS = credentials('your-app-jenkins')
     }
   
     steps {
       bat 'mvnw clean site site:stage scm-publish:publish-scm' +
               ' -DauthUser=%CREDS_USR%' +
               ' -DauthToken=%CREDS_PSW%'
     }
   }
   ```
   And
   
   ```xml
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-scm-publish-plugin</artifactId>
     <version>${scmPublishVersion}</version>
     <dependencies>
       <dependency>
         <groupId>org.apache.maven.scm</groupId>
         <artifactId>maven-scm-provider-jgit</artifactId>
         <version>${scmProviderJGitVersion}</version>
       </dependency>
     </dependencies>
     <configuration>
       <username>${authUser}</username>
       <password>${authToken}</password>
     </configuration>
   </plugin>
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1484252005

   @bmarwell hey there! Is there a chance we can merge this PR soon? Docs improvements and SSH key support would be nice to have for colleagues too.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1464884121

   Hey there @bmarwell!
   I've noticed all the currently present integration tests revolve around SVN.
   
   Not sure how to mock a git server with SSH support. Probably JGit offers something useful.
   
   Found this by googling quickly.
   https://archive.eclipse.org/jgit/site/5.6.0.201912101111-r/apidocs/org/eclipse/jgit/transport/ssh/SshTestHarness.html
   
   My concern here is: we covered pretty much all the `server` element auth fields, and we're handling them through the platform, which is tested for us already. Should we really add a test case?
   
   Up to you. I can try out the JGit test harness in the meantime.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-scm-publish-plugin] lppedd commented on pull request #18: Support using an SSH private key as auth mechanism

Posted by "lppedd (via GitHub)" <gi...@apache.org>.
lppedd commented on PR #18:
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18#issuecomment-1465161467

   I've been experimenting with auth tokens with the `git` and `jgit` SCM providers, as another alternative auth mechanism.
   I've improved the parameters' documentation to explain how the two can be used for this case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support using an SSH private key as auth mechanism [maven-scm-publish-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed pull request #18: Support using an SSH private key as auth mechanism
URL: https://github.com/apache/maven-scm-publish-plugin/pull/18


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org