How To Configure Network Services and Secure Communications on Kali Linux
The first step in being able to use Kali is to ensure that it has connectivity to either a wired or wireless network to support updates and customization.
You may need to obtain an IP address by DHCP (Dynamic Host Configuration Protocol), or assign one statically. First, confirm your IP address using the ifconfig command from a terminal window, as shown in the following screenshot:
In this particular case, the VM has been assigned an IP address of 192.168.204.132.
If an IP address was not obtained, an address can be assigned by DHCP using the command dhclient eth0 (or other available interfaces, which will depend on the specific configuration of the system being used).
If a static IP address is used, additional information may be required. For example, you can assign a static IP of 192.168.204.128 as follows:
host IP address: 192.168.204.128 subnet mask: 255.255.255.0 default gateway: 192.168.204.1 DNS server: 192.168.204.10
Enter a terminal window and enter the following command:
[email protected]:~# ifonconfig eth0 192.168.204.128/24 [email protected]:~# route add default gw 192.168.204.1 [email protected]:~# echo nameserver 192.168.204.10 > /etc/resolv.conf
Changes made to IP settings are non persistent, and will be lost when Kali Linux is rebooted. To make the changes permanent, you will need to edit the /etc/network/ interfaces file, as shown in the following screenshot:
By default, Kali Linux does not start with the DHCP service enabled. Doing so announces the new IP address on the network, and this may alert administrators about the presence of the tester. For some test cases, this may not be an issue, and it may be advantageous to have certain services start automatically during boot up.
This can be achieved by entering the following commands:
[email protected]~# update-rc.d networking defaults [email protected]~# /etc/init.d/networking restart
Kali Linux installs with network services that can be started or stopped as required, including DHCP, HTTP, SSH, TFTP, and the VNC server. These services are usually invoked from the command line, however, some are accessible from the Kali menu.
Adjusting network proxy settings
Users located behind an authenticated or unauthenticated proxy connection must modify bash.bashrc and apt.conf. Both files are located in the /root/etc directory.
1/ Edit the bash.bashrc file, as shown in the following screenshot, use a text editor to add the following lines to the bottom of the bash.bashrc file:
export ftp_proxy="ftp://user:[email protected]:port" export http_proxy="http://user:[email protected]:port" export https_proxy="https://user:[email protected]:port" export socks_proxy="https://user:[email protected]:port"
2/ Replace proxyIP and port with your proxy IP address and port number respectively, and replace the username and password with your authentication username and password. If there’s no need to authenticate, write only the part following the @ symbol.
3/ In the same directory, create the apt.conf file and enter the following command lines, as shown in the following screenshot:
4/ Save and close the file. Log out and then log in to activate the new settings.
Securing communications with Secure Shell
To minimize detection by a target network during testing, Kali Linux does not enable any externally-listening network services. Some services, such as Secure Shell (SSH), are already installed. However, they must be enabled prior to use.
Kali comes preconfigured with default SSH keys. Before starting the SSH service, it’s a good idea to disable the default keys and generate a unique keyset for use.
Move the default SSH keys to a backup folder, and then generate a new SSH keyset using the following command:
The process of moving the original keys and generating the new keyset is shown in the following screenshot.
To verify that the newly generated keys are unique, calculate their md5sum hash values, and compare with the original keys as shown in the following screenshot.
To start the SSH service using the menu, select Applications | Kali Linux | System Services | SSHD | SSHD Start.
To start SSH from the command line :
[email protected]:~# etc/init.d/ssh start
To verify that SSH is running, perform a netstat query, as shown in the following command:
[email protected]:~# netstat -antp
The SSH daemon is listening on port 22 in the previous example. To stop SSH, use
the following command:
[email protected]:~# /etc/init.d/ssh stop
That all, we have down with Configuring network services and secure communications on Kali Linux.
If you have encountered a problem or you have any questions or remarks please feel free to set a comment.
If this article helped you to solve your problem please feel free to share it with your friends … with love and prosperity K4LINUX–TEAM.
With Love and Prosperity K4LINUX-TEAM.