;; erc-tor.el handle tor erc authentication ;; ;; Copyright (C) 2023 oat ;; ;; Author: oat ;; Date: 2023-05-25 ;; Version 0 ;; License GPLv3+ ;; https://www.gnu.org/licenses/gpl-3.0.txt ;; ;; Contributors: Neverwas, Corwin, w0lper and Affliction ;; ;; Keywords: ;; This file is NOT part of GNU Emacs. ;; ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . ;; ;;; Commentary: ;; This file implements libera chat onion service. It was test on ERC 5.5 ;; over Emacs-29.0.90 ;; ;; To activate: ;; ;;; NOTE: requires SASL EXTERNAL authentication ;; ;;; Code: (require 'socks) (require 'sasl) (require 'erc) (require 'gnutls) (defun erc-tor () (interactive) (let* ((socks-password "") (socks-server '("tor" "localhost" 9050 5)) (erc-modules (cons 'sasl erc-modules)) (erc-sasl-mechanism 'external) (erc-server-connect-function #'erc-tor-service)) (erc-open "libera75jm6of4wxpxt4aynol3xjmbtxgfyjpu34ss4d7r7q2v5zrpyd.onion" 6697 "nick-name" "full-name" 'connect nil nil nil nil (list "/home/user/libera.key" "/home/user/libera.crt") "libera-chat-account"))) (defun erc-tor-service (name buffer host service &rest parameters) "Connect to ERC via SOCKS proxy with client cert." (print "Begining erc-tor-service") (let* ((proc (socks-open-network-stream name buffer host service)) (cert-info (plist-get parameters :client-certificate))) ;; This automatically sets :type 'gnutls-x509pki (gnutls-negotiate :process proc :hostname host :keylist (list cert-info)))) (custom-set-variables '(erc-modules '(autojoin button completion fill irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring sasl stamp track))) (custom-set-faces)