18 January 2012 0 Comments

[SYS Admin] Command not Found Crash

Today I run up against a nice bug! Let’s code explains itself:

root@osips:~# ù:q
 Sorry, command-not-found has crashed! Please file a bug report at:
 https://bugs.launchpad.net/command-not-found/+filebug
 Please include the following information with the report:
 command-not-found version: 0.2.44
 root@osips:~#

Same bug could be reproduced by unprivileged user

xxx@osips:~$ ù:q
 Sorry, command-not-found has crashed! Please file a bug report at:
 https://bugs.launchpad.net/command-not-found/+filebug
 Please include the following information with the report:

command-not-found version: 0.2.44
voiceadmin@osips:~$

/usr/lib/command-not-found doesn't seems to have a suid bit:

xxx@osips:~$ ls -al /usr/lib/command-not-found
-rwxr-xr-x 1 root root 2532 2011-11-22 12:53 /usr/lib/command-not-found

then I don't think would be a good point of local privileges excalation ... Just a Useless Post!

Thank'u for your time  :lol:

15 May 2011 6 Comments

[CERTIFICATION] 650-297 TelePresence Video Field Engineer for Advanced Exam

I recently succeeded PAIATVS certification path.

Attached to this post you can find answers to all question I found in my exam.
Resulting score was 873 of 1000!

Have fun!

650-297 Exam

28 January 2011 0 Comments

[Asterisk] Connecting Asterisk PBXs to a SmartNode Patton 4960 Voice Gateway with Full Failover Features

[Asterisk] Connecting Asterisk PBXs to a SmartNode Patton 4960 Voice Gateway with Full Failover Features

The better way to interconnect your Asterisk based PBXs to the PSTN infrastructure is by a dedicated Voice Gateway.
Thanks to, your telephony infrastructure, will benefit of a rich bunch of features:

  • Dedicated DSP equipment.
  • Powerful transcoding capabilities.
  • Advanced call-routing.
  • Failover & Load Balancing.

Many of above were unable to deploy by a PCI Card!!!

With the following configuration you’re able to build a completely fault tolerant architecture with a single point of failure (represented by patton itself):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
cli version 3.20
clock local default-offset +00:00
dns-relay
webserver port 80 language en
sntp-client
sntp-client server primary <NTP SERVER ip> port 123 version 4
system hostname tectton-primario
 
system
 
  ic voice 0
 
system
  clock-source 1 e1t1 0 0
 
profile r2 default
 
profile napt NAPT_WAN
 
profile ppp default
 
profile call-progress-tone IT_Dialtone
  play 1 200 425 -12
  pause 2 200
  play 3 600 425 -12
  pause 4 1000
 
profile call-progress-tone IT_Alertingtone
  play 1 1000 425 -12
  pause 2 4000
 
profile call-progress-tone IT_Busytone
  play 1 500 425 -12
  pause 2 500
 
profile tone-set default
profile tone-set IT
  map call-progress-tone dial-tone IT_Dialtone
  map call-progress-tone ringback-tone IT_Alertingtone
  map call-progress-tone busy-tone IT_Busytone
  map call-progress-tone release-tone IT_Busytone
  map call-progress-tone congestion-tone IT_Busytone
 
profile voip default
  codec 1 g711alaw64k rx-length 20 tx-length 20
  codec 2 g711ulaw64k rx-length 20 tx-length 20
  dtmf-relay rtp
  rtp traffic-class local-default
  dejitter-max-delay 200
  fax transmission 1 bypass g711alaw64k
  fax transmission 2 bypass g711ulaw64k
  fax transmission 3 relay t38-udp
  fax redundancy low-speed 2 high-speed 1
  fax volume -10.0
  fax dejitter-max-delay 300
  fax bypass-method nse
  modem transmission 1 bypass g711alaw64k
  modem transmission 2 bypass g711ulaw64k
  no modem detection on-remote-fax-request
  modem bypass-method v150-vbd
 
profile pstn default
  no echo-canceler-nlp
  no echo-canceler
 
profile sip default
  no autonomous-transitioning
 
profile dhcp-server DHCPS_LAN
  network <NETWORK IP> <NETWORK MASK>
  include 1 <DHCP START> <DHCP END>
  lease 2 hours
  default-router 1 <GATEWAY IP>
  domain-name-server 1 <DNS SERVER>
 
profile aaa default
  method 1 local
  method 2 none
 
context ip router
 
  interface WAN
    ipaddress <WAN IP ADDRESS> <WAN NETMASK>
    use profile napt NAPT_WAN
    tcp adjust-mss rx mtu
    tcp adjust-mss tx mtu
 
  interface LAN
    ipaddress <LAN IP ADDRESS> <LAN NETMASK>
    tcp adjust-mss rx mtu
    tcp adjust-mss tx mtu
 
context ip router
  route 0.0.0.0 0.0.0.0 <GATEWAY IP> 0
 
context cs switch
  no digit-collection timeout
  no digit-collection terminating-char
  national-prefix 0
  international-prefix 00
 
  routing-table called-e164 RT_TO_SIP
    route default dest-service INBOUND
 
  routing-table called-e164 SIP_TO_RT
    route default dest-service OUTBOUND
 
  interface isdn IF_ISDN
    route call dest-table RT_TO_SIP
    use profile tone-set IT
    caller-name send-information-following
    inband-info accept force call-setup setup
 
  interface isdn IF_ISDN_BACKUP
    route call dest-table RT_TO_SIP
    use profile tone-set IT
    caller-name send-information-following
    inband-info accept force call-setup setup
 
  interface sip IF_SIP
    bind context sip-gateway GW_SIP
    route call dest-table SIP_TO_RT
    remote <ASTERISK IP> 5060
    early-disconnect
 
  interface sip IF_SIP_BACKUP
    bind context sip-gateway GW_SIP
    route call dest-interface IF_ISDN
    remote <ASTERISK BACKUP IP> 5061
    early-disconnect
 
  service hunt-group OUTBOUND
    drop-cause normal-unspecified
    drop-cause no-circuit-channel-available
    drop-cause network-out-of-order
    drop-cause temporary-failure
    drop-cause switching-equipment-congestion
    drop-cause access-info-discarded
    drop-cause circuit-channel-not-available
    drop-cause resources-unavailable
    route call 1 dest-interface IF_ISDN
    route call 2 dest-interface IF_ISDN_BACKUP
 
  service hunt-group INBOUND
    drop-cause normal-unspecified
    drop-cause no-circuit-channel-available
    drop-cause network-out-of-order
    drop-cause temporary-failure
    drop-cause switching-equipment-congestion
    drop-cause access-info-discarded
    drop-cause circuit-channel-not-available
    drop-cause resources-unavailable
    route call 1 dest-interface IF_SIP
    route call 2 dest-interface IF_SIP_BACKUP
 
context cs switch
  no shutdown
 
authentication-service AUTH_OB
  realm 1 asterisk
  username <ASTERISK USERID> password <ASTERISK PASSWORD> encrypted
 
location-service ASTERISK
  domain 1 <ASTERISK IP>
 
  identity <ASTERISK USER>
 
    authentication outbound
      authenticate 1 authentication-service AUTH_OB username <ASTERISK USER>
 
    registration outbound
      registrar <ASTERISK IP> 5060
      lifetime 3600
      register auto
      retry-timeout on-system-error 10
      retry-timeout on-client-error 10
      retry-timeout on-server-error 10
 
    call outbound
 
location-service ASTERISK_BACKUP
  domain 1 <ASTERISK BACKUP IP>
 
  identity <ASTERISK USER>
 
    authentication outbound
      authenticate 1 authentication-service AUTH_OB username <ASTERISK USER>
 
    registration outbound
      registrar <ASTERISK BACKUP IP> 5060
      lifetime 3600
      register auto
      retry-timeout on-system-error 10
      retry-timeout on-client-error 10
      retry-timeout on-server-error 10
 
    call outbound
 
context sip-gateway GW_SIP
 
  interface IF_GW_SIP
    bind interface LAN context router port 5060
 
context sip-gateway GW_SIP
  bind location-service ASTERISK
  no shutdown
 
context sip-gateway GW_SIP_BACKUP
 
  interface IF_GW_SIP_BACKUP
    bind interface LAN context router port 5061
 
context sip-gateway GW_SIP_BACKUP
  bind location-service ASTERISK_BACKUP
  no shutdown
 
port ethernet 0 0
  medium auto
  encapsulation ip
  bind interface WAN router
  no shutdown
 
port ethernet 0 1
  medium auto
  encapsulation ip
  bind interface LAN router
  no shutdown
 
port e1t1 0 0
  port-type e1
  clock slave
  framing crc4
  application long-haul
  encapsulation q921
 
  q921
    permanent-layer2
    uni-side auto
    encapsulation q931
 
    q931
      protocol dss1
      uni-side net
      bchan-number-order ascending
      encapsulation cc-isdn
      bind interface IF_ISDN switch
 
port e1t1 0 0
  no shutdown
 
port e1t1 0 1
  port-type e1
  clock slave
  framing crc4
  application long-haul
  encapsulation q921
 
  q921
    permanent-layer2
    uni-side auto
    encapsulation q931
 
    q931
      protocol dss1
      uni-side net
      bchan-number-order ascending
      encapsulation cc-isdn
      bind interface IF_ISDN_BACKUP switch
 
port e1t1 0 1
  no shutdown

The big picture:

20 September 2010 0 Comments

[Asterisk] Audio File Format Conversion

One of the major problem in an Asterisk IVR production is the file audio conversion.
Asterisk is able to playback a wide variety of file formats but the prefferred are following:

- GSM
- A-law
- U-law

Sound eXchange is the better way to accomplish this job.
Sox installation is quite simple:


# apt-get install sox libsox-fmt-all

Command above will install sox engine and all needed formats. Now is possible to converts all kind of audio file types:


$ sox input-file.wav -t raw -r 8000 -c 1 -b 8 -A output-file.alaw
$ sox input-file.wav -t raw -r 8000 -c 1 -b 8 -U output-file.ulaw
$ sox input-file.wav -t raw -r 8000 -c 1 -b 8 -g output-file.gsm

-t: Override input file type header.
-r: Resample audio rate (8 Khz for traditional phone line).
-c: The number of audio channels (-c means mono audio form).
-b: Bit-depth store format.
-A: Encoding type alias (-A stands for A-law, etc).

For others options please read sox(1) manual.

HINT: For multiple file conversion following command is suggested:


for a in *.wav; do sox "$a" -t raw -r 8000 -c 1 -b 8 -A `echo $a|sed "s/.wav/.alaw/"`; done

20 December 2007 0 Comments

[QMAIL] qmail-scanner-queue.pl return-path anonymizer

The following patch is able to anonymize the entire mails routing path.

Reason about this feature is the following:

  1. Customers privacy preservation
  2. Nullify RBL (Source Path) SpamCheck for RBListed ISP connection (fastweb.net, tim.it, etc etc).

In the diff patch attached file you can find some commented code block. You can store an original email copy, if you would to save it, commenting out code lines (not suggested in a thousand-emails-for-day environment).

Download qmail-scanner.queue.diff.patch

18 December 2007 0 Comments

[PERL] “How to” Develop a Dynamic Plugin Engine

:: INTRODUCTION

The main problem in my projects was a dynamically features extension through new implementations and new technology fully-fit across the time (software maintenance). For this problem i’m looking for a method to develop a core engine and to develop features through hooked attached plugins.

I decided to write this tutorial to share my plugin connector view.


:: MAIN SCENARIO


Main Scenario
Here we have the base scenario about plugins/core interconnection.

:: DATA FLOW

  1. An exeternal request incoming
  2. Core module do something and pass result to communicator interface.
  3. Communicator Interface analyze data received, and identify the correct plugin to load.
  4. Communicator Plugin Method, receive data from Communicator Core Interface and parse looking for the correct method to call
  5. Method receive data from Communicator Plugin Method and do something.
  6. Result value will be returned back through the reversed flow path.


:: MESSAGE STRUCTURE

To accomplish the data flow structure depicted before we should to have the following message structure:

Message Structure

A structure like this is useful to build a correct data flow through Main Core Application and Multiple Plugins.


:: BENEFITS

  1. Path Oriented Communication (Like TCP/IP Communication … it works :) )
  2. Low CPU Computation Load (No load on message passing architecture)
  3. Multiple Plugins Loading (We can call multiple plugins at the same time)
  4. Memory Optimization (Dinamic Module Load/Unload)
  5. Better Software Management (Only Plugins should to be maintained)
  6. Better Collaboration (Everyone could write his own plugin)
  7. … and more over !!! :)


:: DISADVANTAGES

  1. Considerable Network Load (in case of heavy production environment)
  2. Plugins Developing Rules (plugins should be written following a rigorous scheme)


:: SOURCE CODE

Let’s post some code to understand basic concepts:

We receive a preformatted input string from our input device. In this string we have the message structure depicted before. Then, first of all, we should to get our “Header” (passed[0]);

In the following statement we prepare the plugins load call

# Construct Module Name
my $obj = "SRVConf::" . $passed[0];

Now we must (in Perl) load requested plugin through eval syscall

# Use Dynamical Module
eval "use $obj";

Now we can call Plugins Communicator method.

# Initialize Module
if(my $module = $obj->new())
   my @returned = $obj->communicator($passed[1]);

For those about Plugins Statement we must supply a “new” method


sub new {
my $this = {};
....
}

and a “communicator” method that know all Plugin method list


sub communicator() {
    if ($action eq "adduser") {
        return(_adduser($splitedstr[1]));
    } elsif ($action eq "moduser") {
        return(_moduser($splitedstr[1]));
    } elsif ($action eq "deluser") {
        return(_deluser($splitedstr[1]));
    } elsif ($action eq "getuserinfo") {
......
12 November 2007 0 Comments

Wishes for an Happy 27th Birthday

10 November 2007 0 Comments

Just Certified

Exam Date/
Time
Exam Name   Client/
Exam Number
  Exam Status Registration Expiration  
25-Oct-2007
10:00 AM
LPI Level 1 Exam 101   Linux Professional Institute (LPI)
117-101
  Passed 30-Sep-2008
11:59 PM
Receipt

1 August 2007 0 Comments

Clima Day – Request for Energy

27 June 2007 0 Comments

[ANSI] Escape Sequences

Intro

ANSI Escape sequences are used to perform special operations on the terminal, such as changing the output color, making it bold, printing at a specified coordinate etc.

The sequences

Wherever you see ‘#’, that should be replaced by the appropriate number.

Cursor Controls:

ESC[#;#H or ESC[#;#f (Moves cusor to line #, column #)
ESC[#A (Moves cursor up # lines)
ESC[#B (Moves cursor down # lines)


ESC[#C (Moves cursor forward # spaces)


ESC[#D (Moves cursor back # spaces)


ESC[#;#R (Reports current cursor line & column)


ESC[s (Saves cursor position for recall later)


ESC[u (Return to saved cursor position)


Erase Functions:
ESC[2J (Clear screen and home cursor)


ESC[K (Clear to end of line)



Set Graphics Rendition:
ESC[#;#;....;#m                     
Set display attributes where # is

  • 00 for normal display (or just 0)
  • 01 for bold on (or just 1)
  • 02 faint (or just 2)
  • 03 standout (or just 3)
  • 04 underline (or just 4)
  • 05 blink on (or just 5)
  • 07 reverse video on (or just 7)
  • 08 nondisplayed (invisible) ( or just 8 )
  • 22 normal
  • 23 no-standout
  • 24 no-underline
  • 25 no-blink
  • 27 no-reverse
  • 30 black foreground
  • 31 red foreground
  • 32 green foreground
  • 33 yellow foreground
  • 34 blue foreground
  • 35 magenta foreground
  • 36 cyan foreground
  • 37 white foreground
  • 39 default foreground
  • 40 black background
  • 41 red background
  • 42 green background
  • 43 yellow background
  • 44 blue background
  • 45 magenta background
  • 46 cyan background
  • 47 white background
  • 49 default background
 

ESC[=#;7h or (Put screen in indicated mode where # is)
ESC[=h or (0 for 40 x 25 black & white)


ESC[=0h or (1 for 40 x 25 color)


ESC[?7h (2 for 80 x 25 b&w)

  • 3 for 80 x 25 color
  • 4 for 320 x 200 color graphics
  • 5 for 320 x 200 b & w graphics
  • 6 for 640 x 200 b & w graphics
  • 7 to wrap at end of line
ESC[=#;7l or ESC[=l or (Resets mode # set with above command)
ESC[=0l or ESC[?7l


Keyboard Reassignments:
ESC[#;#;...p (Keyboard reassignment. The first ASCII)


or ESC["string"p (code defines which code is to be)


or ESC[#;"string";#; (changed. The remaining codes define)


#;"string";#p (what it is to be changed to)


E.g. Reassign the Q and q keys to the A and a keys (and vice versa).
ESC [65;81p (A becomes Q)


ESC [97;113p (a becomes q)


ESC [81;65p (Q becomes A)


ESC [113;97p (q becomes a)

E.g. Reassign the F10 key to a DIR command.

ESC [0;68;"dir";13p (The 0;68 is the extended ASCII code)


for the F10 key and 13 is the ASCII


code for a carriage return.

Other function key codes       
F1=59,F2=60,F3=61,F4=62,F5=63
F6=64,F7=65,F8=66,F9=67,F10=68
Powered by WP Symposium - Social Networking for WordPress  12.01.14