Skip to content

Instantly share code, notes, and snippets.

@alexander-bauer
Created August 22, 2012 04:52
Show Gist options
  • Save alexander-bauer/3422358 to your computer and use it in GitHub Desktop.
Save alexander-bauer/3422358 to your computer and use it in GitHub Desktop.
Script for generating credentials and formatting connection information for adding new peers on cjdns
#!/bin/bash
# usage: makepass <username>
# Requires: makepasswd
# This script is a peering details generator
# for CJDNS
# Functional script written by Grey
# Bells, whistles, and additional usefulness added by SashaCrofter
# Your username, as a memento for your peer
your_name=[Your_Username]
# Your general geographical location, so your peer can easily tell where you are
your_location=[Your_Geographical_Location]
# Your public key, as specified in your cjdroute.conf file
your_pubkey=[Your_Public_Key.k]
# Your IPv6 address, as specified in your cjdroute.conf file
your_IPv6=[Your_IPv6_Address]
# Your IPv4 address, so your peer can connect to you through the Old Internt
your_IPv4=[Your_External_IPv4_Address]
# The port CJDNS runs on, as specified in cjdroute.conf
your_port=[Your_cjdns_Port]
user=$1
if [[ -z $user ]]
then
echo -e "Please enter the user's nickname, followed by [ENTER]: "
read user
fi
subpass=$(makepasswd --char=20)
pass="${user}_${subpass}"
date=$(date)
echo ""
echo "------- Peer's Details -------"
read -d '' conn_string <<FILE
// $your_name (in $your_location): $your_IPv6
// Generated: $date
"$your_IPv4:$your_port":
{
"password": "$pass",
"publicKey": "$your_pubkey"
}
FILE
echo "$conn_string"
echo "------- Your Details -------"
read -d '' pass_string <<FILE
// $user - $date
{
"password": "$pass"
},
FILE
echo "$pass_string"
echo "------- EOF -------"
#!/bin/bash
# usage: makepass <username>
# Requires: makepasswd
# This script is a peering details generator
# for CJDNS
# Functional script written by Grey
# Bells, whistles, and additional usefulness added by SashaCrofter
# Your username, as a memento for your peer
your_name=[Your_Username]
# Your general geographical location, so your peer can easily tell where you are
your_location=[Your_Geographical_Location]
# Your public key, as specified in your cjdroute.conf file
your_pubkey=[Your_Public_Key.k]
# Your IPv6 address, as specified in your cjdroute.conf file
your_IPv6=[Your_IPv6_Address]
# Your IPv4 address, so your peer can connect to you through the Old Internt
your_IPv4=[Your_External_IPv4_Address]
# The port CJDNS runs on, as specified in cjdroute.conf
your_port=[Your_cjdns_Port]
user=$1
if [[ -z $user ]]
then
echo -e "Please enter the user's nickname, followed by [ENTER]: "
read user
fi
subpass=$(makepasswd --char=20)
pass="${user}_${subpass}"
date=$(date)
echo ""
echo "------- Peer's Details -------"
read -d '' conn_string <<FILE
// $your_name (in $your_location): $your_IPv6
// Generated: $date
"$your_IPv4:$your_port":
{
"password": "$pass",
"publicKey": "$your_pubkey"
}
FILE
echo "$conn_string"
echo "------- Your Details -------"
read -d '' pass_string <<FILE
// $user - $date
{
"password": "$pass"
},
FILE
echo "$pass_string"
echo "------- EOF -------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment