diff options
Diffstat (limited to 'examples/chat')
-rw-r--r-- | examples/chat/nc-chatroom.service | 10 | ||||
-rwxr-xr-x | examples/chat/tls-chat.sh | 9 | ||||
-rwxr-xr-x | examples/chat/tlsd-chat.sh | 15 | ||||
-rw-r--r-- | examples/chat/tlsd-chatroom.service | 13 |
4 files changed, 47 insertions, 0 deletions
diff --git a/examples/chat/nc-chatroom.service b/examples/chat/nc-chatroom.service new file mode 100644 index 0000000..8c3f359 --- /dev/null +++ b/examples/chat/nc-chatroom.service @@ -0,0 +1,10 @@ +[Unit] +Description=Ncat chatroom + +[Service] +Type=simple +ExecStart=/usr/bin/nc -vl --broker 127.0.0.1 7000 +User=nobody + +[Install] +WantedBy=multi-user.target diff --git a/examples/chat/tls-chat.sh b/examples/chat/tls-chat.sh new file mode 100755 index 0000000..647331f --- /dev/null +++ b/examples/chat/tls-chat.sh @@ -0,0 +1,9 @@ +#!/bin/sh +rlwrap gnutls-cli --insecure --x509keyfile ~/.tls/key.pem \ + --x509certfile ~/.tls/cert.pem "${1}" --port="${2}" \ + | while read -r LINE +do echo "${LINE}" + case "${LINE}" in + *"${USER}"*) printf '\a' ;; + esac +done diff --git a/examples/chat/tlsd-chat.sh b/examples/chat/tlsd-chat.sh new file mode 100755 index 0000000..a1064a4 --- /dev/null +++ b/examples/chat/tlsd-chat.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +NAME="${ALIAS}[$$]" + +quit () { + echo "$(date -u +%R) * ${NAME} quits" | nc localhost 7000 +} +trap quit EXIT + +JOINMSG="$(date -u +%R) * ${NAME} joins" +echo "${JOINMSG}" +echo "${JOINMSG}" | nc localhost 7000 +while read -r LINE +do echo "$(date -u +%R) ${NAME}: ${LINE}" +done | stdbuf -oL tr -d '\000-\011\013-\037' | nc localhost 7000 diff --git a/examples/chat/tlsd-chatroom.service b/examples/chat/tlsd-chatroom.service new file mode 100644 index 0000000..3b80c42 --- /dev/null +++ b/examples/chat/tlsd-chatroom.service @@ -0,0 +1,13 @@ +[Unit] +Description=TLSd chatroom +Requires=nc-chatroom.service +After=syslog.target + +[Service] +Type=simple +Environment="PATH=/usr/local/bin/:/usr/bin/" +ExecStart=/usr/local/bin/tlsd -p 5600 -- fp2alias -a -- tlsd-chat.sh +User=tlsd + +[Install] +WantedBy=multi-user.target |