Konica User Authentication Scripting

jmoran225
New Contributor

I have a script that I have set up that installs a specific Konica copier for our faculty and sets the proper page handling settings for them. The problem that I am running into is that many of these faculty need to authenticate in order to print.

I have looked through the options available to me through lpoptions, but there is nothing that seems to dictate a user's copy code or even the department under which they are printing.

Does anybody know where Konica stores these settings inside MacOS? This is the last piece that I have to put together in order to finish the printer scripting that I am doing. Thanks in advance for the assistance.

1 REPLY 1

Asnyder
Contributor III

This is what my postinstall script looked like before we swtiched to papercut. Hopefully it can provide some guidance:

#!/bin/sh
## postinstall

pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
# Holy Variables


printer="554e"
printerdomain="554e"
domain="jp.konicaminolta.printers"
path="/Library/Printers/KONICAMINOLTA/Preferences"
plist="${path}/${domain}.${printerdomain}.plist"
printerip="x.x.x.x"
printername="x"
ppdpath="/Library/Printers/PPDs/Contents/Resources/"
ppdname="KONICAMINOLTA${printer}.gz"
ppd="${ppdpath}${ppdname}"
PaperSources="PC410"
Finisher="FS534_ZeusX"
Punch="PK520-23_ZeusX"
aeskey=""
# this turns popup authentication on or off
auth="False"

lpadmin -p ${printername} -E -v lpd://${printerip} -L ${printername} -P ${ppd} -o printer-is-shared=false -o PaperSources=${PaperSources} -o Finisher=${Finisher} -o KMPunchUnit=${Punch} -o PublicUserAccess=True -o KMDuplex=Single -o KMSection=True
# If Plist Already exists then write the plist to this printer in a temporary
# location
if [ -f $plist ]; then
    defaults read $plist $printer
    if [ $? = 0 ]; then ## IF the printer model is in the plist
    cat << EOT > /Users/Shared/${domain}.${printerdomain}.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>${printername}</key>
        <dict>
            <key>CertSimpleAuthReq</key>
            <string>False</string>
            <key>CustomAESEnable</key>
            <string>False</string>
            <key>CustomAESKeyInfo</key>
            <string>${aeskey}</string>
            <key>NameServerEnable</key>
            <string>None</string>
            <key>PopupAccountTrack</key>
            <string>${auth}</string>
            <key>PopupAuthentication</key>
            <string>False</string>
            <key>PopupSecureMode</key>
            <string>ID</string>
            <key>PopupSecurePrint</key>
            <string>False</string>
            <key>com.apple.print.ticket.type</key>
            <string>com.apple.print.PrintSettingsTicket</string>
        </dict>
    </dict>
    </plist>
EOT
    /usr/libexec/PlistBuddy -x -c "Merge /Users/Shared/${domain}.${printerdomain}.plist ${printer}" $plist
else # If the printer is not in the plist use this
        cat << EOF > /Users/Shared/${domain}.${printerdomain}.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>${printer}</key>
        <dict>
            <key>${printername}</key>
            <dict>
                <key>CertSimpleAuthReq</key>
                <string>False</string>
                <key>CustomAESEnable</key>
                <string>False</string>
                <key>CustomAESKeyInfo</key>
                <string>${aeskey}</string>
                <key>NameServerEnable</key>
                <string>None</string>
                <key>PopupAccountTrack</key>
                <string>${auth}</string>
                <key>PopupAuthentication</key>
                <string>False</string>
                <key>PopupSecureMode</key>
                <string>ID</string>
                <key>PopupSecurePrint</key>
                <string>False</string>
                <key>com.apple.print.ticket.type</key>
                <string>com.apple.print.PrintSettingsTicket</string>
                </dict>
            </dict>
        </dict>
        </plist>
EOF
    /usr/libexec/PlistBuddy -x -c "Merge /Users/Shared/${domain}.${printerdomain}.plist" ${plist}
    fi
# Remove Temporary Plist
sudo rm -rf "/Users/Shared/${domain}.${printerdomain}.plist"
# If Plist DOES NOT already exist we will create it
# Check to see if there are different printer models. If so we need to format the plist differently

else    cat << EOF > ${plist}
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>${printer}</key>
        <dict>
            <key>${printername}</key>
            <dict>
                <key>CertSimpleAuthReq</key>
                <string>False</string>
                <key>CustomAESEnable</key>
                <string>False</string>
                <key>CustomAESKeyInfo</key>
                <string>${aeskey}</string>
                <key>NameServerEnable</key>
                <string>None</string>
                <key>PopupAccountTrack</key>
                <string>${auth}</string>
                <key>PopupAuthentication</key>
                <string>False</string>
                <key>PopupSecureMode</key>
                <string>ID</string>
                <key>PopupSecurePrint</key>
                <string>False</string>
                <key>com.apple.print.ticket.type</key>
                <string>com.apple.print.PrintSettingsTicket</string>
                </dict>
            </dict>
        </dict>
        </plist>
EOF
fi
# Set owner and permissions on the plist
sudo chown root:wheel ${plist}
sudo chmod 644 ${plist}
exit 0      ## Success