Conexión por escritorio remoto a servidor CentOS usando Protocolo de Windows (RDP)

Sacrilegio! Gritaran algunos…

En Linux es posible instalar un servidor RDP para usar el protocolo que se usa para conectarse remotamente normalmente a equipos Windows. El funcionamiento es a través de una pasarela RDP hacia un servidor VNC. Esto puede ser útil para aquellos administradores de Windows que no son muy dados a la administración por consola de equipos Linux (que es lo más recomendable en este tipo de ambientes)

Para esto se siguen unos sencillos pasos en CentOS 7 (pasos similares probablemente apliquen para otras distribuciones).

  1. Actualizar el sistema: Por favor, siempre, actualizar el sistema, siempre!

    yum update

  2. Instalar el repositorio EPEL

    yum -y install epel-release

    [root@linuxserver ~]# yum -y install epel-release
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    *base: mirror.edatel.net.co
    *extras: mirror.edatel.net.co
    *updates: mirror.edatel.net.co
    
    Resolving Dependencies
    --> Running transaction check
    ---> Package epel-release.noarch 0:7-9 will be installed
    --> Finished Dependency Resolution
    ^[[Z
    Dependencies Resolved
    
    ===============================================================
    Package                                         Arch                                      Version                                Repository                                 Size
    ===============================================================
    Installing:
    epel-release                                    noarch                                    7-9                                    extras                                     14 k
    
    Transaction Summary
    ===============================================================
    Install  1 Package
    
    Total download size: 14 k
    Installed size: 24 k
    Downloading packages:
    epel-release-7-9.noarch.rpm                                                                                                                                |  14 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Installing : epel-release-7-9.noarch                                                                                                                                        1/1
    Verifying  : epel-release-7-9.noarch                                                                                                                                        1/1
    
    Installed:
    epel-release.noarch 0:7-9
    
    Complete!
    [root@linuxserver ~]#
    
  3. Instalar el servidor de RDP y VNC

    yum -y install xrdp tigervnc-server

    [root@linuxserver ~]# yum -y install xrdp tigervnc-server
    Loaded plugins: fastestmirror, langpacks
    epel/x86_64/metalink                                                                                                                                       |  40 kB  00:00:00
    epel                                                                                                                                                       | 4.2 kB  00:00:00
    (1/3): epel/x86_64/group_gz                                                                                                                                | 170 kB  00:00:01
    (2/3): epel/x86_64/updateinfo                                                                                                                              | 808 kB  00:00:10
    (3/3): epel/x86_64/primary_db                                                                                                                              | 4.8 MB  00:00:27
    Loading mirror speeds from cached hostfile
    *base: mirror.edatel.net.co
    *epel: mirror.cedia.org.ec
    *extras: mirror.edatel.net.co
    *updates: mirror.edatel.net.co
    Resolving Dependencies
    --> Running transaction check
    ---> Package tigervnc-server.x86_64 0:1.3.1-9.el7 will be installed
    ---> Package xrdp.x86_64 1:0.9.2-12.el7 will be installed
    --> Processing Dependency: xorgxrdp for package: 1:xrdp-0.9.2-12.el7.x86_64
    --> Running transaction check
    ---> Package xorgxrdp.x86_64 0:0.2.1-1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===============================================================
    Package                                         Arch                                   Version                                        Repository                            Size
    ===============================================================
    Installing:
    tigervnc-server                                 x86_64                                 1.3.1-9.el7                                    base                                 203 k
    xrdp                                            x86_64                                 1:0.9.2-12.el7                                 epel                                 408 k
    Installing for dependencies:
    xorgxrdp                                        x86_64                                 0.2.1-1.el7                                    epel                                  58 k
    
    Transaction Summary
    ===============================================================
    Install  2 Packages (+1 Dependent package)
    
    Total download size: 669 k
    Installed size: 2.7 M
    Downloading packages:
    (1/3): tigervnc-server-1.3.1-9.el7.x86_64.rpm                                                                                                              | 203 kB  00:00:00
    warning: /var/cache/yum/x86_64/7/epel/packages/xorgxrdp-0.2.1-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY          ] 228 kB/s | 401 kB  00:00:01 ETA
    Public key for xorgxrdp-0.2.1-1.el7.x86_64.rpm is not installed
    (2/3): xorgxrdp-0.2.1-1.el7.x86_64.rpm                                                                                                                     |  58 kB  00:00:01
    (3/3): xrdp-0.9.2-12.el7.x86_64.rpm                                                                                                                        | 408 kB  00:00:01
    -----------------------------------------------------------------
    Total                                                                                                                                             471 kB/s | 669 kB  00:00:01
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    Importing GPG key 0x352C64E5:
    Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
    Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
    Package    : epel-release-7-9.noarch (@extras)
    From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Installing : xorgxrdp-0.2.1-1.el7.x86_64                                                                                                                                    1/3
    Installing : 1:xrdp-0.9.2-12.el7.x86_64                                                                                                                                     2/3
    Installing : tigervnc-server-1.3.1-9.el7.x86_64                                                                                                                             3/3
    Verifying  : xorgxrdp-0.2.1-1.el7.x86_64                                                                                                                                    1/3
    Verifying  : tigervnc-server-1.3.1-9.el7.x86_64                                                                                                                             2/3
    Verifying  : 1:xrdp-0.9.2-12.el7.x86_64                                                                                                                                     3/3
    
    Installed:
    tigervnc-server.x86_64 0:1.3.1-9.el7                                                         xrdp.x86_64 1:0.9.2-12.el7
    
    Dependency Installed:
    xorgxrdp.x86_64 0:0.2.1-1.el7
    
    Complete!
    [root@linuxserver ~]#
    
  4. Configurar servicio, firewall y SELinux

    Una vez instalado se requiere habilitar el servicio para que inicie con el sistema, crear las reglas respectivas de firewall y tambien de SELinux

    systemctl start xrdp.service

    systemctl enable xrdp.service

    firewall-cmd –permanent –zone=public –add-port=3389/tcp

    firewall-cmd –reload

    chcon –type=bin_t /usr/sbin/xrdp

    chcon –type=bin_t /usr/sbin/xrdp-sesman

    [root@linuxserver ~]# systemctl start xrdp.service
    [root@linuxserver ~]# systemctl enable xrdp.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/xrdp.service to /usr/lib/systemd/system/xrdp.service.
    [root@linuxserver ~]# netstat -antup | grep xrdp
    tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      19712/xrdp-sesman
    tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      19713/xrdp
    [root@linuxserver ~]# firewall-cmd --permanent --zone=public --add-port=3389/tcp
    success
    [root@linuxserver ~]# firewall-cmd --reload
    success
    [root@linuxserver ~]#
    [root@linuxserver ~]# chcon --type=bin_t /usr/sbin/xrdp
    [root@linuxserver ~]# chcon --type=bin_t /usr/sbin/xrdp-sesman
    [root@linuxserver ~]#
    
  5. Conectarse al servidor Linux por RDP

    Una vez configurado el servicio, solo se requiere usar el cliente de Windows para conectarse indicando la IP o el nombre del servidor (también funciona en clientes de RDP en Linux como Remmina):

    Inicio de cliente RDP

    Cliente RDP

    Certificado RDP

    Inicio sesion RDP

    Sesion RDP iniciada

Fuentes:

comments powered by Disqus