Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Authen-Krb5/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Authen-Krb5/sample_client
#!/usr/bin/perl

# sample_client
# sends authentication info to a server via sendauth

use blib; # remove if not in module build directory
use IO::Socket;
use Authen::Krb5 (KRB5_NT_SRV_HST);

# replace with your own stuff
$SERVICE = "sample";
$SERVER = "server.domain.edu";

Authen::Krb5::init_context();

$ac = new Authen::Krb5::AuthContext;

$s = new IO::Socket::INET(
	PeerAddr => $SERVER,
	PeerPort => 12345,
	Proto => 'tcp'
);
defined $s or die $!;

$cc = Authen::Krb5::cc_default();

$clientp = Authen::Krb5::parse_name($ENV{'USER'});
$serverp = Authen::Krb5::sname_to_principal($SERVER,$SERVICE,KRB5_NT_SRV_HST);
if (Authen::Krb5::sendauth($ac,$s,"V1",$clientp,$serverp,
	AP_OPTS_MUTUAL_REQUIRED,"test",undef,$cc)) {
	print "Sent authentication info.\n";
}
else {
	print "sendauth error: ",Authen::Krb5::error(),"\n";
}

close($s);

Authen::Krb5::free_context();

Hry