Resetting Guacamole OTP for an user

I’ve implemented Guacamole for remote access, for the time being it uses the builtin OTP module. In the future I might migrate to LemonLDAP or Keycloak for 2FA, for the time being the solution if good enough and works with zero configuration after module installation ūüôā

Chapter 9. TOTP two-factor authentication

My particular setup is pulling users from FreeIPA through LDAP, but also uses MySQL as a supplement to handle the connections definitions and things like the OTP plugin information.

From time to time, an user would need to re-enroll a device because the original device was stolen or reset. Did a quick search, but couldn’t find a clean/easy option to reset it from the GUI in version 1.3.0.


As a quick fix (don’t want to have to rethink this each time a user has this requirement), I created a simple script to do the job for me.

All you need to do is setup your mysql DB connection in ~/.my.cnf and get the script from here:

https://github.com/ciroiriarte/sysadmin-scripts/blob/main/guacamole-reset-user-otp.sh

In most Linux machines, you can copy it to ~/bin/.

mkdir ~/bin
wget https://raw.githubusercontent.com/ciroiriarte/sysadmin-scripts/main/guacamole-reset-user-otp.sh
chmod +x guacamole-reset-user-otp.sh

If you run the script with no options, it will show you the syntax

me@workstation:>; guacamole-reset-user-otp.sh
Usage: /home/me/bin/guacamole-reset-user-otp.sh <username>
      /home/me/bin/guacamole-reset-user-otp.sh ciro.iriarte

And the execution should be as simple as:

guacamole-reset-user-otp.sh the.user

Apstra Web UI & FreeIPA integration

First Attempt (the correct one?)

Looking to provide multiple users sane access to Apstra 4.0.0, I found it supports LDAP based directories in the form of “Providers” in the “External Systems” section.

https://www.juniper.net/documentation/us/en/software/apstra/apstra4.0.0/providers.html#creating-ldap-provider

I happily adapted the default configuration to match the FreeIPA schema (tested with Freeipa 4.6.8), I could authenticate users succesfully but authorization failed, not matter what parameter I change to modify the group lookup function.

ParameterValue
Groups Search DNcn=groups,cn=accounts,dc=ipa,dc=mydomain,dc=com
Users Search DNcn=users,cn=accounts,dc=ipa,dc=mydomain,dc=com
Bind DNuid=sys.apstra,cn=users,cn=accounts,dc=ipa,dc=mydomain,dc=com
Passwordyou.wish
EncryptionSTARTTLS
Tested “Provider-specific Parameters” – Not working

ParameterValueApstra default?
Username Attribute NameuidYes
User Search Attribute NameuidYes
User First Name Attribute NamegivenNameYes
User Last Name Attribute NamesnYes
User Email Attribute NamemailYes
User Object Class Attribute NameinetOrgPerson*Yes
User Member Attribute NamememberOfYes
Group Name Attribute NamecnYes
Group DN Attribute NameentryDNYes
Group Search Attribute NamecnYes
Group Member Attribute NameentryDNYes
Group Member Mapping Attribute NamememberNo
Group Object Class Attribute Namegroupofnames*No
Tested “Advanced configuration” – Not working

Take into account that “Group Object Class Attribute Name” can take “groupofnames” or “ipausergroup” for this usecase.

Looking at the logs, the attribute for user membership lookup seems to be hardcoded to UID, hence the lookup is:

SRCH base="cn=groups,cn=accounts,dc=ipa,dc=mydomain,dc=com" scope=2 filter="(member=john.doe)" attrs="cn"

When it should be like:

SRCH base="cn=groups,cn=accounts,dc=ipa,dc=mydomain,dc=com" scope=2 filter="(member=uid=john.doe,cn=users,cn=accounts,dc=ipa,dc=mydomain,dc=com)" attrs="cn"

The workaround

The correct way to fix this would be to accept a parameter for the user attribute we should use for group membership lookup (DN instead of UID in this case).

As a workaround, I found the “compat” view from FreeIPA could be used to provide another view that’s more inline to what openLDAP would present for example.

The culprit for me is that the compat view:

  • is generated on the fly, it’s not indexed: probably won’t scale if you’re dealing with thousands of users.
  • requires the group to be of class “posixGroup”: because the Apstra groups are expected to be an application only group, it will clutter the view of Unix/Linux sysadmins with irrelevant groups.

In the hope of waiting for a proper fix from Juniper (now owners of Apstra), and given this is a limited environment (in terms of scalability), the workaround seems to be good enough.

As only the group lookup fails, we’ll use the compat view only for the groups.

ParameterValue
Groups Search DNcn=groups,cn=compat,dc=ipa,dc=mydomain,dc=com
Users Search DNcn=users,cn=accounts,dc=ipa,dc=mydomain,dc=com
Bind DNuid=sys.apstra,cn=users,cn=accounts,dc=ipa,dc=mydomain,dc=com
Passwordyou.wish
EncryptionSTARTTLS
Tested “Provider-specific Parameters” – Working workaround

ParameterValueApstra default?
Username Attribute NameuidYes
User Search Attribute NameuidYes
User First Name Attribute NamegivenNameYes
User Last Name Attribute NamesnYes
User Email Attribute NamemailYes
User Object Class Attribute NameinetOrgPersonYes
User Member Attribute NamememberOfYes
Group Name Attribute NamecnYes
Group DN Attribute NameentryDNYes
Group Search Attribute NamecnYes
Group Member Attribute NameentryDNYes
Group Member Mapping Attribute NamememberUidYes
Group Object Class Attribute NameposixGroupYes
Tested “Advanced configuration” – Working workaround

Don’t forget to setup the “Provider Role Mapping” section to get authorization working.

AOS RoleProvide Group
administratorgapstra-administrator
device_ztpgapstra-device_ztp
usergapstra-user
viewergapstra-viewer
Role Mapping setup

Side note

Even though I can get proper authentication & authorization, the “role” user attribute in the profile just shows a gray box for the LDAP backed user. Might be a presentation bug, otherwise the authorization works as expected

Profile for LDAP backed user

Profile for internal admin user

Relocating v2

Hello world v2.!. This is a new attempt to jump start the blog. Unluckily some posts from the previous relocation were lost.

I’m taking a break from my management role, and going hands on once more (good for the soul, from time to time :).

Hope to post in the short term about some work I’ve been doing with VMware products & technology in general (SDN+IaaS+Automation).

Stay tunned!

Automatizando Snapshots en Symmetrix VMAX con Powershell

Hace poco me tocó automatizar el backup de una aplicación no soportada por NetBackup, puntualmente MS SQL Server Analysis Services. La idea es básicamente realizar un backup en frío sin dejar a la aplicacion fuera de servicio por mucho tiempo.

A modo ilustrativo, el equipo productivo tiene presentada una Meta de un  VMax y el snapshot de esta Meta debe ser montado en un equipo secundario para copiar los datos a cinta. El script corre en el equipo secundario donde necesitamos PSExec y Solutions Enabler debe estar instalado en ambos equipos. Además se asume que el pool para snapshots y el grupo necesario ya están preparados.

Continue reading “Automatizando Snapshots en Symmetrix VMAX con Powershell”

Won a Netbook!, thanks Novell!!

Well, I’ve been a SuSE user for quit some time, since 7.3 days and some months ago (around January) I was accepted as a SuSE Linux Enterprise 11 (SLES11) betatester. I was happy to test the bleeding edge enterprise distribution and happy to help releasing it.

In the mail list they stated that some Netbooks would be given away to some testers as a reward (i’m not sure how many units where available and can’t remember what the rules were…). I didn’t pay much attention as I NEVER win those kind of things, EVER.

Now, 5 months after SLES11 was released, I got an email from the people at SUSE stating I won one of them!!!!, I can’t wait to receive the package, it’s like Christmas!!!!! (with a gift I will actually like).

Linux support/troubleshooting

Dealing with Novell Linux support found about their supportconfig script, it’s really useful while troubleshooting systems remotely (or on-site :D).

It’s basically a bash script that collects data about a linux system (it was made for SLES, but should work with any linux). The result is a nice tarball that you can take with you to analyze the system offsite.

The software: http://www.novell.com/communities/node/2332/supportconfig-linux
Basic health check guide: http://www.novell.com/communities/node/4097/basic-server-health-check-supportconfig