Configuring Hidden Services for Tor

View previous topic View next topic Go down

Configuring Hidden Services for Tor

Post by jamied_uk on 1st May 2017, 22:21

First off here's JNET Test Site Onion Link

xya3mxidnyacb5jx.onion








Here's how I finally got it working from Linux Mint OS


1st Install and setup apache2 server or another server of your choice

Next I installed tor via command line

Code:
sudo apt install -y tor

then type


Code:
su

enter password


then


Code:
cd  /var/lib/tor


Code:
sudo gedit torrc

make sure you have these lines


Code:
DataDirectory /var/lib/tor
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80

then type the following

Code:
cd hidden_service

Code:
sudo gedit hostname

To get your onion address (or change)

another way is
Code:
cd /var/lib/tor/hidden_service


Now you can test your server via a tor client from torproject.org site!


More help can be found @ torproject.org/docs/tor-hidden-service.html.en

Again Please Visit

xya3mxidnyacb5jx.onion


Last edited by jamied_uk on 3rd May 2017, 20:19; edited 2 times in total
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 19:59

Allowing access to your control panel:

copy and paste the following:
network.security.ports.banned.override


now type this about:config and paste this into

Chosen solution

Does the address contain an unusual port number, after a colon, such as:
example.com:9876
You can create a preference using about:config and allow the port number which Firefox is blocking. Here's how:
(0) Select and copy the following preference name
network.security.ports.banned.override
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful.
(2) In the search box above the list, type or paste ports and pause while the list is filtered
If the above-listed preference exists:
(3) Double-click it and add a comma to the end of the list followed by the port number you need to allow. No spaces. Then click OK.
If the above-listed preference does not exist:
(4) right-click anywhere on the page and choose New > String
(5) In the preference name dialog, paste the name you coped and click OK
(6) In the preference value dialog, type in the port number you need to allow, then click OK.
Please see the attached screen shot for illustration.
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 20:16

Check For Open Ports For Tor In Linux



Code:
nmap -sT -O localhost

Open these ports via your router!
TCP:


Code:
9001
9050

Socks Proxy Ports!

Also dont forget to open ports if required on your OS Firewall aswell as router!


Last edited by jamied_uk on 3rd May 2017, 23:16; edited 1 time in total
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 20:48

Generating Tor Addresses





timtaubert.de/blog/2014/11/using-the-webcrypto-api-to-generate-onion-names-for-tor-hidden-services
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 20:49

Random Tor Address Function:



Code:
function generateRSAKey() {
  var alg = {
    // This could be any supported RSA* algorithm.
    name: "RSASSA-PKCS1-v1_5",
    // We won't actually use the hash function.
    hash: {name: "SHA-1"},
    // Tor hidden services use 1024 bit keys.
    modulusLength: 1024,
    // We will use a fixed public exponent for now.
    publicExponent: new Uint8Array([0x03])
  };

  return crypto.subtle.generateKey(alg, true, ["sign", "verify"]);
}


function computeOnionHash(publicKey) {
  // Export the DER encoding of the SubjectPublicKeyInfo structure.
  var promise = crypto.subtle.exportKey("spki", publicKey);

  promise = promise.then(function (spki) {
    // Compute the SHA-1 digest of the SPKI.
    // Skip 22 bytes (the SPKI header) that are ignored by Tor.
    return crypto.subtle.digest({name: "SHA-1"}, spki.slice(22));
  });

  return promise.then(function (digest) {
    // Base32-encode the first half of the digest.
    return base32(digest.slice(0, 10));
  });
}
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 20:50

More specific Addresses

Finding a specific .onion name

The only thing missing now is a function that checks for pattern matches and loops until we found one:



Code:

function findOnionName(pattern) {
  var key;

  // Start by generating a random key pair.
  var promise = generateRSAKey().then(function (pair) {
    key = pair.privateKey;

    // Generate the .onion hash of the public key.
    return computeOnionHash(pair.publicKey);
  });

  return promise.then(function (hash) {
    // Try again if the pattern doesn't match.
    if (!pattern.test(hash)) {
      return findOnionName(pattern);
    }

    // Key matches! Export and format it.
    return formatKey(key).then(function (formatted) {
      return {key: formatted, hash: hash};
    });
  });
}





We simply use [i]generateRSAKey()[/i] and [i]computeOnionHash()[/i] as defined before.
In case of a pattern match we export the
[url=http://tools.ietf.org/html/rfc5208]PKCS8[/url] private key information, encode it
as [url=https://en.wikipedia.org/wiki/Base64]Base64[/url] and format it nicely:



function formatKey(key) {
  // Export the DER-encoded ASN.1 private key information.
  var promise = crypto.subtle.exportKey("pkcs8", key);

  return promise.then(function (pkcs8) {
    var encoded = base64(pkcs8);

    // Wrap lines after 64 characters.
    var formatted = encoded.match(/.{1,64}/g).join("\n");

    // Wrap the formatted key in a header and footer.
    return "-----BEGIN PRIVATE KEY-----\n" + formatted +
          "\n-----END PRIVATE KEY-----";
  });
}
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by jamied_uk on 3rd May 2017, 20:51

What is logged to the console can be directly used to replace any random key that Tor has assigned before. Here is how you would use the code we just wrote:


Code:
findOnionName(/ab/).then(function (result) {
  console.log(result.hash + ".onion", result.key);
}, function (err) {
  console.log("An error occurred, please reload the page.");
});
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Configuring Hidden Services for Tor

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum