Package com.mapr.security
Class Security
- java.lang.Object
-
- com.mapr.security.Security
-
public class Security extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static longMAX_EXPIRY_TIME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidBlacklistAndCloseConnections(int[] uids, long[] blacklistTimes, boolean reinitList)static java.lang.StringByteArrayToString(java.lang.String preFix, byte[] bArray)static voidCloneAndGenerateTicketFile(java.io.DataInputStream fsin, long expiration, java.io.DataOutputStream outTicket)Given an input stream for ticket file, clone the current cluster ticket with given expiration.static byte[]DecodeDataFromKeyFile(byte[] encodedData, MutableInt erri)static byte[]Decrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri)static com.mapr.fs.proto.Security.TicketDecryptTicket(byte[] encryptedTicket, MutableInt erri)static booleandoesDareKeyExist()static byte[]EncodeDataForWritingToKeyFile(byte[] serializedProtobuf, MutableInt erri)static byte[]Encrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri)static voidGenerateAndWriteTicketAndKey(java.lang.String userName, long expiration, java.io.DataOutputStream outTicket)Used by JT to generate a ticket for user for a specific jobstatic com.mapr.fs.proto.Security.KeyGenerateRandomKey()static com.mapr.fs.proto.Security.TicketAndKeyGenerateTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, TicketOptionalParams tOptionalParams, MutableInt erri)static com.mapr.fs.proto.Security.TicketAndKeyGenerateTicketAndKeyUsingServerKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key, java.lang.String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, boolean isExternal, MutableInt erri)static com.mapr.fs.proto.Security.KeygetCLDBKeyFromHSM(MutableInt erri)static com.mapr.fs.proto.Security.KeyGetClusterKey(com.mapr.fs.proto.Security.Key CldbKey, long time)static com.mapr.fs.proto.Security.KeyGetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, MutableInt erri)static com.mapr.fs.proto.Security.KeyGetServerKey(com.mapr.fs.proto.Security.Key CldbKey, long time)static com.mapr.fs.proto.Security.TicketAndKeyGetTicketAndKeyForCluster(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String clusterName, MutableInt erri)static booleanisHSMFeatureEnabled()static booleanIsTicketAndKeyUsable(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey)static voidmain(java.lang.String[] args)static voidMergeAndGenerateTicketFile(java.io.DataInputStream fsin, java.lang.String userName, long expiration, java.io.DataOutputStream outTicket)static voidRemoveFromBlacklist(int[] uids)static com.mapr.fs.proto.Security.TicketAndKeyRenewTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long expiryTime, MutableInt erri)static intSetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key)static intSetKeyFile(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String path)static intSetTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String clusterName, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey)static intSetTicketAndKeyFile(java.lang.String path)static voidTestSecurity()static java.lang.StringTicketAndKeyToString(java.lang.String prefix, com.mapr.fs.proto.Security.TicketAndKey t)static java.lang.StringTicketToString(java.lang.String prefix, com.mapr.fs.proto.Security.Ticket t)static voidUseClusterTicketAsServerTicket()static java.lang.StringUserCredsToString(java.lang.String prefix, com.mapr.fs.proto.Security.CredentialsMsg c)static com.mapr.fs.proto.Security.TicketValidateTicketAndKey(com.mapr.fs.proto.Security.TicketAndKey t, MutableInt err)
-
-
-
Method Detail
-
GenerateRandomKey
public static com.mapr.fs.proto.Security.Key GenerateRandomKey()
-
Encrypt
public static byte[] Encrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri)
-
Decrypt
public static byte[] Decrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri)
-
EncodeDataForWritingToKeyFile
public static byte[] EncodeDataForWritingToKeyFile(byte[] serializedProtobuf, MutableInt erri)
-
DecodeDataFromKeyFile
public static byte[] DecodeDataFromKeyFile(byte[] encodedData, MutableInt erri)
-
isHSMFeatureEnabled
public static boolean isHSMFeatureEnabled()
-
doesDareKeyExist
public static boolean doesDareKeyExist()
-
getCLDBKeyFromHSM
public static com.mapr.fs.proto.Security.Key getCLDBKeyFromHSM(MutableInt erri)
-
SetKeyFile
public static int SetKeyFile(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String path)
-
SetKey
public static int SetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key)
-
GetKey
public static com.mapr.fs.proto.Security.Key GetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, MutableInt erri)
-
GenerateTicketAndKey
public static com.mapr.fs.proto.Security.TicketAndKey GenerateTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, TicketOptionalParams tOptionalParams, MutableInt erri)
-
GenerateAndWriteTicketAndKey
public static void GenerateAndWriteTicketAndKey(java.lang.String userName, long expiration, java.io.DataOutputStream outTicket) throws java.io.IOExceptionUsed by JT to generate a ticket for user for a specific job- Parameters:
userName-expiration- - will be configurable on JToutTicket- - DataOutputStream where ticket will be written- Throws:
java.io.IOException
-
CloneAndGenerateTicketFile
public static void CloneAndGenerateTicketFile(java.io.DataInputStream fsin, long expiration, java.io.DataOutputStream outTicket) throws java.io.IOExceptionGiven an input stream for ticket file, clone the current cluster ticket with given expiration. It generates a non-renewable ticket. Parameters that will be cloned are uid, gids, canImpersonate- Parameters:
fsin- - DataInputStream for input ticketexpiration- - expiration of the cloned ticket.outTicket- - DataOutputStream where ticket will be written- Throws:
java.io.IOException- where input ticket cannot be parsed for current cluster.
-
MergeAndGenerateTicketFile
public static void MergeAndGenerateTicketFile(java.io.DataInputStream fsin, java.lang.String userName, long expiration, java.io.DataOutputStream outTicket) throws java.io.IOException- Throws:
java.io.IOException
-
GenerateTicketAndKeyUsingServerKey
public static com.mapr.fs.proto.Security.TicketAndKey GenerateTicketAndKeyUsingServerKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key, java.lang.String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, boolean isExternal, MutableInt erri)
-
RenewTicketAndKey
public static com.mapr.fs.proto.Security.TicketAndKey RenewTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long expiryTime, MutableInt erri)
-
DecryptTicket
public static com.mapr.fs.proto.Security.Ticket DecryptTicket(byte[] encryptedTicket, MutableInt erri)
-
SetTicketAndKeyFile
public static int SetTicketAndKeyFile(java.lang.String path)
-
SetTicketAndKey
public static int SetTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String clusterName, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey)
-
UseClusterTicketAsServerTicket
public static void UseClusterTicketAsServerTicket()
-
GetTicketAndKeyForCluster
public static com.mapr.fs.proto.Security.TicketAndKey GetTicketAndKeyForCluster(com.mapr.fs.proto.Security.ServerKeyType keyType, java.lang.String clusterName, MutableInt erri)
-
GetServerKey
public static com.mapr.fs.proto.Security.Key GetServerKey(com.mapr.fs.proto.Security.Key CldbKey, long time)
-
GetClusterKey
public static com.mapr.fs.proto.Security.Key GetClusterKey(com.mapr.fs.proto.Security.Key CldbKey, long time)
-
ByteArrayToString
public static java.lang.String ByteArrayToString(java.lang.String preFix, byte[] bArray)
-
UserCredsToString
public static java.lang.String UserCredsToString(java.lang.String prefix, com.mapr.fs.proto.Security.CredentialsMsg c)
-
TicketAndKeyToString
public static java.lang.String TicketAndKeyToString(java.lang.String prefix, com.mapr.fs.proto.Security.TicketAndKey t)
-
TicketToString
public static java.lang.String TicketToString(java.lang.String prefix, com.mapr.fs.proto.Security.Ticket t)
-
ValidateTicketAndKey
public static com.mapr.fs.proto.Security.Ticket ValidateTicketAndKey(com.mapr.fs.proto.Security.TicketAndKey t, MutableInt err)
-
IsTicketAndKeyUsable
public static boolean IsTicketAndKeyUsable(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey)
-
BlacklistAndCloseConnections
public static void BlacklistAndCloseConnections(int[] uids, long[] blacklistTimes, boolean reinitList)
-
RemoveFromBlacklist
public static void RemoveFromBlacklist(int[] uids)
-
TestSecurity
public static void TestSecurity()
-
main
public static void main(java.lang.String[] args)
-
-