20#include "RConfigure.h"
52#if !defined(R__WIN32) && !defined(R__MACOSX) && !defined(R__FBSD) && \
59#if defined(R__LINUX) || defined(R__FBSD) || defined(R__OBSD)
68extern "C" char *
crypt(
const char *,
const char *);
73# include <openssl/bio.h>
74# include <openssl/err.h>
75# include <openssl/pem.h>
76# include <openssl/rand.h>
77# include <openssl/rsa.h>
78# include <openssl/ssl.h>
79# include <openssl/blowfish.h>
93 "Unsupported",
"Unsupported",
"Unsupported" };
139 if (
rs ==
sizeof(
int))
return r;
141 Printf(
"+++ERROR+++ : auth_rand: neither /dev/urandom nor /dev/random are available or readable!");
145 memcpy((
void *)&
t1, (
void *)&
tv.tv_sec,
sizeof(
int));
146 memcpy((
void *)&
t2, (
void *)&
tv.tv_usec,
sizeof(
int));
162 const char *
proto,
const char *user)
182 Info(
"TAuthenticate",
"Enter: local host: %s, user is: %s (proto: %s)",
212 Info(
"TAuthenticate",
213 "service: %s (remote protocol: %d): fVersion: %d",
sproto,
223 if (user &&
strlen(user) > 0) {
248 Info(
"TAuthenticate",
"RSA key: default type %d",
fgRSAKey);
268 Info(
"TAuthenticate",
269 "number of HostAuth Instantiations in memory: %d",
293 tmp.ReplaceAll(
"root",4,
"",0);
294 tmp.ReplaceAll(
"sock",4,
"",0);
333 Info(
"CatchTimeOut",
"%d sec timeout expired (protocol: %s)",
372 alarm->SetInterruptSyscalls();
374 alarm->Connect(
"Timeout()",
"TAuthenticate",
this,
"CatchTimeOut()");
382 Info(
"Authenticate",
"try #: %d",
ntry);
393 "trying authentication: method:%d, default details:%s",
437 Error(
"Authenticate",
438 "unable to get user name for UsrPwd authentication");
458 Info(
"Authenticate",
"remloc: %d, ntry: %d, meth: %d, fSecurity: %d",
484 "negotiation not supported remotely: try next method, if any");
502 "after failed attempt: kind= %d, stat= %d", kind, stat);
519 "strings with accepted methods not received (%d:%d)",
526 "remotely allowed methods not yet tried: %s",
529 }
else if (stat == 0) {
531 "no more methods accepted remotely to be tried");
546 for (i = 0; i <
remMeth; i++) {
563 Warning(
"Authenticate",
"no match with those locally available: %s",
available.c_str());
580 "method not even started: insufficient or wrong info: %s",
581 "try with next method, if any");
598 "status code -2 not expected from old daemons");
610 Info(
"Authenticate",
"got a timeout");
622 Info(
"Authenticate",
"unknown status code: %d - assume failure",
st);
637 Info(
"Authenticate",
"attempted methods %s are not supported"
640 "failure: list of attempted methods: %s",
triedMeth);
664 Info(
"SetEnvironment",
665 "setting environment: fSecurity:%d, fDetails:%s",
fSecurity,
676 char pt[5] = { 0 },
ru[5] = { 0 };
704 if ((
pd =
hours.Index(
":")) > -1) {
722 Info(
"SetEnvironment",
"details:%s, pt:%s, ru:%s, us:%s cp:%s",
728 Info(
"SetEnvironment",
"details:%s, pt:%s, ru:%s, us:%s",
785 Error(
"GetUserPasswd",
"SRP no longer supported by ROOT");
790 Info(
"GetUserPasswd",
"Enter: User: '%s' Hash:%d SRP:%d",
794 if (user ==
"" &&
fgUser !=
"")
805 Info(
"GetUserPasswd",
"In memory: User: '%s' Hash:%d",
815 Info(
"GetUserPasswd",
"In memory: User: '%s' Hash:%d",
821 if (user ==
"" ||
passwd ==
"") {
823 Info(
"GetUserPasswd",
"Checking .netrc family ...");
827 Info(
"GetUserPasswd",
"From .netrc family: User: '%s' Hash:%d",
836 Error(
"GetUserPasswd",
"user name not set");
883 Error(
"CheckNetrc",
"SRP no longer supported by ROOT");
934 href.ReplaceAll(
"*",
".*");
958 "file %s exists but has not 0600 permission",
net);
1016 ::Error(
"Krb5Auth",
"Kerberos5 is no longer supported by ROOT");
1044 ::Error(
"Authenticate::GetAuthMethod",
"idx out of bounds (%d)", idx);
1089 "not tty: cannot prompt for user, returning default");
1099 usr.Remove(
usr.Length() - 1);
1117 ::Warning(
"TAuthenticate::PromptPasswd",
1118 "not tty: cannot prompt for passwd, returning -1");
1119 static char noint[4] = {
"-1"};
1124 const char *
pw = buf;
1129 gROOT->GetPluginManager()->FindHandler(
"TGPasswdDialog"))) {
1133 "could not load plugin for the password dialog box");
1143 while (
gROOT->IsInterrupted())
1155 if (
spw.EndsWith(
"\n"))
1156 spw.Remove(
spw.Length() - 1);
1176 key = (key >= 0 && key <= 1) ? key : 0;
1193 if (key >= 0 && key <= 1)
1233 lasterr =
"(last error only; re-run with gDebug > 0 for more details)";
1242 ::Error(
Form(
"TAuthenticate::%s",
where),
1243 "unknown error code: server must be running a newer ROOT version %s",
1261 if (user && user[0])
1292 ::Error(
"SetGlobalSRPPwd",
"SRP no longer supported by ROOT");
1353 ::Error(
"Krb5Auth",
"Kerberos5 is no longer supported by ROOT");
1362 ::Error(
"GlobusAuth",
"Globus is no longer supported by ROOT");
1370 ::Error(
"SshAuth",
"SSH is no longer supported by ROOT");
1379 ::Error(
"GetSshUser",
"SSH is no longer supported by ROOT");
1426 ::Info(
"TAuthenticate::CheckHost",
"checking host IP: %s",
theHost.Data());
1449 ::Error(
"RfioAuth",
"RfioAuth is no longer supported by ROOT");
1463 Info(
"ClearAuth",
"enter: user: %s (passwd hashed?: %d)",
1475 Info(
"ClearAuth",
"ru:%d pt:%d cp:%d ns:%d rk:%d",
1504 options.
Form(
"%d %ld %s %ld %s", opt,
1526 Info(
"ClearAuth",
"anonymous user");
1535 char ctag[11] = {0};
1543 "problems recvn RSA key flag: got message %d, flag: %d",
1549 Info(
"ClearAuth",
"get key request ...");
1563 Warning(
"ClearAuth",
"problems secure-receiving salt -"
1564 " may result in corrupted salt");
1565 Warning(
"ClearAuth",
"switch off reuse for this session");
1596 Info(
"ClearAuth",
"got salt: '%s' (len: %d)",
salt.Data(),
slen);
1599 Info(
"ClearAuth",
"Salt not required");
1602 Warning(
"ClearAuth",
"problems secure-receiving rndmtag -"
1603 " may result in corrupted rndmtag");
1640 "automatically generated anonymous passwd: %s",
1655 Error(
"ClearAuth",
"password not set");
1698 Warning(
"ClearAuth",
"problems secure-sending pass hash"
1699 " - may result in authentication failure");
1706 for (
int i = 0; i <
passwd.Length(); i++) {
1720 Info(
"ClearAuth",
"after kROOTD_PASS: kind= %d, stat= %d", kind,
1732 "problems recvn (user,offset) length (%d:%d bytes:%d)",
1737 int reclen = (stat+1 > 256) ? 256 : stat+1;
1742 "username and offset not received (%d:%d)", kind,
1751 "received from server: user: %s, offset: %d (%s)",
lUser,
1763 "problems secure-receiving token -"
1764 " may result in corrupted token");
1769 token =
new char[
tlen];
1775 Warning(
"ClearAuth",
"token not received (%d:%d)", kind,
1778 for (
int i = 0; i < (
int)
strlen(token); i++) {
1784 Info(
"ClearAuth",
"received from server: token: '%s' ",
1836 "%s@%s does not accept connections from %s@%s",
1843 "%s@%s does not accept %s authentication from %s@%s",
1860 Error(
"ClearAuth",
"password not set");
1862 if (
fUser ==
"anonymous" ||
fUser ==
"rootd") {
1863 if (!
passwd.Contains(
"@")) {
1865 "please use passwd of form: user@host.do.main");
1876 for (
int i = 0; i <
passwd.Length(); i++) {
1889 Info(
"ClearAuth",
"after kROOTD_PASS: kind= %d, stat= %d", kind,
1917 ::Info(
"TAuthenticate::GetHostAuth",
"enter ... %s ... %s", host, user);
1923 char *ps = (
char *)
strstr(host,
":");
1947 ai->Print(
"Authenticate::GetHostAuth");
1986 ::Info(
"TAuthenticate::HasHostAuth",
"enter ... %s ... %s", host, user);
1992 char *ps = (
char *)
strstr(host,
":");
2029 ::Info(
"TAuthenticate::FileExpand",
"enter ... '%s' ... 0x%zx",
fexp, (
size_t)
ftmp);
2042 ::Info(
"TAuthenticate::FileExpand",
"read line ... '%s'",
line);
2053 ln.ReplaceAll(
"\"",1,
"",0);
2054 ln.ReplaceAll(
"'",1,
"",0);
2061 if (
edir.Contains(
"/")) {
2089 "file specified by 'include' cannot be open or read (%s)",
2104 const char copt[2][5] = {
"no",
"yes" };
2107 ::Info(
"TAuthenticate::GetDefaultDetails",
2108 "enter ... %d ...pt:%d ... '%s'",
sec, opt,
usr);
2124 ::Info(
"TAuthenticate::GetDefaultDetails",
"returning ... %s", temp);
2158 ::Info(
"::Print",
" +--------------------------- BEGIN --------------------------------+");
2159 ::Info(
"::Print",
" + +");
2160 ::Info(
"::Print",
" + List fgAuthInfo has %4d members +",
2162 ::Info(
"::Print",
" + +");
2163 ::Info(
"::Print",
" +------------------------------------------------------------------+");
2168 ai->PrintEstablished();
2170 ::Info(
"::Print",
" +---------------------------- END ---------------------------------+");
2186 Info(
"AuthExists",
"%d: enter: msg: %d options: '%s'",
2187 method,*message, options);
2226 token =
secctx->GetToken();
2229 "found valid TSecContext: offset: %d token: '%s'",
2250 Int_t stat = 1, kind;
2255 Warning(
"AuthExists",
"protocol error: expecting %d got %d"
2261 Info(
"AuthExists",
"offset OK");
2281 Warning(
"AuthExists",
"problems secure-sending token %s",
2282 "- may trigger problems in proofing Id ");
2287 for (
int i = 0; i < token.
Length(); i++) {
2296 Info(
"AuthExists",
"offset not OK - rerun authentication");
2307 Info(
"AuthExists",
"%d: after msg %d: kind= %d, stat= %d",
2308 method,*message, kind, stat);
2319 Error(
"AuthExists",
"%s@%s does not accept connections from %s@%s",
2325 "%s@%s does not accept %s authentication from %s@%s",
2343 Info(
"AuthExists",
"valid authentication exists");
2345 Info(
"AuthExists",
"valid authentication exists: offset changed");
2347 Info(
"AuthExists",
"remote access authorized by /etc/hosts.equiv");
2349 Info(
"AuthExists",
"no authentication required remotely");
2379 const char *
randdev =
"/dev/urandom";
2385 if (read(fd, &seed,
sizeof(seed)) !=
sizeof(seed))
2390 ::Info(
"InitRandom",
"%s not available: using time()",
randdev);
2405 Info(
"GenRSAKeys",
"enter");
2409 Info(
"GenRSAKeys",
"Keys prviously generated - return");
2431 Info(
"GenRSAKeys",
"SSL: Generate Blowfish key");
2501 Info(
"GenRSAKeys",
"equal primes: regenerate (%d times)",
nPrimes);
2509 Info(
"GenRSAKeys",
"local: p1: '%s' ", buf);
2511 Info(
"GenRSAKeys",
"local: p2: '%s' ", buf);
2517 Info(
"GenRSAKeys",
" genrsa: unable to generate keys (%d)",
2534 Info(
"GenRSAKeys",
"local: n: '%s' length: %d",
buf_n,
l_n);
2535 Info(
"GenRSAKeys",
"local: e: '%s' length: %d",
buf_e,
l_e);
2536 Info(
"GenRSAKeys",
"local: d: '%s' length: %d",
buf_d,
l_d);
2552 Info(
"GenRSAKeys",
"local: test string: '%s' ",
test);
2561 "local: length of crypted string: %d bytes",
lout);
2567 Info(
"GenRSAKeys",
"local: after private/public : '%s' ", buf);
2578 Info(
"GenRSAKeys",
"local: length of crypted string: %d bytes ",
2585 Info(
"GenRSAKeys",
"local: after public/private : '%s' ", buf);
2604 Info(
"GenRSAKeys",
"local: generated keys are:");
2605 Info(
"GenRSAKeys",
"local: n: '%s' length: %d",
buf_n,
l_n);
2606 Info(
"GenRSAKeys",
"local: e: '%s' length: %d",
buf_e,
l_e);
2607 Info(
"GenRSAKeys",
"local: d: '%s' length: %d",
buf_d,
l_d);
2648 unsigned int iimx[4][4] = {
2649 {0x0, 0xffffff08, 0xafffffff, 0x2ffffffe},
2650 {0x0, 0x3ff0000, 0x7fffffe, 0x7fffffe},
2651 {0x0, 0x3ff0000, 0x7e, 0x7e},
2652 {0x0, 0x3ffc000, 0x7fffffe, 0x7fffffe}
2655 const char *
cOpt[4] = {
"Any",
"LetNum",
"Hex",
"Crypt" };
2661 Info(
"GetRandString",
"unknown option: %d : assume 0", opt);
2664 Info(
"GetRandString",
"enter ... len: %d %s",
len,
cOpt[opt]);
2667 char *buf =
new char[
len + 1];
2677 for (
m = 7;
m < 32;
m += 7) {
2678 i = 0x7F & (
frnd >>
m);
2681 if ((
iimx[opt][
j] & (1 <<
l))) {
2693 Info(
"GetRandString",
"got '%s' ", buf);
2705 Int_t key,
const char *str)
2711 ::Info(
"TAuthenticate::SecureSend",
"local: enter ... (enc: %d)",
enc);
2728 }
else if (key == 1) {
2734 unsigned char iv[8];
2740 ::Info(
"TAuthenticate::SecureSend",
"not compiled with SSL support:"
2741 " you should not have got here!");
2745 ::Info(
"TAuthenticate::SecureSend",
"unknown key type (%d)",key);
2754 ::Info(
"TAuthenticate::SecureSend",
2755 "local: sent %d bytes (expected: %d)",
nsen,
ttmp);
2777 if (sock->
Recv(buflen, 20, kind) < 0)
2781 ::Info(
"TAuthenticate::SecureRecv",
"got len '%s' %d (msg kind: %d)",
2804 if (*str ==
nullptr) {
2806 ::Info(
"TAuthenticate::SecureRecv",
"Memory allocation error size (%ld)", (
long)
strSize);
2811 }
else if (key == 1) {
2813 unsigned char iv[8];
2815 *str =
new char[
nrec + 1];
2818 (*str)[
nrec] =
'\0';
2821 ::Info(
"TAuthenticate::SecureRecv",
"not compiled with SSL support:"
2822 " you should not have got here!");
2826 ::Info(
"TAuthenticate::SecureRecv",
"unknown key type (%d)",key);
2845 ::Info(
"TAuthenticate::DecodeRSAPublic",
2851 ::Info(
"TAuthenticate::DecodeRSAPublic",
2864 while (str[k] == 32) k++;
2866 if (str[k] ==
'#') {
2880 ::Info(
"TAuthenticate::DecodeRSAPublic",
2887 ::Info(
"TAuthenticate::DecodeRSAPublic",
2897 ::Info(
"TAuthenticate::DecodeRSAPublic",
"bad format for input string");
2914 ::Info(
"TAuthenticate::DecodeRSAPublic",
2915 "unable to read pub key from bio");
2920 ::Info(
"TAuthenticate::DecodeRSAPublic",
2921 "no space allocated for output variable");
2928 ::Info(
"TAuthenticate::DecodeRSAPublic",
"not compiled with SSL support:"
2929 " you should not have got here!");
2944 ::Info(
"TAuthenticate::SetRSAPublic",
2987 ::Info(
"TAuthenticate::SetRSAPublic",
" Key type: %d",
rsakey);
3005 ::Info(
"TAuthenticate::SetRSAPublic",
3006 "not compiled with SSL support:"
3007 " you should not have got here!");
3027 ::Info(
"TAuthenticate::SendRSAPublicKey",
3048 char buflen[20] = {0};
3055 }
else if (key == 1) {
3069 ::Info(
"TAuthenticate::SendRSAPublicKey",
"SSL: error: '%s' ",
errstr);
3079 ::Info(
"TAuthenticate::SendRSAPublicKey",
"not compiled with SSL support:"
3080 " you should not have got here!");
3085 ::Info(
"TAuthenticate::SendRSAPublicKey",
"unknown key type (%d)",key);
3099 ::Info(
"TAuthenticate::SendRSAPublicKey",
3100 "local: sent %d bytes (expected: %d)",
nsen,
ttmp);
3126 ::Info(
"TAuthenticate::ReadRootAuthrc",
"Checking file: %s",
tRootAuthrc.Data());
3129 ::Info(
"TAuthenticate::ReadRootAuthrc",
3134 ::Info(
"TAuthenticate::ReadRootAuthrc",
"Checking system file: %s",
tRootAuthrc.Data());
3137 ::Info(
"TAuthenticate::ReadRootAuthrc",
3149 ::Info(
"TAuthenticate::ReadRootAuthrc",
3167 ::Info(
"TAuthenticate::ReadRootAuthrc",
"got tmp file: %s open at 0x%zx",
3183 ::Info(
"TAuthenticate::ReadRootAuthrc",
3210 ::Error(
"TAuthenticate::ReadRootAuthrc",
3211 "could not allocate temporary buffer");
3251 if (host ==
ha->GetHost() && user ==
ha->GetUser() &&
3271 ::Info(
"TAuthenticate::ReadRootAuthrc",
3272 "unrecognized method (%s): ",
mth);
3292 ::Info(
"TAuthenticate::ReadRootAuthrc",
3293 "unrecognized method (%s): ",
mth);
3298 const char *
det = 0;
3303 if (
ha->HasMethod(
met))
3358 if (!
ha->IsActive()) {
3368 if (
hanew->NumMethods()) {
3377 hanew->DeActivate();
3384 hanew->DeActivate();
3390 if (!
hanew->IsActive()) {
3409 TIter next(
ha->Established());
3413 ha->Established()->Remove(ctx);
const Int_t kAUTH_SSALT_MSK
const Int_t kAUTH_CRYPT_MSK
const Int_t kAUTH_REUSE_MSK
const Int_t kAUTH_RSATY_MSK
R__EXTERN const char * gRootdErrStr[]
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
const char Option_t
Option string (const char)
TVirtualMutex * gAuthenticateMutex
Int_t StdCheckSecCtx(const char *, TRootSecContext *)
Standard version of CheckSecCtx to be passed to TAuthenticate::AuthExists Check if User is matches th...
R__rsa_KEY_export R__fgRSAPubExport[2]
static int auth_rand()
rand() implementation using /udev/random or /dev/random, if available
R__EXTERN TVirtualMutex * gAuthenticateMutex
Int_t(* Krb5Auth_t)(TAuthenticate *auth, TString &user, TString &det, Int_t version)
Int_t(* SecureAuth_t)(TAuthenticate *auth, const char *user, const char *passwd, const char *remote, TString &det, Int_t version)
Int_t(* GlobusAuth_t)(TAuthenticate *auth, TString &user, TString &det)
Int_t(* CheckSecCtx_t)(const char *subj, TRootSecContext *ctx)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Int_t gDebug
Global variable setting the debug level. Set to 0 to disable, increase it in steps of 1 to increase t...
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
char * StrDup(const char *str)
Duplicate the string str.
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD2(mutex)
static void RemoveHostAuth(THostAuth *ha, Option_t *opt="")
Remove THostAuth instance from the list.
static Int_t SetRSAPublic(const char *rsapubexport, Int_t klen)
Store RSA public keys from export string rsaPubExport.
static TPluginHandler * fgPasswdDialog
static void SetGlobalSRPPwd(Bool_t srppwd)
Set global SRP passwd flag to be used for authentication to rootd.
static Bool_t fgPromptUser
TRootSecContext * fSecContext
static void FileExpand(const char *fin, FILE *ftmp)
Expands include directives found in fexp files The expanded, temporary file, is pointed to by 'ftmp' ...
static const char * GetGlobalUser()
Static method returning the global user.
static void SetGlobalUser(const char *user)
Set global user name to be used for authentication to rootd.
static void SetPromptUser(Bool_t promptuser)
Set global PromptUser flag.
Int_t RfioAuth(TString &user)
RFIO authentication (no longer supported)
static void Show(Option_t *opt="S")
Print info about the authentication sector.
const char * GetSshUser(TString user) const
Method returning the user to be used for the ssh login (no longer supported)
static const char * GetDefaultUser()
Static method returning the default user information.
static Bool_t GetPromptUser()
Static method returning the prompt user settings.
static Int_t SecureRecv(TSocket *Socket, Int_t dec, Int_t KeyType, char **Out)
Receive str from sock and decode it using key indicated by key type Return number of received bytes o...
static const char * GetKrb5Principal()
Static method returning the principal to be used to init Krb5 tickets.
THostAuth * GetHostAuth() const
static void SetAuthReUse(Bool_t authreuse)
Set global AuthReUse flag.
static R__rsa_KEY_export * fgRSAPubExport
char * GetRandString(Int_t Opt, Int_t Len)
Allocates and fills a 0 terminated buffer of length len+1 with len random characters.
Int_t SshAuth(TString &user)
SSH client authentication code (no longer supported)
static char * PromptPasswd(const char *prompt="Password: ")
Static method to prompt for the user's passwd to be used for authentication to rootd.
static void SetDefaultUser(const char *defaultuser)
Set default user name.
static void SetGlobalPwHash(Bool_t pwhash)
Set global passwd hash flag to be used for authentication to rootd.
static void SetGlobalExpDate(TDatime expdate)
Set default expiring date for new validity contexts.
static Int_t GetRSAInit()
Static method returning the RSA initialization flag.
static void SetSecureAuthHook(SecureAuth_t func)
Set secure authorization function.
static Int_t GetClientProtocol()
Static method returning supported client protocol.
static Int_t ReadRootAuthrc()
Read authentication directives from $ROOTAUTHRC, $HOME/.rootauthrc or <Root_etc_dir>/system....
static Bool_t fgReadHomeAuthrc
static Int_t SecureSend(TSocket *Socket, Int_t enc, Int_t KeyType, const char *In)
Encode null terminated str using the session private key indicated by enc and sends it over the netwo...
Int_t GenRSAKeys()
Generate a valid pair of private/public RSA keys to protect for authentication token exchange.
Bool_t CheckNetrc(TString &user, TString &passwd)
Try to get user name and passwd from the ~/.rootnetrc or ~/.netrc files.
static const char * GetRSAPubExport(Int_t key=0)
Static method returning the RSA public keys.
static void InitRandom()
Initialize random machine using seed from /dev/urandom (or current time if /dev/urandom not available...
static R__rsa_KEY fgRSAPubKey
static Bool_t fgAuthReUse
static Bool_t GetGlobalPwHash()
Static method returning the global password hash flag.
static void SetKrb5AuthHook(Krb5Auth_t func)
Set kerberos5 authorization function.
static void SetGlobusAuthHook(GlobusAuth_t func)
Set Globus authorization function.
static void SetRSAInit(Int_t init=1)
Static method setting RSA initialization flag.
static void SetGlobalPasswd(const char *passwd)
Set global passwd to be used for authentication to rootd.
void SetEnvironment()
Set default authentication environment.
static Int_t SendRSAPublicKey(TSocket *Socket, Int_t key=0)
Receives server RSA Public key Sends local RSA public key encoded.
static TDatime fgLastAuthrc
static TList * fgAuthInfo
static TString fgAuthMeth[kMAXSEC]
void CatchTimeOut()
Called in connection with a timer timeout.
Bool_t GetUserPasswd(TString &user, TString &passwd, Bool_t &pwhash, Bool_t srppwd)
Try to get user name and passwd from several sources.
Bool_t Authenticate()
Authenticate to remote rootd server.
static R__rsa_KEY fgRSAPriKey
static TString fgRootAuthrc
Int_t AuthExists(TString User, Int_t method, const char *Options, Int_t *Message, Int_t *Rflag, CheckSecCtx_t funcheck)
Check if we have a valid established sec context in memory Retrieves relevant info and negotiates wit...
static TList * GetAuthInfo()
Static method returning the list with authentication details.
static GlobusAuth_t GetGlobusAuthHook()
Static method returning the globus authorization hook (no longer supported)
Int_t ClearAuth(TString &user, TString &passwd, Bool_t &pwhash)
UsrPwd client authentication code.
static void AuthError(const char *where, Int_t error)
Print error string depending on error code.
static char * GetDefaultDetails(Int_t method, Int_t opt, const char *user)
Determine default authentication details for method 'sec' and user 'usr'.
static void MergeHostAuthList(TList *Std, TList *New, Option_t *Opt="")
Tool for updating fgAuthInfo 'nin' contains list of last input information through (re)reading of a r...
static TString fgDefaultUser
static Int_t GetAuthMethodIdx(const char *meth)
Static method returning the method index (which can be used to find the method in GetAuthMethod()).
static Int_t DecodeRSAPublic(const char *rsapubexport, R__rsa_NUMBER &n, R__rsa_NUMBER &d, char **rsassl=nullptr)
Store RSA public keys from export string rsaPubExport.
static void SetTimeOut(Int_t to)
Set timeout (active if > 0)
static Bool_t fgUsrPwdCrypt
TAuthenticate(TSocket *sock, const char *remote, const char *proto, const char *user="")
Create authentication object.
static void RemoveSecContext(TRootSecContext *ctx)
Tool for removing SecContext ctx from THostAuth listed in fgAuthInfo.
static TDatime GetGlobalExpDate()
Static method returning default expiring date for new validity contexts.
static Bool_t GetGlobalSRPPwd()
Static method returning the global SRP password flag.
static SecureAuth_t fgSecAuthHook
static char * PromptUser(const char *remote)
Static method to prompt for the user name to be used for authentication to rootd.
static Bool_t CheckHost(const char *Host, const char *host)
Check if 'host' matches 'href': this means either equal or "containing" it, even with wild cards * in...
static void SetDefaultRSAKeyType(Int_t key)
Static method setting the default type of RSA key.
static const char * GetAuthMethod(Int_t idx)
Static method returning the method corresponding to idx.
static Bool_t GetAuthReUse()
Static method returning the authentication reuse settings.
static THostAuth * HasHostAuth(const char *host, const char *user, Option_t *opt="R")
Checks if a THostAuth with exact match for {host,user} exists in the fgAuthInfo list Returns pointer ...
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
TRootSecContext * CreateSecContext(const char *user, const char *host, Int_t meth, Int_t offset, const char *details, const char *token, TDatime expdate=kROOTTZERO, void *ctx=nullptr, Int_t key=-1)
Create a Security context and add it to local list Return pointer to it to be stored in TAuthenticate...
const char * GetHost() const
void SetUser(const char *user)
void SetHost(const char *host)
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
void SetServer(Int_t server)
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
void CountFailure(Int_t level)
Count failures for 'method'.
void AddFirst(Int_t level, const char *details=nullptr)
Add new method in first position If already in the list, set as first method 'level' with authenticat...
Int_t GetMethod(Int_t idx) const
Bool_t HasMethod(Int_t level, Int_t *pos=nullptr)
Return kTRUE if method 'level' is in the list.
TList * Established() const
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
void CountSuccess(Int_t level)
Count successes for 'method'.
This class represents an Internet Protocol (IP) address.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
static RSA_encode_t RSA_encode()
static RSA_genprim_t RSA_genprim()
static RSA_assign_t RSA_assign()
static RSA_cmp_t RSA_cmp()
static RSA_decode_t RSA_decode()
static RSA_genrsa_t RSA_genrsa()
static RSA_num_sput_t RSA_num_sput()
static RSA_num_sget_t RSA_num_sget()
Regular expression class.
void Print(Option_t *option="F") const override
If opt is "F" (default) print object content.
Bool_t IsActive() const
Check remote OffSet and expiring Date.
const char * GetID() const
void AddForCleanup(Int_t port, Int_t proto, Int_t type)
Create a new TSecContextCleanup Internally is added to the list.
const char * GetUser() const
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
static Int_t GetClientProtocol()
Static method returning supported client protocol.
Int_t GetRemoteProtocol() const
virtual void Close(Option_t *opt="")
Close the socket.
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
Int_t GetServType() const
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual int GetPid()
Get process id.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void DispatchOneEvent(Bool_t pendingOnly=kFALSE)
Dispatch a single event.
virtual const char * HostName()
Return the system's host name.
virtual Int_t GetEffectiveUid()
Returns the effective user id.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
Handles synchronous and a-synchronous timer events.
This class implements a mutex interface.
void inv(rsa_NUMBER *, rsa_NUMBER *, rsa_NUMBER *)