Drobo

Drobo5N and Git

My objective is to use a Drobo5N as a Git server and repository site. Code development will occur on other computers. I’ve installed Git (version 2.6.3) and Dropbear (v2015.67) on a Drobo5N. Otherwise, my installation is generally the same as described here. However, this installation does not yet fully support Git operations. Perhaps more experienced users can provide a sanity check on my approach.

Here are some details. The Drobo5N ~/.ssh directory contains an appropriately configured authorized_keys file. It also contains an environment file with an appropriate expression of required paths:

   PATH=/bin:/usr/bin:/sbin:/usr/sbin:/mnt/DroboFS/Shares/DroboApps/git/bin

On the client side, the [remote] section of the .git/config file includes appropriately matching entries:

    uploadpack = /mnt/DroboFS/Shares/DroboApps/git/bin/git-upload-pack
    receivepack = /mnt/DroboFS/Shares/DroboApps/git/bin/git-receive-pack

However, the Dropbear installation did not create an /etc/ssh directory nor an sshd_config file. Hence, I am unable to update the default binding of the shell variable PermitUserEnvironment from “no” to “yes” on the Drobo5N. Perhaps Dropbear does not install all the capability needed for an SSH server daemon.

In this configuration, I can interactively login via SSH to the Drobo5N with appropriate binding of PATH and other variables (as in [1]). Nevertheless, an interactive SSH session fails to bind the appropriate path (as in [2]). Note that Drobo5N is identified in the client’s ~/.ssh/known_hosts file.

[1] user@VM02F7 MINGW32 ~/Projects/my_git_project (master)
$ ssh Drobo5N
Enter passphrase for key ‘/c/Users/user/.ssh/id_rsa’:
Drobo5N:~ $ echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin:/mnt/DroboFS/Shares/DroboApps/git/bin
Drobo5N:~ $ exit
Connection to drobo5n closed.

[2] user@VM02F7 MINGW32 ~/Projects/my_git_project (master)
$ ssh user@Drobo5N echo $PATH
Enter passphrase for key ‘/c/Users/user/.ssh/id_rsa’:
/usr/bin:/bin

With the difference between [1] and [2] in mind, I ran [2] in debug mode to verify that it did indeed invoke an interactive session. With that confirmed, I began to wonder about the server-side shell and its functionality. The default Drobo5N shell is sh, which is encapsulated in the BusyBox “multi-call binary.” Since Git runs inside a bash shell, maybe Busybox sh is not sufficient to support all the capability needed for SSH services.

Are there any experienced experts who can comment on the interoperability of Git, Dropbear (especially its encapsulated SSH services), and the Drobo5N Busybox (especially its sh program facet)?

This is an interesting post. To be honest with you I’m not sure whether dropbear and sh are not enough, but I can tell that using openssh and bash is.

This is the remote URL I’m using on some of my git repositories:

ricardo@drobo5n:/mnt/DroboFS/Shares/Public/path/to/git/repository

I.e., a plain full path spec on a standard SSH URL.

The caveat here is that in fact, I do not use dropbear but I use openssh instead, and I do have bash installed, though my Drobo account default shell is sh.

If I search for the string “bash” in git I get no matches.

And if I run the non-interactive version of the echo $PATH command I get this:

$ ssh ricardo@drobo5n echo \$PATH
/usr/bin:/bin:/usr/sbin:/sbin:/mnt/DroboFS/Shares/DroboApps/openssh/bin

As you can see, even though that is not the same as your non-interactive version, mine does not have git on PATH either.

As far as I can tell, there should be no reason why git wouldn’t work with dropbear and sh. It probably wouldn’t hurt to try and install openssh (remember to uninstall dropbear first) and bash to see if it helps.

P.S.: Isn’t the difference you are seeing between interactive and non-interactive due to the way profile files are sourced on login? Something along these lines: http://askubuntu.com/questions/247738/why-is-etc-profile-not-invoked-for-non-login-shells

So it makes sense to uninstall DropBear and install OpenSSH rather than try to discover why DropBear does not suffice to support Git operations. I accomplished these actions this morning, and I am now using OpenSSH for Drobo5N logins and SSH command connections.

Even so, I cannot find sshd_config on the Drobo5N. For anyone who has installed OpenSSH on a Drobo5N: where is your sshd_config file located? (This file holds configuration options for the SSH daemon.)

Some net posters observe that the default OpenSSH installation does not include SSH server components. These posters suggest another installation process specifically for the server. This could explain why sshd_config remains elusive. At this time, I am skeptical.

Does your Drobo5N have OpenSSH? If so, what is the location of sshd_config?

I guess so, but I’m not convinced that OpenSSH is really necessary. In any case, I’m glad that OpenSSH is working for you.

You need to mount the DroboApps share. Navigate to your Drobo using Windows explorer or Finder, and then browse the \DroboApps share. You’ll find in there one folder named after each DroboApp. The folder you are looking for is \DroboApps\openssh\etc\sshd_config. Once you finished editing, restart openssh using Drobo Dashboard. Please make sure to use Unix newlines! That means no notepad!

If you are already logged in over SSH, then the file is located at /mnt/DroboFS/Shares/DroboApps/openssh/etc/sshd_config. After editing, restart openssh by calling:

/mnt/DroboFS/Shares/DroboApps/openssh/service.sh restart

Full disclaimer: I’m the guy who created the OpenSSH DroboApp. :slight_smile:

I can guarantee to you that the server components are included. As a rule of thumb, a lot of the information you’ll find on the web for any given app will not apply to the DroboApp version, in particular information related to packaging, install, and file locations. Configuration docs should still be relevant, of course.

Fortunately file locations generally follow a simple pattern: if a file was supposed to be in /etc, then you’ll find it in /mnt/DroboFS/Shares/DroboApps//etc. If the original location was /sbin, then you’ll find it in /mnt/DroboFS/Shares/DroboApps//sbin, and so on.

Thank you for the expert guidance. With Bash and OpenSSH installed, the configuration change resulted in the exact behavior you indicated previously:

$ ssh ricardo@drobo5n echo \$PATH /usr/bin:/bin:/usr/sbin:/sbin:/mnt/DroboFS/Shares/DroboApps/openssh/bin Note that /mnt/DroboFS/Shares/DroboApps/git/bin is no longer present in this PATH variable.

Then I updated sshd_config to enable Git clients to use SSH connectivity with commands that consult user environment variables. (I updated the binding of PermitUserEnvironment to “yes.”) Next, I restarted the SSH service. (As you know, the sudo DroboApp must be installed to accomplish these actions.) Once SSH restarts, the apparent result is that non-interactive non-login connections from Git clients using SSH commands now consult .profile in the Git user account on the Drobo5N for shell variable bindings. This is as desired.

The new configuration now enables non-interactive non-login SSH clients to issue commands with access to environment variables during the connection to the server:user@VM02F7 MINGW32 ~/Projects (master) $ ssh user@Drobo5N 'which git-upload-pack' Enter passphrase for key '/c/Users/users/.ssh/id_rsa': /mnt/DroboFS/Shares/DroboApps/git/bin/git-upload-pack This is also as desired. (You can define Git paths in .ssh/environment of the Git user on the Drobo5N.) Without this capability, Git clients using SSH protocols cannot perform as desired.

Here’s the payoff, as a new Git client clones a git repository from the Drobo5N:user@VMFC66 MINGW64 ~/Projects (master) $ git clone -n user@Drobo5N:~/Git/GFSM.git Cloning into 'GFSM'... Enter passphrase for key '/c/Users/user/.ssh/id_rsa': remote: Counting objects: 5, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 0), reused 0 (delta 0) Receiving objects: 100% (5/5), done.

Thanks to Ricardo for his help, and I hope that our exchange of information helps others to configure a Drobo5N as a Git server and repository site.

nice one ricardo :slight_smile:

hi gary, can i just check when you mentioned that code development will take place on other computers, and when you mentioned about cloning a project… it might be worth bearing in mind how large your repository/branch is, and how much free space is on the drobo. (im not a git expert but one project i help out with has a repository of about almost 2GB). maybe you have already imposed a limit on how much space the git program can use, but just wanted to mention about being careful in case something or someone starts cloning multiple projects, and it overfills your storage.

I ran into this issue when trying to set up git to use with Xcode on my Mac. After installing Dropbear and Git SCM, I created the same configurations you show in your post. Configuring the “uploadpack” and “receivepack” variables in my git config file for the project, I was able to successfully “push” the project to the Drobo git using the command line, however; using the “push” operation from within the Xcode app produced a similar error: “sh: git-receive-pack not found”.

Clearly, the git interfaces within Xcode were not recognizing the “receivepack” variable and were not appending it to the “push” command with the --receive-pack option.

So I tried adding the path to the git executables to the PATH environment variable using the .profile file. This worked for interactive SSH sessions and I could see the path was working by using the “type -p git-receive-pack”. But the error from within Xcode remained.

entering
ssh myUser@192.168.1.60 "echo \$PATH"
revealed that the path for the non-interactive SSH connection was unchanged and only contained
/usr/bin:/bin

I did some searching and it seems that Dropbear does not allow modification of the PATH variable. My only option it seemed was to add the git executables to one of the existing paths via symbolic links. So I navigated into /usr/bin and created symbolic links to the executables:

sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git git
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git-cvsserver git-cvsserver
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/gitk gitk
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git-receive-pack git-receive-pack
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git-shell git-shell
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git-upload-archive git-upload-archive
sudo ln -s /mnt/DroboFS/Shares/DroboApps/git/bin/git-upload-pack git-upload-pack

I’m not sure if all of them are needed there, but it did seem to fix my issue of using git within Xcode.