標籤: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=yesbitmap_compression=yesport=3389crypt_level=lowchannel_code=1max_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-Xvnclib=libvnc.sousername=askpassword=askip=127.0.0.1port=-1
還有iptables 相關設定。
#!/bin/bash# INIT CHAINiptables -Fiptables -Xiptables -Ziptables -F -t natiptables -X -t natiptables -Z -t natiptables -P INPUT DROPiptables -P OUTPUT DROPiptables -P FORWARD ACCEPT#INPUT CHAINiptables -A INPUT -i lo -j ACCEPTiptables -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 ACCEPTiptables -A INPUT -p udp -s 192.168.10.4 --sport 53 -j ACCEPT # DNSiptables -A INPUT -p udp -s 192.168.10.5 --sport 123 -j ACCEPT # NTPDATEiptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPTiptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT#OUTPUT CHAINiptables -A OUTPUT -m state --state ESTABLISHED -j ACCEPTiptables -A OUTPUT -p udp -d 192.168.10.4 --dport 53 -j ACCEPT # DNSiptables -A OUTPUT -p udp -d 192.168.10.5 --dport 123 -j ACCEPT # NTPDATEiptables -A OUTPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT # Xrdpiptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPTiptables -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 ACCEPTiptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
SSH僅允許指定使用者或者組登入:
vi /etc/ssh/sshd_config # addAllowUsers root test1 test2AllowGroups root test1 test2
目前這樣測試OK。
Centos Xrdp 遠端桌面