Luis Sequeira

Luis Sequeira

Luis Sequeira is an IT professional with experience in cloud environments, quality of service and network traffic analysis, who loves looking for solutions to engineering challenges, share knowledge. At work, the main challenge is to integrate different network and software technologies to provide solution in a wide range of areas, e.g., virtual network functions, machine learning, autonomous driving, robotics and augmented reality.

The authentication protocol Kerberos allows a number of computers to prove their identity among them safely over an insecure network. The operation of the protocol is based on the Needham-Schroeder protocol, which defines a ''trusted third party'' called Key Distribution Center (KDC). William Stallings in his book Fundamentals of Network Security: Applications and Standards, Second Edition (p.394) defines a KDC as follows:

Authorized system to transmit temporary session key for users. Each session key is transmitted encrypted using a master key that the Key Distribution Center shares with the target user.

The KDC can be seen as a set of two logic stages: an authentication server (AS) and an ticket granting server (TGS). The AS has the function to identify each user, validate their identity and give the client a key that allows to communicate with the TGS. Furthermore, the TGS is the responsible server for checking that the client possesses the authentication ticket and provides a key to the user that allows access to the requested services. This scenario is shown in Figure # 1.

 

 

Figure # 1: Components and communication flow of Kerberos protocol.

What is sed?

Sed is a stream editor which is used to perform basic text transformations on an input stream (a file or input from a pipeline) or filter strings. It permits to modify the contents of different lines in a file, based on some parameters.

For the examples shown in this article, you used the 4.2.1 version of sed as shown below:

sed --version

GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

Sed has a syntax as follows:

sed [-options] [command] [<file(s)>]

 

Visualization

For the cases where you need to display the contents of a file or part of it, we can use any of the following commands:

sed 5q file1                              # see the firsts 5 lines of file1
cat -n file1 | sed -n '5,6 p'        # see lines 5 and 6 of file1
sed -n '1p' file1 > file2             # copy the first line of file1 to file2
sed -n '$p' file1                        # show the last line of file1

 

Replacing strings and characters

In these cases, it is always advisable storing in another file, the results of a substitution, leaving the original file unchanged. Some examples are:

# replace strings in all lines that satisfied the string of file1 and store the result in file2
sed 's/old_string/new_string/g' file1 > file2
# replace strings only in lines 200 y 201
sed '200,201 s/old_string/new_string/g' file1 > file2
# replace several strings by new one
sed 's/old_string_1\|old_string_2/new_string/g' file1 > file2
# replace all lowercase to uppercase
sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' file1 > file2

 

Insert strings

As in the previous case, the original file is left unchanged while the second will contain the changes.

# insert a string at the beginning of each line
sed 's/^/string_at_the_beginning/' file1 >file2
# insert a string at the end of the file
sed -e '$ string_at_the_end' file > file2
# insert a blank line before each line that matches with string
sed '/string/{x;p;x;}' file1 > file2
# insert a blank line after each line that matches with string
sed '/string/G' file1 > file2
# insert a blank line before and other after each line that matches with string
sed '/string/{x;p;x;G;}' file1 > file2
# insert a blank line every 2 lines
sed 'n;G;' file1 > file2

 

Delete lines and strings

If we want to delete characters or entire lines, either because they are empty or commented, we can use the following commands:

sed '2,4 d' file1 > file2                    # remove lines 100 and 105 of file1
sed '5,20 !d' file1 > file2                 # delete all lines except the 5 and 20
sed '$d' file1 > file2                        # delete the last line of file1
sed -i '$d' file1                               # delete the last line of file1 in the same file
sed '/string/ d' file1 > file2              # remove lines that satisfied a string
sed '/^$/d' file1 > file2                    # remove blank lines
sed '/^$/d; / *#/d' file1 > file2          # remove blank lines and bash comments

 

Femtocells are low-power and low-cost base stations that provide residential cellular services, providing a coverage of roughly 10 m [1]. They can integrate with mobile operator through a broadband connection, typically ADSL. In General, femtocell makes that the traffic from the home cellular system, deviates through the broadband connection, releasing the resource consumption of the macrocell.

The 3GPP has introduced the concept of Closed Subscriber Group (CSG), which essentially identifies a group of subscribers who have access permission to one or more cells. Femtocells basically have three different operating modes: open access, closed access and a combination of both named hybrid access [2] and [3], the access methods are:

  • Open ccess: In this case, the UE can access the femtocell without any restrictions, this is seen in the Figure # 1 wherein the EU2 has unrestricted access to the femtocell in the building.
  • Closed Access: The administrator defines the only femtocell users (CSG) that can access the network. For this mode, emergency calls are exempt.
  • Hybrid Access: In this type of access, a limited amount of resources is allocated for access to users who are not part of CSG.

 

Figure # 1. Example of different femto-cell's access methods [2]: Open access, closed access and hybrid access.

Page 2 of 11