Name | ocsh JSON |
Version |
20230908.post3
JSON |
| download |
home_page | |
Summary | SSH password log-in and command automator |
upload_time | 2023-09-08 16:19:03 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.0 |
license | BSD-3-Clause |
keywords |
ssh
bouncer
pass
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## ocsh - SSH password log-in and command automator
ocsh automates SSH password login and command execution through annotations on `ssh_config(5)` Hosts:
* password authentication, reading password from pass[1]:
- config: `# ocsh pass <pass-name>`
- command: `$ ocsh host`
* post-login command execution:
- config: `# ocsh post <action> "<cmd>"`
- command: `$ ocsh host[action]`
* post-login command execution, reading additional password from pass[1]:
- config: `# ocsh postpass <action> "<cmd>" <pass-name>`
- command: `$ ocsh host[action]`
* use different ssh command or prefix by other command:
- config: `# ocsh cmd "<ssh-command>"`
- config: `# ocsh pre "<pre-command>"`
- command: `$ ocsh host`
[1] https://www.passwordstore.org/
Compatibility with OpenSSH is kept as much as possible:
* support usual SSH aliases, keys and command-line options
* compatible with rsync, scp and other tools using SSH for transport, see example commands
* autocompletion can be set-up with --ocsh-install-autocompletion
## Usage
```
usage: ocsh.py [-h] [--ocsh-verbose] [--ocsh-pretend] [--ocsh-examples]
[--ocsh-install-autocompletion]
[destination] ...
ocsh - SSH password log-in and command automator
positional arguments:
destination host[action]
args any OpenSSH options or remote command
options:
-h, --help show this help message and exit
--ocsh-verbose enable debug messages
--ocsh-pretend do not actually perform the connection
--ocsh-examples show example ocsh configuration and commands
--ocsh-install-autocompletion
install bash autocompletion for the current user
```
## Installation
```
pip install ocsh
```
## Examples of usage
```
# connect to SSH alias 'host1' with automated password login
# ssh_config(5)
Host host1
Hostname 10.0.0.1
User minou
# ocsh pass pass-location # location in password-store
# command
ocsh host1
# equivalent ssh command
sshpass -p "$(pass pass-location)" ssh host1
# connect to SSH alias 'host2' with automated password login, going through the above 'host1', and become root
# ssh_config(5)
Host host2
Host 10.9.0.1
User root
# ocsh pass pass-location2 # location in password-store
# ocsh postpass su "su -l" pass-location3
# ocsh post nsep "ip netns exec nsep" # post-login command to enter a network namespace
# command
ocsh host2[root]
# equivalent ssh command
sshpass -p "$(pass pass-location2)" ssh -oProxyCommand="sshpass -p "$(pass pass-location1)" ssh host1" host2 su -l
<now enter root password (from pass-location3) manually>
# run ssh connection from a different namespace
# ssh_config(5)
Host host1
Hostname 10.0.0.1
User minou
# ocsh pre "ip netns exec toto"
# command
ocsh host1
# equivalent command
ip netns exec ssh host1
# run rsync through ocsh from host1 with automated password login
rsync -e "ocsh" -avP host1:/etc/hosts /tmp/
# run scp through ocsh from host1 with automated password login
scp -S "ocsh" host1:/etc/hosts /tmp/
```
## See also
* netmiko - python library to SSH to various network devices
https://github.com/ktbyers/netmiko
* sshpass - automate SSH password-based log-in
https://github.com/kevinburke/sshpass
* passh - sshpass alternative to automate SSH password-based log-in
https://github.com/clarkwang/passh
Raw data
{
"_id": null,
"home_page": "",
"name": "ocsh",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": "",
"keywords": "ssh,bouncer,pass",
"author": "",
"author_email": "Laurent Ghigonis <ooookiwi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/7a/3e/2c1b603ee2f8b353efeb8aae8298cb52aaeccc476fd56c4707d10b3ad30e/ocsh-20230908.post3.tar.gz",
"platform": null,
"description": "## ocsh - SSH password log-in and command automator\n\nocsh automates SSH password login and command execution through annotations on `ssh_config(5)` Hosts:\n* password authentication, reading password from pass[1]:\n - config: `# ocsh pass <pass-name>`\n - command: `$ ocsh host`\n* post-login command execution:\n - config: `# ocsh post <action> \"<cmd>\"`\n - command: `$ ocsh host[action]`\n* post-login command execution, reading additional password from pass[1]:\n - config: `# ocsh postpass <action> \"<cmd>\" <pass-name>`\n - command: `$ ocsh host[action]`\n* use different ssh command or prefix by other command:\n - config: `# ocsh cmd \"<ssh-command>\"`\n - config: `# ocsh pre \"<pre-command>\"`\n - command: `$ ocsh host`\n\n[1] https://www.passwordstore.org/\n\nCompatibility with OpenSSH is kept as much as possible:\n* support usual SSH aliases, keys and command-line options\n* compatible with rsync, scp and other tools using SSH for transport, see example commands\n* autocompletion can be set-up with --ocsh-install-autocompletion\n\n## Usage\n```\nusage: ocsh.py [-h] [--ocsh-verbose] [--ocsh-pretend] [--ocsh-examples]\n [--ocsh-install-autocompletion]\n [destination] ...\n\nocsh - SSH password log-in and command automator\n\npositional arguments:\n destination host[action]\n args any OpenSSH options or remote command\n\noptions:\n -h, --help show this help message and exit\n --ocsh-verbose enable debug messages\n --ocsh-pretend do not actually perform the connection\n --ocsh-examples show example ocsh configuration and commands\n --ocsh-install-autocompletion\n install bash autocompletion for the current user\n```\n\n## Installation\n\n```\npip install ocsh\n```\n\n## Examples of usage\n```\n# connect to SSH alias 'host1' with automated password login\n# ssh_config(5)\nHost host1\n Hostname 10.0.0.1\n User minou\n # ocsh pass pass-location # location in password-store\n# command\nocsh host1\n# equivalent ssh command\nsshpass -p \"$(pass pass-location)\" ssh host1\n\n# connect to SSH alias 'host2' with automated password login, going through the above 'host1', and become root\n# ssh_config(5)\nHost host2\n Host 10.9.0.1\n User root\n # ocsh pass pass-location2 # location in password-store\n # ocsh postpass su \"su -l\" pass-location3\n # ocsh post nsep \"ip netns exec nsep\" # post-login command to enter a network namespace\n# command\nocsh host2[root]\n# equivalent ssh command\nsshpass -p \"$(pass pass-location2)\" ssh -oProxyCommand=\"sshpass -p \"$(pass pass-location1)\" ssh host1\" host2 su -l\n<now enter root password (from pass-location3) manually>\n\n# run ssh connection from a different namespace\n# ssh_config(5)\nHost host1\n Hostname 10.0.0.1\n User minou\n # ocsh pre \"ip netns exec toto\"\n# command\nocsh host1\n# equivalent command\nip netns exec ssh host1\n\n# run rsync through ocsh from host1 with automated password login\nrsync -e \"ocsh\" -avP host1:/etc/hosts /tmp/\n\n# run scp through ocsh from host1 with automated password login\nscp -S \"ocsh\" host1:/etc/hosts /tmp/\n```\n\n## See also\n\n* netmiko - python library to SSH to various network devices\n https://github.com/ktbyers/netmiko\n* sshpass - automate SSH password-based log-in\n https://github.com/kevinburke/sshpass\n* passh - sshpass alternative to automate SSH password-based log-in\n https://github.com/clarkwang/passh\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "SSH password log-in and command automator",
"version": "20230908.post3",
"project_urls": {
"Homepage": "https://github.com/looran/ocsh"
},
"split_keywords": [
"ssh",
"bouncer",
"pass"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d9851108b60625209ef6c19705ad1ae6d48c6d518ac8573c4b644ae713ef2dfa",
"md5": "5deaa94c2ce0062fb56f17b8c48a202c",
"sha256": "465884e5da3be0aa58d01898ebe96dea99c96585785c73d069a8e16572936838"
},
"downloads": -1,
"filename": "ocsh-20230908.post3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5deaa94c2ce0062fb56f17b8c48a202c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 8336,
"upload_time": "2023-09-08T16:19:01",
"upload_time_iso_8601": "2023-09-08T16:19:01.632413Z",
"url": "https://files.pythonhosted.org/packages/d9/85/1108b60625209ef6c19705ad1ae6d48c6d518ac8573c4b644ae713ef2dfa/ocsh-20230908.post3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a3e2c1b603ee2f8b353efeb8aae8298cb52aaeccc476fd56c4707d10b3ad30e",
"md5": "3a0138028aa4b8b2fd036ef7d7ffa913",
"sha256": "e7f0af886997ec9b45f59e62f58b65b7b7da48d72189c9deac44d257d89be7f6"
},
"downloads": -1,
"filename": "ocsh-20230908.post3.tar.gz",
"has_sig": false,
"md5_digest": "3a0138028aa4b8b2fd036ef7d7ffa913",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 6832,
"upload_time": "2023-09-08T16:19:03",
"upload_time_iso_8601": "2023-09-08T16:19:03.595661Z",
"url": "https://files.pythonhosted.org/packages/7a/3e/2c1b603ee2f8b353efeb8aae8298cb52aaeccc476fd56c4707d10b3ad30e/ocsh-20230908.post3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-08 16:19:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "looran",
"github_project": "ocsh",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ocsh"
}