
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Copy down production resources to your new Vagrant VM.
Use vagrant's built-in plugin system:
vagrant plugin install vagrant-cloner
You will need to add a config.vm.provision :cloner
section to your config in
order for Cloner to work. This should come after your other provisioners; if
Cloner runs before Chef or Puppet, for example, it's quite conceivable there
would be no database to restore to!
Each cloner has its own section inside the configuration, and this is the recommended way to set them:
Vagrant::Config.run do |config|
config.vm.provision :chef_solo do |chef|
# ...
end
config.vm.provision :cloner do |cfg|
cfg.cloner.mysql.tap do |c|
# Set options here.
c.enabled = true
c.run_order = 10
# ...
end
end
end
The following keys are valid:
remote_host
using the remote_user
and remote_password
settings. Elsewise, will SSH into the remote host, export the database, download it locally, upload it to the VM, and install it that way.If you have some concern about storing passwords in this file (i.e. your Vagrantfile is under version control), remember that the Vagrantfile is fully executed, so you can simply require a file from elsewhere or read values in.
mysql
- Import a MySQL database(s)testcloner
- A simple example of a cloner not meant for use.mysqlcleaner
- Runs arbitrary SQL scripts against the MySQL server. Useful for sanitizing databases imported by the mysql
cloner.You can write your own cloners to use with the tool. Unfortunately, because of how Vagrant loads its configuration settings, it's not possible to store these in a directory that is not in the gem itself.
Our suggestion is as follows:
rake build
;vagrant gem install vagrant-cloner --local ./pkg/
If you make an error in your script, you may have a hard time uninstalling it with vagrant gem uninstall
. In a trice, you can remove directories in ~/.vagrant.d/gems/gems/
to manually remove troublesome gems. (Note that this was tested on a Linux distribution, so this may vary for Mac and Windows users.)
To operate as a cloner, a class must inherit from Vagrant::Cloners::Cloner
, and implement at a bare minimum these methods:
name
- Returns a string representation of the cloner's name; used for namespacing config.validate(machine, errors)
- Can be used to call errors.add
if there are validations that need to be performed on configuration values.call
- Executes the cloner's routine.A cloner must also be registered in the config to be run. This is best done after the class has been closed, at the bottom of the file:
Vagrant::ClonerContainer.instance.send("#{<Class>.instance.name}=".to_sym, <Class>.instance)
So for the MySQL cloner (which is Vagrant::Cloners::MysqlCloner
), the line would read
Vagrant::ClonerContainer.instance.send("#{Vagrant::Cloners::MysqlCloner.instance.name}=".to_sym, Vagrant::Cloners::MysqlCloner.instance)
A very minimal example can be found in the cloners directory. For more detailed examples, look at the other cloners there!
Cloner
exposes the ssh
, scp
, and vm
methods to your class, so, in combination with Kernel#system
, you can do pretty much anything on either host, VM, or remote server that you can do in (z|ba)sh.
The vm
method, as an aside, is just a reference to the SSH communicator of Vagrant, so you can see what it provides here. If you need to actually access the environment, that is made available through the env
method.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Pull requests most graciously accepted.
FAQs
Unknown package
We found that vagrant-cloner-wops demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.