SIP TLS
Implementing TLS greatly enhances the security. It's also rather confusing to get it working.
I put together a really simple set of procedures to configure Asterisk 1.8.x to accept TLS
connections from its clients.
Bear in mind, Asterisk TLS support is only suitable for very basic use cases. For full compatibility with
RFC 5922 (federated SIP on the public Internet), it is essential to use a full SIP
proxy to handle all external TLS connectivity. Using a SIP proxy in this way has
many other benefits too. Please see the excellent guide
using a SIP proxy instead of Asterisk
There are several basic steps we need to do:
1 - Create or add a certificate on the asterisk server
2 - Add some configuration settings into the sip.conf file
3 - Configure the clients to use TLS
Let's look at each step, one at a time.
First, your asterisk server needs a certificate. For this exercise, we're going to use a self-signed
cert, which is enough to get started. You'll need openssl installed on your sever, so if you don't
have it, load it up. If in doubt, simply type "openssl" at a command prompt - if openssl is
on your system you should see a "OpenSSL" prompt. If so, you're ready for the next step.
Creating a server key - We need to create a digital key for our server. This is not the actual
"certificate", but is needed to create it. Assuming you're asterisk program was loaded with
defaults, your configuration files should be under /etc/asterisk. Let's go to that directory
and create a new directory called "certificates" (mkdir certificates). Change to the new
directory (cd certificates) and make sure the path to the directory is /etc/asterisk/certificates.
You can do this by running the "pwd" command in *nix.
From /etc/asterisk/certificates, we're going to create a server key by typing the following:
openssl genrsa -out key.pem 1024
You should see something like "Generating RSA private key, 1024 bit long modulus". If so,
things are going well. If you do a listing of the directory, you should see something like:
-rw-r--r-- 1 root root 887 2010-08-30 21:39 key.pem
The key.pem is your server key. Make a backup of this file onto a CD or USB drive or
whatever - you may need it in the future.
OK, so we cut a server key - the next step is to create a certificate request. Type this:
openssl req -new -key key.pem -out request.pem
You'll be prompted for the following:
Country Name - Enter a TWO character country code like US, UK, DE, etc.
State or Province Name - If you're in the US, this would be the state, typed out. Do no use abbreviations!
Locality Name - enter the city name where you are located at (i.e. Dallas, Memphis, whatever)
Organization Name - Enter your company name or even your personal name if this is a home server
Organizational Unit Name - This can be the same as the org name, or a division name if you wish
Common name - This *NEEDS* to be the FQDN name of your server, for example, asterisk.something.com
Email Address - leave this blank by simply hitting return
A challenge password - leave this blank by simply hitting a return
An optional company name - This could be your company initials (like IBM) or simply left blank
You should be back at your command prompt at this point. If you do a directory listing of
/etc/asterisk/certificates, you should now see:
-rw-r--r-- 1 root root 887 2010-08-30 21:39 key.pem
-rw-r--r-- 1 root root 639 2010-08-30 21:49 request.pem
The key.pem file is your server key and the request.pem is your certificate request.
If you're going to get a certificate from a real CA, the request.pem file is what you
would send over to have the CA sign. For this exercise, we're going to simply
sign our own certificate by running the following command:
openssl x509 -req -days 3650 -in request.pem -signkey key.pem -out certificate.pem
This will produce a new file called certificate.pem. This *is* your new certificate. Note
that the -days 3650 essentially made it good for 10 years. You may wish to edit that
somewhat, but this is probably a good setting since you'll end up replacing the certs
long before this one expires.
You have no further use for the certificate request file (request.pem), but I'd suggest
leaving it in the directory. It's small and won't bother anybody.
The hard part is done - it's all downhill from here. Now that we have a server key (key.pem)
and a certificate (certificate.pem) we're going to make a new file by adding the two files together.
We want to create a file with the name of your system, so using the example above, we'll name
this new file "asterisk.something.com.pem". We'll create this by first copying the certificate file,
then appending the server key to the end of it. Assuming you're on a *nix box, you should
type the following commands from /etc/asterisk/certificates:
cp certificate.pem asterisk.something.com.pem
cat key.pem >> asterisk.something.com.pem
Note that we used a double ">>". if you used a single ">", you overwrote the certificate portion.
If you did, just do the two steps again.
We now have a server key, a certificate, and a certificate "chain" file (asterisk.something.com.pem). Now we go to /etc/asterisk,
or wherever your sip.conf resides. so we can edit sip.conf and add the following items:
tlsenable=yes
tlsbindaddr=192.168.0.1 (put your actual ip address of your box here)
tlscertfile=/etc/asterisk/certificates/asterisk.something.com.pem
tlsdontverifyserver=no
tlscipher=DES-CBC3-SHA
tlsclientmethod=tlsv1
One note here - if your box is nat'ed, the tlsbindaddress needs to be your internal address,
in other words, the ip address that shows up when you type "ifconfig". Don't put your
public facing address here. For clarity, be sure you show the actual name of the
certificate chain file under tlscertfile.
Finally, go to one of your sip client contexts (still in sip.conf) and add:
transport=tls
In fact, you should do this for each client that will be accessing your asterisk server
through TLS. Hopefully you're using templates for your client configs - if so, simply
create a new template that includes sip tls and configure your clients that way. If
you don't know what templates are, don't worry about it - the simple way works, just
add the transport=tls statement to each users context.
That's it. At this point you should have an asterisk box that speaks TLS. The final step
is to have each of your clients configure their devices/softphones to use TLS. If you're
using a Snom 3xx phone, you would do this by adding ";transport=tls" after the
host name or ip address in "Outbound Proxy" settings. Each client will have to figure
out how to configure their end to work.
One parting note - TLS greatly enhances the sip portion of your clients communications.
Using real certificates (as opposed to self-signed certs) you can prevent MITM (man in the
middle) compromises. But even using self-signed certs prevents someone from capturing
your login credentials. However, TLS by itself *DOES NOT PROTECT THE VOICE TRAFFIC*.
Sip is a signaling protocol, but your actual voice data goes across using RTP. To protect
that portion of your communications, you need to do either tunnel the traffic in a VPN,
or add SRTP (secure RTP). SRTP encrypts the actual voice portion of the calls. The
good news is that Asterisk 1.8.x supposedly has full support for this. Once the
1.8.x comes out of beta, I'll add a second tutorial on how to implement SRTP.
Good luck!
Andrew
afried@deteque.com
I put together a really simple set of procedures to configure Asterisk 1.8.x to accept TLS
connections from its clients.
Bear in mind, Asterisk TLS support is only suitable for very basic use cases. For full compatibility with
RFC 5922 (federated SIP on the public Internet), it is essential to use a full SIP
proxy to handle all external TLS connectivity. Using a SIP proxy in this way has
many other benefits too. Please see the excellent guide
using a SIP proxy instead of Asterisk
There are several basic steps we need to do:
1 - Create or add a certificate on the asterisk server
2 - Add some configuration settings into the sip.conf file
3 - Configure the clients to use TLS
Let's look at each step, one at a time.
First, your asterisk server needs a certificate. For this exercise, we're going to use a self-signed
cert, which is enough to get started. You'll need openssl installed on your sever, so if you don't
have it, load it up. If in doubt, simply type "openssl" at a command prompt - if openssl is
on your system you should see a "OpenSSL" prompt. If so, you're ready for the next step.
Creating a server key - We need to create a digital key for our server. This is not the actual
"certificate", but is needed to create it. Assuming you're asterisk program was loaded with
defaults, your configuration files should be under /etc/asterisk. Let's go to that directory
and create a new directory called "certificates" (mkdir certificates). Change to the new
directory (cd certificates) and make sure the path to the directory is /etc/asterisk/certificates.
You can do this by running the "pwd" command in *nix.
From /etc/asterisk/certificates, we're going to create a server key by typing the following:
openssl genrsa -out key.pem 1024
You should see something like "Generating RSA private key, 1024 bit long modulus". If so,
things are going well. If you do a listing of the directory, you should see something like:
-rw-r--r-- 1 root root 887 2010-08-30 21:39 key.pem
The key.pem is your server key. Make a backup of this file onto a CD or USB drive or
whatever - you may need it in the future.
OK, so we cut a server key - the next step is to create a certificate request. Type this:
openssl req -new -key key.pem -out request.pem
You'll be prompted for the following:
Country Name - Enter a TWO character country code like US, UK, DE, etc.
State or Province Name - If you're in the US, this would be the state, typed out. Do no use abbreviations!
Locality Name - enter the city name where you are located at (i.e. Dallas, Memphis, whatever)
Organization Name - Enter your company name or even your personal name if this is a home server
Organizational Unit Name - This can be the same as the org name, or a division name if you wish
Common name - This *NEEDS* to be the FQDN name of your server, for example, asterisk.something.com
Email Address - leave this blank by simply hitting return
A challenge password - leave this blank by simply hitting a return
An optional company name - This could be your company initials (like IBM) or simply left blank
You should be back at your command prompt at this point. If you do a directory listing of
/etc/asterisk/certificates, you should now see:
-rw-r--r-- 1 root root 887 2010-08-30 21:39 key.pem
-rw-r--r-- 1 root root 639 2010-08-30 21:49 request.pem
The key.pem file is your server key and the request.pem is your certificate request.
If you're going to get a certificate from a real CA, the request.pem file is what you
would send over to have the CA sign. For this exercise, we're going to simply
sign our own certificate by running the following command:
openssl x509 -req -days 3650 -in request.pem -signkey key.pem -out certificate.pem
This will produce a new file called certificate.pem. This *is* your new certificate. Note
that the -days 3650 essentially made it good for 10 years. You may wish to edit that
somewhat, but this is probably a good setting since you'll end up replacing the certs
long before this one expires.
You have no further use for the certificate request file (request.pem), but I'd suggest
leaving it in the directory. It's small and won't bother anybody.
The hard part is done - it's all downhill from here. Now that we have a server key (key.pem)
and a certificate (certificate.pem) we're going to make a new file by adding the two files together.
We want to create a file with the name of your system, so using the example above, we'll name
this new file "asterisk.something.com.pem". We'll create this by first copying the certificate file,
then appending the server key to the end of it. Assuming you're on a *nix box, you should
type the following commands from /etc/asterisk/certificates:
cp certificate.pem asterisk.something.com.pem
cat key.pem >> asterisk.something.com.pem
Note that we used a double ">>". if you used a single ">", you overwrote the certificate portion.
If you did, just do the two steps again.
We now have a server key, a certificate, and a certificate "chain" file (asterisk.something.com.pem). Now we go to /etc/asterisk,
or wherever your sip.conf resides. so we can edit sip.conf and add the following items:
tlsenable=yes
tlsbindaddr=192.168.0.1 (put your actual ip address of your box here)
tlscertfile=/etc/asterisk/certificates/asterisk.something.com.pem
tlsdontverifyserver=no
tlscipher=DES-CBC3-SHA
tlsclientmethod=tlsv1
One note here - if your box is nat'ed, the tlsbindaddress needs to be your internal address,
in other words, the ip address that shows up when you type "ifconfig". Don't put your
public facing address here. For clarity, be sure you show the actual name of the
certificate chain file under tlscertfile.
Finally, go to one of your sip client contexts (still in sip.conf) and add:
transport=tls
In fact, you should do this for each client that will be accessing your asterisk server
through TLS. Hopefully you're using templates for your client configs - if so, simply
create a new template that includes sip tls and configure your clients that way. If
you don't know what templates are, don't worry about it - the simple way works, just
add the transport=tls statement to each users context.
That's it. At this point you should have an asterisk box that speaks TLS. The final step
is to have each of your clients configure their devices/softphones to use TLS. If you're
using a Snom 3xx phone, you would do this by adding ";transport=tls" after the
host name or ip address in "Outbound Proxy" settings. Each client will have to figure
out how to configure their end to work.
One parting note - TLS greatly enhances the sip portion of your clients communications.
Using real certificates (as opposed to self-signed certs) you can prevent MITM (man in the
middle) compromises. But even using self-signed certs prevents someone from capturing
your login credentials. However, TLS by itself *DOES NOT PROTECT THE VOICE TRAFFIC*.
Sip is a signaling protocol, but your actual voice data goes across using RTP. To protect
that portion of your communications, you need to do either tunnel the traffic in a VPN,
or add SRTP (secure RTP). SRTP encrypts the actual voice portion of the calls. The
good news is that Asterisk 1.8.x supposedly has full support for this. Once the
1.8.x comes out of beta, I'll add a second tutorial on how to implement SRTP.
Good luck!
Andrew
afried@deteque.com
相关推荐
一个能自动与vos实现加密的sip软终端意味着它内置了与vos平台兼容的加密机制,用户无需手动配置,就能享受到安全的通话服务。 99tell.exe可能是一个这样的软终端应用程序,它预设了与VOS平台的连接和加密设置,用户...
5. **安全性**: 通过TLS(Transport Layer Security)和SIPS(Secure SIP)提供传输安全,通过SRTP(Secure Real-time Transport Protocol)保障媒体流安全。 ### SIP协议的应用 1. **VoIP通信**: SIP用于搭建VoIP...
3. **安全机制**:华为SIP协议支持TLS加密和SIPS(安全SIP)协议,保证通信过程的安全性,防止中间人攻击。 4. **融合通信**:华为SIP协议支持与PSTN(公共交换电话网)、IMS(IP多媒体子系统)等传统和现代通信...
6. **Security**:为了确保通信的安全性,SIP通信通常会使用TLS进行加密,并可能需要证书来进行身份验证。 7. **Session Management**:SIP会话(Session)是多个关联交互的集合,可以通过SDP(Session Description...
SIP支持多种传输协议,如UDP、TCP和TLS,其中TLS提供安全传输通道,增强SIP通信的安全性。SIP安全机制涵盖信令加密和媒体流加密,确保数据在传输过程中的机密性和完整性,防止窃听和篡改。 综上所述,SIP协议在视频...
虽然SIP本身不提供加密,但可以通过TLS(Transport Layer Security)来保护信令的安全,同时利用SRTP(Secure Real-time Transport Protocol)对媒体流进行加密,确保通信的隐私性和完整性。 7. SIP应用 SIP广泛...
7. **安全性**:SIP协议支持TLS加密和认证机制,如Digest认证。在C++实现中,需要集成OpenSSL库来处理安全连接和验证。 8. **错误处理与调试**:完善的错误处理机制是任何协议栈的关键部分,包括异常处理、日志记录...
5. **认证与安全**:SIP协议支持多种认证机制,如Digest认证、TLS加密等,确保通信的安全性。 6. **多媒体处理**:SIP软电话通常需要与RTP(Real-time Transport Protocol)配合,处理音频和视频的实时传输。 7. *...
6. **SIP安全**:理解如何使用TLS(Transport Layer Security)加密通信,以及如何防止中间人攻击和骚扰电话。 7. **编程实现**:学习如何使用Java的JSR 309(Java SIP API)或其他开源库如Mobicents SIP Servlets...
这包括使用SSL/TLS加密通信、密码保护、防止中间人攻击等。 8. **事件驱动编程**:SIP软电话的实时性要求采用事件驱动的编程模式,当接收到SIP消息或媒体流事件时,程序应能及时响应。 9. **多线程与并发**:考虑...
例如,文件列表中的`sipekSoftphone.sln`和`sipekSoftphone_tls.sln`可能就是项目解决方案文件,包含了软电话的源代码,可能分别对应了常规和TLS加密的SIP连接。 GUI(图形用户界面)是软电话的重要组成部分,...
3. **安全防护**:内置安全机制,包括TLS加密、认证和授权,保护通信免受窃听和攻击。 4. **易于集成**:提供了丰富的API和SDK,便于开发人员将其无缝集成到现有的网络基础设施或业务系统中。 5. **扩展性**:Sip...
安装完成后,用户可以通过服务器提供的管理界面或API进行配置和管理,包括设置用户账户、配置网络参数、启用TLS等。 总结来说,brekerk ondo sip server 3.0.3.2是一款强大且灵活的开源SIP服务器,它结合了TLS/TCP...
SIP协议本身不提供加密和认证机制,但可以与TLS(Transport Layer Security)结合使用,以确保通信安全。此外,通过配合其他协议(如RSVP)和QoS(Quality of Service)策略,SIP可以优化网络资源分配,保障多媒体...
同时,确保SIP通信的安全性,如使用TLS加密传输、实施严格的访问控制策略。 总结,使用Independentsoft.Sip.dll进行SIP软件开发是一项技术性强且需要深入理解SIP协议的工作。通过对库的熟练运用,开发者可以构建...
虽然SIP是基于文本的,容易受到中间人攻击,但可以通过实施SIPS(使用TLS加密的SIP)和SRTP(Secure Real-time Transport Protocol)来增强安全性。 SIP与VoIP: 在VoIP(Voice over IP)中,SIP常用于建立和管理...
- **安全性**:保护通话内容的隐私,可能需要启用SSL/TLS加密通信。 ### 6. 文件分析 文件"www.pudn.com.txt"可能是下载源码或文档的链接记录,而"SIPPhone"可能是项目或源码文件夹,包含了实现SIP软电话的具体Java...
- 考虑使用TLS(Transport Layer Security)加密通信,确保通话的隐私安全。 - 对SIP服务器的身份验证和访问控制进行配置,防止未授权访问。 以上步骤概述了使用Spring Boot和Java开发SIP网络电话客户端的基本...
常见的安全措施有使用SIPS(通过TLS加密的SIP)、SRTP(安全实时传输协议)以及严格的认证机制。 ### 实际应用 SIP广泛应用于企业通信系统、VoIP提供商、移动网络以及智能家居等领域,提供高效、灵活的通信解决...
1. **网络配置**:确保服务器的网络设置正确,包括IP地址、DNS配置和端口开放,以便SIP消息能正确传递。 2. **用户注册**:设置用户代理客户端如何通过SIP Proxy进行注册,以便它们能够发起和接收呼叫。 3. **呼叫...