Client Web Fragment Plugin Modules

SSH Request Handler Plugin Module

Introduction

As you probably know, Bitbucket Data Center supports serving SCM hosting requests (i.e. pushes and pulls) over both HTTP/S and SSH. What you may not know is that Bitbucket Data Center supports another simple SSH command - whoami. If you have SSH enabled on your server and have uploaded your public key, try the following from the command line:

1
2
$ ssh -p 7999 your-bitbucket-server.example.com whoami

(Replace 7999 with the port that your Bitbucket server uses)

You should get a simple response with your username:

1
2
tpettersen

Neat, huh? What's even cooler is the fact that these commands are pluggable. The whoami command is actually provided by a simple bundled plugin in Bitbucket Data Center. You can implement your own SSH command support using the SSH Request Handler plugin module.

See the javadoc for SshScmRequestHandler and SshScmRequest for more details on implementing support for a new SSH command.

Configuration

The root element for an SSH Request Handler plugin module is <ssh-request-handler/>. It allows the following attributes for configuration:

Attributes

Example

Here is a simple atlassian-plugin.xml with a single SSH Request Handler module:

1
2
<atlassian-plugin name="My SSH Command Handler" key="example.plugin.mysshcommand" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
    </plugin-info>

    <ssh-request-handler key="my-ssh-command" class="com.example.myplugin.MyCommandSshRequestHandler" />
</atlassian-plugin>

Rate this page: