lunes, 10 de agosto de 2015

Generar Claves SSH

Fuente: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets

Create the RSA Key Pair

The first step is to create the key pair on the client machine (there is a good chance that this will just be your computer):


ssh-keygen -t rsa
 
 
 

Copy to Server

cat ~/.ssh/id_rsa.pub | ssh root@[your.ip.address.here] "cat >> ~/.ssh/authorized_keys"

 

 

 
 
 
 

 

lunes, 15 de junio de 2015

Upgrade/iRedAdmin-Pro/LDAP to 2.1.2

Fuente: http://www.iredmail.org/wiki/index.php?title=Upgrade/iRedAdmin-Pro/LDAP/2.1.1-2.1.2

nano upgrade_iredadmin.sh

# Debian
        export DISTRO='DEBIAN'
        export HTTPD_SERVERROOT='/opt/www'
        export RC_SCRIPT_HTTPD='/etc/init.d/apache2'



Terminal: 
 
# tar xjf /root/iRedAdmin-Pro-LDAP-2.1.2.tar.bz2 -C /tmp/
# cd /tmp/iRedAdmin-Pro-LDAP-2.1.2/tools/
# bash upgrade_iredadmin.sh
# rm -rf /tmp/iRedAdmin-Pro-LDAP-2.1.2/

sábado, 9 de mayo de 2015

Generate Polycom XML directory file from FreePBX DB

Fuente: https://www.snip2code.com/Snippet/388850/Generate-Polycom-XML-directory-file-from


#!/bin/bash

# Author: Thyrus Gorges
# Date: 2015/03/04

#The MIT License (MIT)

#Copyright (c) <2015>

#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:

#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the Software.

#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#THE SOFTWARE.


# Build a Polycom Directory XML file
# by pulling the usernames and extensions of all SIP users

# Set so we can loop on newlines instead of spaces
IFS=$'\n'

# MySQL Creds
SQLUSER=
SQLPASS=

# Declare our file
FILE=/tftpboot/000000000000-directory.xml

# Remove old file
rm $FILE

# ReCreate our file
touch $FILE


# Write the header of the file
# Passing the -e option to echo allows us to use tabs
echo -e '' >> $FILE
echo -e '' >> $FILE
echo -e '' >> $FILE
echo -e "\t" >> $FILE


# Query Database
# We pass -N to MySQL so it doens't print headers
for i in $( mysql -u $SQLUSER -p$SQLPASS -N -e "use asterisk; select extension, name from users;" ); do
        # Assign Variables to each field
        EXTEN=`echo $i | cut -f1`
        FN=`echo $i | cut  -f2 | cut -d" " -f1`
        LN=`echo $i | cut -d" " -f2`
        # The item tag is the beginning of a contact
        echo -e "\t\t" >> $FILE
        echo -e "\t\t\t $LN " >> $FILE
        echo -e "\t\t\t $FN " >> $FILE
        echo -e "\t\t\t $EXTEN " >> $FILE
        echo -e "\t\t
" >> $FILE
done

# Write file endings
echo -e "\t
" >> $FILE
echo -e "
" >> $FILE

miércoles, 22 de abril de 2015

Install g729 Elastix

Fuente: http://wiki.kolmisoft.com/index.php/G723/G729_Codec_installation


G729 license installation

These instructions works with Asterisk 1.8.23
Download and execute the register utility to generate a valid license.
 
cd /root
wget http://downloads.digium.com/pub/register/x86-64/register

Change the permissions of the /root/register file to r-x------.
chmod 500 /root/register

Run the register utility and follow the interactive instructions. The registration utility will prompt you for your G.729 license key.
/root/register

Download and execute the benchg729 utility to determine the optimum build.
cd /root
wget http://downloads.digium.com/pub/telephony/codec_g729/benchg729/x86-64/benchg729-1.0.8-x86_64 -O benchg729

Change the permissions of the /root/benchg729 file to r-x------
chmod 500 /root/benchg729

Run the benchg729 utility and record the build that it recommends should be used for your platform.
/root/benchg729

Download and install the codec_g729 binary that is built for your platform from
http://downloads.digium.com/pub/telephony/codec_g729/asterisk-1.8.4/x86-64/
NOTE: Asterisk 1.8.23 requires binaries from exactly this download directory.
Extract downloaded file and copy codec_g729a.so to /var/lib/asterisk/modules.
Move original codec_g729.so to another directory for backup purposes.

Restart Asterisk and check if license is found:
asterisk -rvvv
*CLI> g729 show licenses                                                                           
0/0 encoders/decoders of 26 licensed channels are currently in use                                 

Licenses Found:                                                                                    
Key: G729-EXAMPLE1 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 2 (Expires: 2026-09-26) (OK)                                     
Key: G729-EXAMPLE2 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 24 (Expires: 2026-09-26) (OK)

jueves, 16 de abril de 2015

Rsync Examples

Origen: http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

1- Copy/Sync Files and Directory Locally

This following command will sync a single file on a local machine from one location to another location. Here in this example, a file name backup.tar needs to be copied or synced to /tmp/backups/ folder.

Copy Files
[root@tecmint]# rsync -zvh backup.tar /tmp/backups/

Copy Directory
[root@tecmint]# rsync -avzh /root/rpmpkgs /tmp/backups/


 2- Copy/Sync Files and Directory to or From a Server

This command will sync a directory from a local machine to a remote machine. For example: There is a folder in your local computer “rpmpkgs” which contains some RPM packages and you want that local directory’s content send to a remote server, you can use following command.

Copy a Directory from Local Server to a Remote Server
[root@tecmint]$ rsync -avz rpmpkgs/ root@192.168.0.101:/home/


Copy/Sync a Remote Directory to a Local Machine
 [root@tecmint]# rsync -avzh root@192.168.0.100:/home/tarunika/rpmpkgs /tmp/myrpms

martes, 20 de enero de 2015

Install Wine on Debian

Fuente: http://ask.xmodulo.com/install-wine-linux.html

Since Wine is included in the default repository of Debian, you can install it with apt-get. However, if you are using 64-bit Debian, you need to enable multi-architecture, as Wine is a 32-bit application.

On 64-bit Debian:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install wine-bin:i386 
 
On 32-bit Debian:
$ sudo apt-get install wine

domingo, 11 de enero de 2015

Ubuntu Server Grub does not autoboot the default option

Fuente: http://askubuntu.com/questions/214972/grub-does-not-autoboot-the-default-option-after-upgrade-to-12-10

My /etc/default/grub has only these effective options:

GRUB_DEFAULT='Ubuntu'
GRUB_HIDDEN_TIMEOUT=1
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_TERMINAL=console
 
 
 
Add the following to /etc/default/grub

GRUB_RECORDFAIL_TIMEOUT=0
 
Save and run

sudo update-grub