summaryrefslogtreecommitdiff
path: root/docs/hdb.html
blob: 31986c66052c3ef902010c8f6c38d8b267855e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta name="author" content="Carson Fleming" />
        <meta name="description" content="Harness encrypted client-server communication, asynchronous command distribution, terminal emulation, and support for unlimited clients and controllers with Penguin's Kiss, the ultimate tool to manage remotely controlled devices with security and convenience." />
        <link rel="icon" type="image/x-icon" href="/favicon.ico" />
        <link rel="stylesheet" type="text/css" href="/css/control.css" />
        <title>Hosts Database | Docs | Penguin&apos;s Kiss</title>
        <link rel="canonical" href="https://c2.pkctl.org/hdb" />
    </head>
    <body>
        <header id="banner">
            <a id="banner-logo" href="/">
                <img id="logo-img" src="/img/banner.webp" alt="Penguin&apos;s Kiss Banner" />
            </a>
            <div id="banner-buttons">
                <a class="button" href="https://github.com/cflems/pk">GitHub</a>
                <a class="button" href="https://github.com/cflems/pk/releases">Download</a>
            </div>
        </header>
        <div id="page">
            <nav id="navigation">
                <h3 class="nav-heading"><a href="/">About PK</a></h3>
                <ul class="nav-section">
                    <li><a href="/#download">Downloading</a></li>
                    <li><a href="/#build">Building</a></li>
                    <li><a href="/#precompiled">Precompiled</a></li>
                </ul>
                <h3 class="nav-heading"><a href="/client">Client Config</a></h3>
                <ul class="nav-section">
                    <li><a href="/client#tts">Time to Sleep</a></li>
                    <li><a href="/client#bits">RSA Bits</a></li>
                </ul>
                <h3 class="nav-heading"><a href="/server">Server Config</a></h3>
                <ul class="nav-section">
                    <li><a href="/server#install">Installing</a></li>
                    <li><a href="/server#pkctl">PKCTL Usage</a></li>
                    <li><a href="/server#keygen">Host Key Generation</a></li>
                    <li><a href="/server#users">Local Users</a></li>
                </ul>
                <h3 class="nav-heading"><a href="/hdb">Hosts Database</a></h3>
                <ul class="nav-section">
                    <li><a href="/hdb#format">Format</a></li>
                    <li><a href="/hdb#keys">Keys Section</a></li>
                    <!-- Routes here soon. :) -->
                </ul>
                <h3 class="nav-heading"><a href="/commands">Command Reference</a></h3>
                <ul class="nav-section">
                    <li><a href="/commands#beacon">beacon</a></li>
                    <li><a href="/commands#delbeacon">delbeacon</a></li>
                    <li><a href="/commands#nbeacons">nbeacons</a></li>
                    <li><a href="/commands#lbeacons">lbeacons</a></li>
                    <li><a href="/commands#nscreen">nscreen</a></li>
                    <li><a href="/commands#ncli">ncli</a></li>
                    <li><a href="/commands#lcli">lcli</a></li>
                    <li><a href="/commands#lq">lq</a></li>
                    <li><a href="/commands#cq">cq</a></li>
                    <li><a href="/commands#show-serverkey">show-serverkey</a></li>
                    <li><a href="/commands#pty">pty</a></li>
                    <li><a href="/commands#refresh-hdb">refresh-hdb</a></li>
                    <li><a href="/commands#tunnel">tunnel</a></li>
                    <li><a href="/commands#die">die</a></li>
                    <li><a href="/commands#shell">Shell Commands</a></li>
                    <li><a href="/commands#target">Targeting</a></li>
                </ul>
            </nav>
            <div id="content">
                <p>Now that we&apos;ve generated our host key and gotten our server up and running, its
                    time to publish its public key in a hosts database file so that it can be retrieved
                    by clients. The TL;DR for this section is to create a file that looks like this:</p>
                <pre>{"keys": {"&lt;server ip&gt;": {"n": &lt;number n that python spit out&gt;, "e": 65537}}}</pre>
                <p>and upload it to the web somewhere. You can then supply this URL to your clients as
                    your hosts database. Literally even a PasteBin will work if you use the raw file
                    URL.</p>
                <section id="format">
                    <h3>Format</h3>
                    <p>The hosts database is essentially just a JSON object in which the PK client will
                        look for specific keys to retrieve information. The basic skeleton looks like
                        this:</p>
                    <pre>{"keys": {&lt;keys section&gt;}}</pre>
                </section>
                <section id="keys">
                    <h3>Keys Section</h3>
                    <p>The keys section is just a mapping from server IPs to key objects, which in
                        turn are just a way of representing RSA public keys. The keys section supports
                        multiple server IPs, but currently only one public key per server IP. Its
                        skeleton looks like the following:</p>
                    <pre>{"0.1.2.3": {&lt;key object&gt;}, "255.255.255.255": {&lt;key object&gt;}}</pre>
                    <h4>Key Objects</h4>
                    <p>A key object is just a modulus and a public exponent, both of which are integers.
                        The modulus is at key <code>n</code> and the public exponent is at key
                        <code>e</code>. The public exponent is optional and defaults to
                        <code>65537</code> if not supplied. These values can be pulled directly from
                        <code>/etc/pk/server_key.json</code>, but it is important to delete the
                        <code>d</code> key and its value, as this information needs to remain secret.
                    </p>
                    <p>The format of a key object is as follows:</p>
                    <pre>{"n": 3043289324798327498257285749857984257249857245, "e": 12345}</pre>
                </section>
            </div>
        </div>
    </body>
</html>