Tuesday, 22 November 2016

MyFortiGate cheat sheet

CLI Commands for Troubleshooting FortiGate Firewalls


This blog post is a list of common troubleshooting commands I find usefull in my daily work. It is not complete nor very detailled, but provides the basic commands for troubleshooting network related issues that are not resolvable via the GUI. I am not focused on too many memory, process, kernel, etc. details. These must only be used if there are really specific problems. I am more focused on the general troubleshooting stuff. I am using it personally as a cheat sheet / quick reference and will update it from time to time.

# fnsysctl


# MV

usage: mv [-f] src dst


# GREP

Usage: grep [-ilHhnqvscABC] PATTERN [FILE...]

Options:

-i Ignore case distinctions

-l List names of files that match

-H Prefix output lines with filename where match was found

-h Suppress the prefixing filename on output

-n Print line number with output lines

-q Quiet

-v Select non-matching lines

-s Suppress file open/read error messages

-c Only print count of matching lines

-A Print NUM lines of trailing context

-B Print NUM lines of leading context

-C Print NUM lines of output context


# KILL

# KILLALL

# LS

# CAT

usage: cat [file ...]


# IFCONFIG

# PWD

# DU

usage: du

Summarize disk space used for each FILE and/or directory


-a Show file sizes too

-L Follow all symlinks

-H Follow symlinks on command line

-d N Limit output to directories (and files with -a) of depth < N

-c Show grand total

-l Count sizes many times if hard linked

-s Display only a total for each argument

-x Skip directories on different filesystems

-i Show number of inodes


# PS

# DATE

# SH

# DF




In Cisco, everything is “show”. With Fortinet, you have the choice between show | get | diagnose | execute
Likewise the sys | system keyword. It is always “diagnose sys” but “execute system”


Fortigate Cisco
show full-configuration show run
execute factory-reset write erase
show system interface show run interface brief
diagnose hardware deviceinfo nic show interface
get system status show version
get system arp | diagnose ip arp list show arp
get router info routing-table all show ip route
diagnose system session list show ip nat translation
diagnose system session clear clear ip nat translation
get router info ospf neighbor show ip ospf neighbor
get router info bgp neighbor show ip bgp neighbor
get router info bgp summary show ip bgp summary

Entering the correct vdom/gobal Config

Remember to enter the correct vdom or global configuration tree before configuring anything:

config global
config vdom
edit <vdom-name>

To show the running configuration (such as “show run”), simply type in:

show

To show the entire running configuration with default values, use:

show full-configuration
To omit the “–More–” stops when displaying many lines, you can set the terminal output to the following, which will display all lines at once. This is similar to “terminal length 0” from Cisco. Be careful with it, because this command is persistent. Set it to default after usage!
config system console
  set output standard
end
To find a CLI command within the configuration, you can use the pipe sign “|” with “grep” (similar to “include” on Cisco devices). Note the “-f” flag to show the whole config tree in which the keywords was found, e.g.:
show | grep -f ipv6
show full-configuration | grep -f ipv6

General Information



get system interface physical       #overview of hardware interfaces
get hardware nic <nic-name>         #details of a single network interface, same as: diagnose hardware deviceinfo nic <nic-name>
fnsysctl ifconfig <nic-name>        #kind of hidden command to see more interface stats such as errors
get system status                   #show version
get system performance status       #CPU and network usage
diagnose sys top                    #top with all forked processed
diagnose sys top-summary            #top easier, incl. CPU and mem bars. Forks are displayed by [x13] or whatever
execute dhcp lease-list
diagnose ip arp list
diagnose ipv6 address list
diagnose ipv6 neighbor-cache list
diagnose sys ntp status
diagnose autoupdate versions        #lists the attack definition versions, last update, etc.
diagnose log test                   #generated all possibe log entries
diagnose test application dnsproxy 6    #shows the IP addresses of FQDN objects
diagnose debug crashlog read       #shows crashlog, a status of 0 indicates a normal close of a process!

After rebooting a fresh device which is already licensed, it takes some time until it is “green” at the dashboard. The following commands can troubleshoot and start the “get license” process. Use the first three to enable debugging and start the process, while the last one disables the debugging again:
diag debug app update -1
diag debug enable
exec update-now
diag debug disable

General Network Troubleshooting



execute ping-options ?
execute ping-options source <ip-address-of-the-interface>
execute ping <hostname|ip>
execute ping6-options ?
execute ping6 <hostname|ip>
execute traceroute <hostname|ip>
execute tracert6 <hostname|ip>
get router info routing-table all   #routing table
get router info6 routing-table      #IPv6 without the "all" keyword
get router info kernel              #Forwarding Information Base
get router info6 kernel
get router <routing-protocol>       #basic information about the enabled routing protocol
diagnose firewall proute list       #policy-based routing
diagnose firewall proute6 list
diagnose ip rtcache list            #route cache = current sessions w/ routing information

HA

diagnose sys ha status
execute ha manage ?                 #switch to the CLI of a secondary unit
execute ha manage <device-index>
diagnose sys ha showcsum            #verify the checksum of all synchronized peers
get system session list             #rough view with NAT, only IPv4

Session Table

diagnose sys session filter clear
diagnose sys session filter ?
diagnose sys session filter dst 8.8.8.8
diagnose sys session filter dport 53
diagnose sys session list           #show the session table with the filter just set
View per-packet operations:

1#diagnose debug disable
2#diagnose debug flow trace stop
3#diagnose debug flow filter clear
4#diagnose debug reset

5#diagnose debug flow filter addr x.x.x.x
6#diagnose debug flow show console enable
7#diagnose debug flow show function-name enable
8#diagnose debug console timestamp enable
9#diagnose debug flow trace start 100
10#diagnose debug enable

View specific traffic session with:
#diag sys session list
or
#diag sys session filter  sport:dport:dst:src:proto:policy

View per-ethernet frame operations:
#diag sniffer packet

View object dependencies:
# diagnose sys checkused firewall.address:name 'SSLVPN_TUNNEL_ADDR1'
# diagnose sys checkused firewall.address:name 'iPhoneVPN_range'
# diagnose sys checkused firewall.address:name 'Local LAN'
# diagnose sys checkused system.interface:name  <interface name>



Debug

Sniffer - URL https://gateIP/ng/page/p/firewall/sniffer/

Sniff packets like tcpdump does. This can be used for investigating connection problems between two hosts. There are no details of the firewall policy decisions. Use the debug flow (next paragraph) for analysis about firewall policies, etc.
with:
verbose:
1: print header of packets
2: print header and data from ip of packets
3: print header and data from ethernet of packets (if available)
4: print header of packets with interface name
5: print header and data from ip of packets with interface name
6: print header and data from ethernet of packets (if available) with intf name

count: number of packets
time-format:
a: UTC time
l: local time
Examples: (Thanks to the comment from Ulrich for the IPv6 example)

Here are two more examples on how to show LLDP or CDP packets in order to reveal the connected layer 2 ports from switches. Kudos to Joachim Schwierzeck.
For more information on how to capture and then convert the date to pcap file please follow this link:
https://kb.fortinet.com/kb/documentLink.do?externalID=11186&languageId

Flow

If you want to see the FortiGate details about a connection, use this kind of debug. E.g., it shows the routing decision and the policy, which allowed the connection.
Example:

 

VPN

To show details about IKE/IPsec connections, use these commands:
To debug IKE/IPsec sessions, use the VPN debug:
To reset a certain VPN connection, use :

Log

For investigating the log entries (similar to the GUI), use the following filters, etc.:


Defaults

Just a reminder for myself:
  • IP: 192.168.1.99
  • Login: admin
  • Password: <blank>
To change the IP address of the mgmt interface (or any other) via the CLI, these commands can be used:
#diag debug <option>  <level>

Options:
application - Application
cli - debug cli
console
crashlog - crash log info
disable
flow - trace packet flow
haproxy
info - show active debug level settings
report - report for tech support
reset - reset all debug level to default

Capture TCP packets with SYN flag set on
# diagnose sniffer packet  any 'port 80 and tcp[13]&2==2' 4






// Health and Status

show [enter]               //Note that output is only non-default values.

show full-configuration   // Show all configurations on the device.

show system interface wan1 | grep -A2 ip // Show WAN and interface information.

get system info admin status // Show logged in users

get system status            // Show system hardware/software update versions

get hardware status          // Detailed hardware model information

get system performance status

get system performance top

show system interface // Interface Configuration



DEBUG





diagnose hardware deviceinfo nic // Interface Statistics/Settings

diagnose hardware sysinfo memory

diag debug crashlog read

diag hardware sysinfo shm     // Device should be in 0, if (>0) then conserve mode

get system global | grep -i timer    // Show tcp and udp timers for half open and idle

get system session-ttl     // System default tcp-idle session timeout

execute ha manage <devid>    // send heartbeat across management link.

get hardware nic

diagnose ip address list

get system interface physical // ARP

diagnose ip arp list // Track and Troubleshoot

get system session status      // Connection count for ingress/egress

get system session-info full-stat    // Displays session status with breakdown by state

get system session list       // Session list, protocol, expire, src nat, dst nat

diag sys session              // Basic output with no filters of diag sys session

diag sys session filter <option> <value>      // Capture filter based on src, dst, duraction, policy id, vd // Packet capture

diag debug info     // Displays active debug

diag debug enable     // Enable debug

#diagnose debug flow filter (shows what filters are configured)

#diagnose debug flow filter clear (clear all filter)

#diagnose debug flow filter <options> <value> (configures the filter)

#diagnose debug flow show con enable <show output on console>

#diagnose debug flow show fun enable <show functions>

#diagnose debug flow trace start <number of lines> (to start the trace)

#diagnose debug flow trace stop (to stop the trace)

Example:

diagnose debug reset

diagnose debug enable

diagnose debug flow filter clear

diagnose debug flow filter saddr 192.168.10.1

diagnose debug flow filter dport 80

diagnose debug flow show con enable

diagnose debug flow show fun enable

diagnose debug flow trace start 20

diagnose sniffer packet <interface or ANY> ‘<arguments>’ <level 1-6>

example:

diagnose sniffer packet ANY ‘net 192.168.10.0/24 and not host 192.168.10.1 and port 80 and TCP’ 6

Syn packets only:

diag sniffer packet internal ‘tcp[13] == 2′



 Enable packet capture in GUI - System -> Config -> Advanced

Setup packet capture filter, Check box to start, Uncheck to stop.

Download Debug Log

// Show identified devices

diag user device list



Routing

diagnose ip rtcache list // rt cache table





Interface Up -> Multiple: Select lowest distance -> Dynamic: If same distance choose lowest metric -> Dynamic: If multiple have same distance/metric, depends on protocol -> All “Best Routes” places in table. Match goes to most exact subnet -> Policy routing applied before table lookups.

Route lookups are only for the first packet of each session.

All packets will use same path.

After topology change, routes are flushed and sessions relearned.

get system arp          // ARP Table

get router info routing-table all       // All routing table entries



get router info routing-table details <ip>         // Shows if custom static or dynamic routes exist for dest.

get router info kernel             // Raw kernel routing table

show router static    // Display static routes

show router policy //



Restore image

execute restore image <firmware_file_name> <TFTP server_ipaddress>    // Restore an image from TFTP



Provisioning

config system settings        // Configure for layer-3

set opmode nat

end

config system settings       // Configure transparent

set opmode transparent

end

config system global         // Set port for admin if VPN is sharing

set admin-sport 8443

set sslvpn-sport 443

end

config system global        // Enable SCP

set admin-scp enable

cofng system ntp            // Setup NTP

config ntpserver

edit 1

set server 10.0.0.0

end

edit 2

set server 10.0.0.1

end

set ntpsync enable

end

execute time

config system dns          // Setup DNS

set primary  0.0.0.0

set secondary 0.0.00

config log syslogd(2|3) setting     // Enable syslog

set status enable

set server <IP address>

set port 514

set facility user

end

diagnose log test     // Test logging

config system interface          // Setup IP Address

edit wan1

set mode static

set ip 172.16.0.0 255.255.255.0

set vlan id 50

end

config system interface          // LACP port aggregation

edit aggr1

set member “port8″ “port9″

end

config system zone             // Add interfaces to zone

edit outside

set interface internal1 internal 2

enable intrazone traffic

set intrazone allow

end

config router static       // Add default route

edit 1

set gateway 172.16.0.0

end

config router static       // Static route

edit2

set device port1

set dst 10.0.0.0 255.0.0.0

set gateway 10.0.1.1

// Vendor Notes

http://docs.fortinet.com/fgt.html

http://docs.fortinet.com/fgt/handbook/40mr3/fortigate-cli-40-mr3.pdf

http://docs.fortinet.com/fgt50.html

Monday, 16 May 2016

vSphere Client on Windows Server 2008

VmWare vSphere Client 5.5

If you try to run the installer as usual you would get an error complaining that you are not permitted to install the client on a DC.
But I can't access my esxi box from Linux so I do need to RDP to the windows box in order to manage my VM's.
To get around this as with many installers just silence the OS check of the installer by running it from the CMD with the following switch:
/VSKIP_OS_CHECKS="1"


Next you would be prompted to install .Net framework if you haven't already done so and reboot the server once the installation completes.


Now at this point I had to run the installer again inc. the switch from the command prompt.












Result !!






Sunday, 15 May 2016

Minicom for serial console connections

Mini ...what?

Every now and again  I fail to ssh to various device that being a server, firewall box or a random router. The only option at this time is to get physical access to the box and plug my trusty serial pl2303 connector.
At work is straightforward as I use putty on Windows box, but at home I use Ubuntu so the only option that I know of is to use a utility call minicom.
I keep forgeting how to do it as don't have to do it very often  so here's my reminder.

  • Install Minicom
      • sudo apt-get install minicom
  • Find out which connection is being used by your serial cable by executing  the command below
      • george@uc:~$ dmesg  | grep tt
      • [    0.000000] Found optimal setting for mtrr clean up
        [    0.000000] console [tty0] enabled
        [    0.212709] vgaarb: setting as boot device: PCI:0000:00:02.0
        [    0.641198] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1
        [    0.641202] ACPI: Power Button [PBTN]
        [    0.641244] input: Sleep Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input2
        [    0.641247] ACPI: Sleep Button [SBTN]
        [    0.641288] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input3
        [    0.641291] ACPI: Power Button [PWRF]
        [    0.654926] ACPI: Battery Slot [BAT0] (battery present)
        [    0.697515] evm: HMAC attrs: 0x1
        [    0.698208] rtc_cmos 00:02: setting system clock to 2016-05-14 21:26:40 UTC (1463261200)
        [    0.988132] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giomtti <giometti@linux.it>
        [    1.030838] tg3 0000:0a:00.0 eth0: attached PHY is 5761 (10/100/1000Base-T Ethernet) (WireSpeed[1], EEE[0])
        [    1.373946] sd 0:0:0:0: Attached scsi generic sg0 type 0
        [    1.416301] sd 0:0:0:0: [sda] Attached SCSI disk
        [    1.734473] sr 1:0:0:0: Attached scsi CD-ROM sr0
        [    1.734574] sr 1:0:0:0: Attached scsi generic sg1 type 5
        [    7.568508] systemd[1]: Created slice system-getty.slice.
        [    7.568525] systemd[1]: Starting system-getty.slice.
        [ 1559.436187] usb 2-1.3: pl2303 converter now attached to ttyUSB0
        [ 1626.066967] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
        [ 1629.436887] usb 2-1.4: pl2303 converter now attached to ttyUSB0
        [ 1788.507218] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
        [ 1791.877138] usb 2-1.4: pl2303 converter now attached to ttyUSB0
        [ 2373.961110] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
        [ 2376.303718] usb 2-1.4: pl2303 converter now attached to ttyUSB0
        [ 2517.698598] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
        [ 2523.630796] usb 2-1.3: pl2303 converter now attached to ttyUSB0
  • From the output above I can see that my cable is attached to ttyUSB0 
  • It's time to configure Minicom
      • george@uc:~$ sudo minicom -s -c on
    • You should now see the config window as below


  • Select the Serial port setup and press A to change the port
    • Now this will depend on individual set up but in my case I need to change the port to /dev/ttyUSB0
  • Select E and change the baud rate to 9600


  • Save the setup as DFL and exit minicom
  • Now run 
    • sudo minicom
  • You should now be able to connect to your device if you press the spacebar a couple of times 
  • I just tried it with putty on my Ubuntu box and it worked as well as with minicom , some of you may find it a bit more intuitive by using putty


Now what was the password for that box ????



Tuesday, 3 May 2016

Cisco IOS Voice Gateway

Here's some of my quick reference CLI commands for troubleshooting and testing Cisco Voice Gateway

Which ISDN channels are in service
VG224#sh isdn service

To show which rule is matched
VG224#test voice translation -rule 10 XXXXXX

How to monitor Cisco Unity with RTMT

One way to find out what's going on with your Unity box is to use standard tool such as RTMT.
  • Download the tool from the Plugins section of your call manager.
  • Once all set up login to RTMT with your normal admin account
  • Navigate to Unity Connection> Port Monitor



  • You should now be able to see all your ports as configured in CUC

  • At this point to see the result press the Msg button on your phone and login to your mailbox
  • You should be able to see now in information in real-time as users dial in and access the server



Thursday, 28 May 2015

iPBX installation on Ubuntu 14.04 -Guide by Nerd Vittle

Here are the steps to get Ubuntu 14.04 humming on your new server or virtual machine once you’ve booted up. If you can bake cookies from a recipe, you can do this:

UBUNTU mini.iso install:
Choose language
Choose timezone
Detect keyboard
Hostname: incrediblepbx < continue >
Choose mirror for downloads
Confirm archive mirror
Leave proxy blank unless you need it < continue >
** couple minutes of whirring as initial components are loaded **
New user name: incredible < continue >
Account username: incredible < continue >
Account password: makeitsecure < continue >
Encrypt home directory < no >
Confirm time zone < yes >
Partition disks: Guided - use entire disk and set up LVM
Confirm disk to partition
Write changes to disks and configure LVM
Whole volume? < continue>
Write changes to disks < yes> < -- last chance to preserve your disk drive!
** about 15 minutes of whirring during base system install ** < no touchy anything>
** another 5 minutes of whirring during base software install ** < no touchy anything>
Upgrades? Install security updates automatically
** another 5 minutes of whirring during more software installs ** < no touchy anything>
Software selection: *Basic Ubuntu server (only!)
** another couple minutes of whirring during software installs ** < no touchy anything>
Grub boot loader: < yes>
UTC for system clock: < no>
Installation complete: < continue> after removing installation media
** on VirtualBox, PowerOff after reboot and remove [-] mini.iso from Storage Tree & restart VM
login as user: incredible
** enter user incredible's password **
sudo passwd
** enter incredible password again and then create secure root user password **
su root
** enter root password **
apt-get update
apt-get install ssh -y
sed -i 's|without-password|yes|' /etc/ssh/sshd_config
sed -i 's|yes"|without-password"|' /etc/ssh/sshd_config
sed -i 's|"quiet"|"quiet text"|' /etc/default/grub
update-grub
ifconfig
** write down the IP address of your server from ifconfig results
reboot
** login via SSH to continue **
Installing Incredible PBX on Your Ubuntu 14.04 Server
Adding Incredible PBX to a running Ubuntu 14.04 server is a walk in the park. To restate the obvious, your server needs a reliable Internet connection to proceed. Using SSH (or Putty on a Windows machine), log into your new server as root at the IP address you deciphered in the ifconfig step at the end of the Ubuntu install procedure above. First, make sure to run the update step for Ubuntu before you begin the install. This is especially important if using a cloud-based Ubuntu 14 server.
apt-get update && apt-get upgrade -y && reboot
WARNING: If you’re using a 512MB droplet at Digital Ocean, be advised that their Ubuntu setup does NOT include a swap file. This may cause serious problems when you run out of RAM. Uncomment ./create-swapfile-DO line below to create a 1GB swap file which will be activated whenever you exceed 90% RAM usage on Digital Ocean.
Now let’s begin the Incredible PBX install. Log back in as root and issue the following commands:
cd /root
wget http://incrediblepbx.com/incrediblepbx11.4.ubuntu14.tar.gz
tar zxvf incrediblepbx*
#./create-swapfile-DO
./Incredible*
Once you have agreed to the license agreement and terms of use, press Enter and go have a 30-minute cup of coffee. The Incredible PBX installer runs unattended so find something to do for a bit unless you just like watching code compile. When you see “Have a nice day”, your installation is complete. Write down your admin password for FreePBX as well as your three “knock” ports for PortKnocker. If you forget them, you can reset your admin password by running /root/admin-pw-change. And you can retrieve your PortKnocker setup like this: cat /root/knock.FAQ.
Log out and back in as root and you should be greeted with a status display that looks something like this:

You can access the Asterisk CLI by typing: asterisk -rvvvvvvvvvv
You can access the FreePBX GUI using your favorite web browser to configure your server. Just enter the IP address shown in the statusdisplay. The default username is admin with the randomized password you wrote down above. If desired, you can change them in FreePBX Administration by clicking Admin -> Administrators -> admin. Enter a new password and click Submit Changes then Apply Config. Now edit extension 701 so you can figure out (or change) the randomized passwords that were set up for default 701 extension and voicemail: Applications -> Extensions -> 701.

Setting Up a Soft Phone to Use with Incredible PBX
Now you’re ready to set up a telephone so that you can play with Incredible PBX. We recommend YateClient which is free. Download it from here. Run YateClient once you’ve installed it and enter the credentials for the 701 extension on Incredible PBX. You’ll need the IP address of your server plus your extension 701 password. Choose Settings -> Accounts and click the New button. Fill in the blanks using the IP address of your server, 701 for your account name, and whatever password you created for the extension. Click OK.

Once you are registered to extension 701, close the Account window. Then click on YATE’s Telephony Tab and place some test calls to the numerous apps that are preconfigured on Incredible PBX. Dial a few of these to get started:
123 - Reminders
222 - ODBC Demo (use acct: 12345)
947 - Weather by ZIP Code
951 - Yahoo News
*61 - Time of Day
*68 - Wakeup Call
TODAY - Today in History
Now you’re ready to connect to the telephones in the rest of the world. If you live in the U.S., the easiest way (at least for now) is to use an existing (free) Google Voice account. Google has threatened to shut this down but as this is written, it still works with previously set up Google Voice accounts. The more desirable long-term solution is to choose several SIP providers and set up redundant trunks for your incoming and outbound calls. The PIAF Forum includes dozens of recommendations to get you started.

Configuring Google Voice
If you want to use Google Voice, you’ll need a dedicated Google Voice account to support Incredible PBX. If you want to use the inbound fax capabilities of Incredible Fax 11, then you’ll need an additional Google Voice line that can be routed to the FAX custom destination using FreePBX. The more obscure the username (with some embedded numbers), the better off you will be. This will keep folks from bombarding you with unsolicited Gtalk chat messages, and who knows what nefarious scheme will be discovered using Google messaging six months from now. So keep this account a secret!
We’ve tested this extensively using an existing Google Voice account, and inbound calling is just not reliable. The reason seems to be that Google always chooses Gmail chat as the inbound call destination if there are multiple registrations from the same IP address. So, be reasonable. Do it our way! Use a previously configured and dedicated Gmail and Google Voice account, and use it exclusively withIncredible PBX 11.
IMPORTANT: Be sure to enable the Google Chat option as one of your phone destinations in Settings, Voice Setting, Phones. That’s the destination we need for The Incredible PBX to work its magic! Otherwise, all inbound and outbound calls will fail. If you don’t see this option, you’re probably out of luck. Google has disabled the option in newly created accounts as well as some old ones that had Google Chat disabled. Now go back to the Google Voice Settings.
While you’re still in Google Voice Settings, click on the Calls tab. Make sure your settings match these:
Call Screening – OFF
Call Presentation – OFF
Caller ID (In) – Display Caller’s Number
Caller ID (Out) – Don’t Change Anything
Do Not Disturb – OFF
Call Options (Enable Recording) – OFF
Global Spam Filtering – ON
Click Save Changes once you adjust your settings. Under the Voicemail tab, plug in your email address so you get notified of new voicemails. Down the road, receipt of a Google Voice voicemail will be a big hint that something has come unglued on your PBX.
One final word of caution is in order regardless of your choice of providers: Do NOT use special characters in any provider passwords, or nothing will work!

Now you’re ready to set up your Google Voice trunk in FreePBX. After logging into FreePBX with your browser, click the Connectivity tab and choose Google Voice/Motif. To Add a new Google Voice account, just fill out the form. Do NOT check the third box or incoming calls will never ring!

IMPORTANT LAST STEP: Google Voice will not work unless you restart Asterisk from the Linux command line at this juncture. Using SSH, log into your server as root and issue the following command: amportal restart.
If you have trouble getting Google Voice to work (especially if you have previously used your Google Voice account from a different IP address), try this Google Voice Reset Procedure. It usually fixes connectivity problems. If it still doesn’t work, enable Less Secure Apps using this Google tool.
SIP Gateways for Google Voice — GVsip and Simonics
Troubleshooting Audio and DTMF Problems
You can avoid one-way audio on calls and touchtones that don’t work with these simple settings in FreePBX: Settings -> Asterisk SIP Settings. Just plug in your public IP address and your private IP subnet. Then set ULAW as the only Audio Codec.

Adding Speech Recognition to Incredible PBX
To support many of our applications, Incredible PBX has included Google’s speech recognition service for years. These applications include Weather Reports by City (949), AsteriDex Voice Dialing by Name (411), and Wolfram Alpha for Asterisk (4747), all of which use Lefteris Zafiris’ terrific speech-recog AGI script. Unfortunately (for some), Google now has tightened up the terms of use for their free speech recognition service. Now you can only use it for “personal and development use.” If you meet those criteria, keep reading. Here’s how to activate speech recognition on Incredible PBX. Don’t skip any steps!
1. Using an existing Google/Gmail account to join the Chrome-Dev Group.
2. Using the same account, create a new Speech Recognition Project.

3. Click on your newly created project and choose APIs & auth.
4. Turn ON Speech API by clicking on its Status button in the far right margin.

5. Click on Credentials in APIs & auth and choose Create New Key -> Server key. Leave the IP address restriction blank!

6. Write down your new API key or copy it to the clipboard.
7. Log into your server as root and issue the following commands:
# for Ubuntu and Debian platforms
apt-get clean
apt-get install libjson-perl flac -y
# for RedHat and CentOS platforms
yum -y install perl-JSON
# for all Linux platforms
cd /var/lib/asterisk/agi-bin
mv speech-recog.agi speech-recog.last.agi
wget --no-check-certificate https://raw.githubusercontent.com/zaf/asterisk-speech-recog/master/speech-recog.agi
chown asterisk:asterisk speech*
chmod 775 speech*
nano -w speech-recog.agi
8. When the nano editor opens, go to line 70 of speech-recog.agi: my $key = "". Insert your API key from Step #6 above between the quotation marks and save the file: Ctrl-X, Y, then Enter.
Now you’re ready to try out the speech recognition apps. Dial 949 and say the name of a city and state/province/country to get a current weather forecast from Yahoo. Dial 411 and say “American Airlines” to be connected to American.
To use Wolfram Alpha by phone, you first must install it. Obtain your free Wolfram Alpha APP-ID here. Then run the one-click installer: /root/wolfram/wolframalpha-oneclick.sh. Insert your APP-ID when prompted. Now dial 4747 to access Wolfram Alpha by phone and enter your query, e.g. “What planes are overhead.” Read the Nerd Vittles tutorial for additional examples and tips.
A Few Words about the Incredible PBX Security Model for Ubuntu
Incredible PBX for Ubuntu 14 is our most secure turnkey PBX implementation, ever. As configured, it is protected by both Fail2Ban and a hardened configuration of the IPtables Linux firewall. As configured, nobody can access your PBX without  your credentials AND  an IP address that is either on your private network or that matches the IP address of your server or the PC from which you installed Incredible PBX. Incredible PBX is preconfigured to let you connect to many of the leading SIP hosting providers without additional firewall tweaking.
You can whitelist additional IP addresses for remote access in several ways. First, you can use the command-line utilities: /root/add-ipand /root/add-fqdn. You can also remove whitelisted IP addresses by running /root/del-acct. Second, you can dial into extension 864 (or use a DID pointed to extension 864 aka TM4) and enter an IP address to whitelist. Before Travelin’ Man 4 will work, you’ll need to add credentials for each caller using the tools in /root/tm4. You must add at least one account before dial-in whitelisting will be enabled. Third, you can temporarily whitelist an IP address by successfully executing the PortKnocker 3-knock code established for your server. You’ll find the details and the codes in /root/knock.FAQ. Be advised that IP addresses whitelisted with PortKnocker (only!) go away whenever your server is rebooted or the IPtables firewall is restarted. For further information on the PortKnocker technology and available clients for iOS and Android devices, review the Nerd Vittles tutorial.
HINT: The reason that storing your PortKnocker codes in a safe place is essential is because it may be your only available way to gain access to your server if your IP address changes. You obviously can’t use the command-line tools to whitelist a new IP address if you cannot gain access to your server at the new IP address.
We always recommend you also add an extra layer of protection by running your server behind a hardware-based firewall with no Internet port exposure, but that’s your call. If you use a hardware-based firewall, be sure to map the three PortKnocker ports to the internal IP address of your server!
The NeoRouter VPN client also is included for rock-solid, secure connectivity for remote users. Read our previous tutorial for setup instructions.
As one would expect, the IPtables firewall is a complex piece of software. If you need assistance configuring it, visit the PIAF Forum for some friendly assistance.
Adding Incredible Fax 11 to Your Server
Once you’ve completed the Incredible PBX install, log out and log back in to load the latest automatic updates. Then reboot. Now you’re ready to continue your adventure by installing Incredible Fax 11 for Ubuntu. Special thanks to Josh North for all his hard work on this! The latest download includes the Incredible Fax 11 installer. So just run the script:
cd /root
./incrediblefax11_ubuntu14.sh
Accept all of the defaults during the installation process. IMPORTANT: Once you complete the install, reboot your server. After rebooting, log into FreePBX -> Module Admin and enable the AvantFax module. When you log out of FreePBX, there now will be an option for AvantFax on the FreePBX login screen. Choose it and enter admin:password to login and change your default password. You also can set your AvantFax admin password by logging into the Linux CLI and… /root/avantfax-pw-change.
Incredible Backup and Restore
We’re pleased to introduce our latest backup and restore utilities for Incredible PBX. Running /root/incrediblebackup will create a backup image of your server in /tmp. This backup image then can be copied to any other medium desired for storage. To restore it to another Incredible PBX 11 server, simply copy the image to a server running Asterisk 11 and FreePBX 2.11 and run/root/incrediblerestore. Doesn’t get much simpler than that.
NEWS FLASH: More good news. If you decide you’d prefer another Linux platform, Incredible Backup and Restore will now let you migrate from one operating system to another. For details on the procedure, see this message thread.
Incredible PBX Automatic Update Utility
Every time you log into your server as root, Incredible PBX will ping the IncrediblePBX.com web site to determine whether one or more updates are available to bring your server up to current specs. We recommend you log in at least once a week just in case some new security vulnerability should come along.
In the meantime, we encourage you to sign up for an account on the PIAF Forum and join the discussion. In addition to providing first-class, free support, we think you’ll enjoy the camaraderie. Come join us!

Originally published: Monday, June 30, 2014    Updated: Wednesday, January 7, 2015
Support Issues. With any application as sophisticated as this one, you’re bound to have questions. Blog comments are a terrible place to handle support issues although we welcome general comments about our articles and software. If you have particular support issues, we encourage you to get actively involved in thePBX in a Flash Forums. It’s the best Asterisk tech support site in the business, and it’s all free! Please have a look and post your support questions there. Unlike some forums, ours is extremely friendly and is supported by literally hundreds of Asterisk gurus and thousands of users just like you. You won’t have to wait long for an answer to your question.

Need help with Asterisk? Visit the PBX in a Flash Forum.

New Vitelity Special. Vitelity has generously offered a new discount for PBX in a Flash users. You now can get an almost half-price DID from our special Vitelity sign-up link. If you’re seeking the best flexibility in choosing an area code and phone number plus the lowest entry level pricing plus high quality calls, then Vitelity is the hands-down winner. Vitelity provides Tier A DID inbound service in over 3,000 rate centers throughout the US and Canada. And, when you use our special link to sign up, the Nerd Vittles and PBX in a Flash projects get a few shekels down the road while you get an incredible signup deal as well. The going rate for Vitelity’s DID service is $7.95 a month which includes up to 4,000 incoming minutes on two simultaneous channels with terminations priced at 1.45¢ per minute. Not any more! For PBX in a Flash users, here’s a deal you can’t (and shouldn’t) refuse! Sign up now, and you can purchase a Tier A DID with unlimited incoming calls for just $3.99 a month. To check availability of local numbers and tiers of service from Vitelity, click here. Do not use this link to order your DIDs, or you won’t get the special pricing! Vitelity’s rate is just 1.44¢ per minute for outbound calls in the U.S. There is a $35 prepay when you sign up. This covers future usage and any balance is fully refundable if you decide to discontinue service with Vitelity.

Some Recent Nerd Vittles Articles of Interest…

Be Sociable, Share!



inShare

With some providers including ones linked in this article, Nerd Vittles receives referral fees which assist in keeping the Nerd Vittles lights burning brightly. [↩]
Posted in Technology, Telephony by ward, Wednesday, January 7, 2015 4:00 am
Tags: asterisk, fax, freepbx, google voice, gvoice, IncrediblePBX, twitter, voip
20 Responses to “30 Minutes to Paradise: Incredible PBX for Ubuntu 14.04 is Ready for Primetime”

Eric
Monday, June 30, 2014 at 8:12 am
See what happens when your (Me) too stupid to say no!
If you want to completely automate the upgrades go to https://help.ubuntu.com/10.04/serverguide/automatic-updates.html this explains how to do it. It can be set to email when it has installed updates. Sorry I’m lazy and forgetful!
Glad to see all my efforts go to good use!
Skavoovie
Monday, June 30, 2014 at 12:52 pm
A quick fix to allow PHP5.5+ to accept both the PHP short tag and the long tag ( <? vs. <?php ):
/etc/php.ini:
short_open_tag = On
Restart Apache and done.
AlfaNerd
Wednesday, July 2, 2014 at 1:14 pm
I tried your installation instructions on a pre-built ubuntu 14 server in the cloud and it does not function. I’m guessing there are some prerequisites to the server instance including php and mysql being installed.
I cannot run (or even find) the asterisk binary but any attempt to rerun the installation scripts results in a message “Incredible PBX is already installed.”
Can I recover from this?
[WM: You didn’t mention which cloud provider you were using. Works flawlessly on Digital Ocean. We would need a good bit more information to troubleshoot what went wrong. That’s what the PIAF Forum is there for. We install the LAMP stack as part of the Incredible PBX installation procedure so that’s not the problem. You can attempt to rerun the installer and see where the install is failing. Just delete /etc/pbx/.incredible, and you’re good to go. ]
Bob
Thursday, July 3, 2014 at 10:42 am
So glad to see Ubuntu available for PBX in a Flash! Thanks Ward :)
Steve
Friday, July 11, 2014 at 2:37 am
I seem to be unable to find Google’s Speech Recognition in the api-list.
Any ideas, whether it is still available for new users at all?
[WM: It is still available, but the license has changed a bit. Read the Adding Speech Recognition tutorial in this article. It will walk you through setting it up. Did you skip the first step??
Marcelo
Monday, July 14, 2014 at 8:36 am
Came to the site to see if PIAF was being supported on CentOS7 and found out the great news that I can now have all Ubuntu VMs on my servers.
Still don’t understand why setting up and maintaining a ppa repository would not be a better approach. Yes, you mentioned the preference to compiling Asterisk from source but is it really a smart tradeoff to lose all the great work a package manager can offer for free – fast security updates included?
[WM: Nothing in our build precludes enabling automatic security updates with Ubuntu. And Incredible PBX handles automatic security updates for Asterisk and any other problems we spot.]
Slambers
Wednesday, July 16, 2014 at 4:08 am
‘The Incredible PBX installer runs unattended so find something to do for the next 30 minutes unless you just like watching code compile. When you see “Have a nice day”, your installation is complete.’
In between the above stages, I get a load of questions I don’t know the answer to:
‘Enter your USERNAME to connect to the ‘asterisk’ database:
Enter your PASSWORD to connect to the ‘asterisk’ database:
Enter the hostname of the ‘asterisk’ database:
Enter a USERNAME to connect to the Asterisk Manager interface:
Enter a PASSWORD to connect to the Asterisk Manager interface:’
Is this normal behaviour, and if so, what am I supposed to be entering?
[WM: Sounds like you’re either using the wrong version of Ubuntu or you skipped the initial (required) update, upgrade, and reboot steps. Follow the tutorial exactly, and you shouldn’t have any problems. Still works as advertised for us.]
Josh
Thursday, July 24, 2014 at 3:07 pm
The Google Voice section still mentions FAX capabilities, but I don’t see how I can use Incredible Fax on the Ubuntu installation with the method on this page. Is that just leftover from a copy/paste from other tutorials or am I missing something?
[WM: Thanks for the heads up, Josh. We’ll have a look. Running a little low on people with paddles at the moment, but we’ll get it squared away… soon. Ubuntu is still very much a testing platform. If you need a production-ready system, switch to Incredible PBX with PIAF-Green and FreePBX 2.11 on the CentOS 6.5 platform.]
Josh
Saturday, July 26, 2014 at 10:51 pm
Thanks so much for the reply! It’s purely experimental for me currently, my production clients use a mix of “real” PIAF or custom asterisk boxes, quite frankly the only reason I am testing this version is that I prefer Apt to Yum :)
I might see if I can play around with porting over incredfax over the next couple of weekends on my own for kicks.
Thanks for all your work on this!
[WM: Thanks, Josh. Wrestling with Incredible Fax would be a huge help. Come join the forum!]
Bill Dengler
Wednesday, August 6, 2014 at 1:16 am
I installed the preview. How can I upgrade without reinstalling/reconfiguring everything? Do I simply run your new installer?
[WM: Download and untar Incredible Backup 11 for Ubuntu, make a backup, and copy it from /tmp to your desktop. Install the newest version, copy the backup image to /tmp, and run /root/incrediblerestore.]
zhando
Thursday, August 7, 2014 at 2:26 pm
Waiting for approval at the forum. So I’ll try here.
First, thank you for developing this ubuntu install of incrediblepbx.. I much prefer this over the old CentOS implementation.
I’ve been messing with this ubuntu installation on a cubox-i2ex for my simple soho installation. It’s looking promising..
While I’ve been studying the hiccups on the cubox-i, I’ve been using the ubuntu preview on an x86 box – two providers, handful of extensions.. Been pretty good so far.
One problem on BOTH platforms that is driving me nuts: the install scripts breaks the OS reboot/shutdown. Short of cycling power, I can’t reboot or shutdown either the x86 or arm boxes. Anyone experience this? Suggestions?
[WM: Try this!]
cd /root
wget --no-check-certificate https://raw.githubusercontent.com/joshnorth/UbuntuPIAF/master/FixIncrediblePBXMySQL.sh
chmod +x FixIncrediblePBXMySQL.sh
./FixIncrediblePBXMySQL.sh
zhando
Friday, August 8, 2014 at 3:39 pm
Ward,
Thanks for the tip. It seems to work. That one was driving me crazy..
Looking through the install script – it downloads knockd from the debian repos. Why not just use the Ubuntu trusty universe repo?
No need then to dl libpcap and test for 32/64 bit..
[WM: Thank you for the tip! As time permits, we’ll rework it to incorporate your suggestion.]
Anthony McCarhy
Sunday, August 17, 2014 at 12:23 pm
Awesome installation of piaf on ubuntu!
I see above some people are confused between updates and upgrades.
After installing 14.04 you recommend the following command as root:
apt-get update && apt-get upgrade -y && reboot
This works fine for those using an older version of ubuntu.
However, when 14.10 is released in October, the upgrade typically breaks lots of stuff, and very likely will break Incredible PBX also.
I suggest you put a caveat about the October upgrade to 14.10 – and give people a heads up.
[WM: Thanks, Anthony. Still an Ubuntu newbie here. We’ll update the article and remove the upgrade component. We initially had problems, but it may have been because we didn’t run update or upgrade. In any case, you’re absolutely right. We’ve learned the hard way with CentOS upgrades. No need to reinvent the wheel.]
Ryan
Wednesday, September 3, 2014 at 3:46 pm
Awesome!! Glad to see this guide!
Unfortunately, I tried to run the install on a Digital Ocean droplet that I host my web applications on and ran into some problems.
I tried the brand new Vultr.com hosting solution, fired up a new VPS for 5 bucks and better specs than D.O., and voila — the install worked flawlessly.
FYI, the problem I ran into on D.O. had to do with PHP loading a blank page when visiting my IP. Probably because of my own preconfigurations though.
Thanks again.
dny
Sunday, September 7, 2014 at 8:33 am
how can i connect multiple pbx (like branch offices) ??
[WM: Visit the PIAF Forum. There are numerous ways.]
Eric
Sunday, September 14, 2014 at 12:18 am
Hello,
Sorry if I am confused. Is fax available (specifically on the rentpbx version of Incredible Pbx for Ubuntu 14) I see references on the CuBox Ubuntu, and of course in the Incredible PBX 11… but am stumped as to installation on what i have. I saw an earlier note to consider piaf green/centos… but not sure if that was specific to fax or something else…. Thanks!!!
[WM: It’s still experimental but Josh North appears to have tamed the fax beast on Ubuntu. Here’s the link.]
Tevor
Tuesday, September 16, 2014 at 7:52 am
I am wondering if this will work with a web server installed as well on the computer. I am running a web server using Ubuntu server 14.04.
I have tried freepbx but crashed and never played nice with my setup, So i had to restore my server.
[WM: Not a good idea to do web hosting and VoIP telephony on the same box.]
Christian
Friday, September 26, 2014 at 7:02 pm
After the installation, i can only login to webmin and not the the gui. Is there something i have to do or is it running on a non standard port? Thanks.
[WM: Take another look at the tutorial. Did you set up an admin password??]
Peter
Tuesday, September 30, 2014 at 8:52 pm
I noticed that the IPTables allow access from 10.0.0.0/8 and 192.168.0.0/16 but 172.16.0.0/12 is not allowed. Is it easy to add a whole subnet?
WM: We disabled this because of a reported problem on Amazon EC2. But it’s easy to enable it again. Just issue the following commands. Or you could add a subnet directly by editing /etc/iptables/rules.v4 and restarting IPtables. Just be sure to use our iptables-restart script so that IPtables doesn’t end up disabled if you make a coding error!
sed -i 's|#-A INPUT -s 172.16.0.0/12|-A INPUT -s 172.16.0.0/12|' /etc/iptables/rules.v4
iptables-restart
Nerd Uno
Wednesday, October 29, 2014 at 5:04 am
Just a heads up that Ubuntu has released 14.10. For the time being, stick with 14.04 LTS. There are a few wrinkles to iron out with 14.10.
← Lessons Learned: Getting Started in the Billion Dollar VoIP Business
An Open Letter to Sangoma: Here’s to a New Beginning in 2015 →
RSS Entries RSS | Comments RSS
Now Visiting:  
Stats by whos.amung.us
 




free counters
Nerd Vittle