text
stringlengths
0
152
Chapter 3: Installing Asterisk
CHAPTER 4
Certificates for Endpoint Security
We only need to be lucky once. You need to be lucky every time.
—The IRA to Margaret Thatcher, after a failed assassination attempt
If you really want to do something, you’ll find a way. If you don’t, you’ll find an excuse.
—Jim Rohn
The Inconvenience of Security
VoIP security can be regarded as two separate (but interconnected) challenges:
• Securing a system against toll fraud (which is generally the goal of SIP-based
intrusion attempts)
• Securing a system against call interception (which relates to privacy, as well as
improving toll fraud defenses)
There are of course many other aspects to the security of your system, but most of
those are general security concepts, not specific to VoIP.
In this chapter we will focus on an area of security that is too often overlooked,
namely the generation and application of certificates and keys in order to secure com‐
munication between endpoints and your system. In SIP communications, encryption
is optional (and, unfortunately, not used most of the time). In WebRTC, it is required.
This chapter should by no means be considered the final word on securing your
Asterisk system; there will be more covered in Chapter 22. We do hope, however, that
it will provide you with a solid foundation on which to build a secure solution.
49
Securing SIP
If you build any sort of server that is exposed to the internet, and wait for a few short
hours after powering it up, you will notice that the system will have already attracted
probes attempting to determine if it has any vulnerable SIP services. You will then
notice, a short while later, an increasing amount of attacks on the server attempting to
compromise account security. Congratulations, your server has automatically been
added to lists of SIP servers shared by criminals for the purpose of fraud. If one of
these intrusions succeeds, the compromised platform will likely become part of an
organized crime network, with you paying the bill for untraceable calls to various
expensive destinations.
We’re not playing around here; do not take your SIP security lightly
or you are likely to find yourself the victim of a very expensive
fraud attack.
Subscriber Names
The subscriber portion of the SIP credentials (the userinfo part of the URI) is far too
often set to an extension number. This practice is fine for the purposes of addressing
calls, but is not at all recommended for the purposes of authenticating an endpoint.
The subscriber name of your endpoints should have no meaning outside of your
organization. A MAC address is perfect for this. Without an actual address to probe,
an attacker’s job just got a lot more difficult.
You will see many SIP-type PBXs (including many based on Asterisk, unfortunately)
that assign the extension number to the credentials of the phone. In this book, you
will see that the extension number is not part of the phone credentials. There are sev‐
eral benefits to this, but from the perspective of security, the benefit is that if an
attacker knows an extension, it does not provide any knowledge about how to
authenticate a call through the system.
So, you might have a user with the SIP address 100@shifteight.org, which your
Asterisk system will associate with the device at 0000f3101010@yourpbx.com. When a
call is directed to 100, it will ring 0000f3101010, but the caller never knows anything
about that endpoint.
You will see throughout this book that we will establish a relationship between an
extension (which we believe is something that should be associated with a user or ser‐
vice) with a device identifier (which could be a SIP device or a phone number), and
that a simple table can be used to tie them together (and subsequently increase both
security and flexibility).
50
|
Chapter 4: Certificates for Endpoint Security
Secure SIP Signaling
By default, SIP messaging is passed in the clear, with no effective security. A man-in-
the-middle attack is capable of obtaining all sorts of information about your calls.
Transport layer security (TLS) is used to minimize this risk.
We’ll talk more about how to configure devices to use TLS in the next chapter. All we
need to do here is create the certificates.
There are three common ways to generate certificates. We’ll provide examples for two
of them (self-signed and LetsEncrypt), but will leave the exercise of obtaining for‐
mally issued certificates to the reader.
Self-signed certificates
The primary advantage of a self-signed certificate is that you don’t have to validate it