Skip to content

cameri/smtp-nostr-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTP Nostr Gateway

Dependencies

  • Node v18
  • iptables or ufw (not explained here)

Getting Started

  1. Add firewall rules to allow SMTP traffic (see this guide to make this change permanent)

    sudo iptables -A INPUT -p tcp --dport 25 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
    sudo iptables -A OUTPUT -p tcp --sport 25 -m conntrack --ctstate ESTABLISHED -j ACCEPT
  2. Create key & certificate for TLS

    # Warning: Follow the steps below at your own risk
    
    export DOMAIN=your.domain # e.g. wlvs.space
    
    cd certs/
    
    # Generate private key
    openssl genrsa -des3 $DOMAIN.key 1024
    
    # Generate certificate sign request
    openssl req -new -key $DOMAIN.key -out $DOMAIN.csr
    
    # Remove passphrase from key
    openssl rsa -in $DOMAIN.original -out $DOMAIN.key
    
    # Generate certificate from request & private key
    openssl x509 -req -days 365 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt
    
    # Update the cert and key file on index.js 
  3. Create file with secret (once)

    mkdir -p /etc/smtp-nostr-gateway
    echo -n "definitely-do-not-use-this-secret" | sudo tee /etc/smtp-nostr-gateway/secret
  4. Install packages

    npm install
  5. Run

    sudo SECRET=$(cat /etc/smtp-nostr-gateway/secret) node index.js

Releases

No releases published

Packages

No packages published