Skip to content

Commit

Permalink
Enable remote execution optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 11, 2024
1 parent e708e0c commit c3d01d3
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
additional_dependencies:
- flake8-docstrings
- flake8-sfs
args: [ --max-line-length=120, --extend-ignore=SFS3 D107 SFS301 D100 D104 D401 SFS101 SFS201 D412 ]
args: [ --max-line-length=120, --extend-ignore=SFS3 D107 SFS301 D100 D104 D401 SFS101 SFS201 D412 D400 ]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ pyninja start
- **NINJA_HOST** - Hostname for the API server.
- **NINJA_PORT** - Port number for the API server.
- **WORKERS** - Number of workers for the uvicorn server.
- **COMMAND_TIMEOUT** - Number of seconds for a command to timeout.
- **API_SECRET** - Secret access key for running commands on server remotely.
- **APIKEY** - API Key for authentication.

**COMMAND_TIMEOUT** is set to `0` by default, disabling remote executions. To enable it, set it to a value greater than `0`<br>
⚠️ Enabling remote execution can be extremely risky and can be a major security threat. So use **caution** and set the **API_SECRET** to a strong value.

> `PyNinja` supports [logging.ini] configuration for custom logging. Just place it in the current working directory.<br>
> Refer [samples] directory for examples.
Expand Down
8 changes: 4 additions & 4 deletions doc_gen/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ Monitors
========

Process
=======
-------

.. automodule:: pyninja.process

Service
=======
-------

.. automodule:: pyninja.service

Squire
======

.. autoclass:: pyninja.squire.StatusPayload(BaseModel)
.. autoclass:: pyninja.squire.Payload(BaseModel)
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====
Expand All @@ -63,7 +63,7 @@ Squire
====

.. automodule:: pyninja.squire
:exclude-members: StatusPayload, ServiceStatus, EnvConfig
:exclude-members: Payload, ServiceStatus, EnvConfig

Indices and tables
==================
Expand Down
4 changes: 4 additions & 0 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ <h2>Environment Variables<a class="headerlink" href="#environment-variables" tit
<li><p><strong>NINJA_HOST</strong> - Hostname for the API server.</p></li>
<li><p><strong>NINJA_PORT</strong> - Port number for the API server.</p></li>
<li><p><strong>WORKERS</strong> - Number of workers for the uvicorn server.</p></li>
<li><p><strong>COMMAND_TIMEOUT</strong> - Number of seconds for a command to timeout.</p></li>
<li><p><strong>API_SECRET</strong> - Secret access key for running commands on server remotely.</p></li>
<li><p><strong>APIKEY</strong> - API Key for authentication.</p></li>
</ul>
<p><strong>COMMAND_TIMEOUT</strong> is set to <code class="docutils literal notranslate"><span class="pre">0</span></code> by default, disabling remote executions. To enable it, set it to a value greater than <code class="docutils literal notranslate"><span class="pre">0</span></code><br>
⚠️ Enabling remote execution can be extremely risky and can be a major security threat. So use <strong>caution</strong> and set the <strong>API_SECRET</strong> to a strong value.</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">PyNinja</span></code> supports <a class="reference external" href="https://docs.python-guide.org/writing/logging/#example-configuration-via-an-ini-file">logging.ini</a> configuration for custom logging. Just place it in the current working directory.<br>
Refer <a class="reference external" href="https://github.com/thevickypedia/PyNinja/tree/main/samples">samples</a> directory for examples.</p>
Expand Down
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ pyninja start
- **NINJA_HOST** - Hostname for the API server.
- **NINJA_PORT** - Port number for the API server.
- **WORKERS** - Number of workers for the uvicorn server.
- **COMMAND_TIMEOUT** - Number of seconds for a command to timeout.
- **API_SECRET** - Secret access key for running commands on server remotely.
- **APIKEY** - API Key for authentication.

**COMMAND_TIMEOUT** is set to `0` by default, disabling remote executions. To enable it, set it to a value greater than `0`<br>
⚠️ Enabling remote execution can be extremely risky and can be a major security threat. So use **caution** and set the **API_SECRET** to a strong value.

> `PyNinja` supports [logging.ini] configuration for custom logging. Just place it in the current working directory.<br>
> Refer [samples] directory for examples.
Expand Down
5 changes: 5 additions & 0 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ pyninja start
- **NINJA_HOST** - Hostname for the API server.
- **NINJA_PORT** - Port number for the API server.
- **WORKERS** - Number of workers for the uvicorn server.
- **COMMAND_TIMEOUT** - Number of seconds for a command to timeout.
- **API_SECRET** - Secret access key for running commands on server remotely.
- **APIKEY** - API Key for authentication.

**COMMAND_TIMEOUT** is set to `0` by default, disabling remote executions. To enable it, set it to a value greater than `0`<br>
⚠️ Enabling remote execution can be extremely risky and can be a major security threat. So use **caution** and set the **API_SECRET** to a strong value.

> `PyNinja` supports [logging.ini] configuration for custom logging. Just place it in the current working directory.<br>
> Refer [samples] directory for examples.

Expand Down
8 changes: 4 additions & 4 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ Monitors
========

Process
=======
-------

.. automodule:: pyninja.process

Service
=======
-------

.. automodule:: pyninja.service

Squire
======

.. autoclass:: pyninja.squire.StatusPayload(BaseModel)
.. autoclass:: pyninja.squire.Payload(BaseModel)
:exclude-members: _abc_impl, model_config, model_fields, model_computed_fields

====
Expand All @@ -63,7 +63,7 @@ Squire
====

.. automodule:: pyninja.squire
:exclude-members: StatusPayload, ServiceStatus, EnvConfig
:exclude-members: Payload, ServiceStatus, EnvConfig

Indices and tables
==================
Expand Down
30 changes: 26 additions & 4 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ <h1 id="index">Index</h1>

<div class="genindex-jumpbox">
<a href="#A"><strong>A</strong></a>
| <a href="#C"><strong>C</strong></a>
| <a href="#D"><strong>D</strong></a>
| <a href="#E"><strong>E</strong></a>
| <a href="#F"><strong>F</strong></a>
| <a href="#G"><strong>G</strong></a>
| <a href="#M"><strong>M</strong></a>
| <a href="#N"><strong>N</strong></a>
| <a href="#P"><strong>P</strong></a>
| <a href="#R"><strong>R</strong></a>
| <a href="#S"><strong>S</strong></a>
| <a href="#U"><strong>U</strong></a>
| <a href="#W"><strong>W</strong></a>
Expand All @@ -58,6 +60,8 @@ <h1 id="index">Index</h1>
<h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.EnvConfig.api_secret">api_secret (pyninja.squire.EnvConfig attribute)</a>
</li>
<li><a href="index.html#pyninja.squire.EnvConfig.apikey">apikey (pyninja.squire.EnvConfig attribute)</a>
</li>
</ul></td>
Expand All @@ -69,6 +73,18 @@ <h2 id="A">A</h2>
</ul></td>
</tr></table>

<h2 id="C">C</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.Payload.command">command (pyninja.squire.Payload attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.EnvConfig.command_timeout">command_timeout (pyninja.squire.EnvConfig attribute)</a>
</li>
</ul></td>
</tr></table>

<h2 id="D">D</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down Expand Up @@ -161,6 +177,8 @@ <h2 id="N">N</h2>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.Payload">Payload (class in pyninja.squire)</a>
</li>
<li><a href="index.html#pyninja.routers.process_status">process_status() (in module pyninja.routers)</a>
</li>
<li>
Expand Down Expand Up @@ -217,11 +235,17 @@ <h2 id="P">P</h2>
</ul></td>
</tr></table>

<h2 id="S">S</h2>
<h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.squire.StatusPayload.service_name">service_name (pyninja.squire.StatusPayload attribute)</a>
<li><a href="index.html#pyninja.routers.run_command">run_command() (in module pyninja.routers)</a>
</li>
</ul></td>
</tr></table>

<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pyninja.routers.service_status">service_status() (in module pyninja.routers)</a>
</li>
<li><a href="index.html#pyninja.squire.ServiceStatus">ServiceStatus (class in pyninja.squire)</a>
Expand All @@ -231,8 +255,6 @@ <h2 id="S">S</h2>
<li><a href="index.html#pyninja.main.start">start() (in module pyninja.main)</a>
</li>
<li><a href="index.html#pyninja.squire.ServiceStatus.status_code">status_code (pyninja.squire.ServiceStatus attribute)</a>
</li>
<li><a href="index.html#pyninja.squire.StatusPayload">StatusPayload (class in pyninja.squire)</a>
</li>
</ul></td>
</tr></table>
Expand Down
Loading

0 comments on commit c3d01d3

Please sign in to comment.