domingo, 14 de abril de 2013

Emulating Terminal Server with VNC

Recipe to have something like Terminal Server with Linux.

If you need several graphical sessions in a headless server, you can combine the Xdmcp protocol, GDM and VNC Server.

Prerequisites: gdm, vncserver, xinetd

1. Enable Xdmcp in GDM
    edit /etc/gdm3/daemon.conf and add
       Enable = true
  to the [xdmcp] section.
2. Restart GDM (/etc/init.d/gdm3 restart)
3. Add VNC service to xinetd.d
             Add a file /etc/xinetd.d/vnc
service Xvnc
        type = UNLISTED
        disable = no
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        server = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -geometry 800x600 -depth 16 -securitytypes=none -NeverShared
        port = 5901
4. Restart XINETD (/etc/init.d/xinetd restart)
5. Voilà

$ xvncviewer IP:1  and you'll see a graphical login prompt.
Each time you'll have a new session till it gets closed.

Automatic CheckPoint SSL VPN login (Linux)

Little recipe to automatically login to CheckPoint SSL Network Extender:

----------------- /home/user/login.vpn.expect -----------
spawn /usr/bin/snx -s <SERVER> -p 443 -u <USERNAME>
expect "password:"
send "<PASSWORD>\r"
expect eof

To execute it, you just need to use expect tool:
$ expect login.vpn.expect

Good luck!