Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ These environment variables can be set to configure some aspects of AAD auth and

`SQLCMDCLIENTID` - set this to the identifier of an application registered in your AAD which is authorized to authenticate to Azure SQL Database. Applies to `ActiveDirectoryInteractive` and `ActiveDirectoryPassword` methods.

### Kerberos Authentication on Linux and macOS

On Linux and macOS, `-E` authenticates with Kerberos using the ticket from `kinit`. This also applies when no user name is given, such as `sqlcmd query` with a context that has no user, or the flag CLI without `-U`.

```
kinit alice@EXAMPLE.COM
sqlcmd -S sqlhost.example.com,1433 -E
```

`KRB5_CONFIG` sets the location of `krb5.conf` (default `/etc/krb5.conf`) and `KRB5CCNAME` sets the credential cache (default `/tmp/krb5cc_<uid>`). Only `FILE:` caches are supported, so on Linux distributions that default to `KCM:` or `KEYRING:` (Fedora, RHEL), run `kinit -c FILE:...` and set `KRB5CCNAME`.

macOS has no `krb5.conf` by default and keeps tickets in an `API:` cache that `sqlcmd` can't read. Create a `krb5.conf` and add `default_cc_name = FILE:/tmp/krb5cc_%{uid}` to its `[libdefaults]` section so `kinit` writes a file cache (this is the Heimdal setting name used on macOS; MIT Kerberos calls it `default_ccache_name`). Alternatively, point `KRB5CCNAME` to a `FILE:` cache.

### Console colors

Sqlcmd now supports syntax coloring the output of `:list` and the results of TSQL queries when output to the terminal.
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ require (
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-crypt/x v0.4.12 // indirect
github.com/go-krb5/krb5 v0.1.0 // indirect
github.com/go-krb5/x v0.3.2 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-crypt/x v0.4.12 h1:84mFpT7cdVxQUY8pTnBhAGvqrGxY/q8M+757zrMiXPM=
github.com/go-crypt/x v0.4.12/go.mod h1:edbLOsFD4LEWC9wVvNb3k560JIMIhEJ7awb8NeTPHs8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-krb5/krb5 v0.1.0 h1:eckVEox/2y/0OlQiAPKWrRF2cVvLsu4a1JaEnF0EGaE=
github.com/go-krb5/krb5 v0.1.0/go.mod h1:pjottanZMR4s9ITIh/cHBYoNMtqkK4IzXuplsihoncI=
github.com/go-krb5/x v0.3.2 h1:uIjmgkxEbIXoVwgKT1Xi+efVmtqiXcpQlCVuJ/hq2Z0=
github.com/go-krb5/x v0.3.2/go.mod h1:h44nn9OxeR34A9Tu0UZfRmgwWizETfWwWy97K3RlxuI=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -89,6 +95,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down
95 changes: 58 additions & 37 deletions internal/translations/catalog.go

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions internal/translations/locales/de-DE/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,29 @@
],
"fuzzy": true
},
{
"id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"translation": "",
"placeholders": [
{
"id": "SQLCMDFORMAT",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "sqlcmd.SQLCMDFORMAT"
},
{
"id": "Ascii",
"string": "%[2]s",
"type": "string",
"underlyingType": "string",
"argNum": 2,
"expr": "\"ascii\""
}
]
},
{
"id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
"message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
Expand Down Expand Up @@ -2899,6 +2922,11 @@
],
"fuzzy": true
},
{
"id": "Do not strip the \"mssql: \" prefix from error messages",
"message": "Do not strip the \"mssql: \" prefix from error messages",
"translation": ""
},
{
"id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
"message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
Expand Down Expand Up @@ -3655,6 +3683,36 @@
],
"fuzzy": true
},
{
"id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"translation": "",
"placeholders": [
{
"id": "CacheType",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "cacheType"
}
]
},
{
"id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"translation": "",
"placeholders": [
{
"id": "Path",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "path"
}
]
},
{
"id": "Server name override is not supported with the current authentication method",
"message": "Server name override is not supported with the current authentication method",
Expand Down
66 changes: 66 additions & 0 deletions internal/translations/locales/en-US/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,31 @@
],
"fuzzy": true
},
{
"id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"translation": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "SQLCMDFORMAT",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "sqlcmd.SQLCMDFORMAT"
},
{
"id": "Ascii",
"string": "%[2]s",
"type": "string",
"underlyingType": "string",
"argNum": 2,
"expr": "\"ascii\""
}
],
"fuzzy": true
},
{
"id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
"message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
Expand Down Expand Up @@ -2905,6 +2930,13 @@
],
"fuzzy": true
},
{
"id": "Do not strip the \"mssql: \" prefix from error messages",
"message": "Do not strip the \"mssql: \" prefix from error messages",
"translation": "Do not strip the \"mssql: \" prefix from error messages",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
"message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
Expand Down Expand Up @@ -3661,6 +3693,40 @@
],
"fuzzy": true
},
{
"id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"translation": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "CacheType",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "cacheType"
}
],
"fuzzy": true
},
{
"id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"translation": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"translatorComment": "Copied from source.",
"placeholders": [
{
"id": "Path",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "path"
}
],
"fuzzy": true
},
{
"id": "Server name override is not supported with the current authentication method",
"message": "Server name override is not supported with the current authentication method",
Expand Down
58 changes: 58 additions & 0 deletions internal/translations/locales/es-ES/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,29 @@
],
"fuzzy": true
},
{
"id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"translation": "",
"placeholders": [
{
"id": "SQLCMDFORMAT",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "sqlcmd.SQLCMDFORMAT"
},
{
"id": "Ascii",
"string": "%[2]s",
"type": "string",
"underlyingType": "string",
"argNum": 2,
"expr": "\"ascii\""
}
]
},
{
"id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
"message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
Expand Down Expand Up @@ -2899,6 +2922,11 @@
],
"fuzzy": true
},
{
"id": "Do not strip the \"mssql: \" prefix from error messages",
"message": "Do not strip the \"mssql: \" prefix from error messages",
"translation": ""
},
{
"id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
"message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
Expand Down Expand Up @@ -3655,6 +3683,36 @@
],
"fuzzy": true
},
{
"id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"translation": "",
"placeholders": [
{
"id": "CacheType",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "cacheType"
}
]
},
{
"id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"translation": "",
"placeholders": [
{
"id": "Path",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "path"
}
]
},
{
"id": "Server name override is not supported with the current authentication method",
"message": "Server name override is not supported with the current authentication method",
Expand Down
58 changes: 58 additions & 0 deletions internal/translations/locales/fr-FR/out.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,29 @@
],
"fuzzy": true
},
{
"id": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"message": "Prints the output in ASCII table format. This option sets the sqlcmd scripting variable {SQLCMDFORMAT} to '{Ascii}'. The default is false",
"translation": "",
"placeholders": [
{
"id": "SQLCMDFORMAT",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "sqlcmd.SQLCMDFORMAT"
},
{
"id": "Ascii",
"string": "%[2]s",
"type": "string",
"underlyingType": "string",
"argNum": 2,
"expr": "\"ascii\""
}
]
},
{
"id": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
"message": "{_r0__1} Redirects error messages with severity \u003e= 11 output to stderr. Pass 1 to to redirect all errors including PRINT.",
Expand Down Expand Up @@ -2899,6 +2922,11 @@
],
"fuzzy": true
},
{
"id": "Do not strip the \"mssql: \" prefix from error messages",
"message": "Do not strip the \"mssql: \" prefix from error messages",
"translation": ""
},
{
"id": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
"message": "Specifies the number of rows to print between the column headings. Use -h-1 to specify that headers not be printed",
Expand Down Expand Up @@ -3655,6 +3683,36 @@
],
"fuzzy": true
},
{
"id": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"message": "Kerberos credential cache type {CacheType} is not supported. Use a FILE: cache in KRB5CCNAME.",
"translation": "",
"placeholders": [
{
"id": "CacheType",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "cacheType"
}
]
},
{
"id": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"message": "No Kerberos credentials found in {Path}. Run kinit to get a ticket in a FILE: cache, or set KRB5CCNAME to one.",
"translation": "",
"placeholders": [
{
"id": "Path",
"string": "%[1]s",
"type": "string",
"underlyingType": "string",
"argNum": 1,
"expr": "path"
}
]
},
{
"id": "Server name override is not supported with the current authentication method",
"message": "Server name override is not supported with the current authentication method",
Expand Down
Loading
Loading