Vagrant Security Concerns
Databases typically contain information to which access should be restricted. For this reason, it's worth discussing some security concerns that Vagrant users should be aware of.
Access to the Vagrant Machine
By default, Vagrant machines are only accessible from the localhost. SSH access uses randomly generated key pairs, and therefore it is secure.
The password for root
and vagrant
is "vagrant" by default. Consider changing it.
Synced Folders
By default, the project folder in the host system is shared with the machine, which sees it as /vagrant
. This means that whoever has access to the project folder also has read and write access to the synced folder. If this is a problem, make sure to properly restrict the access to the synced folder.
If we need to exchange files between the host system and the Vagrant machine, it is not advisable to disable the synced folder. This is because the only alternative is to use the file
provider, which works by copying files to the machine via ssh. The problem is that the default ssh user does not have permissions to write to any directory by default, and changing this would be less secure than using a synced folder.
When a machine is provisioned, it should read the needed files from the synced folder or copy them to other places. Files in the synced folder should not be accessed by the Vagrant machine during its normal activities. For example, it is fine to load a dump from the synced folder during provisioning; and it is fine to copy configuration files from the synced folder to directories in /etc
during provisioning. But it is a bad practice to let MariaDB use table files located in the synced folder.
Reporting Security Bugs
Note that security bugs are not reported as normal bugs. Information about security bugs are not public. See Security at HashiCorp for details.
Content initially contributed by Vettabase Ltd.