Showing posts with label Miami. Show all posts
Showing posts with label Miami. Show all posts

Tuesday, January 8, 2019

Using the Script feature in Check Point R80

Scripting in Check Point R80 by John Ejaife


In our last blog, we showed you how to configure Check Pointfirewalls and Cisco ISE, so that Windows users in Active Directory could accessthe firewalls with different sets of permissions assigned to them via RADIUS. If you plan on adding more than one firewall to ISE, it can become tedious to manually configure each individual firewall with the required changes. In this blog, we will show you how to use the Script feature in Check Point R80’s Smart Console to apply changes to sets of firewalls that share common blocks of configuration.
In the diagram below, firewall R80-10-GW1 (at 192.168.133.11) for the Miami office has already been configured and added as a RADIUS client of the Cisco ISE server (at 192.168.133.220). We will show you how you can take the Radius and roles configuration from the command line of the Miami firewall and apply them to the second firewall, R80-10-GW2 (at 192.168.133.12) for the Fort Lauderdale office, using the Check Point Smart Console GUI. *This article assumes that you have already added both firewalls to your Check Point management server; therefore this topic will not be covered. Please consult official vendor documentation for information regarding how to do this.*




Let’s start by connecting to the command line of the firewall in the Miami office, R80-10-GW1 (192.168.133.11) via SSH.
Enter your username and password.

This firewall has been configured to use BASH as its shell. We’ll want to switch over to the CLISH shell to view the configuration. Type `clish` at the shell prompt.

Type `show configuration` to view the configuration.


This screenshot shows the end of the configuration.

Next, copy the contents of the putty session to the clipboard and paste them in a Notepad. Here we will be concerned with the RADIUS sections and the roles section.
First, let’s look at the Radius commands.



Take these commands below and copy them to another notepad file.



(You’ll want to replace the asterisks following the word secret, with a shared key (eg abc123) of your choosing that will be used between the Check Point gateway and the ISE Server)
set aaa tacacs-servers state off
add aaa radius-servers priority 1 host 192.168.133.220 port 1812 secret ***** timeout 3
set aaa radius-servers super-user-uid 96

Next, you’ll want to look at the “role” commands and copy them to a text file.


add rba role checkpointAdmins domain-type System all-features
add rba role checkpointNoc domain-type System readwrite-features ext_netstat,ext_ping,ext_ping6,ext_top,ext_traceroute
add rba role checkpointNoc domain-type System readonly-features CloningGroup,CloningGroupManagement,aaa-servers,adv-vrrp,aggregate,arp,asset,backup,bgp,blades,bootp,certificate_authority,clock-date,cluster_ha,command,configuration,core-dump,cron,dhcp,dns,domainname,edition,expert,expert-password,expert-password-hash,export,fcd,firewall_management,format,ftw,group,host,host-access,hostname,hw-monitor,igmp,import,inactto,installer,installer_conf,interface,interface-name,iphelper,ipv6-state,lcd,license
add rba role checkpointNoc domain-type System readonly-features license_activation,logicalvolume,lom,management_interface,message,mgmt-gui-clients,neighbor,netaccess,netflow,ntp,ospf,password-controls,pbr-combine-static,perf,pim,prod-maintain,proxy,raid-monitor,rba,rdisc,reboot_halt,rip,route,route-injection,route-options,routemap,sam,sceduled_backup,scratchpad,selfpasswd,show-route-all,smart-console,snapshot,snmp,ssmtp,static-mroute,static-route,sysconfig,sysenv,syslog,tacacs_enable,upgrade,user,version
add rba role checkpointNoc domain-type System readonly-features virtual-system,vpnt,vrrp,vsx,web


Next, we’ll want to open up SmartConsole and connect to the management server at 192.168.133.10


Navigate to Gateways and Servers on the top left hand corner of the window.
You will see the server, gw-28e800, which is the management server, and the two firewalls, R80-10-GW1, which is the original firewall from which we will copy parts of the configuration from, as well as the other firewall R80-10-GW2, which we will copy parts of the configuration to.
At this point, we’ll want to click the Scripts menu option in the top of the page. 

Next, navigate to the scripts repository.

Notice the pre-existing scripts that come with the management server by default.


We’ll want to click on thebutton to create a new script. Let’s start with a script for the RADIUS portion of the configuration. Let’s call it R80-RADIUS-Script.



If the default login shell for the Check Point firewall is clish, we can paste the contents of the RADIUS portion of the config, as is, into the Content text box.



In the event that someone else is logged in, or a previous login session has not expired, you’ll want to add the line `lock database override` to the top of the script. At the end of the script, you’ll want to add the line `save config`. In the box, the script will look like this:



Now, if the admin shell in the firewall is BASH, instead of CLISH, you’ll need to encapsulate each individual line in the config with clish -c ' ' , so the first line will look like
clish -c 'lock database override'
The second line will look like
clish -c 'add aaa radius-servers priority 1 host 192.168.133.220 port 1812 secret abc123 timeout 3'
The the third line will look like this
clish -c 'set aaa radius-servers default-shell /bin/bash'
The fourth line will look like
clish -c 'set aaa radius-servers super-user-uid 96'
…and so forth, until the end of the script. The script box in Smart Console will look like this:



Click the OK button.
Now you’ll see your script, “R80-RADIUS-Script,” in the Script Repository.


Click the Close button.
Now, right-click the R80-10-GW2 firewall, and navigate to Scripts > Scripts Repository.


Click on the R80-RADIUS-Script.
Then click the button that looks like a scroll:
In the pop-up window, click the “Run” button.



Look on the bottom left to verify that the script ran properly.




To verify that the commands were added to the config, lets connect to the firewall via SSH and look at the  configuration, by first typing ‘clish’ and then enter, and then typing ‘show configuration.’ As you can see, the lines have been added.



Now, in Smart Console, we will want to create a second script for for the roles we created in the first blog, to add to the second firewall to allow multiple Windows users to log onto it with different permission levels.
Navigate to the Scripts Repository again






Click thebutton create a new script. Lets call it R80-Add-Roles




Now, copy the lines of configuration pertaining to adding Check Point Roles from R80-10-GW1, and paste them into the Script Content box. Remember to add the “lock database override” at the beginning of the script and “save config” at the end of the script, so the output looks like this.



Now, again, if the admin shell on the Check Point firewall is bash, your script will want to look like this:



Then click “OK” and click “Close.”
Now, right click the R80-10-GW2 gateway and navigate to the Scripts > Scripts Repository again


Click on the R80-Add-Role Script



Then click the scroll button above, again  and click “Run” in the window that pops up.



Then, look to see that the script was applied successfully to the firewall.




If you connect to the firewall, you can see that the commands were added to the config, by typing “clish”, and then “show configuration.”



Now, all that is left to allow Windows users to log on is to add it as a device in ISE.
Open up IE and browse to your ISE server (in our instance, it is https://192.168.133.220/admin/login.jsp)


Navigate to Administration > Network Resources > Network Devices



Click the “Add” Button 

In our case, we’ll call our Ft. Lauderdale firewall R80-10-GW2, give it an IP address of 192.168.133.12, set the Device Profile to CheckPoint-Firewalls, and Set the Device Type to CheckPoint-DeviceType.



Then we’ll check the Radius authentication settings check box and enter the shared secret.



Then click the Submit Button




Now, you should be able to connect to the firewall via the GUI or SSH with your Windows login, as in the previous blog entry.

Saturday, September 10, 2016

How to install Debian on Gaia Embedded - 700/1400 (not 1200R (ok and not 600/1100*))

UPDATE: Turns out this doesn't work on the 600/1100 (wah waaaah). Need some more testing (Yeah, I totally tested this on a 600/1100 before posting) to see if i can work around libc issue.

I recently... well maybe not that recently.. spent a few months working on building cross compilers that matched up %100 to a given Checkpoint Gaia Embedded system. Meaning, same libc (glibc 2.5, what a pain!), compiler version (based on glibc output) and kernel heads version.

I thought this was needed so that everything would be compatible. Well, turns out I made things way harder then it should have been. I recently found out that glibc is basically backwards compatible. There may be edge cases where things don't end up right, but for the most part, it seems pretty darn backwards compatible.

So that got me thinking. I started downloading .deb files and extracting them on my 750 and pretty much everything worked. Granted there was a lot of tracing library dependencies. So knowing that all worked I switched gears. I bought a 32 gig microsd card and installed it. I did format it to ext4 since vfat isn't a linux friendly file system. Side note: of course 7xx doesn't have the mkfs.ext4. Sigh... I'll have to map out all the needed libraries for that and point out the download links.

So the next idea was, can we just install debian on the 750 in a chroot environment? It turns out, yeah. I used the Debootstrap to create the chroot. It took a little while as it needs perl and wget and a few other things. The default wget on Gaia Embedded doesn't support https so just to be safe I pulled wget down also.

Before continuing, this is not supported by anyone. I would only do this on a test box, and not on a production firewall.

Basically I downloaded all these utilities on a spare Linux box in our Miami office:

ca-certificates_20141019+deb8u1_all.deb
debootstrap_1.0.67_all.deb
gzip_1.6-4_armhf.deb
libblkid1_2.20.1-5.3_armhf.deb
libdb5.3_5.3.28-9_armhf.deb
libffi-dev_3.1-2+b2_armhf.deb
libffi6_3.1-2+b2_armhf.deb
libgdbm3_1.8.3-13.1_armhf.deb
libgmp10_6.0.0+dfsg-6_armhf.deb
libgnutls-deb0-28_3.3.8-6+deb8u3_armhf.deb
libhogweed2_2.7.1-5+deb8u1_armhf.deb
libicu52_52.1-8+deb8u3_armhf.deb
libidn11_1.29-1+deb8u2_armhf.deb
liblzma5_5.1.1alpha+20120614-2+b3_armhf.deb
libnettle4_2.7.1-5+deb8u1_armhf.deb
libp11-2_0.2.8-5_armhf.deb
libp11-kit-dev_0.20.7-1_armhf.deb
libp11-kit0_0.20.7-1_armhf.deb
libpsl0_0.5.1-1_armhf.deb
libssl1.0.0_1.0.1t-1+deb8u2_armhf.deb
libstdc++6_4.9.2-10_armhf.deb
libtasn1-3-bin_4.2-3+deb8u2_all.deb
libtasn1-6_4.2-3+deb8u2_armhf.deb
libuuid1_2.20.1-5.3_armhf.deb
libuuid1_2.25.2-6_armhf.deb
perl-base_5.20.2-3+deb8u6_armhf.deb
perl-modules_5.20.2-3+deb8u6_all.deb
wget_1.16-1_armhf.deb
xz-utils_5.1.1alpha+20120614-2+b3_armhf.deb
zlib1g_1.2.8.dfsg-2+b1_armhf.deb


I put them on a linux box and extracted them using this... somewhat nasty process:


for x in `ls *.deb` ; do ar xv $x ; tar -zxvf data.tar.gz ; tar -Jxvf data.tar.xz ; done


What I'm doing is expanding the .deb archive, which contains 3 or more files. The binaries are in a file called data.tar.gz (gziped) or data.tar.xz (lzma). I would have done this on Checkpoint Gaia Embedded but it doesn't include anything uncompress lzma. Kind of a brute force method to extract everything, but it worked. After that the raw files are ready to install on your Checkpoint firewall.


Next I just moved the files over to the Maimi Checkpoint firewall, so now I have this:


[Expert@FWCKP750]# ls -l
drwxr-xr-x 2 root root 4096 Sep 10 10:49 bin
drwxr-xr-x 5 root root 4096 Sep 10 10:13 etc
drwxr-xr-x 3 root root 4096 Sep 10 09:40 lib
drwxr-xr-x 2 root root 4096 Sep 10 09:33 sbin
drwxr-xr-x 7 root root 4096 Sep 10 09:47 usr
drwxr-xr-x 3 root root 4096 Sep 10 09:33 var
[Expert@FWCKP750]# pwd
/mnt/sd/cnf/debian/bootstrap
[Expert@FWCKP750]#


Debootstrap is really just a shell script so once you have everything you can just run it. You also don't have to run it in Miami, I won't tell anyone if you do.


I did make a small script to setup library and path so the debootstrap files are used first. The last item was to tell debootstrap where its shell include files were.


I put this in setup.sh:

[Expert@FWCKP750]# pwd
/mnt/sd/cnf/debian

[Expert@FWCKP750]# cat setup.sh
declare -x DEBOOTSTRAP_DIR="/mnt/sd/debian/cnf/bootstrap/usr/share/debootstrap/"
declare -x LD_LIBRARY_PATH="/mnt/sd/debian/cnf/bootstrap/usr/lib/arm-linux-gnueabihf:/mnt/sd/debian/bootstrap/usr/lib:/mnt/sd/debian/bootstrap/lib/arm-linux-gnueabihf:/mnt/sd/debian/bootstrap/lib:.:/pfrm2.0/lib:/pfrm2.0/lib/iptables:"
declare -x PATH="/mnt/sd/cnf/debian/bootstrap/usr/bin:/mnt/sd/debian/bootstrap/usr/sbin:/mnt/sd/debian/bootstrap/sbin:/usr/local/bin:/usr/bin:/bin:/pfrm2.0/bin:/pfrm2.0/bin/cli:/pfrm2.0/bin/cli/provisioning:.:/usr/local/sbin:/usr/sbin:/sbin:/opt/fw1/bin"
[Expert@FWCKP750]#


This will suck in those settings for this login session on the Miami Checkpoint firewall.


source setup.sh


That should be about all that is needed to run debootstrap. Next, just make the dir you want to install the OS into and run debootstrap.


mkdir /mnt/sd/stable-chroot


Then fire off debootstrap.


debootstrap --arch arghf stable /mnt/sd/stable-chroot http://httpredir.debian.org/debian/

With luck and about 15 min you'll have a fully installed OS. We'll need a few little tweaks to wrap this up.

We need to mount proc and sysfs inside the chroot.

I added these statements to my userScript to handle this at bootup (yes the Miami Checkpoint firewall):

[Expert@FWCKP750]# ls -l userScript
-rwxr-xr-x 1 root root 120 Sep 10 12:01 userScript
[Expert@FWCKP750]# cat userScript
mount /dev/mmcblk1 /mnt/sd
mount proc /mnt/sd/stable-chroot/proc -t proc
mount sysfs /mnt/sd/stable-chroot/sys -t sysfs
[Expert@FWCKP750]#

You can just run those mount commands by hand also if you want. The mount /mnt/sd isn't
needed if the system is already up and running as it should auto mount. However,
the auto mount happens after userScript. Adding the mount to userScript is the workaround.

Now you're ready to jump in. Here I login to the chroot and then show python version
and perl version install.

[Expert@FWCKP750]# chroot /mnt/sd/stable-chroot bash -l
root@FWCKP750:/# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin root@FWCKP750:/# cat /etc/debian_version 8.5
root@FWCKP750:/# python3 -V Python 3.4.2
root@FWCKP750:/# perl -v This is perl 5, version 20, subversion 2 (v5.20.2) built for arm-linux-gnueabihf-thread-multi-64int (with 81 registered patches, see perl -V for more detail) Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. root@FWCKP750:/#


The install is about 500meg. Fits just great on a 32gig sd card, but is way too big without it.

I should point out things will work just fine inside the chroot. Once you logout, some things
will work outside of the chroot (/mnt/sd/stable-chroot/usr/bin/lsof for example), others you
may need to create a shell script to add library search and path statements, or in the case of
perl and python, do something to tell it where the modules are located.

I hope I didn't loose you at inside the chroot and outside the chroot. Chroot is a linux command that CHanges the ROOT dir.

So outside the chroot means the dir structure would look like this for example:

/mnt/sd/stable-chroot/
inside the chroot it would look like this.
/

Here is an example:
First I login to the chroot (now I'm inside)
[Expert@FWCKP750]# chroot /mnt/sd/stable-chroot bash -l
I create a file called TestFile
root@FWCKP750:/# touch TestFile
Notice how i'm in /
root@FWCKP750:/# pwd
/
And we see the TestFile
root@FWCKP750:/# ls
TestFile boot etc lib mnt proc run srv tmp var
bin dev home media opt root sbin sys usr
root@FWCKP750:/# exit
Now I logout. Notice out the directory changes? I'm now outside the chroot.
[Expert@FWCKP750]# pwd
/mnt/sd/stable-chroot
[Expert@FWCKP750]# ls
TestFile dev lib opt run sys var
bin etc media proc sbin tmp
boot home mnt root srv usr
[Expert@FWCKP750]#
Hope that clears things up!

One interesting thing I noticed was the default ip utilties package on gaia embedded says
it doesn't support netns (Network Name Space (think VSX)), but using the Debian ip utility I was able to create a netns name. I haven't looked into this any further.


I'll have to run through the whole process again to make sure I documented it correctly.

Wait what? You would like a tar file of the debootstrap dir?

ok ok ok. Here you go.

debootstrap - 600 / 1100 / 700 / 1400

Thursday, September 8, 2016

Meetup group created!

Hi everyone, if you live in south Florida (or close enough) you should join the Meetup! The South Florida Checkpoint Zdebug Group - SFCZG for short! We're just getting started with the meetup. We're researching a location somewhere in Miami. Might expand to Fort Lauderdale at some point, but for now we'll be sticking to Miami for the Checkpoint meetup.

Join and drop a line!

Sunday, June 19, 2016

Check Point 750 - see inside!

Hi everyone! This will be a quick write up covering physical aspects of a Check Point 750. And let's face it, you want to know what's on under the case right? Who wouldn't?!?!

I won't bother with packing material, but this is the box, just like all the other pics show.

Here is the front:





And here is the back:



6 x 10/100/1000 ports on a switch + WAN and DMZ ports.
802.11 b/g/n/ac MIMO 3x3, 1 radio band: 2.4Ghz/5Ghz
2 Console ports - 1 rj45 serial port and one usb port for console.


Here are all the cables it comes with:

Note: the black rectangle is a USB -> Mini USB Console Cable.
Basically, you can use this to console into the device if you for some reason
don't already own 3 to 5 USB -> 9pin serial converts.
You may need to download drivers from checkpoint to get it working.
I'll stick with my usb console cable because it has leds and blinky lights are fun!




Here is a picture with the Antenna properly installed. 

Why did it come with an extra one?


That might not be right, I'll have to do some research on that.




Now comes the hard part. How do we open this?
As it turns out, it's a highly complicated process involving up to two screws:




Ok screws are off. The top of the case should slide forward and lift off. Now we can see the sexy hardware on the inside!








...



...


.... Oh no! It's too sexy!







Ok, remove that last bit and this is what we have.
Here is a close up of the left side of the motherboard:



And here is the right:



Not much to see really. I want to take that heat sink off but the chicken is great with this one.

Oh, I should have listed what is on the inside.

ARMv7 Processor rev 4 (v7l) (Two cores)
1GB of ram
Not sure how big the storage is yet. I'll update with info.
Busybox 1.8.1
Linux Optix-700 3.10.20-al-5.0-pr2 (haven't check if this changed with R77.20 hfa 20).

I'll follow this up with some software info shortly.