Giter VIP home page Giter VIP logo

fortigate-vagrant-libvirt's Introduction

Vagrant

Fortinet FortiGate Vagrant box

A Packer template for creating a Fortinet FortiGate Vagrant box for the libvirt provider.

Prerequisites

Steps

0. Verify the prerequisite tools are installed.

$ which git unzip packer libvirtd qemu-system-x86_64 vagrant
$ vagrant plugin list
vagrant-libvirt (0.4.0, global)

1. Log in and download the FortiGate-VM virtual appliance deployment package from Fortinet. Save the file to your Downloads directory.

2. Extract the disk image file to the /var/lib/libvirt/images directory.

$ cd $HOME/Downloads
$ sudo unzip -d /var/lib/libvirt/images FGT_VM64_KVM-v6-build1828-FORTINET.out.kvm.zip

3. Modify the file ownership and permissions. Note the owner may differ between Linux distributions.

Ubuntu 18.04

$ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/fortios.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/fortios.qcow2

Arch Linux

$ sudo chown nobody:kvm /var/lib/libvirt/images/fortios.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/fortios.qcow2

4. Create the boxes directory.

$ mkdir -p $HOME/boxes

5. Clone this GitHub repo and cd into the directory.

$ git clone https://github.com/mweisel/fortigate-vagrant-libvirt
$ cd fortigate-vagrant-libvirt

6. Packer build to create the Vagrant box artifact. Supply the FortiOS version number for the version variable value.

$ packer build -var 'version=6.4.5' fortigate.pkr.hcl

7. Copy the Vagrant box artifact to the boxes directory.

$ cp ./builds/fortinet-fortigate-6.4.5.box $HOME/boxes/

8. Copy the box metadata file to the boxes directory.

$ cp ./src/fortigate.json $HOME/boxes/

9. Change the current working directory to boxes.

$ cd $HOME/boxes

10. Substitute the HOME placeholder string in the box metadata file.

$ awk '/url/{gsub(/^ */,"");print}' fortigate.json
"url": "file://HOME/boxes/fortinet-fortigate-VER.box"

$ sed -i "s|HOME|${HOME}|" fortigate.json

$ awk '/url/{gsub(/^ */,"");print}' fortigate.json
"url": "file:///home/marc/boxes/fortinet-fortigate-VER.box"

11. Also, substitute the VER placeholder string with the FortiOS version you're using.

$ awk '/VER/{gsub(/^ */,"");print}' fortigate.json
"version": "VER",
"url": "file:///home/marc/boxes/fortinet-fortigate-VER.box"

$ sed -i 's/VER/6.4.5/g' fortigate.json

$ awk '/\<version\>|url/{gsub(/^ */,"");print}' fortigate.json
"version": "6.4.5",
"url": "file:///home/marc/boxes/fortinet-fortigate-6.4.5.box"

12. Add the Vagrant box to the local inventory.

$ vagrant box add fortigate.json

License

This project is licensed under the MIT License - see the LICENSE file for details

fortigate-vagrant-libvirt's People

Contributors

mweisel avatar rahnersec avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.