LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-30-2023, 10:52 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,587

Rep: Reputation: 179Reputation: 179
Configuring stunnel on Windows


I've used stunnel a few years ago, mainly for VNC security, but also for RDC on Windows. I'm trying to re-implement this for Windows, but am having problems this time. I did this once upon a time, but apparently didn't take very good notes.

stunnel version 5.70. I have the following in stunnel.conf on the Windows 10 computer:
Code:
[WIN10]
client = yes
accept = 127.0.0.1:3389
;connect = pop.gmail.com:995
CAfile = stunnel.pem
The 'accept' line is, I presume, the port on the Windows machine to listen on. I don't know what the 'connect' line is for in this case and presume it's not needed for a client connection (yes, I've RTFM).

With the above config, I get the following error:
Code:
Configuration successful
[ ] Deallocating deployed section defaults
[ ] Binding service [WIN10]
[ ] Listening file descriptor created (FD=724)
[ ] Setting accept socket options (FD=724)
[ ] Option SO_EXCLUSIVEADDRUSE set on accept socket
[.] Binding service [WIN10] to 127.0.0.1:3389: Permission denied (WSAEACCES) (10013)
[!] Binding service [WIN10] failed
[ ] Unbinding service [WIN10]
[ ] Service [WIN10] closed
[ ] Deallocating deployed section defaults
[ ] Deallocating section [WIN10]
[ ] Initializing inetd mode configuration
[ ] Running on Windows 6.2

Server is down
I run stunnel by clicking on the stunnel desktop icon/shortcut. When the error dialog appears the title bar says, "stunnel 5.70 on Win64 (invalid configuration file)". The 4 lines shown above are the only uncommented lines in the stunnel.conf.

Why am I getting this Permission denied error?
 
Old 08-30-2023, 11:20 PM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 794

Rep: Reputation: 253Reputation: 253Reputation: 253
The idea of stunnel is to catch an encrypted connection and suffle it off unencrypted to its destination that wouldn't normally be encrypted. Windows runs RDP on 3389, so you can't rebind the port.
https://learn.microsoft.com/en-us/wi...-error-codes-2

I'm not sure why you'd try to wrap remote desktop anyway as it already uses TLS (at least on Linux; correct me if I'm wrong).

This is what I used to use for POP3S with a non-SSL server under Xinetd on the same host.

Code:
[pop3s]
; POP3 using SSL. Listen on all addresses, with ipv4/6. Use libwrap.
accept  = :::995
connect = 110
libwrap = yes
protocol = pop3
 
Old 08-31-2023, 09:55 AM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,587

Original Poster
Rep: Reputation: 179Reputation: 179
First to define my terms. I will call the PC from which I am connecting, e.g. from my home computer REMOTE, and the one at the office to which I want to RDC I'll call OFFICE. What I'm wanting to do is require the REMOTE user to enter credentials when trying to connect to OFFICE. I recall that stunnel used to work that way when I first used it (5 years ago!).

Why? Because the cyber insurance company doesn't want to see RDC ports accessible from the Internet. I figure with stunnel as a layer, probing the RDC ports will return a stunnel handshake and not the RDC fingerprint.

Although I had stunnel running 5 years ago, my notes are incomplete and there is no good tutorial on setting it up. The stunnel "documentation" consists of manpage-like descriptions of the various conf parameters, so one basically already needs to know how to set up stunnel and can use the docs as a refresher reference.

The first task I'm attempting is to set up OFFICE, which I've already done incorrectly since it is the server, not the client. I've changed the config to:
Code:
[WIN10]
accept = 127.0.0.1:3389
CAfile = stunnel.pem
But I still get the permission denied error. You wrote: "Windows runs RDP on 3389, so you can't rebind the port." Maybe I'm going about this wrong and stunnel should not be running on OFFICE at all.

Here's my setup: There's another computer in the mix, located at the office I'll call ROUTER, which is Linux. Windows computer REMOTE is at e.g. a home office somewhere on planet Earth. It attempts an RDC connection to ROUTER using secret port 1234 (not 3389). ROUTER re-directs port 1234 to host OFFICE:3389. It does this for several office workstations. For example port 4567 redirected to JANE:3389, etc. This all works now.

Perhaps I should have stunnel running as a server on ROUTER, not on the target Windows workstation?

Last edited by mfoley; 08-31-2023 at 09:57 AM.
 
Old 09-01-2023, 11:33 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Any chance of simply using VPN? And/Or piggybacking on what is probably already in place at the company?
 
1 members found this post helpful.
Old 09-04-2023, 12:56 PM   #5
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,587

Original Poster
Rep: Reputation: 179Reputation: 179
There is nothing at place at the company, hence this project. I thought stunnel would be quick and easy and would be a stop-gap while we research the most appropriate VPN to use, but I guess stunnel isn't as quick and easy as I thought. Maybe I should move on.
 
Old 09-05-2023, 02:02 PM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,587

Original Poster
Rep: Reputation: 179Reputation: 179
I've decided to not worry about stunnel and install a VPN. Thanks for the feedback.
 
  


Reply

Tags
stunnel, win10



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 14.04 + OpenVPN + Stunnel + Windows 10 Client adenicol Linux - Newbie 0 04-26-2016 12:57 AM
Stunnel won't work! Linux6574 Linux - General 0 04-12-2004 04:20 PM
error when trying to install stunnel f1uke Linux - Software 0 12-23-2003 04:55 PM
Stunnel for POP3 server J_Szucs Linux - Software 4 05-24-2003 04:48 PM
Stunnel and Sendmail mikeyt_333 Linux - Security 3 04-17-2002 06:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration