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

Fix password input in deploy new agent section #5098

Merged

Conversation

chantal-kelm
Copy link
Member

@chantal-kelm chantal-kelm commented Jan 10, 2023

Description

The following use cases have been fixed:

When a user enables authentication and sets a default password

When a user enables authentication and enters a password at login

Issues Resolved

#5093

Evidence

When a user enables authentication and sets a default password:

image (7)

image (8)

When a user enables authentication and enters a password at login:

image (5)

image (8)

image (9)

Fixed the 'textToCopy' error displayed in the console:

image

Test

For the first case:

add these lines to the imposter's wazuh-config.yml file:

- method: GET
   path: /agents/000/config/auth/auth
   response:
     statusCode: 200
     staticFile: ossec/ossec.json

Create a ossec folder with a ossec.json file where you are going to put these lines of code:

{
    "data": {
      "authd.pass":"hola",
      "auth": {
        "port": 1515,
        "disabled": "no",
        "remote_enrollment": "yes",
        "ipv6": "no",
        "use_source_ip": "no",
        "purge": "yes",
        "use_password": "yes",
        "ssl_verify_host": "no",
        "ssl_auto_negotiate": "no",
        "ciphers": "HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH",
        "ssl_manager_cert": "/var/ossec/etc/sslmanager.cert",
        "ssl_manager_key": "/var/ossec/etc/sslmanager.key",
        "key_request": {
          "enabled": "no"
        },
        "force": {
          "enabled": "yes",
          "key_mismatch": "yes",
          "disconnected_time": {
            "enabled": "yes",
            "value": 3600
          },
          "after_registration_time": 3600
        }
      }
    },
    "error": 0
  }

For the second case:

  • Remove this line from the ossec.json file: "authd.pass": "hola",

*Go to the deploy new agent section.

First case:

  • Make the configuration in the imposter mentioned for case 1.
  • Check that the 'Wazuh password' input does not appear in the deploy new agent section.
  • Control that depending on whether the switch is activated or not the hidden password is shown with **** or the previously defined password is shown.
  • Try to choose HP, Solaris or Alpine, check that the variable WAZUH_REGISTRATION_PASSWORD='hello' does not appear in the install command and that the 'show password' switch does not appear either.

image

Second case:

  • Perform the configuration in the impostor mentioned for case 2.
  • Check that the 'Wazuh password' entry appears in the deploy new agent section and that you can enter a password without having selected an os yet.
  • Check that depending on whether the switch is activated or not the hidden password is shown with **** or the password you typed in is shown.
  • Choose some operating system other than hp, alpine or solaris put a password, check that the hide password switch works fine.
  • Choose some operating system other than HP, Alpine or Solaris set a password, check that the password hiding switch works fine, now choose HP, Solaris or Alpine check that the ui is not broken.
  • Try choosing hp, solaris or alpine, the password input and the switch should not appear.

image

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@chantal-kelm chantal-kelm requested a review from a team as a code owner January 10, 2023 16:10
@chantal-kelm chantal-kelm self-assigned this Jan 10, 2023
Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test: ❌

With some of the operating systems works, but when I choose Solaris it throws an exception:

Screenshot from 2023-01-10 18-39-21
Screenshot from 2023-01-10 18-39-45

@Desvelao
Copy link
Member

Desvelao commented Jan 11, 2023

Test: x

With some of the operating systems works, but when I choose Solaris it throws an exception:

Screenshot from 2023-01-10 18-39-21 Screenshot from 2023-01-10 18-39-45

Good catch! I think the problem is related to the command used to deploy and Solaris agent doesn't use the password deployment variable and there is an error when trying to match the expected string in the command.

I think the problem could be happening for:

  • Solaris
  • HP-UX
  • Alpine

If this is the case, we must fix the function that obfuscates the password.

I will check it.

@Desvelao
Copy link
Member

Desvelao commented Jan 11, 2023

Test: x
With some of the operating systems works, but when I choose Solaris it throws an exception:
Screenshot from 2023-01-10 18-39-21 Screenshot from 2023-01-10 18-39-45

Good catch! I think the problem is related to the command used to deploy and Solaris agent doesn't use the password deployment variable and there is an error when trying to match the expected string in the command.

I think the problem could be happening for:

  • Solaris
  • HP-UX
  • Alpine

If this is the case, we must fix the function that obfuscates the password.

I will check it.

I confirm it. It breaks for Alpine, HP-UX and Solaris.

The logic to obfuscate the password must not be done for operating systems that don't support the WAZUH_REGISTRARTION_PASSWORD variable. We could fix the method that obfuscates the password or avoid this method is executed for these operating systems.

@chantal-kelm
Copy link
Member Author

Test: ❌

With some of the operating systems works, but when I choose Solaris it throws an exception:

Screenshot from 2023-01-10 18-39-21 Screenshot from 2023-01-10 18-39-45

Fixed Solaris, HP and Alpine password input

@chantal-kelm
Copy link
Member Author

Test: x
With some of the operating systems works, but when I choose Solaris it throws an exception:
Screenshot from 2023-01-10 18-39-21 Screenshot from 2023-01-10 18-39-45

Good catch! I think the problem is related to the command used to deploy and Solaris agent doesn't use the password deployment variable and there is an error when trying to match the expected string in the command.
I think the problem could be happening for:

  • Solaris
  • HP-UX
  • Alpine

If this is the case, we must fix the function that obfuscates the password.
I will check it.

I confirm it. It breaks for Alpine, HP-UX and Solaris.

The logic to obfuscate the password must not be done for operating systems that don't support the WAZUH_REGISTRARTION_PASSWORD variable. We could fix the method that obfuscates the password or avoid this method is executed for these operating systems.

Fixed Solaris, HP and Alpine password input

asteriscos
asteriscos previously approved these changes Jan 11, 2023
Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✔️
Test: ✔️

Without password

Peek 2023-01-11 18-52

With password

Peek 2023-01-11 18-37

@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 8.8% ( 3253 / 36962 )
Branches 4.49% ( 1291 / 28727 )
Functions 7.68% ( 703 / 9154 )
Lines 8.87% ( 3138 / 35392 )

Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test: ✔️

screencapture-localhost-5601-app-wazuh-2023-01-12-09_02_06

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:

Kibana 7.10

Legend:
⚫: none
🟢: passed
🔴: failed
🟡: warning
⚪: not applicable

Test Chrome Package
Check that the 'Wazuh password' input does not appear in the deploy new agent section. 🟢 Kibana 7.10
Control that depending on whether the switch is activated or not the hidden password is shown with **** or the previously defined password is shown. 🟢 Kibana 7.10
Try to choose HP, Solaris or Alpine, check that the variable WAZUH_REGISTRATION_PASSWORD='hello' does not appear in the install command and that the 'show password' switch does not appear either. 🟢 Kibana 7.10
Check that the 'Wazuh password' entry appears in the deploy new agent section and that you can enter a password without having selected an os yet. 🟢 Kibana 7.10
Check that depending on whether the switch is activated or not the hidden password is shown with **** or the password you typed in is shown 🟢 Kibana 7.10
Choose some operating system other than hp, alpine or solaris put a password, check that the hide password switch works fine 🟢 Kibana 7.10
Choose some operating system other than HP, Alpine or Solaris set a password, check that the password hiding switch works fine, now choose HP, Solaris or Alpine check that the ui is not broken. 🟢 Kibana 7.10
Try choosing hp, solaris or alpine, the password input and the switch should not appear. 🟢 Kibana 7.10

Details

🟢 Check that the 'Wazuh password' input does not appear in the deploy new agent section.

Chrome - 🟢

image
image

🟢 Control that depending on whether the switch is activated or not the hidden password is shown with **** or the previously defined password is shown.

Chrome - 🟢

image
image

🟢 Try to choose HP, Solaris or Alpine, check that the variable WAZUH_REGISTRATION_PASSWORD='hello' does not appear in the install command and that the 'show password' switch does not appear either.

Chrome - 🟢

image
image
image

🟢 Check that the 'Wazuh password' entry appears in the deploy new agent section and that you can enter a password without having selected an os yet.

Chrome - 🟢

image

🟢 Check that depending on whether the switch is activated or not the hidden password is shown with **** or the password you typed in is shown

Chrome - 🟢

image
image

🟢 Choose some operating system other than hp, alpine or solaris put a password, check that the hide password switch works fine

Chrome - 🟢

image
image

🟢 Choose some operating system other than HP, Alpine or Solaris set a password, check that the password hiding switch works fine, now choose HP, Solaris or Alpine check that the ui is not broken.

Chrome - 🟢

image
image
image
image

🟢 Try choosing hp, solaris or alpine, the password input and the switch should not appear.

Chrome - 🟢

image
image
image

@Desvelao Desvelao merged commit b3b0222 into 4.4-7.10 Jan 12, 2023
@Desvelao Desvelao deleted the 5093-fix-password-input-in-deploy-new-agent-section branch January 12, 2023 09:00
github-actions bot pushed a commit that referenced this pull request Jan 12, 2023
* register agent section: password

* changelog

* fixed solaris, hp and alpine password input and added some styles

* fixed the textToCopy error displayed in the console

(cherry picked from commit b3b0222)
github-actions bot pushed a commit that referenced this pull request Jan 12, 2023
* register agent section: password

* changelog

* fixed solaris, hp and alpine password input and added some styles

* fixed the textToCopy error displayed in the console

(cherry picked from commit b3b0222)
Desvelao pushed a commit that referenced this pull request Jan 12, 2023
…#5111)

Fix password input in deploy new agent section (#5098)

* register agent section: password

* changelog

* fixed solaris, hp and alpine password input and added some styles

* fixed the textToCopy error displayed in the console

(cherry picked from commit b3b0222)

Co-authored-by: Chantal Belén kelm <[email protected]>
Desvelao pushed a commit that referenced this pull request Jan 12, 2023
…5110)

Fix password input in deploy new agent section (#5098)

* register agent section: password

* changelog

* fixed solaris, hp and alpine password input and added some styles

* fixed the textToCopy error displayed in the console

(cherry picked from commit b3b0222)

Co-authored-by: Chantal Belén kelm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "Deploy a new agent" page breaks if password authentication is enabled
3 participants