A configuração do
Freenx é bem simples, foram feitas algumas alterações em seu arquivo de configuração, que fica em
/etc/nxserver/node.conf.
Algumas alterações importantes:
- Porta de conexão que foi mudada da 22 para a 37775;
- Modo de autenticação pelo arquivo passwd do sistema;
- Efetuar "log" do FreeNX em modo critico;
- Utilizar o Fluxbox como padrão de interface gráfica.
Abaixo estão as alterações feitas no arquivo:
##########################################################
# General FreeNX directives
##########################################################
# The host name which is used by NX server. It's should be used if it's
# different than the default hostname (as returned by `hostname`)
SERVER_NAME="$(hostname)"
# The port number where local 'sshd' is listening.
SSHD_PORT=37775
##########################################################
# Authentication / Security directives
##########################################################
# This adds the passdb to the possible authentication methods
ENABLE_PASSDB_AUTHENTICATION="0"
# This adds SSH to the possible authentication methods. For it to work sshd
# must be set up at localhost accepting password authentication.
ENABLE_SSH_AUTHENTICATION="1"
# Require all users to be in the passdb, regardless of authentication method
ENABLE_USER_DB="0"
##########################################################
# Logging directives
##########################################################
# This directives controls the verbosity of the server-wide log.
# 0: No Logging
# 1: Errors
# 2: Warnings
# 3: Important information
# 4: Server - Client communication
# 5: Information
# 6: Debugging information
# 7: stderror of some applications
NX_LOG_LEVEL=7
# Before turning logging on, please make sure that NX_LOGFILE is
# writeable for the "nx" user
NX_LOGFILE=/var/log/nxserver.log
##########################################################
# Path directives
##########################################################
# The command binary for the default window manager. If set it is run when a
# 'unix-custom' session is requested by the NX Client and an application
# to run is specified. It defaults to empty (ie no WM is run).
# If KILL_DEFAULT_X_WM is set the WM is terminated after the started
# application finishes. Else FreeNX will wait for the WM to complete.
DEFAULT_X_WM="gdm"
# When a 'unix-default' session is requested by the client the user's X startup
# script will be run if pressent and executable, otherwise the default X
# session will be run.
# Depending on distribution USER_X_STARTUP_SCRIPT might be .Xclients, .xinitrc
# and .Xsession
# Depending on distribution DEFAULT_X_SESSION might be /etc/X11/xdm/Xsession,
# /etc/X11/Sessions/Xsession or /etc/X11/xinit/xinitrc
#USER_X_STARTUP_SCRIPT=.Xclients
DEFAULT_X_SESSION=/etc/X11/xdm/Xsession
# Linha acrescentada para utilização da interface gráfica “FLUXBOX”
COMMAND_START_FLUXBOX=fluxbox
##########################################################
# Misc directives
##########################################################
AGENT_FONT_SERVER="unix/:7100"
Configuração do SSH
Como o FreeNX utilizará uma porta diferente do padrão do ssh, é preciso executar essa alteração também no sshd. Para fazer essa alteração edite o arquivo /etc/ssh/sshd_config.
# vi /etc/ssh/sshd_config
Port 37775
Configuração do FluxBox
No FluBox houve uma alteração no menu para que as pessoas que acessassem remotamente essa máquina pudessem somente fazer acesso remoto, trocar a sua senha ou sair do sistema. Para que isso fosse realizado editamos o arquivo /usr/share/fluxbox/menu.
# vi /usr/share/fluxbox/menu
[begin] (NOME_DA_EMPRESA)
[exec] (Rdesktop) {tsclient}
[exec] (Troca de Senha) {xterm -iconic -e sh freenxpass}
[exit] (Exit)
[end]
Para conseguir fazer o acesso remoto foi instalado um aplicativo chamado txclient:
# yum install tsclient
Já no sistema de troca de senha, foi criado um script para efetuar essa troca. Para que o script ficasse com um front end melhor foi utilizado um aplicativo chamado Xdialog.
#!/bin/bash
senha ()
{
SENHAOLD=$(/usr/bin/Xdialog --stdout \
--title "Troque a Senha" \
--insecure \
--passwordbox 'Informe a Senha Atual:' 0 0)
case $? in
1) exit ;;
esac
SENHA=$(/usr/bin/Xdialog --stdout \
--title "Troque a Senha" \
--insecure \
--passwordbox 'Informe a nova Senha. Minimo 6 caracteres' 0 0)
case $? in
1) exit ;;
esac
SENHACHECK=$(/usr/bin/Xdialog --stdout \
--title "Troque a Senha" \
--insecure \
--passwordbox 'Repita a nova Senha:' 0 0)
case $? in
1) exit ;;
esac
if [ "$SENHA" == "$SENHACHECK" ]
then
( echo $SENHAOLD ; echo $SENHA ; echo $SENHA ) | passwd 2>&- >&-
if [ $? -ne 0 ]
then
/usr/bin/Xdialog --title ERRO --msgbox ' Senha Atual Incorreta ou Senha Nova Fraca. Tente Novamente' 0 0
else
/usr/bin/Xdialog --title Nome_da_Empresa --msgbox 'Senha Alterada com Sucesso!' 0 0
exit
fi
else
/usr/bin/Xdialog --title ERRO --msgbox 'Erro na troca da senha: Senhas diferentes' 0 0
fi
}
while true
do
senha
done