#!/bin/bash

if [ "$1" = "" ]; then
  read -p "Dominio ? (esempio: riso.app) " MYDOMAIN
else
  MYDOMAIN=$1
fi

mkdir -p /etc/opendkim/keys/$MYDOMAIN
cd /etc/opendkim/keys/$MYDOMAIN
opendkim-genkey -t -s mail -d $MYDOMAIN
cat /etc/opendkim/keys/$MYDOMAIN/mail.txt
chown opendkim:opendkim /etc/opendkim/keys/$MYDOMAIN/mail.private
