github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/docs/source/sysadmin_guide/configuring_permissions.rst (about) 1 *********************** 2 Configuring Permissions 3 *********************** 4 5 Transactor Permissioning 6 ======================== 7 8 Overview 9 -------- 10 11 A running protected network needs a mechanism for limiting which transactors 12 are allowed to submit batches and transactions to the validators. There are 13 two different methods for defining the transactors a validator will accept. 14 15 The first method is configuring a validator to only accept batches and 16 transactions from predefined transactors that are loaded from a local validator 17 config file. Once the validator is configured the list of allowed transactors 18 is immutable while the validator is running. This set of permissions are only 19 enforced when receiving a batch from a connected client, but not when receiving 20 a batch from a peer on the network. 21 22 The second method uses the identity namespace which will allow for network-wide 23 updates and agreement on allowed transactors. The allowed transactors are 24 checked when a batch is received from a client, received from a peer, and 25 when a block is validated. 26 27 When using both on-chain and off-chain configuration, the validator only 28 accepts transactions and batches from a client if both configurations agree it 29 should be accepted. If a batch is received from a peer, only on-chain 30 configuration is checked. 31 32 It is possible that in the time that the batch has been in the pending queue, 33 the transactor permissions have been updated to no longer allow a batch signer 34 or a transaction signer that is being included in a block. For this reason, the 35 allowed transactor roles will also need to be checked on block validation. 36 37 .. _Off-Chain_Transactor_Permissioning: 38 39 Off-Chain Transactor Permissioning 40 ---------------------------------- 41 Validators can be locally configured by creating a validator.toml file and 42 placing it in the config directory. Adding configuration for transactor 43 permissioning to the configuration shall be done in the following format: 44 45 validator.toml: 46 47 .. code-block:: none 48 49 [permissions] 50 51 ROLE = POLICY_NAME 52 53 Where ROLE is one of the roles defined below for transactor permissioning and 54 equals the filename for a policy. Multiple roles may be defined in the same 55 format within the config file. 56 57 The policies are stored in the policy_dir defined by the path config. Each 58 policy will be made up of permit and deny rules, similar to policies defined in 59 the Identity Namespace. Each line will contain either a “PERMIT_KEY” or 60 “DENY_KEY” and should be followed with either a public key for an allowed 61 transactor or an * to allow all possible transactors. The rules will be 62 evaluated in order. 63 64 Policy file: 65 66 .. code-block:: none 67 68 PERMIT_KEY <key> 69 DENY_KEY <key> 70 71 72 On-Chain Transactor Permissioning 73 --------------------------------- 74 The Identity Namespace stores roles as key-value pairs, where the key is a role 75 name and the value is a policy. All roles that limit who is allowed to sign 76 transactions and batches should start with transactor as a prefix. 77 78 .. code-block:: none 79 80 transactor.SUB_ROLE = POLICY_NAME 81 82 SUB_ROLEs are more specific signing roles, for example who is allowed to sign 83 transactions. Each role equals a policy name that corresponds to a policy 84 stored in state. The policy contains a list of public keys that correspond 85 to the identity signing key of the transactors. 86 87 To configure on-chain roles, the signer of identity transactions needs to have 88 their public key set in the Setting "sawtooth.identity.allowed_keys". Only 89 those transactors whose public keys are in that setting are allowed to update 90 roles and policies. 91 92 .. code-block:: console 93 94 $ sawset proposal create sawtooth.identity.allowed_keys=02b2be336a6ada8f96881cd55fd848c10386d99d0a05e1778d2fc1c60c2783c2f4 95 96 Once your signer key is stored in the setting, the ``identity-tp`` command can be used 97 to set and update roles and policies. Make sure that the Identity transaction 98 processor and the REST API are running. 99 100 .. literalinclude:: ../cli/output/sawtooth_identity_policy_create_usage.out 101 :language: console 102 103 .. literalinclude:: ../cli/output/sawtooth_identity_role_create_usage.out 104 :language: console 105 106 For example, running the following will create a policy that permits all 107 and is named policy_1: 108 109 .. code-block:: console 110 111 $ sawtooth identity policy create policy_1 "PERMIT_KEY *" 112 113 To see the policy in state, run the following command: 114 115 .. code-block:: console 116 117 $ sawtooth identity policy list 118 policy_1: 119 Entries: 120 PERMIT_KEY * 121 122 Finally, run the following command to set the role for transactor to permit all: 123 124 .. code-block:: console 125 126 $ sawtooth identity role create transactor policy_1 127 128 To see the role in state, run the following command: 129 130 .. code-block:: console 131 132 $ sawtooth identity role list 133 transactor: policy_1 134 135 Transactor Roles 136 ---------------- 137 The following are the identity roles that are used to control which transactors 138 are allowed to sign transactions and batches on the system. 139 140 default: 141 When evaluating role permissions, if the role has not been set, the default 142 policy will be used. The policy can be changed to meet the network's 143 requirements after initial start-up by submitting a new policy with the name 144 default. If the default policy has not been explicitly set, the default 145 is “PERMIT_KEY \*”. 146 147 transactor: 148 The top level role for controlling who can sign transactions and batches on 149 the system will be transactor. This role shall be used when the allowed 150 transactors for transactions and batches are the same. Any transactor whose 151 public key is in the policy will be allowed to sign transactions and batches, 152 unless a more specific sub-role disallows their public key. 153 154 transactor.transaction_signer: 155 If a transaction is received that is signed by a transactor who is not 156 permitted by the policy, the batch containing the transaction will be dropped. 157 158 transactor.transaction_signer.{tp_name}: 159 If a transaction is received for a specific transaction family that is signed 160 by a transactor who is not permitted by the policy, the batch containing the 161 transaction will be dropped. 162 163 transactor.batch_signer: 164 If a batch is received that is signed by a transactor who is not permitted by 165 the policy, that batch will be dropped. 166 167 Validator Key Permissioning 168 =========================== 169 170 Overview 171 -------- 172 173 One of the permissioning requirements is that the validator network be able to 174 limit the nodes that are able to connect to it. The permissioning rules 175 determine the roles a connection is able to play on the network. The roles 176 control the types of messages that can be sent and received over a given 177 connection. The entities acting in the different roles will be referred to as 178 requesters below. 179 180 Validators are able to determine whether messages delivered to them should 181 be handled or dropped based on a set of role and identities stored within the 182 Identity namespace. Each requester will be identified by the public key derived 183 from their identity signing key. Permission verifiers examine incoming 184 messages against the policy and the current configuration and either permit, 185 drop, or respond with an error. In certain cases, the connection will be 186 forcibly closed -- for example: if a node is not allowed to connect to the 187 validator network. 188 189 This on-chain approach allows the whole network to change its policies at the 190 same time while the network is live, instead of relying on a startup 191 configuration. 192 193 Configuring Authorization 194 ------------------------- 195 The Identity namespace stores roles as key-value pairs, where the key is a role 196 name and the value is a policy. Validator network permissioning roles use 197 the following pattern: 198 199 .. code-block:: none 200 201 network[.SUB_ROLE] = POLICY_NAME 202 203 where network is the name of the role to be used for validator network 204 permissioning. POLICY_NAME refers to the name of a policy that is set in the 205 Identity namespace. The policy defines the public keys that are allowed to 206 participate in that role. The policy is made up of PERMIT_KEY and DENY_KEY 207 rules and is evaluated in order. If the public key is denied, the connection 208 will be rejected. For more information, please look at the 209 :doc:`Identity Transaction Family <../transaction_family_specifications/identity_transaction_family>`. 210 211 Like above, run the following command to set the role for network to permit all: 212 213 .. code-block:: console 214 215 $ sawtooth identity role create network policy_1 216 217 To see the role in state, run the following command: 218 219 .. code-block:: console 220 221 $ sawtooth identity role list 222 network: policy_1 223 224 Network Roles 225 ------------- 226 The following is the suggested high-level role for on-chain validator network 227 permissioning. 228 229 network 230 If a validator receives a peer request from a node whose public key is not 231 permitted by the policy, the message will be dropped, an 232 AuthorizationViolation will be returned, and the connection will be closed. 233 234 This role is checked by the permission verifier when the following 235 messages are received: 236 237 - GossipMessage 238 - GetPeersRequest 239 - PeerRegisterRequest 240 - PeerUnregisterRequest 241 - GossipBlockRequest 242 - GossipBlockResponse 243 - GossipBatchByBatchIdRequest 244 - GossipBatchByTransactionIdRequest 245 - GossipBatchResponse 246 - GossipPeersRequest 247 - GossipPeersResponse 248 249 network.consensus 250 If a validator receives a GossipMessage that contains a new block published 251 by a node whose public key is not permitted by the policy, the message will 252 be dropped, an AuthorizationViolation will be returned, and the connection 253 will be closed. 254 255 In the future, other sub-roles can be added to further restrict access to 256 specific functions of the role. For example network.gossip could control who is 257 allowed to send gossip messages. 258 259 .. Licensed under Creative Commons Attribution 4.0 International License 260 .. https://creativecommons.org/licenses/by/4.0/