码迷,mamicode.com
首页 > 其他好文 > 详细

Centos Xrdp 远程桌面

时间:2016-11-29 23:44:41      阅读:416      评论:0      收藏:0      [点我收藏+]

标签:iptables   ldap   xrdp   

现在公司要求服务器不允许上传下载文件,也不允许复制之类的。领导说用VNC,然后查了一下,VNC是可以复制的(可以添加相关选项禁用复制功能),另外VNC账号要使用LDAP认证还不是太方便。

后来找了一下,发现 xrdp 这个软件。这个其实就是一个远程桌面,在WIN下可以直接用 mstsc连接。

它支持LDAP认证。然后核心还是用的VNC。

因为要禁用复制粘贴,然后默认这个是可以的。直接把 

sesman/chansrv/clipboard.h

中定义的函数,在

sesman/chansrv/chansrv.c

中全部注释即可。然后再编译...


LDAP认证:

centos5、centos6 直接复制一下就OK

cp /etc/pam.d/system-auth-ac /etc/pam.d/xrdp-sesman

ubuntu:

vi /etc/pam.d/xrdp-sesman
#%PAM-1.0
@include common-auth
@include common-account
@include common-session
@include common-password


另外建议把 /etc/xrdp/xrdp.ini 中 其它配置删除,仅使用 sesman-Xvnc

[globals]
bitmap_cache=yes
bitmap_compression=yes
port=3389
crypt_level=low
channel_code=1
max_bpp=24
#black=000000
#grey=d6d3ce
#dark_grey=808080
#blue=08246b
#dark_blue=08246b
#white=ffffff
#red=ff0000
#green=00ff00
#background=626c72

[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1


还有iptables 相关设置。 

#!/bin/bash

# INIT CHAIN
iptables -F
iptables -X
iptables -Z
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD ACCEPT
#INPUT CHAIN
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
# Docker Centos 6 ERROR "FATAL: Could not load /lib/modules/4.4.0-45-generic/modules.dep: No such file or directory"
iptables -A INPUT -p tcp -m multiport --dport 22,3389 -m state --state NEW -j ACCEPT
iptables -A INPUT -p udp -s 192.168.10.4 --sport 53 -j ACCEPT # DNS
iptables -A INPUT -p udp -s 192.168.10.5 --sport 123 -j ACCEPT # NTPDATE
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
#OUTPUT CHAIN
iptables -A OUTPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -d 192.168.10.4 --dport 53 -j ACCEPT # DNS
iptables -A OUTPUT -p udp -d 192.168.10.5 --dport 123 -j ACCEPT # NTPDATE
iptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT # Xrdp
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT

上面的 -m multiport 在Docker Centos 6 中报错,然后拆成,即可

iptables -A INPUT -p tcp --dport 3389 -m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT



SSH仅允许指定用户或者组登录:

vi /etc/ssh/sshd_config  # add
AllowUsers root test1 test2
AllowGroups root test1 test2


目前这样测试OK。

Centos Xrdp 远程桌面

标签:iptables   ldap   xrdp   

原文地址:http://abian.blog.51cto.com/751059/1877805

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!