Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

add security #19

Draft
wants to merge 12 commits into
base: security
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pegasus-client.iml
log.txt
rolling_log/
.vscode/

.history/
4 changes: 4 additions & 0 deletions configuration/pegasus.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ async_workers = 4
enable_perf_counter = false
perf_counter_tags = cluster=onebox,app=unit_test
push_counter_interval_secs = 10
open_auth = false
jaas_conf = configuration/pegasus_jaas.conf
service_name = xxx
service_fqdn = xxx
10 changes: 10 additions & 0 deletions configuration/pegasus_jaas.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
client {
com.sun.security.auth.module.Krb5LoginModule required
debug=true
useTicketCache=true
useKeyTab=true
keyTab="/etc/xxx.keytab"
renewTGT=true
principal="[email protected]"
storeKey=true;
};
3 changes: 2 additions & 1 deletion idl/recompile_thrift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ rm -rf $TMP_DIR

mkdir -p $TMP_DIR
$thrift --gen java rrdb.thrift
$thrift --gen java replication.thrift
$thrift --gen java replication.thrift
$thrift --gen java security.thrift

# as we pack the thrift source in our project, so we need to replace the package name
find $TMP_DIR -name "*.java" | xargs sed -i -e "s/org.apache.thrift/com.xiaomi.infra.pegasus.thrift/g"
Expand Down
2 changes: 2 additions & 0 deletions idl/replication.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ struct query_cfg_request
2:list<i32> partition_indices;
}

// for server version > 1.11.2, if err == ERR_FORWARD_TO_OTHERS,
// then the forward address will be put in partitions[0].primary if exist.
struct query_cfg_response
{
1:base.error_code err;
Expand Down
55 changes: 55 additions & 0 deletions idl/security.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
include "base.thrift"

namespace cpp dsn.apps
namespace java com.xiaomi.infra.pegasus.apps
namespace py pypegasus.rrdb

// negotiation process:
//
// client server
// | --- SASL_MECH --> |
// | <-- SASL_MECH --- |
// | - SASL_SEL_MECH ->|
// | <- SASL_SEL_OK ---|
// | |
// | --- SASL_INIT --> |
// | |
// | <-- SASL_CHAL --- |
// | --- SASL_RESP --> |
// | |
// | ..... |
// | |
// | <-- SASL_CHAL --- |
// | --- SASL_RESP --> |
// | | (authentication will succeed
// | | if all chanllenges passed)
// | <-- SASL_SUCC --- |
// (client won't response | |
// if servers says ok) | |
// | --- RPC_CALL ---> |
// | <-- RPC_RESP ---- |

enum negotiation_status
{
INVALID = 0,
SASL_LIST_MECHANISMS,
SASL_LIST_MECHANISMS_RESP,
SASL_SELECT_MECHANISMS,
SASL_SELECT_MECHANISMS_OK,
SASL_INITIATE,
SASL_CHALLENGE,
SASL_RESPONSE,
SASL_SUCC,
SASL_AUTH_FAIL
}

struct negotiation_message
{
1: negotiation_status status;
2: base.blob msg;
}

service security
{
negotiation_message negotiate(1:negotiation_message nego_msg);
}
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>1.3.7-1</version>
</dependency>
</dependencies>
<reporting>
<plugins>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/java/com/xiaomi/infra/pegasus/apps/key_value.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/java/com/xiaomi/infra/pegasus/apps/meta.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/java/com/xiaomi/infra/pegasus/apps/mutate.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading