Ask HN: Developers, how do you keep SSH and web URLs organized at work?

88 points by nsxwolf ↗ HN
So I'm sure many of you have dozens of web application URLs across multiple development, QA, production environments and as many URLs for tools and SSH endpoints you use all the time.

My system for keeping all this organized is to sift through bash history and browser history and abortive attempts at keeping Excel spreadsheets or Evernote pages full of this stuff.

Does anyone have any pointers for tools they like to make this easier?

Thanks!

101 comments

[ 3.4 ms ] story [ 127 ms ] thread
Most of my ssh connections are aliased via my dotfiles. I use bookmarks in browser.
Keep it simple

SSH: ~/.ssh/known_hosts and ~/.ssh/config

Web URLs - Use bookmarks or write yourself a small local html file with a bit more organisation. Or use a text file with an editor that makes it easy to Cmd+Click a link.

Less simple, but great for teams, use a wiki page with the appropriate links.

For web application URLs and things like it (server names, IP addresses, things I need to keep track of), I keep it all in a vimwiki tech.md file in my ~/notes directory. I used to use org-mode, but it was overkill for me and after 20+ years of using vi, switching to emacs (even spacemacs) was a tough adjustment.

For SSH endpoints, I more or less have everything aliased in my ~/.ssh/config file. If it's just a server, I can just ssh hostname. If it's a host I'm doing port forwarding on, I'll have it aliased to ssh hostname-tunnel or ssh hostname-SOCKS5.

On windows, WinSCP has a nice internal folder structure for saving all your links. I tend to keep a txt file of all my urls though.
What I'd like to see, but haven't yet, is a way to teach a browser extension about my environments, what they are named and what their URL patterns are such that I can get a border color-indicator of "hey, you're in prod!" and have a quick switcher to view the same page I'm on now, but in a different environment (this page looks weird in test, was it already like that on prod, wonder if I can debug in my local dev) -- and export this configuration to share with newbs.
Firefox's container tabs can do the colour coding if you're environments are on different domains. What you describe would indeed be useful though.
Does a sub domain count as a different domain?
You could try Firefox tab containers, though I don't know if you can share them with others.
Might not be what your looking for, but what about something like stylebot to give your production sites a red border?
You could add the styles to your profile's userStyle or userChrome files.
For URLs i have a single html page that I use as a starting page for my “dev” browser, which I edit manually when I add a new environment/tool.

For ssh I just use bash history, but I don’t have a ton of environments

TextExpander which is more or less like alias
need one time ssh config for new host/user/key
For SSH, using your ssh config file[0] is probably the most idiomatic way to go about it. For web applications I tend to rely on using plain old bookmarks, using bookmark folders to keep related URLs together. It's a fairly simple system but it manages everything together where I'm most likely to use it.

[0] https://www.digitalocean.com/community/tutorials/how-to-conf...

+1. If you are somehow stuck on Windows, MobaXterm is quite nice for achieving a similar storage of SSH logins and password.
mRemoteNG is very good for many remote sessions.
+1 for mRemoteNG (although it uses Putty for SSH), but it supports a lot more: RDP, VNC, Telnet, raw sockets.
Second this, this is also my method.

Cygwin does a good job with the ssh config file on Windows, if anyone is looking for tool suggestions.

This wasn't in OPs question, but have to add that if possible, put your SSH keys in the servers known_hosts file and you can have secure passwordless login, which combined with the ssh config file on your machine is fantastic. I just do "ssh $SERVER" in cygwin, where $SERVER is my defined alias pointing to an IP, and that's it. Takes literally five seconds.

I'm like you, but use pinboard for urls
Yep. ~/.ssh/config for ssh stuff, ~/home.html for web links (that file is my browser home page, it also contains a few different forms for searches on various systems, such as google, DDG, our internal ticket system, etc).
If you have the potential for tens or more unique SSH hosts (particularly if they aren't conducive to wildcards), ASSH[0] is a rather handy utility. It allows you to break up your SSH config into multiple files and use inheritance and variables in your host configs.

[0] https://github.com/moul/advanced-ssh-config

What does this give you over the `include` directive?
Webpages - Bookmark folders organized by Application/System then Environment then functional use. Site specific info/creds in LastPass

Ssh - ssh config named as <system>_<environent>

rest APIs - postman collections by system

Hah, this is literally my exact setup too, right down to using LastPass and Postman.

Although, my work recently took away direct SSH access for all devs in all environments, we now have to SSH to a bastion host, then SSH to servers from there. Makes my ssh config less valuable.

You can use SSH agent forwarding, however that causes some holes to open up as well, so ymmv.
Don't do that. Do this instead (taken from my ~/.ssh/config):

  # Sample bastion host configuration without ForwardAgent
  # Host bastion
  #       User bastion_user
  #       Hostname 10.11.12.13
  #       IdentityFile ~/.ssh/id_bastion
  #
  # Host server
  #       User server_user
  #       Hostname 192.168.0.1
  #       IdentityFile ~/.ssh/id_server
  #       ProxyCommand ssh -q -W %h:%p bastion
SSH endpoints go into ~/.ssh/config
Keepass2: https://keepass.info/

You can configure custom url handlers so that it opens the terminal then ssh right in the server you clicked on.

With a firefox extension, it let you autofill credentials.

Simple one file to backup or sync. Always encrypted. Crossplateform. Free software. Robust. Proven. And a Fugly UI that looks corporate enough for you pointy hair boss.

The only thing missing is that I'm using a cmd otp generator for one time passwords, but it doesn't have keepass support yet.

But does it have RBAC, revocation, central auditing, corporate compliance approval, a corporate approved supplier, a support contract spanning 5 years at least?

Otherwise pointy hair boss will bitch.

I'm sure I can provide those for a price :)
I have a handwritten notebook, like a science logbook.
If your password manager supports it, make a secure note with all the URLs you use regularly. My work keep a big wiki of documentation, including frequently accessed servers, which seems to work really well - it also allows us to document each individual server.

When in doubt, write it down, preferably somewhere secure to prevent leaking anything if handling sensitive data. Excel spreadsheets work pretty well too, but formatting might get a bit distracting.

At a previous job we ran a lot of client-facing servers and kept most of the URLs in our server monitoring software. It wasn't great and there wasn't a lot of documentation, but frequently accessed servers were all in a central place (save for our test/Ansible servers).

(comment deleted)
We have a wiki, but I personally keep everything in an Org-mode file.
Once upon a time I used a sandbox (just a simple locally hosted web app) to manage my work URLs and web tools. Now, I just use bookmarks cause it is more simple. Also config files for SSH.
I keep URLs organized in groups each one in a separate text file. One URL per line plus bash style comments for lines beggining with hash. Unfortunately browsers don’t support file with URLs as a command line parameter (as e.g. wget) so I have custom shell script accepting the file and opening each URL in new tab.
We do something similar. I have a directory structure like:

    environments/
      development/
        readme.md
        services/
          service1/
            readme.md
          service2/
            readme.md
      preproduction/
        ...
      production/
        ...
And store that in a git repository and publish it. We're starting to look at documentation generation tools (like Sphinx and readthedocs) to help make a pretty website for endusers.
SSH:

Windows: mRemoteNG

Linux: Gnome connection manager

Mac: Iterm 2 profiles (any better options?)

I created aliases in .bashrc. For instance, instead of 'ssh -i [key] user@devenvurl' I aliased it to 'ssh-dev'
I believe this can also be done in your ssh config file which would confer the added benefit of having the alias available to scp and rsync.
Use SSH config for SSH.

I built a database on AWS DynamoDB + API Gateway which has the "url" information. Also many other things, like which newrelic accounts are used by each environment. This is intended to be used by automation, but humans can just curl | jq these.

That said, SSH access (by humans) should be very rare. If you have to SSH to a production system, ask yourself what is it that you are trying to accomplish, and would you still be doing that if you had another tool to accomplish the same operation?

Just append aliases to .bash_profile? E.g. alias connect-amazon-example="ssh -i ~/.ssh/amazon-example-key.pem ubuntu@123.123.123.123" Then just 'connect-amazon-example' at the terminal?
Is that best practice?

I've never really understood how you should keep SSH keys. I kept them all in a folder and set zsh to iterate through them all and run ssh-add on startup. Until I realised it can't cope after adding a certain amount, now I'm back to manually doing it.

     ~/.ssh/config
is really simple, I never needed anything else.

For URLs, I use bookmarks, that's it. You might actually need more, or you might think you might need more :D but I don't think so.

Also different URL collections have different places, for example I collected all our developer documentation URLs in a single wiki (Confluence) page with a permalink and put it under an easy-to-remember internal domain.

I do 2 things:

1) As others have already written, I use ssh config to organize the urls and have simpler host names.

2) I use 2/3 letter codes as aliases which ssh into the specific host.

For ex- Environment - tool

sw = staging webserver pw = production webserver pj = production jenkins.

This allows me to open a new terminal window and type 2/3 characters to ssh into a box.

For my ssh environments, I use iTerm2 profiles with keyboard shortcuts to launch. However, I only have about 5 servers that I need to ssh to.

I find chrome bookmarks sufficient for my website bookmarks. They sync across computers and can be organized in folders.