Monday, June 10, 2019

Vagrant maintenace i.e. Box clean up

I use vagrant alot,

If you do not prune and / or removed unsed box you can quiet easily see yourself waisting space.

Case in point.

bclark@bclark:~$ du -sh .vagrant.d/boxes/
5.7G    .vagrant.d/boxes/



If you want to see what boxes you have:

vagrant box list

i.e.
bclark@bclark:~$ vagrant box list
debian/stretch64 (virtualbox, 9.5.0)
debian/stretch64 (virtualbox, 9.7.0)
debian/stretch64 (virtualbox, 9.8.0)
debian/stretch64 (virtualbox, 9.9.0)
ubuntu/bionic64  (virtualbox, 20190212.1.0)
ubuntu/trusty64  (virtualbox, 20180814.0.0)
ubuntu/xenial64  (virtualbox, 20190325.0.0)


To clean up you can use:

vagrant box remove debian/stretch64 --box-version 9.5.0

HTH
Brent

Tuesday, May 28, 2019

Modsecuritys upload / scanning testing


If you ever need to test Modsecuritys upload / scanning function, here a method.

curl -k -i -F 'upload=@"//tmp/bad.txt"' https://$domain/


HTH
Brent

Saturday, May 25, 2019

Easiest way to scp files from host to Vagrant guest (or visa versa)

If you running a vagrant instance, and you forgot to set up file sharing, but *now* you need to copy a file off to a guest, or on a guest.

Here is a method, I used to save my bacon.

Try this:

vagrant plugin install vagrant-scp (From vagrant-scp)
 
And then the method is
 
vagrant scp <some_local_file_or_dir> [vm_name]:<somewhere_on_the_vm>
 
To get "vm_name" you need to run:

vagrant global-status

In my instance:

bclark@bclark:~/Vagrant_Projects/Imapproxy$ vagrant global-status
id       name         provider   state    directory                                          
--------------------------------------------------------------------------------------------- 
5250600  default      virtualbox running  /home/bclark/Vagrant_Projects/Imapproxy

Then to copy the files, I run:

vagrant scp 5250600:/etc/dovecot /path/to/where/you/want/it/stored

HTH
Brent