Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th January 2021
jonsec jonsec is offline
Fdisk Soldier
Join Date: Jul 2019
Posts: 56
Question Socks5 server in OpenBSD

is any package exists for implementing socks5 server ?


how i can implementing socks5 server in OpenBSD ?
Reply With Quote
  #2   (View Single Post)  
Old 11th January 2021
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
Join Date: May 2008
Location: USA
Posts: 7,188

Built in, ssh(1) will act as a SOCKS v5 server for any dynamic port forwarding uses. See the -D option in the ssh(1) man page. There are also several third party packages of SOCKS v5 servers that can be installed; one that comes to mind is dante. I also can recall several proxy server packages, such as nylon, py-socks, and torsocks, and there may be many others.
Reply With Quote
  #3   (View Single Post)  
Old 17th January 2021
jonsec jonsec is offline
Fdisk Soldier
Join Date: Jul 2019
Posts: 56

jggimi thanks.

A good config :
pkg_add dante
Change the config, to something like so:
The config, actually contains 3 sections

The main section, with "shared" configurations
The "client pass" defines, which clients are allowed to talk to the dante
The "socks pass" defines rules for the sockd service, like rules, authentication method.

Now edit, the configuration, /etc/sockd.conf, so it looks like this...

internal: em0 port = 1080
external: em0
socksmethod: username none 
user.privileged: root
user.unprivileged: _sockd
#logoutput: syslog/user
#debug: 1
logoutput: /var/log/sockd.log

## client access rules

#define clients who can talk to the server. The "client pass" is checked before the "socks pass" sections!
client pass {
        from: to:
        log: error connect disconnect
# block connections to localhost, or they will appear to come from the proxy.
socks block {
	from: 0/0 to: lo
	log: error connect disconnect
#define the socks server access
socks pass {
	from: to:
	command: bind connect udpassociate
	log: error connect disconnect
#No authentication
#	socksmethod: none
#Username authentication
        socksmethod: username
#Username OR none authentication (Why would you ever need this?)
#        socksmethod: username none
#	Require the users to be part of the group "socks5users"
	group: socks5users
Then restart the server, for the changes to take effect.

/etc/rc.d/sockd restart

Users and Groups
As the configuration states, we need an user, which must be member of an group.
Create an group, since we require users to authenticate, and be part of an group:

groupadd socks5users
Create test user, which cannot login to the system:
useradd -s /sbin/nologin test
useradd: Warning: home directory `/home/test' doesn't exist, and -m was not specified
Set an password:

passwd test
Add the user to the group:
Warning, will set the primary group! You might not actually want this! Consider using -G instead of -g
If you have created the user from scratch, from the example, you are fine.

usermod -gsocks5users test
Switch to any client you have, which can access this server!
You can test with curl, like so from an client. Notice that the authentication depends on how you have configured the "socks pass" section.
If it should require username/password or none. Or maybe even, either.

Test from an client with curl:

curl -x socks5://test:testtest@ ifconfig.me
Without authentication

curl -x socks5:// ifconfig.me
Reply With Quote

socks, socks5

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BEST VNC SERVER FOR OPENBSD rdikarlus OpenBSD Packages and Ports 3 20th May 2019 06:22 PM
OpenBsd server PapaParrot OpenBSD General 28 23rd July 2017 11:17 PM
OpenBSD As DNS Server 3v1l OpenBSD Packages and Ports 8 6th February 2014 05:06 AM
ssh server on OpenBSD MarinosK OpenBSD General 4 16th February 2011 07:38 PM
OpenBSD Xterminal Server jjjustjjjay OpenBSD General 0 17th April 2010 12:46 PM

All times are GMT. The time now is 03:32 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick