#!/usr/bin/env bash # Copyright (c) 2013, Perforce Software # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #*************************************************** # Sample configuration for using p4auth.sh with mod_authnz_external # # AddExternalAuth p4_auth "/vagrant/p4auth.sh 1666" # SetExternalAuthMethod p4_auth pipe # # <Directory /var/www/> # AuthType Basic # AuthName "Git yo" # AuthBasicProvider external # AuthExternal p4_auth # Require valid-user # </Directory> #*************************************************** # When performing authorization against an SSL-enabled Perforce Server, # uncomment and specify the path to the .p4trust file #export P4TRUST=/var/www/.p4trust # The path to the p4 command line client p4=/usr/local/bin/p4 if [ $# -eq 0 ] then echo "No Perforce connection information supplied."; exit 1 fi read -n1024 login cat /dev/stdin | $p4 -u "$login" -p "$1" login -p > /dev/null 2>&1 exit $?
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 12861 | colin_grant |
Quote passed in login information for better security. @matt_attaway #review Merging //guest/colin_grant/bash-scripts/p4auth.sh to //guest/matt_attaway/bash-scripts/p4auth.sh |
||
#2 | 10192 | colin_grant |
Merging @9609: Modify p4auth.sh to accomodate an SSL-enabled P4D, and a non-standard path to the p4 command line client executable. //guest/colin_grant/bash-scripts/p4auth.sh to //guest/matt_attaway/bash-scripts/p4auth.sh |
||
#1 | 8438 | Matt Attaway |
Add simple bash script to allow Perforce to act as an authenticator for mod_authnz_external. Usage information is in the script. |