1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
ULib/tests/examples/nocat/bin/get_cn.sh
2015-01-23 17:24:36 +01:00

12 lines
330 B
Bash
Executable File

#!/bin/sh
cn=`awk -F= '/[Ss]ubject[:=]/ {
gsub(" ", "_") ; print "vpn " $NF }' \
/etc/openvpn/client.crt 2> /dev/null`
test "$cn" || cn=`awk -F= '/[Ss]ubject[:=]/ {
gsub(" ", "_") ; print "wiauth " $NF }' \
/etc/wiauthclt/user.crt.pem 2> /dev/null`
echo "cn=$cn"