Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
torbutton
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
Legacy
gitolite
user
brade
torbutton
Commits
d2651639
Commit
d2651639
authored
Jan 15, 2020
by
Kathleen Brade
Browse files
Options
Downloads
Patches
Plain Diff
Bug 19757: Support on-disk storage of v3 client auth keys
Add onionAuthViewKeys() and onionAuthRemove() Tor controller functions.
parent
84098221
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/tor-control-port.js
+36
-0
36 additions, 0 deletions
modules/tor-control-port.js
with
36 additions
and
0 deletions
modules/tor-control-port.js
+
36
−
0
View file @
d2651639
...
...
@@ -580,6 +580,26 @@ info.getConf = function (aControlSocket, key) {
// A namespace for functions related to tor's ONION_CLIENT_AUTH_* commands.
let
onionAuth
=
{};
onionAuth
.
keyInfoStringsFromMessage
=
utils
.
extractor
(
/^250-CLIENT
\s
+
(
.+
)
$/gmi
);
onionAuth
.
keyInfoObjectsFromMessage
=
function
(
message
)
{
let
keyInfoStrings
=
onionAuth
.
keyInfoStringsFromMessage
(
message
);
return
keyInfoStrings
.
map
(
infoStr
=>
utils
.
listMapData
(
infoStr
,
[
"
hsAddress
"
,
"
typeAndKey
"
]));
}
// __onionAuth.viewKeys()__.
// Sends a ONION_CLIENT_AUTH_VIEW command to retrieve the list of private keys.
// Returns a promise that is fulfilled with an array of key info objects which
// contain the following properties:
// hsAddress
// typeAndKey
// Flags (e.g., "Permanent")
onionAuth
.
viewKeys
=
function
(
aControlSocket
)
{
let
cmd
=
"
onion_client_auth_view
"
;
return
aControlSocket
.
sendCommand
(
cmd
).
then
(
onionAuth
.
keyInfoObjectsFromMessage
);
};
// __onionAuth.add(controlSocket, hsAddress, b64PrivateKey, isPermanent)__.
// Sends a ONION_CLIENT_AUTH_ADD command to add a private key to the
// Tor configuration.
...
...
@@ -600,6 +620,19 @@ onionAuth.add = function (aControlSocket, hsAddress, b64PrivateKey,
return
aControlSocket
.
sendCommand
(
cmd
);
};
// __onionAuth.remove(controlSocket, hsAddress)__.
// Sends a ONION_CLIENT_AUTH_REMOVE command to remove a private key from the
// Tor configuration.
onionAuth
.
remove
=
function
(
aControlSocket
,
hsAddress
)
{
if
(
!
utils
.
isString
(
hsAddress
))
{
return
utils
.
rejectPromise
(
"
hsAddress argument should be a string
"
);
}
let
cmd
=
`onion_client_auth_remove
${
hsAddress
}
`
;
return
aControlSocket
.
sendCommand
(
cmd
);
};
// ## event
// Handlers for events
...
...
@@ -655,9 +688,12 @@ tor.controller = function (ipcFile, host, port, password, onError) {
isOpen
=
true
;
return
{
getInfo
:
key
=>
info
.
getInfo
(
socket
,
key
),
getConf
:
key
=>
info
.
getConf
(
socket
,
key
),
onionAuthViewKeys
:
()
=>
onionAuth
.
viewKeys
(
socket
),
onionAuthAdd
:
(
hsAddress
,
b64PrivateKey
,
isPermanent
)
=>
onionAuth
.
add
(
socket
,
hsAddress
,
b64PrivateKey
,
isPermanent
),
onionAuthRemove
:
(
hsAddress
)
=>
onionAuth
.
remove
(
socket
,
hsAddress
),
watchEvent
:
(
type
,
filter
,
onData
)
=>
event
.
watchEvent
(
socket
,
type
,
filter
,
onData
),
isOpen
:
()
=>
isOpen
,
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment