create README.txt and .html

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-28 09:54:51 +02:00
parent fcca1391b5
commit b831e60cbe
4 changed files with 211 additions and 127 deletions

101
README.html Normal file
View File

@ -0,0 +1,101 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>Bashbot README</title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<div id="header">
<h1 class="title">Bashbot README</h1>
</div>
<h1 id="bashbot">bashbot</h1>
<p>A Telegram bot written in bash.</p>
<p>Written by Drew (<span class="citation">@topkecleon</span>), Daniil Gentili (<span class="citation">@danogentili</span>), and Kay M (<span class="citation">@gnadelwartz</span>).</p>
<p>Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.</p>
<p>Released to the public domain wherever applicable. Elsewhere, consider it released under the <a href="http://www.wtfpl.net/txt/copying/">WTFPLv2</a>.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Depends on <a href="http://github.com/tmux/tmux">tmux</a>. Uses <a href="http://github.com/dominictarr/JSON.sh">JSON.sh</a>.</p>
<p>Most complete <a href="doc/4_expert.md#Bashbot-UTF-8-Support">UTF-8 support for bashbot</a> is availible if phyton is installed (optional).</p>
<p>Bashbot <a href="https://github.com/topkecleon/telegram-bot-bash">Documentation</a> and <a href="https://github.com/topkecleon/telegram-bot-bash/releases">Downloads</a> are availible on www.github.com</p>
<h2 id="documentation">Documentation</h2>
<ul>
<li><a href="https://core.telegram.org/bots">Introdution to Telegram Bots</a>
<ul>
<li><a href="https://core.telegram.org/bots#3-how-do-i-create-a-bot">One Bot to rule them all</a></li>
<li><a href="https://core.telegram.org/bots#commands">Bot commands</a></li>
</ul></li>
<li><a href="doc/0_install.md">Install Bashbot</a>
<ul>
<li>Install release</li>
<li>Install from githup</li>
<li>Update Bashbot</li>
<li>Notes on Updates</li>
</ul></li>
<li><a href="doc/1_firstbot.md">Create a new Telegram Bot with botfather</a></li>
<li><a href="doc/2_usage.md">Getting Started</a>
<ul>
<li>Managing your Bot</li>
<li>Recieve data</li>
<li>Send messages</li>
<li>Send files, locations, keyboards</li>
</ul></li>
<li><a href="doc/3_advanced.md">Advanced Features</a>
<ul>
<li>Access Control</li>
<li>Interactive Chats</li>
<li>Background Jobs</li>
<li>Inline queries</li>
</ul></li>
<li><a href="doc/4_expert.md">Expert Use</a>
<ul>
<li>Handling UTF-8 character sets</li>
<li>Run as other user or system service</li>
<li>Scedule bashbot from Cron</li>
</ul></li>
<li><a href="doc/5_practice.md">Best Practices</a>
<ul>
<li>Customize commands.sh</li>
<li>Seperate logic from commands</li>
<li>Test your Bot with shellcheck</li>
</ul></li>
<li><a href="doc/6_reference.md">Bashbot function reference</a></li>
<li><a href="doc/7_develop.md">Deveoper Notess</a>
<ul>
<li>Setup your environment</li>
<li>Test, Add, Push changes</li>
<li>Prepare a new version</li>
<li>Bashbot testsuite</li>
</ul></li>
<li><a href="doc/8_customize.md">Customize bashbot environment</a></li>
</ul>
<h2 id="security-considerations">Security Considerations</h2>
<p>Running a Telegram Bot means it is connected to the public and you never know whats send to your Bot.</p>
<p>Bash scripts in general are not designed to be bullet proof, so consider this Bot as a proof of concept. More concret examples of security problems are: bashs quoting hell and globbing. <a href="https://unix.stackexchange.com/questions/171346/security-implications-of-forgetting-to-quote-a-variable-in-bash-posix-shells">Implications of wrong quoting</a></p>
<p>Whenever you are processing input from from untrusted sources (messages, files, network) you must be as carefull as possible, e.g. set IFS appropriate, disable globbing (set -f) and quote everthing. In addition disable not used Bot commands and delete unused scripts from your Bot, e.g. example scripts notify, calc, question,</p>
<p>A powerful tool to improve your scripts robustness is <code>shellcheck</code>. You can <a href="https://www.shellcheck.net/">use it online</a> or <a href="https://github.com/koalaman/shellcheck#installing">install shellcheck locally</a>. All bashbot scripts are checked by shellcheck.</p>
<h3 id="run-your-bot-as-a-restricted-user">Run your Bot as a restricted user</h3>
<p><strong>I recommend to run your bot as a user, with almost no access rights.</strong> All files your Bot have write access to are in danger to be overwritten/deleted if your bot is hacked. For the same reason ervery file your Bot can read is in danger to be disclosed. Restict your Bots access rigths to the absolute minimum.</p>
<p><strong>Never run your Bot as root, this is the most dangerous you can do!</strong> Usually the user nobody has almost no rights on Unix/Linux systems. See <a href="doc/4_expert.md">Expert use</a> on how to run your Bot as an other user.</p>
<h3 id="secure-your-bot-installation">Secure your Bot installation</h3>
<p><strong>Your Bot configuration must no be readable from other users.</strong> Everyone who can read your Bots token can act as your Bot and has access to all chats your Bot is in!</p>
<p>Everyone with read access to your Bot files can extract your Bots data. Especially your Bot Token in <code>token</code> must be protected against other users. No one exept you must have write access to the Bot files. The Bot must be restricted to have write access to <code>count</code> and <code>tmp-bot-bash</code> only, all other files must be write protected.</p>
<p>To set access rights for your bashbot installation to a reasonable default run <code>sudo ./bashbot.sh init</code> after every update or change to your installation directory.</p>
<h3 id="is-this-bot-insecure">Is this Bot insecure?</h3>
<p>Bashbot is not more (in)secure as any other Bot written in any other language, we have done our best to make it as secure as possible. But YOU are responsible for the bot commands you wrote and you should know about the risks …</p>
<h3 id="why-bash-and-not-the-much-better-xyz">Why Bash and not the much better xyz?</h3>
<p>Well, thats a damn good question … may be because Im an Unix/Linux admin from stone age. Nevertheless there are more reasons from my side:</p>
<ul>
<li>bashbot will run everywhere where bash is availible, from ebedded linux to mainframe</li>
<li>easy to integrate with other shell script, e.g. for sending system message / health status</li>
<li>no need to install or learn a new programming language, library or framework</li>
<li>no database, not event driven, not OO …</li>
</ul>
<p><span class="citation">@Gnadelwartz</span></p>
<h2 id="thats-it">Thats it!</h2>
<p>If you feel that theres something missing or if you found a bug, feel free to submit a pull request!</p>
<h4 id="version-v0.70-pre1-6-g3cd6eeb"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.70-pre1-6-g3cd6eeb</h4>
</body>
</html>

View File

@ -1,151 +1,133 @@
bashbot
-------
# bashbot
A Telegram bot written in bash.
Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M
Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M
(@gnadelwartz).
Contributions by JuanPotato, BigNerd95, TiagoDanin, and iicc1.
Released to the public domain wherever applicable. Elsewhere, consider
it released under the http://www.wtfpl.net/txt/copying/[WTFPLv2].
Released to the public domain wherever applicable.
Elsewhere, consider it released under the
[WTFPLv2](http://www.wtfpl.net/txt/copying/).
Prerequisites
~~~~~~~~~~~~~
## Prerequisites
Depends on [tmux](http://github.com/tmux/tmux).
Uses [JSON.sh](http://github.com/dominictarr/JSON.sh).
Depends on http://github.com/tmux/tmux[tmux]. Uses
http://github.com/dominictarr/JSON.sh[JSON.sh].
Most complete [UTF-8 support for
bashbot](doc/4_expert.md#Bashbot-UTF-8-Support) is availible if phyton is
installed (optional).
Most complete link:doc/4_expert.md#Bashbot-UTF-8-Support[UTF-8 support
for bashbot] is availible if phyton is installed (optional).
Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and
[Downloads](https://github.com/topkecleon/telegram-bot-bash/releases) are
availible on www.github.com
Bashbot https://github.com/topkecleon/telegram-bot-bash[Documentation]
and https://github.com/topkecleon/telegram-bot-bash/releases[Downloads]
are availible on www.github.com
## Documentation
* [Introdution to Telegram Bots](https://core.telegram.org/bots)
* [One Bot to rule them
all](https://core.telegram.org/bots#3-how-do-i-create-a-bot)
* [Bot commands](https://core.telegram.org/bots#commands)
* [Install Bashbot](doc/0_install.md)
* Install release
* Install from githup
* Update Bashbot
* Notes on Updates
* [Create a new Telegram Bot with botfather](doc/1_firstbot.md)
* [Getting Started](doc/2_usage.md)
* Managing your Bot
* Recieve data
* Send messages
* Send files, locations, keyboards
* [Advanced Features](doc/3_advanced.md)
* Access Control
* Interactive Chats
* Background Jobs
* Inline queries
* [Expert Use](doc/4_expert.md)
* Handling UTF-8 character sets
* Run as other user or system service
* Scedule bashbot from Cron
* [Best Practices](doc/5_practice.md)
* Customize commands.sh
* Seperate logic from commands
* Test your Bot with shellcheck
* [Bashbot function reference](doc/6_reference.md)
* [Deveoper Notess](doc/7_develop.md)
* Setup your environment
* Test, Add, Push changes
* Prepare a new version
* Bashbot testsuite
* [Customize bashbot environment](doc/8_customize.md)
Documentation
~~~~~~~~~~~~~
* https://core.telegram.org/bots[Introdution to Telegram Bots]
** https://core.telegram.org/bots#3-how-do-i-create-a-bot[One Bot to
rule them all]
** https://core.telegram.org/bots#commands[Bot commands]
* link:doc/0_install.md[Install Bashbot]
** Install release
** Install from githup
** Update Bashbot
** Notes on Updates
* link:doc/1_firstbot.md[Create a new Telegram Bot with botfather]
* link:doc/2_usage.md[Getting Started]
** Managing your Bot
** Recieve data
** Send messages
** Send files, locations, keyboards
* link:doc/3_advanced.md[Advanced Features]
** Access Control
** Interactive Chats
** Background Jobs
** Inline queries
* link:doc/4_expert.md[Expert Use]
** Handling UTF-8 character sets
** Run as other user or system service
** Scedule bashbot from Cron
* link:doc/5_practice.md[Best Practices]
** Customize commands.sh
** Seperate logic from commands
** Test your Bot with shellcheck
* link:doc/6_reference.md[Bashbot function reference]
* link:doc/7_develop.md[Deveoper Notess]
** Setup your environment
** Test, Add, Push changes
** Prepare a new version
** Bashbot testsuite
* link:doc/8_customize.md[Customize bashbot environment]
## Security Considerations
Running a Telegram Bot means it is connected to the public and you never know
whats send to your Bot.
Security Considerations
~~~~~~~~~~~~~~~~~~~~~~~
Bash scripts in general are not designed to be bullet proof, so consider this
Bot as a proof of concept. More concret examples of security problems are:
bash's 'quoting hell' and globbing. [Implications of wrong
quoting](https://unix.stackexchange.com/questions/171346/security-implications-o
f-forgetting-to-quote-a-variable-in-bash-posix-shells)
Running a Telegram Bot means it is connected to the public and you never
know whats send to your Bot.
Whenever you are processing input from from untrusted sources (messages, files,
network) you must be as carefull as possible, e.g. set IFS appropriate, disable
globbing (set -f) and quote everthing. In addition disable not used Bot
commands and delete unused scripts from your Bot, e.g. example scripts
'notify', 'calc', 'question',
Bash scripts in general are not designed to be bullet proof, so consider
this Bot as a proof of concept. More concret examples of security
problems are: bash's 'quoting hell' and globbing.
https://unix.stackexchange.com/questions/171346/security-implications-of-forgetting-to-quote-a-variable-in-bash-posix-shells[Implications
of wrong quoting]
A powerful tool to improve your scripts robustness is ```shellcheck```. You can
[use it online](https://www.shellcheck.net/) or [install shellcheck
locally](https://github.com/koalaman/shellcheck#installing). All bashbot
scripts are checked by shellcheck.
Whenever you are processing input from from untrusted sources (messages,
files, network) you must be as carefull as possible, e.g. set IFS
appropriate, disable globbing (set -f) and quote everthing. In addition
disable not used Bot commands and delete unused scripts from your Bot,
e.g. example scripts 'notify', 'calc', 'question',
### Run your Bot as a restricted user
**I recommend to run your bot as a user, with almost no access rights.**
All files your Bot have write access to are in danger to be overwritten/deleted
if your bot is hacked.
For the same reason ervery file your Bot can read is in danger to be disclosed.
Restict your Bots access rigths to the absolute minimum.
A powerful tool to improve your scripts robustness is `shellcheck`. You
can https://www.shellcheck.net/[use it online] or
https://github.com/koalaman/shellcheck#installing[install shellcheck
locally]. All bashbot scripts are checked by shellcheck.
**Never run your Bot as root, this is the most dangerous you can do!** Usually
the user 'nobody' has almost no rights on Unix/Linux systems. See [Expert
use](doc/4_expert.md) on how to run your Bot as an other user.
Run your Bot as a restricted user
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
### Secure your Bot installation
**Your Bot configuration must no be readable from other users.** Everyone who
can read your Bots token can act as your Bot and has access to all chats your
Bot is in!
*I recommend to run your bot as a user, with almost no access rights.*
All files your Bot have write access to are in danger to be
overwritten/deleted if your bot is hacked. For the same reason ervery
file your Bot can read is in danger to be disclosed. Restict your Bots
access rigths to the absolute minimum.
Everyone with read access to your Bot files can extract your Bots data.
Especially your Bot Token in ```token``` must be protected against other users.
No one exept you must have write access to the Bot files. The Bot must be
restricted to have write access to ```count``` and ```tmp-bot-bash``` only,
all other files must be write protected.
*Never run your Bot as root, this is the most dangerous you can do!*
Usually the user 'nobody' has almost no rights on Unix/Linux systems.
See link:doc/4_expert.md[Expert use] on how to run your Bot as an other
user.
To set access rights for your bashbot installation to a reasonable default run
```sudo ./bashbot.sh init``` after every update or change to your installation
directory.
Secure your Bot installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
### Is this Bot insecure?
Bashbot is not more (in)secure as any other Bot written in any other language,
we have done our best to make it as secure as possible. But YOU are responsible
for the bot commands you wrote and you should know about the risks ...
*Your Bot configuration must no be readable from other users.* Everyone
who can read your Bots token can act as your Bot and has access to all
chats your Bot is in!
### Why Bash and not the much better xyz?
Well, thats a damn good question ... may be because I'm an Unix/Linux admin
from stone age. Nevertheless there are more reasons from my side:
Everyone with read access to your Bot files can extract your Bots data.
Especially your Bot Token in `token` must be protected against other
users. No one exept you must have write access to the Bot files. The Bot
must be restricted to have write access to `count` and `tmp-bot-bash`
only, all other files must be write protected.
To set access rights for your bashbot installation to a reasonable
default run `sudo ./bashbot.sh init` after every update or change to
your installation directory.
Is this Bot insecure?
^^^^^^^^^^^^^^^^^^^^^
Bashbot is not more (in)secure as any other Bot written in any other
language, we have done our best to make it as secure as possible. But
YOU are responsible for the bot commands you wrote and you should know
about the risks ...
Why Bash and not the much better xyz?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Well, thats a damn good question ... may be because I'm an Unix/Linux
admin from stone age. Nevertheless there are more reasons from my side:
* bashbot will run everywhere where bash is availible, from ebedded
linux to mainframe
* easy to integrate with other shell script, e.g. for sending system
message / health status
* no need to install or learn a new programming language, library or
framework
* no database, not event driven, not OO ...
- bashbot will run everywhere where bash is availible, from ebedded linux to
mainframe
- easy to integrate with other shell script, e.g. for sending system message /
health status
- no need to install or learn a new programming language, library or framework
- no database, not event driven, not OO ...
@Gnadelwartz
That's it!
~~~~~~~~~~
## That's it!
If you feel that there's something missing or if you found a bug, feel
free to submit a pull request!
If you feel that there's something missing or if you found a bug, feel free to
submit a pull request!
latexmath:[\[VERSION\]] v0.70-pre1-6-g3cd6eeb
+++++++++++++++++++++++++++++++++++++++++++++
#### $$VERSION$$ v0.70-pre1-6-g3cd6eeb

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
#### $$VERSION$$ v0.70-pre1-0-g490c472
#### $$VERSION$$ v0.70-pre1-8-gfcca139
# shellcheck disable=SC2016
#
# Easy Versioning in git:
@ -57,6 +57,7 @@ do
done
# try to compile README.txt
echo -n " README.txt" >&2
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
type -f pandoc >/dev/null && pandoc -s -S -M "title=Bashbot README" README.md >README.html
fold -s README.md >README.txt
echo " done."

View File

@ -58,7 +58,7 @@ You must use the function ```user_is_allowed``` to check if a user has the capab
;;
esac
```
**See also [Bashbot User Access Control functions](6_reference.md#User_Access_Control)**
**See also [Bashbot User Access Control functions](6_reference.md#User-Access-Control)**
### Interactive Chats
To create interactive chats, write *(or edit the 'exmaples/question.sh' script)* a bash *(or C or python)* script, make it executable
@ -177,5 +177,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
#### [Prev Getting started](2_usage.md)
#### [Next Expert Use](4_expert.md)
#### $$VERSION$$ v0.70-pre1-7-g02d9afb
#### $$VERSION$$ v0.70-pre1-8-gfcca139