Resources Blog Securing Repository Credentials with Nexus Pro User Tokens

Securing Repository Credentials with Nexus Pro User Tokens

Until yesterday I had a Maven Settings file in ~/.m2/settings.xml that contained following XML:


Silly, right? The only way to authenticate against Nexus was to drop my plaintext username and password in my Settings file, for anyone who gained access to my laptop to see. I've never been too happy with this approach, and even built-in support for encryption in Maven didn't seem like much of an improvement over a plaintext password. The Maven-specific approach to password encryption still has to decrypt the password on the client, and if someone is using password encryption in Maven Settings file all you need to do to intercept the password is fire up Wireshark and read what Maven sends over the wire. (Maven's built-in password encryption isn't security at all, it's security theater.)

Nexus Professional 2.1 takes a different approach, an approach that keeps the password encrypted in transit and which shifts the responsibility to the repository manager.

[iframe width="560" height="315" src="" frameborder="0" allowfullscreen/]
With Nexus Professional 2.1 we've taken one step further toward a more secure approach to distributing credentials - User Tokens. You can think of a User Token as you would an SSH key or sorts. When you configure your Maven Settings, you'll need to supply some credentials (preferably not your plaintext username and password). With Nexus Professional, all you need to do is:
  1. Login into Nexus with your user credentials.
  2. Open up your profile.
  3. Select User Token from the profile settings dropdown.
  4. Press Access User Token

At this point, Nexus Professional will ask you for your username and password again just to make certain that you are who you say you are, and it will present you with a User Token that looks like this:


But, wait, how is this more secure? First, an attacker could still grab your user token and deploy to Nexus, but the damage would be limited to deployment and download. User Tokens are more secure because they are limited, you won't use a User Token to login to the UI and make changes to Nexus, and, if your User Tokens happed to be compromised, you can reset them. Lastly, your plaintext password is never transferred over the wire.

What this change is doing is moving Nexus toward an authentication system on par with the security of a system that relies on public SSH keys (a system such as Github). This is just the first step toward making Nexus authentication more secure, and it's a big step. If you find this feature useful, please let us know, and we hopeyou enjoy Nexus Professional 2.1. Download it today.

Picture of Tim OBrien

Written by Tim OBrien

Tim is a Software Architect with experience in all aspects of software development from project inception to developing scaleable production architectures for large-scale systems during critical, high-risk events such as Black Friday. He has helped many organizations ranging from small startups to Fortune 100 companies take a more strategic approach to adopting and evaluating technology and managing the risks associated with change.