Show some LOVE, LIKE our page :)

Wednesday, November 19, 2014

Limiting calls by DIDs for FreePBX users, with dynamic configurable parameters

Image Source: http://appcrawlr.com/android-apps/best-apps-restrict-access

So, we had this challenge by our customer to do this as they are using PRI and supporting multiple customers. Each customer needs to be limited to n number of channels on PRI. When they were using analog that was simply straightforward, its a physical line, so nothing much you can do about “limiting” it is limited by design!

The following guide allows you to limit calls based on

  • A single DID
  • A group of DIDs (in this guide the amount of DIDs per group is limited to 5, add more, improv as you wish)
  • Group DIDs will be a union meaning, if you have DID1 and DID2 with limit of 3 calls, at any one time either calls coming to those DIDs are added up and if exceed 3, it will hangup.

Anyway, here’s a quick how-to to give you an idea how to go about it. Improv as you see fit :-)

Requirements: (my system)

1) FreePBX 2.10 or 2.11
2) Asterisk 1.8 or higher
3) Dahdi based PRI or SIP or just about anything with the use of proper declarations (variables)
4) Use MySQL
5) Debian Wheezy
6) Adminer to run a few MySQL tasks such as creating db/tables, editing values in them etc…

So here’s how:

  1. Create a database inside MySQL called LIMITER
  2. Use adminer and paste the following codes to using the “SQL Command” feature

    USE ` LIMITER`;
    CREATE TABLE `tbl_didlimiter` (
    `group` int(255) NOT NULL AUTO_INCREMENT,
    `data` varchar(100) DEFAULT NULL,
    PRIMARY KEY (`group`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

  3. Now, we will create a user superuser with password dbgod00, paste the following codes in SQL Command again

    CREATE USER 'superuser'@'localhost' IDENTIFIED BY ‘dbgod00';
    GRANT ALL PRIVILEGES ON LIMITER.* TO 'superuser'@'localhost';
    FLUSH PRIVILEGES;

  4. Now, we edit the dialplan, the most important part! Since i use FreePBX, we use the _custom.conf to add new hacks. So that’s exactly what we are doing here, copy and paste the codes into extensions_custom.conf, like below

    #nano /etc/assterisk/extensions_custom.conf

    ;; DIALPLAN START ;;

    ;; READ ME FIRST
    ;; copyleft sanjay@astiostech.com
    ;; 1. Set trunks to use from-pstn, from-dahdi, from-zaptel OR from-trunk contexts
    ;; 2. The bold highlights may need to be changed depending on what you see in the
    ;; channel variables, most cases we see either EXTEN or FROM_DID or even CALLERID(DNID)
    ;; 3. Be sure this value is available and matching each other, in my case, the value
    ;; ${EXTEN} eventually matches the value ${CALLERID(DNID)} and they must
    ;; 4. This only supports one unique DID entry in DB. IF there are multiple entries
    ;; by mistake or whatever, it will pickout the first result that returns only
    ;;
    ;; 5. Feel free to add more G numbers as shown below, right now its just 5
    ;; 6. Maxdefault is set for global when no DB definitions are found for that DID and its limit,
    ;; if you do not want blanket settings, simply set MAXDEFAULT to blank (as per default) if you want to set a global
    ;; limit then set it with MAXDEFAULT which then applies to
    all DIDs not set in DB.
    ;; Only when
    there’s a value found in DB then that DB value’s limits overrides maxdefault 

    [from-pstn-custom]
    exten => _X.,1,NoOp(Handling incoming to do cool stuff)
    same => n,Set(GROUP()=${EXTEN})
    same => n,Macro(didchoke)

    [macro-didchoke]
    exten => s,1,NoOp(Checking for incoming limits and applying if needed)
    exten => s,n,Set(MAXDEFAULT=””)
    exten => s,n,MYSQL(Connect connid localhost superuser dbgod00 LIMITER)
    exten => s,n,MYSQL(Query resultid ${connid} SELECT data from tbl_didlimiter where data like '%${CALLERID(DNID)}%' LIMIT 1)
    exten => s,n,MYSQL(Fetch fetchid ${resultid} DBRESULT)
    exten => s,n,MYSQL(Clear ${resultid})
    exten => s,n,MYSQL(Disconnect ${connid})

    exten => s,n,ExecIf($["${DBRESULT}"=""]?Set(DBRESULT=${CALLERID(DNID)})
    exten => s,n,GotoIf($["${DBRESULT}"=""]?exception)

    ;
    exten => s,n,Set(GROUPLIMIT=${CUT(DBRESULT,:,2)})
    exten => s,n,ExecIf($["${GROUPLIMIT}"=""]?Set(GROUPLIMIT=${MAXDEFAULT})
    exten => s,n,GotoIf($["${GROUPLIMIT}"=""]?exception)
    ;
    exten => s,n,Set(DIDS=${CUT(DBRESULT,:,1)})
    exten => s,n,Set(DID1=${CUT(DIDS,\,,1)})
    exten => s,n,Set(DID2=${CUT(DIDS,\,,2)})
    exten => s,n,Set(DID3=${CUT(DIDS,\,,3)})
    exten => s,n,Set(DID4=${CUT(DIDS,\,,4)})
    exten => s,n,Set(DID5=${CUT(DIDS,\,,5)})
    ;
    exten => s,n,ExecIf($["${DID1}"!=""]?Set(G1=${GROUP_COUNT(${DID1})}))
    exten => s,n,ExecIf($["${DID2}"!=""]?Set(G2=${GROUP_COUNT(${DID2})}))
    exten => s,n,ExecIf($["${DID3}"!=""]?Set(G3=${GROUP_COUNT(${DID3})}))
    exten => s,n,ExecIf($["${DID4}"!=""]?Set(G4=${GROUP_COUNT(${DID4})}))
    exten => s,n,ExecIf($["${DID5}"!=""]?Set(G5=${GROUP_COUNT(${DID5})}))
    ;
    exten => s,n,ExecIf($["${DID1}"=""]?Set(G1=0)
    exten => s,n,ExecIf($["${DID2}"=""]?Set(G2=0)
    exten => s,n,ExecIf($["${DID3}"=""]?Set(G3=0)
    exten => s,n,ExecIf($["${DID4}"=""]?Set(G4=0)
    exten => s,n,ExecIf($["${DID5}"=""]?Set(G5=0)
    ;
    exten => s,n,Set(TOTALGGROUPCHANS=$[${G1}+${G2}+${G3}+${G4}+${G5}])
    exten => s,n,NoOp(So total channels here are ${TOTALGGROUPCHANS} of GROUPLIMIT of ${GROUPLIMIT})
    exten => s,n,GotoIf($["${TOTALGGROUPCHANS}" > "${GROUPLIMIT}"]?overlimit)
    exten => s,n,MacroExit()
    ;
    exten => s,n(overlimit),Busy(20)
    exten => s,n,Hangup(16)
    exten => s,n,MacroExit()
    ;
    exten => s,n(exception),MacroExit()

    ;; DIALPLAN END ;;

  5. Now, reload asterisk dialplan, be sure to tail the log file to start troubleshooting if things don’t go right.
    #asterisk -rx “dialplan reload”
  6. Now, edit the DB values and add DIDs like show in example below, use adminer or similar for easy editing
    E.g. 1 Format: DID1:3
    Where DID1 is DID you wish to limit to 3 channels
    E.g. 2 Format: DID1,DID2,DID3,DID4,DID5:3
    Where DID1-5 are the DIDs you wish to limit to 3 channels combined

    Here’s sample data from my own server!
    image   

Fire away, test it out…! As usual, appreciate the feedback and ideas to improve! Do let us know how it went for you!

Thursday, November 13, 2014

Setting up DHCP in a clustered (heartbeat) for Debian users

Some may want to do this in case you use a HA setup and where DHCP is required to be in HA too. Doing it via heartbeat isn’t good as it doesn’t keep track of IPs already issued and can cause long delays in providing IPs to clients should a failover/failback occur.

For document purpose we will assume the following, please take note and document the IPs as match below in the config files

  • Primary IP 10.10.10.1
  • Secondary IP 10.10.10.2
  • IP range offered to dhcp clients = from 10.10.10.20 to 10.10.10.250
  • Netmask 255.255.255.0 (class B)
  • Gateway is 10.10.10.254
  • NTP is referred to own servers and if you run NTP on the respective servers
  • Be sure if there’s a firewall to allow these servers to communicate per port 647 tcp/udp
  • Monitor the activities in /var/log/syslog
  • This config does NOT handle TFTP options, see add tftp manually if you need

 1) First, install DHCP (on both servers)

#apt-get install isc-dhcp-server

2) Setup rndc key, paste the single liner like below (on both servers)

#nano /etc/rndc.key

mydhcprndckey2014

3) Edit the dhcp defaults and ensure that the DHCP is only offering DHCP via the required interface, and in most cases may be eth0, locate work INTERFACES and add accordingly (on both servers)

#nano /etc/default/isc-dhcp-server

INTERFACES="eth0"

4) Edit the DHCPD config file as per below, change items accordingly (on master only)

#nano /etc/dhcp/dhcpd.conf

authoritative;
option domain-name "customername.internal";
option domain-name-servers 10.10.10.1,10.10.10.2;

key rndckey {
algorithm hmac-md5;
secret " mydhcprndckey2014";
}

failover peer "failover" {
primary;
address 10.10.10.1;
port 647;
peer address 10.10.10.2;
peer port 647;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
split 128;
load balance max seconds 3;
}

subnet 10.10.10.0 netmask 255.255.255.0
{
pool {
failover peer "failover";
range 10.10.10.20 10.10.10.250;
option dhcp-server-identifier 10.10.10.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
default-lease-time 43200;
max-lease-time 43200;
option routers 10.10.10.254;
deny dynamic bootp clients;
option ntp-servers 10.10.10.1;
}
allow unknown-clients;
ignore client-updates;
}

5) Restart DHCP (on master only)
#/etc/init.d/isc-dhcp-server restart

6) Edit the DHCPD config file as per below, change items in red (on slave only)

#nano /etc/dhcp/dhcpd.conf

authoritative;
option domain-name "customername.internal";
option domain-name-servers 10.10.10.2,10.10.10.1;

key rndckey {
algorithm hmac-md5;
secret "
mydhcprndckey2014";
}

failover peer "failover" {
secondary;
address 10.10.10.2;
port 647;
peer address 10.10.10.1;
peer port 647;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
load balance max seconds 3;
}

subnet 10.10.10.0 netmask 255.255.255.0
{
pool {
failover peer "failover";
range
10.10.10.20 10.10.10.250;
option dhcp-server-identifier 10.10.10.2
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
default-lease-time 43200;
max-lease-time 43200;
option routers 10.10.10.254;
deny dynamic bootp clients;
option ntp-servers 10.10.10.2;
}

allow unknown-clients;
ignore client-updates;
}

7) Restart DHCP (on slave only)
#/etc/init.d/isc-dhcp-server restart

Tuesday, October 21, 2014

POODLE SSLv3 Vulnerabilities Fixes on Debian/pfSense for common widely used apps

Systems or apps that enabled SSLv3 is vulnerable and the only way currently is to disable SSLv3 in various software, applications. Whenever you see any cert that says Version V3, it is vulnerable and must be disabled until further notice.
Ref: CVE-2014-3566

IMPORTANT

  • USETHIS GUIDE AT YOUR OWN RISK, i am not responsible for any broken apps/programs etc etc.
  • We do not know the extent of the vulnerability/fixes this is from best knowledge and effort, you are advised to research of your own too and not completely rely on these below. These methods are also described in many many online articles, i put them together mainly for our customers and people using Deb6/7.
  • This article is to be done/performed by those who have sufficient knowledge in these apps/software
  • Please read more articles and follow online security resources for updates should there be any.
  • Until a patch is released, customers are advised to simply disable SSLv3 as part of an enforced or fallback method for providing encryption.

Software that we use/distribute

1) Apache
2) Asterisk
3) Nagios (and related software)
4) pfSense and related software (e.g. OpenVPN)
5) Other related software

There are many guides out there and (i’ve) we have copied some of them for the ease of our clients

Apache fix

#nano /etc/apache2/mods-available/ssl.conf
Locate the value SSLProtocol, if it doesn’t exist, add exactly as below within the </ifmodule> tag
SLProtocol all -SSLv2 –SSLv3
if exist in that file, change as below
SLProtocol all -SSLv2 to  SLProtocol all -SSLv2 –SSLv3

Restart apache
#/etc/init.d/apache2 restart

A simple test for apache would be to run
#openssl s_client -ssl3 -connect localhost:443

It should throw an error like handshake failure, that’s good!, SSLv3 is disabled on Apache!

Asterisk fix

Read stuff here: http://downloads.asterisk.org/pub/security/AST-2014-011.html

For Asterisk 11

Go to your Asterisk 11 source directory
#cd /usr/src/asterisk-11…..
If don't exist, just download from http://downloads.asterisk.org/pub/telephony/asterisk/. NOTE: Asterisk 11.13.1 fixes this so you don’t have to patch as below if you are redownloading.
#wget http://downloads.asterisk.org/pub/security/AST-2014-011-11.diff
#patch –p0 < AST-2014-011-11.diff

For recent installs (2013 onwards):
#make clean && ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib --prefix=/usr
#make && make install

Older Installs simply run (Skip if the above worked!)
#make clean && ./configure

For Asterisk 1.8

Go to your Asterisk 1.8 source directory
#cd /usr/src/asterisk-1.8…..
If don't exist, just download from http://downloads.asterisk.org/pub/telephony/asterisk/. NOTE: Asterisk 1.8.31.1 fixes this, so you don’t have to patch as below if you are redownloading
#wget http://downloads.asterisk.org/pub/security/AST-2014-011-1.8.diff
#patch –p0 < AST-2014-011-1.8.diff
#make clean && ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib --prefix=/usr

Older Installs simply run (Skip if the above worked!)
#make clean && ./configure

#make && make install

For both 1.8 and 11, restart Asterisk (FreePBX users!)
#amportal kill
#amportal start

Nagios fix

[Nagios info contributor: Anthony [at..]] Astiostech.com
Nagios itself as a monitoring system doesn't use SSL in the monitoring core itself. With the POODLE SSLv3 Vulnerabilities in mind, so far Nagios itself is not vulnerable to the issue as the following explains.

Nagios Console (Monitoring Core)

Nagios Core monitoring engine doesnt use SSL in itself. It is only used by the Nagios Web Console or any Nagios Web Configuration Editor. These web consoles are very dependant on the running HTTP server in the system. Therefore the POODLE vulnerabilities on the CORE Nagios should be properly handled by the HTTP server itself.

Nagios NRPE

SSL option in NRPE is used to encrypt the monitoring data. When this is switched on Nagios NRPE encrypts the data between the Nagios Core and the remote server. According to the file 'src/nrpe.c' line 256, since January 19th 2004, by default SSLv3 and SSLv2 has been disabled in NRPE and only TLS protocols are used. Therefore it is considered safe if the SSL is enabled in the NRPE agent.

Nagios NDO2DB

SSL option in NDO2DB is used to encrypt the received monitoring data from Nagios. When this is switched on Nagios NDO2DB encrypts the data between the Nagios Core and the NDO2DBserver. According to the file 'src/ndo2db.c' in line 167, since January 19th 2004, by default SSLv3 and SSLv2 has been disabled in ndo2db and only TLS protocols are used. Therefore it is

pfSense fix

The webserver

Go into the shell of pfsense, and run
#openssl s_client -connect localhost:443 -ssl3
If you see a value other than NONE in the cipher then its vulnerable and must be fixed.

Using the WebUI, we will download and install the system patch manager
1) Goto System, go to Packages, click on Available Packages
2) Locate System Patches and add it/install it
3) Go back to System, click on Patches
4) Click on + to add new patch
5) If using 2.2x, enter this “5ff7f58e5903cca4f99edd20f9db402163527fd6” without quotes as the commit ID
6) If using 2.1x, enter “29be59ad8ed25830f4e50a89977aca53ad8a29f4” without quotes as the commit ID
7) Click on Save, then it will bring you out to the main page, click on Fetch. Wait for it to complete. Now, you should see the word test, click on test. Once you can test, it will tell you patch can be applied cleanly. If only so, click Apply. If not, you’ve done something wrong :(
8) Restart the webservice
9) Point your browser to /restart_httpd.php, say if your pfsense IP is https://10.10.10.1 then just point to https://10.10.10.1/restart_httpd.php
10) Run again
#openssl s_client -connect localhost:443 –ssl3
You should now get an error!

The OpenVPN

OpenVPN uses TLS so it is not vulnerable. OpenVPN uses TLSv1.0, or (with >=2.3.3) optionally TLSv1.2 and is thus not impacted by POODLE. [src pfsense forum]

Other software that uses SSLv3

If you are aware of any other encrypting software that may use SSLv3, you might need to search for documents online on how to disable SSLv3 within the app’s implementation. If you know of such app and need help from us, do contact us and we will have a look at it.

Saturday, October 11, 2014

Debian 7 (wheezy) based Asterisk 12, Freepbx 12 on VMware / Virtualbox (Asterisk VM/Asterisk Ready Virtual Machine)

Show some love,  do like our FB page www.fb.com/Astiostech |

 

[UPDATED: 10 OCT 2014]

Here’s a VMDK image to run a full featured Asterisk PaBX with FreePBX as the management UI using our default and secure install practices. No registrations, no username/password, no signing up for newsletter.

Get it from Sourceforge: https://sourceforge.net/projects/debianasterisk/ [Select SWSterisk12 folder, then download the zip file therein]

 

After extracting, You either need VirtualBox or VMPlayer/VMWare or any Virtualization products that supports VMDK files or if you’re using Hypervisor, convert the image to VHD using MVMC from here.  This is to give you a feel of Asterisk with FreePBX without worrying about installation etc., its plug and play, literally. Just start up to your VirtualBox/VMplayer and get it up and running in seconds. Go in to FreePBX and start creating extensions and enable other features.

This image is free from any lockdowns or customizations that you cannot reverse or disable or enable as you wish. It is completely FREE from any personal restrictions.

This image does not trace usage, or “dials home” or anything strange like that. Totally clean, totally lean and totally fast. It is functional and you can hook it up to a real production environment and you almost have a full fledge PBX, just add a Digium VoIP Gateway or another IP based PSTN.

IMPORTANT

  • DISCLAIMER: By using this VIRTUAL MACHINE IMAGE, i disclaim any sorts of liability whatsoever. What you do with this image is purely your choice/actions.
  • This is not "another distros", nothing proprietary, i don't claim any copyrights, just make it look and feel like its mine for fun, but of course any of those customizations can be reversed. All other trademarks are properties of their respective owners. All rights reserved.
Here’s some information about the VM image you just downloaded
  • It’s in ZIP compression, just get WinRAR or 7-ZIP to extract. After extracting, there should be one vmdk just mount the vmdk into VMWare/VMPlayer or Virtualbox and start the image
  • Username/password
  • OS
    - Username: root (the other non root user is support with same password as below)
    - Password: asteriskrocks (change this!)
  • FreePBX(admin), MySQL(root), AMI(admin): usernames and passwords;
    username: admin
    password: @steriskRocks1 (change this, here’s a good guide to start you off withhttp://www.freepbx.org/support/documentation/installation/first-steps-after-installation)
  • REMEMBER REMEMBER REMEMBER: CHANGE PASSWORDS!
  • The network adapter is set to auto on eth0.
  • Image needs at least 384M memory (or more if you have more)
  • All source files except kernel-headers are removed to save disk space for downloading, you need to download them manually (Size before compression ~ 2.2GB, size after compression ~600M)

OS features/settings

  • Debian 7.6.0 64bit (Source AMD64 netinstall)
  • Disks are LVM so you can add more storage
  • The interface, eth0, is set to use DHCP, so be sure to hook up DHCP or manually edit the IP. IPV6 is disabled. In case you can’t bring the interface up, run #ifconfig –a . Then edit the file in /etc/network/interfaces and set all values to correspond to the interface shown when you run ifconfig –a (not loopback of course)
  • Webmin installed but not started (# /etc/init.d/webmin start , then access using https://<ipaddress>:10000) . Use sparingly, has many holes if it doesn’t get updated constantly.
  • Apache as webserver with enforced HTTPS (Port 443)
  • MySQL administration with Adminer in https://<ipaddress>/dbmanage.php
  • Phpsysinfo https://<ipaddress>/phpsysinfo
  • Munin for monitoring in https://<ipaddress>/munin
  • DHCP and TFTP server downloaded, not installed
  • Firewalled with IPTables (be sure to see /bin/wallfire.sh) - can be stopped and started #wallfire stop #wallfire start
  • Time i.e NTP autosyncs with ntp.org daily, when starting and when stopping
  • Exim4 (mailserver) configured to relay, configure your email appropriately #dpkg-reconfigure exim4-config
  • fail2ban properly set up and ready for ssh and asterisk failed attempts (modify notification email here /etc/fail2ban/jail.conf)
  • Free from bash vulnerability :-)
  • Many CLI tools for troubleshooting like tcpdump, ntop, htop…
  • Astribank support [if ever u need it]
FreePBX/Asterisk features
  • FreePBX 12 with most basic and extended modules pre-installed
  • Asterisk 12.6 (Dahdi tools/linux 2.10.0.1/LibPRI). NOTE I have set to chan_sip as the default sip driver, not pjssip. Had issues with fail2ban and other things. But all other components will work fine, not to worry. Change as you see fit.
  • Asterisk runs as high priority (Nice = 10)
  • New version of g711 selected
  • H323 Enabled
  • SRTP enabled (GoogleTalk/XMPP/Jingle + Secure RTP)
  • Iksemel for GoogleTalk/XMPP/Jingle
  • Asterisk-CEL logging enabled (in DB/table asteriskcdr/cel)
  • Log rotation enabled for files inside /var/log/asterisk/
  • Extra codecs: Speex (wanted to add SILK and openg729 but they seem to crash Asterisk codec translators)
  • WebRTC ready using FreePBX’s UAC
    • Notes on using this
      • A test user has been created for you to immediately use.
      • Click on UCP.
      • Username: 2000, password 2000 (password can be changed under User Management)
      • When using Chrome, be sure to check and enable “unsafe script” on top right corner in the address bar
      • Be sure ports 80 (or 443), ports 8088 both TCP are opened to this box
      • Here’s me making a test call with that user 2000 inside UCP
      • image 

Tuesday, October 7, 2014

Error 0x0000005d when installing Windows 10 tech preview on Oracle VirtualBox (4.3.x)

Thought of quickly setting a note on this. If you get this error with Windows 10 Tech Preview on Virtual Box, you probably have to set the in the General Setting to Windows 8.1 (32 or 64 bit depending on your version you’ve downloaded).

image

Also be sure to have sufficient video memory > 32M, reboot and start installation. Cheers :-)

Thursday, October 2, 2014

FreePBX RCE vulnerability CVE: 2014-7235

The FreePBX team has been made aware of a security vulnerability affecting one of its modules called the Asterisk Recording Interface (ARI). While many of our users do not use this module on a day to day basis, it is almost available in all our installs. 

Important Notes

  • This vulnerability allows unauthenticated remove execution of code via the web and execute shell commands which are then limited to the rights of the apache process (in our client's cases, that would be low privilege user asterisk). However, this user has rights to manage the Asterisk, FreePBX and other web related software or services.
  • FreePBX versions affected: Any version prior to version 12 (e.g. 2.8,2.9,2.10,2.11). 
  • All OS versions
  • This is a FreePBX only bug, not Asterisk, not OS, etc..
  • It is safe to upgrade during production/live. Restarts or reboots are not required

The fixes are available since 30 Sept 2014 and users are advised to run the following commands and/or run from via the web interface or the module admin page: The following commands may require internet access from the Asterisk/FreePBX console to perform the upgrade.

(Do not copy the '#' when pasting into the putty/CLI interface, they are indicators of command line codes)

#rm -rf /var/www/html/admin/modules/admindashboard
#amportal a ma delete admindashboard

NOTE: You may NOT have the above modules installed, even if in error, ignore and proceed as below;

Now, locate and delete these files like below

#for i in `find / -name 'c2.pl' -print`; do rm -i $i; done
#for i in `find / -name 'c.sh' -print`; do rm -i $i; done

The above command will search through any of the automated hacking scripts (if exists) and ask you to remove, just hit [y]es if you find them. Otherwise, the command will return an empty output.

Finally, and most importantly, get the upgrade;
#amportal a ma upgrade fw_ari
#amportal a r

Alternatively, you can upgrade the module as show above via the FreePBX module admin module too.

Systems that expose the http/https port TCP80 or TCP443 (or FreePBX) interface via the internet is at particularly higher risk, you are advised to immediately close all access from the Internet to your FreePBX webUI and should be doing so anyway for best security practice.

For more detailed understanding, please checkout article: http://goo.gl/6JT3oT

Friday, September 26, 2014

Bash vulnerability possible quick fix for Debian 6 and 7 (squeeze and wheezy) - "CVE-2014-6271" or more CVEs

A bug discovered by Stephane Chazelas

IMPORTANT - MUST READ:

  • USE AT YOUR OWN RISK, i am not responsible for any broken apps/programs etc etc. Don’t sue me, im not rich anyway.
  • We do not know the extent of the vulnerability/fixes this is from best knowledge and effort, you are advised to research of your own too and not completely rely on these below. These methods are also described in many many online articles, i put them together mainly for our customers and people using Deb6/7.
  • This article is to be done/performed by people who know how to use bash and shell codes, not for newbies
  • Please read more articles and follow online security resources for updates should there be any. If you need to reupgrade, just follow steps below again, in case there’s a better fix/newer version.
NOTES
  • Note on command line operations: the # means its a shell code to run, copy paste that in your SSH console

Intro

For immediate fix to possible vulnerable users: e.g. using vulnerable bash with bash codes that may run on publicly exposed protocols such as SSH/HTTP etc where publicly accessible shell codes are possible. 
More reading: (askubuntu has an easy article to understand)

Test and Check Version

Note # denotes copy and paste into shell, don’t copy the # itself, copy after it, everything should be a single line unless said otherwise
1) Logon to your OS using SSH
2) Run the following 
#curl https://shellshocker.net/shellshock_test.sh | bash
If you see the output showing "vulnerable" from 7 out of 7 checks, you need to fix, therefore, proceed to fix as below. 
3) To check bash version, run, you might need this info as you may be upgrading to a higher version of bash as shown in this article. this article for debian 6 will assume bash 4.1;
#dpkg -s bash | grep Ver

Fix

Fix for Squeeze (Deb6)

Following a guide from http://www.tannkost.no/2014/09/compile-bash-from-source-to-remedy-shellshock-on-debian-lenny/
1) Do this in the /usr/src dir
#cd /usr/src
#wget http://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz
#tar zxvf bash-4.1.tar.gz
#cd bash-4.1
2) Fetch all patches, including latest ones that patches all related CVEs, note if you are using bash 4.2x then change accordingly, eg change to 4.1 to 4.2 and 41 to 42 so on. Since more and more patches are coming up, i am setting the possible number of patches to 25, at time of writing, there are 17 patches.
#for i in $(seq -f  %03g 0 25); do wget -nv http://ftp.gnu.org/gnu/bash/bash-4.1-patches/bash41-$i; patch -p0 < bash41-$i; done
#./configure && make
#make install
#mv /bin/bash /bin/bash.old
#ln -s /usr/local/bin/bash /bin/bash
3) Check that you're not vulnerable anymore wiith the output of the following
# it should not output vulnerable word anymore
#curl https://shellshocker.net/shellshock_test.sh | bash
4) You can and also should delete the old one that's a problem
#rm /bin/bash.old
5) Rerun Test!, you should not be vulnerable anymore.

Fix for Wheezy (Deb7)

1) Just run below for Wheezy
#apt-get update
#apt-get install --only-upgrade bash
2) Rerun Test!, you should not be vulnerable anymore. Your bash version should also be higher than that specified above in the MUST READ section.
---http://highsecurity.blogspot.com--- ---RSS http://feeds.feedburner.com/highsecurity---






















Friday, August 1, 2014

Fixing magnet links on Google Chrome (and re-associate with uTorrent or <insert.favourite.torrent.program.here>)

NOTE: This post is for education purposes only.

Spent some time trying to fix and after reading/following some resources online like youtube links and others, they still didn't’ seem to work for me. Finally, found this regkey, changed one value and it worked for me. It may help you too..

The association of magnet links on torrent sites (which most of them use instead of a .torrent file) may break if you’ve installed/uninstalled a program that also handles magnet/torrent links and may have override your favorite torrent proggie e.g. uTorrent as your default torrent handler.

And now, Google Chrome won’t associate/open uTorrent when you click the image icon or this type of link image 


So, first do try the following:

1) This Youtube link http://www.youtube.com/watch?v=6nELJpK7B5E

2) This other resource http://www.metserve.com/blog/magnet-links-working-with-chrome

 

If those links still don’t help or the problem isn’t fixed, fear not, there’s one other thing you can do:,

1) Open up the registry (click start, then run, regedit). In Windows 7 or higher, just type in the application bar search box

2) Look for the following key
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\magnet\UserChoice

3) Edit the REG_GZ value for ProgID and enter your favourite program you wish to associate with, e.g. uTorrent
(How to find my program’s progID - http://www.ehow.com/how_6871656_progid.html

 

image

 

And done! IT should work now. Cheers!

Friday, June 20, 2014

Monast – An uber cool FREE web based monitoring for Asterisk (an install guide for Debian users)

I had the chance to install and use Monast (http://monast.sourceforge.net/) by Diego Aguirre and found it extremely useful, simple, fast and FREE to monitor Asterisk 1.4 or higher (this guide uses Asterisk 11.x). Thought i’d share this how to for basic asterisk monitoring needs. Even though the project has not been updated for years, i still find it super useful and works on Asterisk 11 for me just fine.

Important notes:

  • This guide is for users of Debian 32/64, other platforms can adapt, esp the “apt” parts :-)
  • You should already have a running FreePBX (or at least Apache and related libraries) if you do not have FreePBX
  • This guide would likely work for Ubuntu as well

Follow this guide to get it up and running in minutes

  1. Update your apt and get some packages
  2. #apt-get update
  3. #apt-get install python-twisted python-zope.interface php-pear
  4. #pear install HTTP_Client
  5. Get starpy package and install it
  6. #cd /usr/src
  7. #wget -O starpy-1.0.0a13.tar.gz http://downloads.sourceforge.net/project/starpy/starpy/1.0.0a13/starpy-1.0.0a13.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fstarpy%2Ffiles%2Fstarpy%2F1.0.0a13%2F&ts=1402506121&use_mirror=jaist
  8. #tar –zxvf starpy-1.0.0a13.tar.gz
  9. #cd starpy-1.0.0a13/
  10. #./setup.py install
  11. #cd ..
  12. Now download monast
  13. #wget –O monast-3.0b4.tar.gz http://downloads.sourceforge.net/project/monast/Monast%20for%20Asterisk%201.4%2C%201.6%20and%201.8/3.0b4/monast-3.0b4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmonast%2Ffiles%2FMonast%2520for%2520Asterisk%25201.4%252C%25201.6%2520and%25201.8%2F3.0b4%2F&ts=1403193094&use_mirror=jaist
  14. #tar -zxvf monast-3.0b4.tar.gz
  15. #cd monast-3.0b4/
  16. At this point below, simply use the defaults, change if you know what you’re doing….
  17. #./install.sh
  18. Now, lets create an AMI user using FreePBX’s
  19. Note, use the module Asterisk Manager Users and its a recommended way to add AMI users
  20. Create a new manager user called monastfpbx with a secret like this “mysecret123”, select ALL for read, and ALL for write

    Example below
    image
  21. Submit and apply
  22. If you do not have/use this module, create you own user like this in [freepbx users] /etc/asterisk/manager_custom.conf or rest of the world /etc/asterisk/manager.conf

    [monastfpbx]
    secret = mysecret123
    deny=0.0.0.0/0.0.0.0
    permit=127.0.0.1/255.255.255.0
    read = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
    write = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
  23. Then reload the manager module #asterisk –rx “manager reload”
  24. Now, edit the monast config file
  25. #nano /etc/monast.conf
  26. Look for the following and change per suggested here (basic setup, change others if you know what you’re doing)

    auth_required = true

    [server: Server_1] # Server name can not contains space
    hostname = 127.0.0.1
    hostport = 5038
    username = monastfpbx
    password = mysecret123

    default_context = from-internal
    transfer_context = from-internal-xfer

    [user: admin]
    secret  = secret12345
    roles   = originate,queue,command,spy
    servers = ALL
  27. Save and exit
  28. Now, lets test start monast
    #/opt/monast/monast.py
    You should see this at minimum (ignore server_2 errors)
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Initializing Monast AMI Interface...
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Parsing config file /etc/monast.conf
    [Fri Jun 20 19:17:05 2014] NOTICE   :: Server Server_1 :: AMI Connected...
  29. Now, ctrl-c to stop that and run this monast as a daemon instead (runs in background)
    #/opt/monast/monast.py --daemon
    You should see something like this:
    Monast daemonized with pid 6738
  30. That’s about it, now log on to the webUI
  31. http(s)://<yourIP>/html/monast with username admin and password secret12345
  32. Remember, you can right click and do stuff to the tabs you see there such as originate calls…
    image 
    image 
    image
    image
  33. The init.d should be automatically added and should auto start in daemon mode, but do verify yourself
  34. Shout out to Diego Aguirre! awesome software mate :-)
  35. Thanks and as usual do give us feedback

 

Happy weekend folks!