This tutorial describes how to set up an xRDP server to connect to Ubuntu Linux with the lightweight graphical Xforce UI using the RDP protocol. This can be very handy when you need to connect to Linux operating systems with graphical interface from Windows using Remote Desktop.
What is xRDP?
xRDP is Microsoft’s free and open-source implementation of RDP (Remote Desktop Protocol) which allows non-Microsoft Windows operating systems (such as Linux and BSD) to provide a fully functional RDP-compatible remote desktop.
Installation and Setup
Connect to your ubuntu server via SSH and perform a system update:
sudo apt-get update
sudo apt-get upgrade -y
Install and enable the xRDP utility:
sudo apt-get install xrdp
sudo systemctl enable xrdp
sudo systemctl restart xrdp
Xrdp Installation
Install the xfce environment:
sudo apt-get install xfce4 xfce4-terminal
Open RDP port to be able to connect remotely:
sudo ufw allow 3389/tcp
Reboot the xRDP server for the changes to take effect:
sudo /etc/init.d/xrdp restart
Connecting to an Ubuntu Server via RDP
If you don’t know the IP address of the Ubuntu server, you can check it by entering the command:
Ifconfig -a
Ifconfig -a
In our test case it is 10.0.0.2. To connect open the Windows Remote Desktop Connection (mstsc.exe). Enter the IP address of the server and click Connect:
Remote Desktop Connection
A security warning will appear. Click Yes:
RDP Certificate Error
In the opened window, select Xorg as the session, enter the username and password for the user and click OK:
Xrdp Login
This will connect to the xforce desktop.
Xforce Desktop
If it shows a black screen when connecting to xrdp you need to go into the /etc/xrdp folder, and make changes to the startwm.sh file.
sudo nano /etc/xrdp/startwm.sh
We need to add:
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Before the line:
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
Troubleshooting Errors with Xrdp
After making the changes you have to restart the XRDP service:
sudo systemctl restart xrdp
Now you can run mstsc.exe again and connect to our ubuntu server.
In this article we will cover the installation and configuration of the OpenVPN server based on Linux CentOS, and show how to connect two remote computers (or offices) behind NAT into one network using OpenVPN server. We will also use certificates for encrypted connection. If you are a Windows user, check out the guide about configuring VPN in Windows server operating system.
Contents
What is OpenVPN
How to Install OpenVPN and Easy-RSA
How to Configure Easy-RSA and Issue a Certificate
How to Create Keys and Certificates for the OpenVPN Server
How to Configure OpenVPN Server
How to Configure Firewall with OpenVPN
How to Connect Computers and Networks using OpenVPN
What is Open VPN
Virtual Private Network (VPN) – a set of technologies that allow you to build a secure network over public networks or the Internet. With a VPN, you can consolidate Internet-divided segments of networks into a single local network. OpenVPN – one of the implementations of open source VPN technology based on SSL/TLS. With the help of OpenVPN it is possible to connect in a single network both remote offices and separate local PCs, which are behind firewall with Network Address Translation (NAT).
How to Install OpenVPN and Easy-RSA
First thing you need to do is to connect the ExtraPackagesforEnterpriseLinux (EPEL) repository and update the system:
When the system is updated, you need to use the yum package manager to install OpenVPN and Easy-RSA to implement a Public Key Infrastructure (PKI) infrastructure on the VPN server.
sudo yum install openvpn easy-rsa -y
Easy-RSA Installation
How to Configure Easy-RSA and Issue a Certificate
Copy all the Easy-RSA scripts into /etc/openvpn/:
sudo cp -r /usr/share/easy-rsa /etc/openvpn/
Let’s go to /etc/openvpn/easy-rsa/3/ and create a file named vars there:
cd /etc/openvpn/easy-rsa/3/
sudo nano vars
Let’s fill this file with the following parameters (you can edit the location and company parameters for yourself):
Press Ctrl+x to exit the file then y to save it and then hit Enter. The file must be executable, so next step is to execute the following:
sudo chmod +x vars
How to Create Keys and Certificates for the OpenVPN Server
Before creating the key, we need to initialize the Public Key Infrastructure (PKI) directory and create the CA key:
cd /etc/openvpn/easy-rsa/3/
sudo ./easyrsa init-pki
Initializing PKI Directory
Now let’s create a CA key:
sudo ./easyrsa build-ca
After running the command, we will need to specify a password to generate the certificates and key. The password will be required in the future to sign the certificates.
Creating CA Key
After that the system will ask to enter Distinguished Name (DN) enter your server and domain name for example server.domain.com and create a server key with nopass option which disables the password for domain.com:
sudo ./easyrsa gen-req server.domain.com nopass
Creating Server Key
During the certificate issuance process, you will be asked to enter Common Name, just press Enter to continue.
Sign the domain.com key using our CA certificate:
sudo ./easyrsa sign-req server server.domain.com
Server Key Signing
First you need to confirm the request by typing “yes”. After that you will need to enter the password that we set when the CA certificate was issued:
To make sure that the certificates were generated without errors, run the command:
Let’s move on to the settings of the OpenVPN configuration file. First let’s create the OpenVPN configuration file named server.conf:
sudo cd /etc/openvpn/ && nano server.conf
Change the contents of the file to the following:
# Specify port, protocol and device
port 1194
proto udp
dev tun
# Specify path to server certificates
ca /etc/openvpn/server/ca.crt
cert /etc/openvpn/server/server.domain.com.crt
key /etc/openvpn/server/server.domain.com.key
# Paths to CRL and DH keys
dh /etc/openvpn/server/dh.pem
crl-verify /etc/openvpn/server/crl.pem
# Specify the network IP and mask which the VPN clients will enter
server 10.0.2.0 255.255.255.0
push "redirect-gateway def1"
# Enter the target DNS servers
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
# Allow users to connect with the same key
duplicate-cn
# TLS security
tls-auth /etc/openvpn/server/ta.key 0
cipher AES-256-CBC
tls-version-min 1.2
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-128-CBC-SHA256
auth SHA512
auth-nocache
# Other config
keepalive 20 60
persist-key
persist-tun
comp-lzo yes
daemon
user nobody
group nobody
# Log file path
log-append /var/log/openvpn.log
verb 3
Then we save the file. I specified the default UDP port 1194 for the VPN server, but for OpenVPN you can specify any free port on the server.
How to Configure Firewall with OpenVPN
What remains is to configure firewall rules to allow connection and routing between segments.
If you are using Firewalld, you must first activate the kernel module forwarding:
Let’s check the IP settings of the network interface:
sudo ip a
3: tun0: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100
link/none
inet 10.0.2.1 peer 10.0.2.2/32 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::932a:e40b:ac2f:6b2/64 scope link flags 800
valid_lft forever preferred_lft forever
As you can see, the network specified in the configuration has been added to the tun0.
These are the minimum settings you need to make for OpenVPN to work.
How to Connect Computers and Networks using OpenVPN
How to connect to the OpenVPN server from two remote computers that are connected to the Internet via NAT, and organize a private network between them? To connect a Windows computer to the OpenVPN server you will need the official client from that can be downloaded from the official site. The installation is straightforward, so we will focus on the configuration.
After you have installed the client, you need to go to the configuration file, which you need to create along the way:
C:\Program Files\OpenVPN\config
Create a file with the name Client.ovpn and add the following content to it:
client
dev tun
proto udp
remote publicVPNserverIP 1194
resolv-retry infinite
nobind
block-outside-dns
perist-key
persist-tun
mute-replay-warnings
remote-cert-tls server
tls-client
auth SHA512
tls-auth "C:\Program Files\OpenVPN\config.key" 1
remote-cert-eku "TLS Web Server Authentication"
ca "C:\Program Files\OpenVPN\config\ca.crt".
cert "C:\Program Files\OpenVPN\config\admin.crt".
key "C:\Program Files\OpenVPN\config\admin.key".
cipher AES-256-CBC
comp-lzo
verb 3
As you can see we need the client, security and server certificates and keys we created earlier to configure. They need to be downloaded from the OpenVPN server and placed in a C:\Program Files\OpenVPN\config\ directory.
After that we connect through the shortcut Open VPN client in the tray:
On the second computer behind the NAT, we need to do the same thing by first creating a certificate for the second user. After connection the second computer has IP address in the same network:
Once connected, both computers are on the same network and ping each other. Both connected VPN clients can exchange packets and transfer files directly to each other. This way, we were able to combine two PCs located in different parts of the world into one local network.
On your OpenVPN server you can create an unlimited number of keys and certificates for users. If you need a new certificate, run the following commands in /etc/openvpn/easy-rsa/3:
sudo ./easyrsa gen-req client name nopass
sudo ./easyrsa sign-req client name
Remember to periodically revoke client certificates if they are not used to keep your network secure.
Zabbix is an open-source enterprise level monitoring system. At the moment Zabbix is one of the most popular and functional free monitoring systems, with its easy installation and configuration. Zabbix server can be used for monitoring large infrastructures with hundreds of servers, as well as for small environment. In this article we will cover how to install and configure free monitoring system Zabbix with Linux Ubuntu based web interface. Install Zabbix agents on Windows and Linux server, and add new hosts to the system for monitoring.
Contents
Zabbix structure and functionality
Installing Zabbix server on Linux
Configuring Zabbix web interface
Installing Zabbix agent on Windows
Adding a device on a Zabbix server
Installing Zabbix agent on Linux
Zabbix Structure and Functionality
Zabbix is rather simple to install and configure. It is written in C++ (server, proxy and agent) and PHP (frontend). Zabbix server and Zabbix proxy can only run on Linux systems. The agent can be installed on many supported operating systems and platforms.
The Zabbix server installation package consists of:
Zabbix server binary
MySQL (MariaDB)/PostgreSQL databases
Apache2/Nginx web server with PHP frontend
Frontend files – .php, .js, .css, etc…
The scheme of work looks like this:
The Zabbix agent sends data to the server
The Zabbix server receives and processes the data
If the received data is subject to the specified conditions, a trigger is triggered
An active trigger signals a problem. A notification is displayed on the frontend, the notification emails is sent and needed actions are automatically performed. This depends on the configuration, for example Zabbix agent can restart the service that is being monitored.
Zabbix can work with all known protocols, thanks to a system of external scripts.
Installing Zabbix Server on Linux
In this article we will take a look at an example installation of Zabbix Server on Linux (using Ubuntu Server) through a batch manager.
Go to the download page https://www.zabbix.com/download and select the repository corresponding to your Linux distribution. Ready-made packages are available for all popular distributions.
For example, to install Zabbix 5 on Ubuntu 18.04 you have to select :
Zabbix Version 5 ⇒ OS Distribution (Ubuntu) ⇒ OS Version (18.04 Bionic) ⇒ Database (MySQL) ⇒ Web Server (Nginx or Apache).
Create a database and give the rights to the service account under whom Zabbix will access the database:
mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'Your Password';
mysql> quit;
Import the Zabbix database. You will need to enter the password that you specified for the zabbix@localhost user.
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p Zabbix
Edit the configuration file /etc/zabbix/zabbix_server.conf, specify the password from the newly created user.
DBPassword=users password
Since in this example the web server is nginx, you need to change nginx.conf by removing “#” from the following lines:
listen 80;
server_name example.com;
Also change “example.com” to the domain name you want to log in to Zabbix web console, in this example it’s “test.zabbix.local“.
Now let’s set the time zone in PHP. In the /etc/zabbix/php-fpm.conf file lets remove “#” from the following line:
php_value[date.timezone] = Europe/Moscow
Additionally, you can set the following PHP settings in /etc/php.ini:
memory_limit 128M
upload_max_filesize 8M
post_max_size 16M
max_execution_time 300
max_input_time 300
max_input_vars 10000
Add the zabbix-server service to autostart and run it:
Now you need to configure the frontend (web interface) of Zabbix. Open the previously specified URL of Zabbix server in your browser. In our example it is test.zabbix.local. Do not forget to register it on your DNS server.
Make sure that all installer requirements are OK.
Enter the data to connect to the database. Use the user and password you created earlier.
Enter the name of the Zabbix server. I recommend not to change the standard port – TCP 10051.
Note. The default Zabbix system uses two ports:
TCP 10050 is a passive agent port, on which the zabbix server polls clients;
TCP 10051 – the port on which zabbix server receives data from clients (active agent).
After that press Next Step and Finish. After successful installation, you will need to log in. Use “Admin” as login and “zabbix” as password, these are the default credentials.
This concludes the installation of the Zabbix Server.
Installing Zabbix Agent on Windows Server
Let’s try to install Zabbix agent on a Windows server and add it to our Zabbix monitoring. Download Zabbix agent for Windows here: https://www.zabbix.com/download_agents.
Select the desired version of the agent for Windows. For this example we will choose the “.msi x64” format (without OpenSSL). If you plan to install zabbix agent on servers/computers via Group Policy or SCCM, you can download the zip archive with binary and configuration files.
Start the installer, accept the license agreement, specify the requested data. Note that in the “Server or Proxy for active checks” field I entered the IP address in “IP:PORT” format. Since I left the port as standard, it will be serverip:10051.
Then click Next and Install.
Now we need to make sure that our agent is installed. The Zabbix agent service should appear in the services.msc list.
On the Windows client Firewall, you need to allow incoming connections from the Zabbix server:
To make sure that the agent is working, you need to add our host to the Zabbix server and assign it checks.
Note. There are two types of checks in the Zabbix: Passive – the Zabbix server asks for some data from the agent; Active – the agent sends data to the server;
While installing the agent, we specified a server in IP:PORT format just for active checks.
Adding Device on a Zabbix Server
So We’ve installed the agent, now we need to add it on the monitoring platform via web-interface. Go to Configuration ⇒ Hosts ⇒ Click Create host and fill in the data. Note that the host’s name must match the host name of the server with the agent or the value of the Hostname parameter in the agent config.
On the Templates tab, add some built-in Windows templates. Templates in Zabbix are sets of values, triggers, graphs and detection rules that can be assigned to one or more hosts.
These integrated templates have “active” in the end, which means that active checks will be used.
Click Add. To avoid waiting for the server and agent to connect with each other (usually takes a couple of minutes), restart the Zabbix Agent service on monitored host and check the agent’s log (C:\Program Files\Zabbix Agent\zabbix_agentd.txt).
The message “started [active checks #1]” indicates that active checks for this host have been found on the server. Now let’s look at the data that came to the Zabbix server from the agent. To do this in Zabbix, go to Monitoring ⇒ Latest Data and select the desired host in the Hosts field.
This section shows the latest data that came to the server by selected hosts or groups of hosts. Note that there is a notification on the Zabbix dashboard that the BITS service is not running. This notification appears because we have assigned standard templates to our host. One of the templates was monitoring the BITS service and the corresponding trigger, which is triggered if the BITS service is not in status Running.
This concludes the configuration of the Windows Agent.
Installing the Zabbix Agent on Linux
Now let’s install the Zabbix agent on Linux. To install the Zabbix agent in Ubuntu Server using the package manager you need to download and install the Zabbix repository. Then we will install the zabbix agent from the repository:
Before we run the zabbix agent, we need to edit the /etc/zabbix/zabbix_agentd.conf configuration file. In this file you need to specify the IP address of the Zabbix server for active checks:
“Cannot parse list of active checks” string indicates that there are no active checks for this host on the server.
Similar to the Windows agent, you need to add your Linux host to the Zabbix server settings. Note the Hostname parameter in the host configuration in the server’s Zabbix interface must match the Hostname parameter that we specify in the Zabbix config.
Reboot the Zabbix agent and check the log.
Check that the agent data has appeared on the Zabbix server.
This completes the configuration of the Zabbix agent on your Linux system.