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

Add install active directory install command #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adfoster-r7
Copy link

@adfoster-r7 adfoster-r7 commented Mar 17, 2023

Adds install active directory command script to vm-automation; which allows for testing Kerberos/AD environments


My testing steps were running this script locally against a windows 2016/2019 server box. Will be used by https://github.com/rapid7/metasploit-jenkins-jobs/pull/449

I then tested it with vmware-automation project by first building the metasploit-baseline-builder docker container:

cd metasploit-baseline-builder/docker
docker build -f Dockerfile -t metasploit-baseline-builder .

Creating an ESXi config in ~/helper_config.json:

{
  "HYPERVISOR_TYPE": "ESXI",
  "HYPERVISOR_HOST": "10.x.x.x",
  "HYPERVISOR_USERNAME": "....",
  "HYPERVISOR_PASSWORD": "....",
  "HYPERVISOR_LISTENING_PORT": 443
}

Running a docker container from the Jenkins user, mounting vmware-automation and the esxi config:

cd vmware-automation
docker run -it -u jenkins -v $(pwd):/r7-source/vm-automation -v $(realpath ~/helper_config.json):/r7-source/helper_config.json -w /r7-source metasploit-baseline-builder:latest /bin/bash -l

Inside the running docker instance I had to install pip:

pip install requests

Verifying the action is available (change the prefix):

$ cd /r7-source/vm-automation/samples
$ python ./samples/manageServices.py -k MYPREFIX_Win --actionFile /r7-source/vm-automation/samples/action_scripts/commands.json --listCommands /r7-source/helper_config.json
cryptography, and will be removed in the next release.
  from cryptography.hazmat.backends import default_backend
INSTALL_AVG
AUTOLOGIN_DISABLE
DEFENDER_SIGUPDATE
UAC_ENABLE
INSTALL_MALWAREBYTES
WSUS_DISABLE
DEFENDER_DISABLE
UAC_DISABLE
INSTALL_AVAST
AUTOLOGIN_ENABLE
SMB1_ENABLE
FIREWALL_DISABLE
SMB1_DISABLE
WSUS_ENABLE
INSTALL_ACTIVE_DIRECTORY_DOMAIN_SERVICES <------------------
FIREWALL_ENABLE
DEFENDER_ENABLE

Running the action with hard coded user/password values against the target machine (change the prefix):

cd /r7-source/vm-automation/samples
python /r7-source/vm-automation/samples/manageServices.py -k MYPREFIX_Win --actionFile /r7-source/vm-automation/samples/action_scripts/commands.json --action INSTALL_ACTIVE_DIRECTORY_DOMAIN_SERVICES --user vagrant --password vagrant /r7-source/helper_config.json

View the log files:

cat /r7-source/vm-automation/samples/logs/* 

Copy link
Contributor

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

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

This looks like a great add.

Sorry this got delayed, more testing is in progress. Posting a couple initial thoughts.

samples/action_scripts/install_active_directory_forest.ps1 Outdated Show resolved Hide resolved
samples/action_scripts/commands.json Outdated Show resolved Hide resolved
@adfoster-r7 adfoster-r7 force-pushed the add-install-active-directory-forest-command branch from b17af3a to 5a43e3b Compare May 2, 2023 23:45
@adfoster-r7 adfoster-r7 force-pushed the add-install-active-directory-forest-command branch from 5a43e3b to 3bba31d Compare May 4, 2023 09:17
Copy link
Contributor

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

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

Testing looks good, just the one question here about using a hardcoded configuration password.


# Configuration
$domain = "demo.local"
$plaintextPassword = "vagrant"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this get the VM password from the launch config for manageServices.py? I don't mind a hardcode value however I that is not super friendly to the those that may want to have at least some security in the testing env.

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.

2 participants