Mercurial > prosody-modules
annotate mod_alias/mod_alias_postfixadmin.sh @ 5243:d5dc8edb2695
mod_http_oauth2: Use more compact IDs
UUIDs are nice but so verbose!
The reduction in entropy for the nonce should be fine since the
timestamp is also counts towards this, and it changes every second
(modulo clock shenanigans), so the chances of someone managing to get
the same client_secret by registering with the same information at the
same time as another entity should be negligible.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 11 Mar 2023 22:46:27 +0100 |
parents | 0c3ba5ff7a3b |
children |
rev | line source |
---|---|
1953
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
1 #!/bin/sh |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
2 # Copyright (C) 2015 Travis Burtrum |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
3 # This file is MIT/X11 licensed. |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
4 |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
5 # run like ./mod_alias_postfixadmin.sh "mysql -N -upostfixadmin -ppostfixadmin postfixadmin" > /etc/prosody/aliases.cfg.lua |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
6 # then put: |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
7 # Include "aliases.cfg.lua" |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
8 # in prosody.cfg.lua |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
9 |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
10 mysql="$1" |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
11 |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
12 echo "-- alias plugin, generated by mod_alias_postfixadmin.sh" |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
13 echo "aliases = {" |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
14 |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
15 echo "SELECT concat('["'"'"', address, '"'"'"] = "'"'"', goto, '"'"'";') FROM alias WHERE address != goto; |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
16 SELECT concat('["'"'"', address, '"'"'"] = "'"'"', goto, '"'"'";') FROM ( |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
17 select replace(address, concat('@', target_domain), concat('@', alias_domain)) as address, goto FROM alias JOIN alias_domain ON alias_domain.target_domain = SUBSTRING(alias.address, locate('@',alias.address) + 1, length(alias.address)) |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
18 ) a WHERE a.address != a.goto;" | $mysql | sort | uniq |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
19 |
0c3ba5ff7a3b
mod_alias: New alias module
moparisthebest <admin@moparisthebest.com>
parents:
diff
changeset
|
20 echo "}" |