Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Linux repeater mod

Simple, Free, Open Source UltraVNC Wrapper Supporting Windows and Mac OSX
Post Reply
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Linux repeater mod

Post by lall »

Hi,

chunkrepeater.pl is a modified version of ultravnc_repeater.pl
chunkrepeater.pl is very easy to use and run. Just make it executable (4) and double click it to run in default mode!

Complete how-to:
I use console to explain the process, because there may be differences in different OS builds, but console stays quite the same.
You can basically copy-paste those commands to your console.

Open your console/terminal and write:

1)Download script

Code: Select all

wget http://www.chunkvnc.com/extras/lall/chunkrepeater.tar.gz
This will download the script to your home directory.

2)Unpack it:

Code: Select all

tar xvfz chunkrepeater.tar.gz
3)Move it where you want it to be (optional):
Tip! Use TAB to finish your commands.

Code: Select all

mv chunkrepeater/ /path/you/want-it-to-be/
(for example: mv chunkrepeater/ /srv/)

4)Make it executable!

Code: Select all

sudo chmod +x chunkrepeater/chukrepeater.pl
OR if you moved it

Code: Select all

sudo chmod +x /path/to/script/chunkrepeater.pl
That's it! Now the script is ready to run!

###########################

How to use the script:

Code: Select all

sudo /path/to/script/chunkrepeater.pl [-b -w] [-r] [server port] [viewer port]
All [arguments] are optional!

-w runs script in whitelist mode
-b runs script in blacklist mode
-r refuses existing IDs

To kill/stop the script:

Code: Select all

sudo killall -p chunkrepeater.pl
Log file will be created in:
/var/log/chunkrepeater.log


Download:
http://www.chunkvnc.com/extras/lall/

Changes:
script has IP logging
script runs always as system daemon (no need to use CHUNKREPEATER_LOOP=BG)
script always creates log file to /var/log/ (no need to use CHUNKREPEATER_LOGFILE=/pathtologfile.log)
script has three operating modes - normal, whitelist and blacklist.

Tips:
edit chunkrepeater.pl with any text editor and change 10101 and 10102 ports as you need them to be! with so, you can simply start the script without entering your server and viewer ports! (chunkrepeater -w 5900 5901)

To switch between operating modes you must kill the script first and then run it in different mode.


Still working on other mods and security.
Last edited by lall on 2011-01-04 06:21, edited 33 times in total.
maxabbr
8
8
Posts: 19
Joined: 2006-06-06 20:19

Re: Linux repeater tips

Post by maxabbr »

Thanks lall, great tip and explanation about the repeater configuration on Linux.
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Linux repeater tips

Post by supercoe »

Wow, great tips and first post!

Welcome lall, I hope you stick around. :D
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Re: Linux repeater tips

Post by JonD »

I use the repeater from
http://koti.mbnet.fi/jtko/
and auto start it with my linux box bootup.

Is there anyone that can compare the perl script with the above application to show the relative merits of each repeater?

The one feature that I do use... a restriction on what IDs are permitted to pass through the repeater.

JonD
redge
1000
1000
Posts: 6797
Joined: 2004-07-03 17:05
Location: Switzerland - Geneva

Re: Linux repeater tips

Post by redge »

lall,

you welcome
please, merge your effort together with others coders
[topic=18035][/topic]

http://code.google.com/p/uvncrepeater/
Last edited by redge on 2010-12-22 22:34, edited 1 time in total.
UltraVNC 1.0.9.6.1 (built 20110518)
OS Win: xp home + vista business + 7 home
only experienced user, not developer
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater tips

Post by lall »

JonD wrote:I use the repeater from
http://koti.mbnet.fi/jtko/
and auto start it with my linux box bootup.

Is there anyone that can compare the perl script with the above application to show the relative merits of each repeater?

The one feature that I do use... a restriction on what IDs are permitted to pass through the repeater.

JonD
JonD,

This Jari's code is quite old. But it works, I've used it before.

If you'd like, I may edit the perl script so, that there would be a blacklist file for IP addresses and ID numbers. This was in my todo list, because I have some InstantSupport exes installed as services, and I have no idea where they are..and it sounds like fun :)
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater tips

Post by lall »

redge wrote:lall,

you welcome
please, merge your effort together with others coders
[topic=18035][/topic]

http://code.google.com/p/uvncrepeater/
I will digest the information that's available. Thanks for link.
JonD
40
40
Posts: 121
Joined: 2006-12-24 16:46
Location: Canada

Re: Linux repeater tips

Post by JonD »

lall,

A modified script to restrict to specified IDs would be great. Since most everyone here seems to be using the Perl script, I think I would like to switch.

JonD
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater tips

Post by lall »

I'll do necessary modifications and post complete modified script with complete how-to.
Since it's Christmas (happy holidays to all) it's gonna take me some time.
And since I'm not a programmer or a developer, the process may be slower than it's for some qualified perl-philologist :)
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Linux repeater tips

Post by supercoe »

I agree that the Perl repeater would be the best one to work on.

Looking forward to see what you do here. :D


Wishlist:

- Simple authentication before allowing an ID to connect
- Ability to see currently connected ID's (rudi did this in a test build of the Windows repeater with a built in http server)


I'm new to Perl as well but I'd really like to help in any way I can since repeater security is often requested.

Happy holidays. :)
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater tips

Post by lall »

JonD wrote:lall,

A modified script to restrict to specified IDs would be great. Since most everyone here seems to be using the Perl script, I think I would like to switch.

JonD
Have you tried the script already? I'd like to get (any) comments.
redge
1000
1000
Posts: 6797
Joined: 2004-07-03 17:05
Location: Switzerland - Geneva

Re: Linux repeater mod

Post by redge »

i can't check, i have a linux server but i'm not techncian of linux, i'm just lammer, and the repeater is installed is based on the repeater linux 0.14
UltraVNC 1.0.9.6.1 (built 20110518)
OS Win: xp home + vista business + 7 home
only experienced user, not developer
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

redge wrote:i can't check, i have a linux server but i'm not techncian of linux, i'm just lammer, and the repeater is installed is based on the repeater linux 0.14
0.14 is old..i'd really recommend you to switch.
You and lammer? I hardly believe..:)

If you'd like test the repeater and need help, I can help you out.

What is your server OS? Debian based? Or centOS?

if it's centos, i must create new virtual machine to test the script, since i have never used centOS before..although i imagine that it's not a problem for me. I am usng debian based linux distros.

Should I write complete how-to for downloading, unpacking and using the script so everyone can understand it?
redge
1000
1000
Posts: 6797
Joined: 2004-07-03 17:05
Location: Switzerland - Geneva

Re: Linux repeater mod

Post by redge »

would be happy to know the list change log of repeater before request update repeater on my linux virtual server

i'm owner of the virtual server based Debian linux but not technician of linux
i'm experienced user of windows not linux ;-)
UltraVNC 1.0.9.6.1 (built 20110518)
OS Win: xp home + vista business + 7 home
only experienced user, not developer
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

redge wrote:would be happy to know the list change log of repeater before request update repeater on my linux virtual server

i'm owner of the virtual server based Debian linux but not technician of linux
i'm experienced user of windows not linux ;-)
Let me know if you need help, maybe i can help.
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

Before I'm diving to security, i'm splitting the code into 2:
GUI mode and verbose mode.

If all goes well, the script will run in GUI by default and in verbose mode from command line.
Rat
80
80
Posts: 182
Joined: 2004-11-01 02:11

Re: Linux repeater mod

Post by Rat »

Although I've already mentioned this point to Lall privately I thought I should repeat it publicly here now that there's a forum thread.

I use the Perl repeater on shared hosting environments where the user has only limited privileges and the BG Loop mode allowed it to run effectively as a daemon. A GUI would also be of limited use in this scenario unless it provided a Web interface which woud be great and was something that I have also considered.

I can only reiterate Supercoe's comment that the ability to provide security to the script would be my highest priority too.

I also recently suggested a mod to add IP address logging, see the code below:

IP ADDRESS LOGGING MOD
In the code where it has: lprint("new vnc client connecting."); and lprint("new vnc server connecting."); add some other lprint commands like the following:

Code: Select all

if ($client_listen) {lprint($client_listen->sockhost ());}
else if ($client_listen6) {lprint($client_listen6->sockhost ());}
and

Code: Select all

if ($server_listen) {lprint($server_listen->sockhost ());}
else if ($server_listen6) {lprint($server_listen6->sockhost ());}
This should log the Client and Server IP address in the log file.

Note: See http://perldoc.perl.org/IO/Socket/INET.html[/u]
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

Hi rat,

Actually, I added IP logging to the point where the server gets an ID.

Code: Select all

lprint("storing new vnc server with ID:$id from " . $sock->peerhost);
But i'll add it before that point too, thanks for info.
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

Rat wrote:A GUI would also be of limited use in this scenario unless it provided a Web interface which would be great and was something that I have also considered.
If you can tell me how to create PHP based UI for the script without local webserver, I'll do it. I searched and experimented, but didn't had success..
So far the easiest (for users) is to write Tk UI in to the script and IF users are really unable to install perl-tk, they can always run the script in verbose mode, without needing to install anything.

You asked how did I manage to run the scrip as sys daemon:

Code: Select all

#Daemon stuff
setpgrp(0, 0);
my $pid = fork();

	if (! defined $pid) {
	die "chunkrepeater.pl: $!\n";
	} elsif ($pid) {
	wait;
	exit 0;
	}
	if (fork) {
		exit 0;
	}
	setpgrp(0, 0);
	close STDIN;
	if (! $ENV{CHUNKREPEATER_LOGFILE}) {
		close STDOUT;
		close STDERR;
	}
	if (exists $ENV{CHUNKREPEATER_PIDFILE}) {
		open_pidfile();
	}

if (exists $ENV{CHUNKREPEATER_PIDFILE}) {
	open_pidfile();
}

# End of background/daemon stuff
This is original code from original ultravnc_repeater.pl, I just ripped out what wasn't needed. This should run even without superuser privileges.
naftali5
Posts: 1
Joined: 2011-01-05 16:54

Re: Linux repeater mod

Post by naftali5 »

lall wrote:
Rat wrote:A GUI would also be of limited use in this scenario unless it provided a Web interface which would be great and was something that I have also considered.
If you can tell me how to create PHP based UI for the script without local webserver, I'll do it. I searched and experimented, but didn't had success..
So far the easiest (for users) is to write Tk UI in to the script and IF users are really unable to install perl-tk, they can always run the script in verbose mode, without needing to install anything.
How about simply modfying the pl script to maintain a single file, in a sensible format, of all current server connections, all viewer connections, along with if they are bridged, and connection information (ip, id, and anything else you have). This will allow integration of a read-only UI from any programming language. I don't specifcally need it to be linux, but this feature (ability to view/retrieve a list of current connections) is noticably lacking in every implementation of repeater that i have seen.
lall
8
8
Posts: 20
Joined: 2010-12-16 16:50
Location: Estonia

Re: Linux repeater mod

Post by lall »

naftali5 wrote:
lall wrote:
Rat wrote:A GUI would also be of limited use in this scenario unless it provided a Web interface which would be great and was something that I have also considered.
If you can tell me how to create PHP based UI for the script without local webserver, I'll do it. I searched and experimented, but didn't had success..
So far the easiest (for users) is to write Tk UI in to the script and IF users are really unable to install perl-tk, they can always run the script in verbose mode, without needing to install anything.
How about simply modfying the pl script to maintain a single file, in a sensible format, of all current server connections, all viewer connections, along with if they are bridged, and connection information (ip, id, and anything else you have). This will allow integration of a read-only UI from any programming language. I don't specifcally need it to be linux, but this feature (ability to view/retrieve a list of current connections) is noticably lacking in every implementation of repeater that i have seen.
Hi,

I've considered this option too. But.
Right now my plans are to write live connections monitoring in to the repeater but without GUI. In that case you can use the repeater in headless server without graphical manager and still get the information as txt files. And I'll write separate GUI controller (in perl, for now) for the repeater that collects data (logs, live connections) from text files. This is really good way, because you can always write other GUIs for the repeater (php, or whatever is needed). This will make repeater to be independent from GUIs and gives a lot flexibility for users.
Last edited by lall on 2011-01-06 06:33, edited 1 time in total.
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Linux repeater mod

Post by supercoe »

+1 for the GUI being separate, Rudi has similar ideas for UltraVNC v2.
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
stinson6016
Posts: 4
Joined: 2011-02-26 16:50

Re: Linux repeater mod

Post by stinson6016 »

Have been using chunkrepeater at work the past week using a php log file viewer with success. every thing seems to work well
Post Reply