Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSM: nsm_server_user-add should require usernames to be alphanumeric #1627

Closed
dougburks opened this issue Aug 27, 2019 · 3 comments

Comments

@dougburks
Copy link
Contributor

commented Aug 27, 2019

Use logic similar to what's already in sosetup:

        while [ $USERNAME_CONFIRMED = "no" ]; do
                TEXT="Let's create our first user account.\n\nThis account will be used when logging into Kibana, Squert, and Sguil.\n\nWhat would you like the username to be?\n\nPlease use alphanumeric characters only.\n\nYou can create other usernames later using so-user-add."
                SGUIL_CLIENT_USERNAME=$(promptinput "$TEXT")
                [ $? = 1 ] && exit 1
                COMPRESSED="$(echo $SGUIL_CLIENT_USERNAME | sed -e 's/[^[:alnum:]]//g')"
                if [ "$COMPRESSED" != "$SGUIL_CLIENT_USERNAME" ] || [ x$SGUIL_CLIENT_USERNAME = "x" ] ; then
                        prompterror "Invalid username!\n\nPlease use alphanumeric characters only."
                else
                        USERNAME_CONFIRMED="yes"
                        [ $DEBUG -eq 1 ] && echo "DEBUG: Sguil username set."
                fi
        done

@dougburks dougburks added this to To do in 16.04.6.3 via automation Aug 29, 2019

dougburks added a commit to Security-Onion-Solutions/securityonion-nsmnow-admin-scripts that referenced this issue Sep 6, 2019

@dougburks dougburks moved this from To do to In progress in 16.04.6.3 Sep 6, 2019

@dougburks dougburks moved this from In progress to In Testing in 16.04.6.3 Sep 6, 2019

@dougburks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 6, 2019

securityonion-nsmnow-admin-scripts - 20120724-0ubuntu0securityonion205 is now available at ppa:securityonion/test.

Please test and verify as follows:

  • Install the latest ISO image.

  • Run Setup and choose Evaluation Mode.

  • Add the test PPA:

sudo add-apt-repository -y ppa:securityonion/test
  • Install updates:
sudo soup
  • Test nsm_server_user-add:
sudo nsm_server_user-add
  • Entering an empty username should result in an error.

  • Entering a non-alphanumeric username should result in an error.

  • Entering an alphanumeric username should allow you to create a user.

  • so-user-add should behave the same way since it just calls nsm_server_user-add

  • Verify no regressions.

  • Anything else we missed?

Thanks in advance for your time and effort!

@weslambert

This comment has been minimized.

Copy link
Collaborator

commented Sep 9, 2019

Looks good from my testing! 👍

@dougburks dougburks self-assigned this Sep 9, 2019

@dougburks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2019

@dougburks dougburks closed this Sep 9, 2019

16.04.6.3 automation moved this from In Testing to Done Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.