https://github.com/dajudge/mssqlproxy
A proxy sidecar for moving security with MSSQL out of your services.
https://github.com/dajudge/mssqlproxy
Last synced: over 1 year ago
JSON representation
A proxy sidecar for moving security with MSSQL out of your services.
- Host: GitHub
- URL: https://github.com/dajudge/mssqlproxy
- Owner: dajudge
- License: apache-2.0
- Created: 2020-04-26T15:01:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-16T11:42:38.000Z (about 6 years ago)
- Last Synced: 2025-01-23T14:51:18.418Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 104 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mssqlproxy
-
A proxy sidecar for moving security with MSSQL out of your services.
You connect to the proxy with any username / password combination and the proxy injects the correct login credentials.
# Usage
```shell script
$ docker run -p 1433:1433 -e MSSQLPROXY_PROXIES="0.0.0.0:1433=username:password@mssql-server:1433" -d dajudge/mssqlproxy:0.0.2
```
`MSSQLPROXY_PROXIES` is a comma-separated list of proxy definitions where each proxy definition looks like this:
```
:=:@:
```
Fields:
* `bindAddress`: the local address to listen on
* `bindPort`: the local port to listen on
* `username`: the username to use for logging in to the MSSQL server
* `password`: the password to use for logging into the MSQQL server
* `serverHostname`: the hostname of the MSSQL server
* `serverPort`: the port of the MSSQL server
# Example
Start a MSSQL server instance with the password `MyPassword100` (runs on port `1433`):
```shell script
$ docker run -e ACCEPT_EULA=y -e SA_PASSWORD=MyPassword100 --net host -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu
```
Start a mssqlproxy on port `51433`:
```shell script
$ docker run --net host -e MSSQLPROXY_PROXIES="0.0.0.0:51433=sa:MyPassword100@localhost:1433" -d dajudge/mssqlproxy:0.0.2
```
Talk to the MSSQL server via the proxy with invalid credentials:
```shell script
$ docker run --rm --net host -it mcr.microsoft.com/mssql-tools /opt/mssql-tools/bin/sqlcmd -S tcp:localhost,51433 -U sa -P wrong
1> select @@version
2> go
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2017 (RTM-CU8) (KB4338363) - 14.0.3029.16 (X64)
Jun 13 2018 13:35:56
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 16.04.4 LTS)
(1 rows affected)
1> exit
```
# TODO
* Improved handling of various protocol versions.
* Strong server certificate verification (waiting for a [feature in r2dbc-mssql](https://github.com/r2dbc/r2dbc-mssql/issues/148)).