summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Brannon <chris@the-brannons.com>2021-05-06 06:46:29 -0700
committerChristopher Brannon <chris@the-brannons.com>2021-05-06 07:03:05 -0700
commit5eb08b5a315bd642beeef6b1cce267958268fb31 (patch)
tree3ed4c8843ecb040964a340597231b8b525b1baa9
parente2e77ec375ba0339b63de2bf63fa927346b68ed4 (diff)
downloadrandom-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar.gz
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar.bz2
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar.lz
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar.xz
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.tar.zst
random-things-5eb08b5a315bd642beeef6b1cce267958268fb31.zip
Remote emacspeak.
-rw-r--r--remote-emacspeak/dotemacs4
-rw-r--r--remote-emacspeak/helper-scripts/README.md4
-rwxr-xr-xremote-emacspeak/helper-scripts/esbounce-local4
-rwxr-xr-xremote-emacspeak/helper-scripts/esbounce-lothlorien3
-rwxr-xr-xremote-emacspeak/runit/run6
-rwxr-xr-xremote-emacspeak/servers/lothlorien-espeak13
-rw-r--r--remote-emacspeak/stunnel-emacspeak.conf31
7 files changed, 65 insertions, 0 deletions
diff --git a/remote-emacspeak/dotemacs b/remote-emacspeak/dotemacs
new file mode 100644
index 0000000..1da2636
--- /dev/null
+++ b/remote-emacspeak/dotemacs
@@ -0,0 +1,4 @@
+; A little helper to drop in to ~/.emacs:
+(defun cmb-switch-server (newserver)
+ (dtk-select-server newserver)
+ (dtk-initialize) (dtk-set-rate 449 449))
diff --git a/remote-emacspeak/helper-scripts/README.md b/remote-emacspeak/helper-scripts/README.md
new file mode 100644
index 0000000..3106f52
--- /dev/null
+++ b/remote-emacspeak/helper-scripts/README.md
@@ -0,0 +1,4 @@
+# Helpers
+
+These go in ~/.local/bin, or ~/bin, or wherever you put helper scripts.
+They use emacsclient, so your emacs will need to be set up for that.
diff --git a/remote-emacspeak/helper-scripts/esbounce-local b/remote-emacspeak/helper-scripts/esbounce-local
new file mode 100755
index 0000000..3fc9ed2
--- /dev/null
+++ b/remote-emacspeak/helper-scripts/esbounce-local
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Move speech back to the espeak server on the "local" system, I.E., the
+# one running emacs:
+emacsclient -e '(cmb-switch-server "espeak")'
diff --git a/remote-emacspeak/helper-scripts/esbounce-lothlorien b/remote-emacspeak/helper-scripts/esbounce-lothlorien
new file mode 100755
index 0000000..73a596b
--- /dev/null
+++ b/remote-emacspeak/helper-scripts/esbounce-lothlorien
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Move speech to the lothlorien host.
+emacsclient -e '(cmb-switch-server "lothlorien-espeak")'
diff --git a/remote-emacspeak/runit/run b/remote-emacspeak/runit/run
new file mode 100755
index 0000000..4d03878
--- /dev/null
+++ b/remote-emacspeak/runit/run
@@ -0,0 +1,6 @@
+#!/usr/bin/execlineb
+# On my machines where the speech servers run, I have a runit service
+# under /etc/sv/emacspeak-espeak with this run-script.
+# The server runs under the emacspeaksrv user and needs several different
+# groups:
+cd / chpst -u emacspeaksrv:audio:pulse-access:tls stunnel /etc/stunnel-emacspeak.conf
diff --git a/remote-emacspeak/servers/lothlorien-espeak b/remote-emacspeak/servers/lothlorien-espeak
new file mode 100755
index 0000000..44d9f12
--- /dev/null
+++ b/remote-emacspeak/servers/lothlorien-espeak
@@ -0,0 +1,13 @@
+#!/bin/sh
+# This is the part of the speech server that runs on the machine where emacs
+# and emacspeak run. It should go in the servers/ directory of your
+# emacspeak tree. It's like cloud-espeak and friends, but it uses a
+# TLS connection with a client certificate.
+# I have one of these named for each host where speech is generated.
+#
+# Once it is in place, yuou can use the dtk-select function (C-e d d)
+# from within emacs and pass lothlorien-espeak as the server name to
+# get speech output on lothlorien. Or set the DTK-PROGRAM environment
+# variable.
+#
+exec socat - openssl-connect:lothlorien:2345,cafile=/home/chris/.local/ssl/ca.crt,cert=/home/chris/.local/ssl/beast.pem
diff --git a/remote-emacspeak/stunnel-emacspeak.conf b/remote-emacspeak/stunnel-emacspeak.conf
new file mode 100644
index 0000000..45ef2e2
--- /dev/null
+++ b/remote-emacspeak/stunnel-emacspeak.conf
@@ -0,0 +1,31 @@
+# A stunnel configuration that spawns an emacspeak speech server,
+# waiting for TLS connections on port 2345.
+# I start stunnel with this configuration from runit.
+foreground = yes
+#output = /var/log/stunnel-emacspeak.log
+socket = l:TCP_NODELAY=1
+socket = r:TCP_NODELAY=1
+#compression = rle
+
+[emacspeak-espeak]
+accept = 2345
+# You can set the cert to a combo *.pem file and omit the key, if you like.
+# Keys are owned by user root, group tls, with 0640 permissions.
+# lothlorien is one of my machines that has I/O hardware connected:
+cert = /etc/ssl/private/lothlorien.crt
+key = /etc/ssl/private/lothlorien.key
+client = no
+
+# To allow anyone to try an ssl connection, use this:
+# But actually don't, because, umm, you will have just given them
+# arbitrary code execution privileges as the emacspeaksrv user on your box.
+# The espeak speech server is literally a TCL REPL, and the speech
+# server "protocol" is just TCL commands. So yeah, don't.
+###verify = 0
+
+# To allow only cert-authorized clients, use something like this instead of the above:
+verify = 2
+CAfile = /etc/ssl/certs/beast.localdomain-ca.crt
+
+exec = /usr/local/lib/emacspeak-servers/espeak
+execargs = /usr/local/lib/emacspeak-servers/espeak