This tutorial will help you to get started with the firewalld configuration. Basics on zones and rich rules are presented.
What we do
The shell provisioner will ensure that on all hosts firewalld and curl are installed. For “host_protected” the provisioner will install nginx for demo purposes, too. Furthermore, the firewall will configured on “host_protected”.
Every host has two interfaces NAT (enp0s3) and host-only (enp0s8). The provisioner will not touch the NAT interface (zone: public) rules! Only the host-only interface (zone: home) rules will modified!
# show result configuration public (local)
$ vagrant ssh host_protected -c 'sudo firewall-cmd --list-all --zone=public'
...
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
# show result configuration home (local)
$ vagrant ssh host_protected -c 'sudo firewall-cmd --list-all --zone=home'
...
home (active)
target: default
icmp-block-inversion: no
interfaces: enp0s8
sources:
services:
ports:
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="192.168.33.10" service name="http" accept
rule family="ipv4" source address="192.168.33.20" service name="ssh" accept
# start vagrant environment (local)
$ vagrant up
# show status (optional - local)
$ vagrant status
...
Current machine states:
host_http_access running (virtualbox)
host_ssh_access running (virtualbox)
host_protected running (virtualbox)
# ssh into host_http_access (local)
$ vagrant ssh host_http_access
# try http via curl (host_http_access)
$ curl -I http://192.168.33.30
# try ssh (host_http_access)
$ ssh vagrant@192.168.33.30
# ssh into host_ssh_access (local)
$ vagrant ssh host_ssh_access
# try http via curl (host_ssh_access)
$ curl -I http://192.168.33.30
# try ssh (host_ssh_access)
$ ssh vagrant@192.168.33.30
# destroy vagrant environment
$ vagrant destroy -f
Note: before you destroy the vagrant environment, have a look on zones xml files for “host_protected”!
# ssh into host_protected (local)
$ vagrant ssh host_protected
# change to root (host_protected)
$ sudo su -
# change directory
$ cd /etc
# cat actual zone xml files
$ cat firewalld/zones/*.xml
With kickstart configurator you don`t need to remember the correct syntax of kickstart files. An graphical user interface helps to create or to edit kickstart files on the fly.
Pappy Proxy (Proxy Attack Proxy ProxY) is an open source intercepting proxy for performing web application security tests. It is similar to BurpSuite, ZAP and so on. The benefit is the command line!
Installation
# update system
$ yum update -y
# install epel
$ yum -y install epel-release
# install needed packages
$ yum install -y git python-pip python-devel gcc libffi-devel libxml2 libxml2-devel libxslt libxslt-devel openssl-devel
# clone repository
$ git clone --recursive https://github.com/roglew/pappy-proxy.git
# change directory
$ cd pappy-proxy/
# install pappy-proxy
$ pip install .
# run help
$ pappy --help
# start up in lite mode
$ pappy -l
So pappy is started … we can configure and test it (via lite-mode).
# generate certificates
pappy> gencerts
# test proxy from other terminal
$ curl -x http://localhost:8000 -L http://google.com
# list requests
pappy> ls
# prints the full response to a request
pappy> vfs <id>
# exit pappy-proxy lite mode
pappy> quit
Explainshell.com rocks! Nevertheless, you lose time to leave the terminal (open browser, copy-paste). But there is a cool solution from ManKier. All what you need is curl.
With a tiny script it will be more comfortable! Add the following to your .bashrc or .bash_profile (MAC OS X).
# explain.sh begins
explain () {
if [ "$#" -eq 0 ]; then
while read -p "Command: " cmd; do
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
done
echo "Bye!"
elif [ "$#" -eq 1 ]; then
curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1"
else
echo "Usage"
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
fi
}
Now you can do …
# explain one command
$ explain 'df -h'
...
df(1)
df displays the amount of disk space available on the file system containing each file name
argument. If no file name is given, the space available on all currently mounted file systems is
shown. Disk space is shown in 1K blocks by default, unless the environment variable
POSIXLY_CORRECT is set, in which case 512-byte blocks are used. If an argument is the absolute
file name of a disk device node containing a mounted file system, df shows the space available on
that file system rather than on the file system containing the device node. This version of df
cannot show the space available on unmounted file systems, because on most kinds of systems doing
so requires very nonportable intimate knowledge of file system structures.
-h (-H, --HUMAN-READABLE)
print sizes in powers of 1024 (e.g., 1023M)
… if you insert only “explain” an interactive mode will started!
This time shows the tutorial two topics in one. The first topic is: “How an easy to configure SSH host jump”. The 2nd topic is: “Provisioning examples for Vagrant”.
The title says it, … this tutorial is about Packer, CentOS 7 and Vagrant. After that, you should be able to integrate the creation of Vagrant base boxes into your Build-server. There is on small exception to other – the VirtualBox Guest Additions will be provided via PlugIn! Because other users could may have different versions.
install
cdrom
lang en_US.UTF-8
keyboard us
timezone UTC
network --bootproto=dhcp
firewall --disabled
rootpw --plaintext packer
user --name=vagrant --password=vagrant
auth --enableshadow --passalgo=sha512 --kickstart
selinux --permissive
text
skipx
clearpart --all --initlabel
zerombr
autopart
bootloader --location=mbr
firstboot --disable
reboot
%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
@^minimal
@core
-aic94xx-firmware
-atmel-firmware
-b43-openfwwf
-bfa-firmware
-ipw2100-firmware
-ipw2200-firmware
-ivtv-firmware
-iwl100-firmware
-iwl105-firmware
-iwl135-firmware
-iwl1000-firmware
-iwl2000-firmware
-iwl2030-firmware
-iwl3160-firmware
-iwl3945-firmware
-iwl4965-firmware
-iwl5000-firmware
-iwl5150-firmware
-iwl6000-firmware
-iwl6000g2a-firmware
-iwl6000g2b-firmware
-iwl6050-firmware
-iwl7260-firmware
-libertas-usb8388-firmware
-ql2100-firmware
-ql2200-firmware
-ql23xx-firmware
-ql2400-firmware
-ql2500-firmware
-rt61pci-firmware
-rt73usb-firmware
-xorg-x11-drv-ati-firmware
-zd1211-firmware
%end
%post --log=/root/ks.log
SEE NEXT PICTURE!!!! The security settings of my provider does not allow this content!
%end
# -*- mode: ruby -*-
Vagrant.require_version ">= 1.8.1"
Vagrant.configure("2") do |config|
config.vm.box = "packer/centos7"
config.vm.box_url = "target/virtualbox-CentOS-7.box"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "virtualbox" do |vb|
vb.name = "CentOS-7"
vb.cpus = "2"
vb.memory = "2048"
vb.gui = false
end
end
Usage
# run packer build (via make)
$ make build
# run vagrant up (via make)
$ make run
# run vagrant reload (via make)
$ make reload
# run vagrant ssh (via make)
$ make ssh
# destroy everything (via make)
$ make clean