Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocks to enable/disable SSH server and PasswordAuthentication config option #67

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sshenable/sshenable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "sshenable",
"text": "%1 secure shell (SSH) server",
"script": "sshenable.sh",
"args": [
{
"type": "menu",
"options": ["Enable", "Disable"]
}
],
"network": false,
"continue": true,
"type": "software",
"category":"software",
"supportedOperatingSystems": [
"raspbian-pibakery.img",
"raspbian-lite-pibakery.img"
],
"shortDescription":"Enable or disable the SSH server.",
"longDescription":"By default, the built in secure shell (SSH) server does not run on startup. Using this block you can enable it, or disable it if you have already enabled it."
}
10 changes: 10 additions & 0 deletions sshenable/sshenable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [ "$1" == "Enable" ]
then
systemctl enable ssh
systemctl start ssh
else
systemctl disable ssh
systemctl stop ssh
fi
21 changes: 21 additions & 0 deletions sshpasswordauth/sshpasswordauth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "sshpasswordauth",
"text": "%1 SSH password authentication",
"script": "sshpasswordauth.sh",
"args": [
{
"type": "menu",
"options": ["Enable", "Disable"]
}
],
"network": false,
"continue": true,
"type": "setting",
"category":"setting",
"supportedOperatingSystems": [
"raspbian-pibakery.img",
"raspbian-lite-pibakery.img"
],
"shortDescription":"Enable or disable password authentication for the SSH server.",
"longDescription":"The secure shell (SSH) service supports password authentication by default. Use this setting to disable it, and allow SSH access only via public key authentication. Make sure you have authorized a public key first!"
}
9 changes: 9 additions & 0 deletions sshpasswordauth/sshpasswordauth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [ "$1" == "Enable" ]
then
sed -re 's/^(\#?)(PasswordAuthentication)([[:space:]]+)(no|yes)[[:space:]]*$/\2\3yes/' -i /etc/ssh/sshd_config
else
sed -re 's/^(\#?)(PasswordAuthentication)([[:space:]]+)(no|yes)[[:space:]]*$/\2\3no/' -i /etc/ssh/sshd_config
fi
systemctl reload sshd