Skip to content

Commit ea679b8

Browse files
committed
final style/grammatical mods to the new README section.
(Final from me anyway. I am hereby satisfied.)
1 parent 6eed9cf commit ea679b8

File tree

1 file changed

+41
-42
lines changed

1 file changed

+41
-42
lines changed

README.md

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -129,87 +129,86 @@ the `encryption_*` and `ssl_*` options
129129
directly to the constructor as keyword arguments, even though it is
130130
required when they are placed in the environment file.
131131

132-
Creating PAM or Native Credentials File (.irodsA)
133-
-------------------------------------------------
132+
Creating a PAM or Native Authentication File
133+
--------------------------------------------
134134

135-
Two free functions exist which allow the user to create encoded authentication files
136-
for use in the client's iRODS login environment:
137-
```
138-
irods.client_init.write_native_irodsA_file
139-
irods.client_init.write_pam_irodsA_file
140-
```
141-
142-
These functions can roughly be described as duplicating the function of iinit (from iCommands),
143-
once a valid irods_environment.json has already been created.
135+
The following free functions may be used to create the authentication secrets files (called
136+
`.irodsA` per the convention of iRODS's iCommands):
137+
- `irods.client_init.write_native_irodsA_file`
138+
- `irods.client_init.write_pam_irodsA_file`
144139

145-
Each takes a cleartext password and writes an appropriately processed version of it
146-
into an .irodsA "password" or "secrets" in the appropriate location.
140+
These functions can roughly be described as duplicating the function of `iinit`,
141+
provided that a valid `irods_environment.json` has already been created.
147142

148-
That location is ~/.irods/.irodsA) unless IRODS_AUTHENTICATION_FILE has
149-
been set with an alternate file path in the OS environment.
143+
Each of the above functions can take a cleartext password and write an appropriately encoded
144+
version of it into an authentication in the appropriate location. That location is
145+
`~/.irods/.irodsA` unless the environment variable IRODS_AUTHENTICATION_FILE has been set
146+
in the command shell to dictate an alternative file path.
150147

151-
As an example, for the `native` authentication scheme, it is simple to create the
152-
.irodsA file directly:
148+
As an example, here we write a native `.irodsA` file using the first of the two functions. We
149+
provide the one required argument, a password string entered - in this case - interactively at the
150+
terminal.
153151

154152
```bash
155-
$ echo '{ "irods_user_name":"rods", ... }'> ~/.irods/irods_environment.json
156-
$ python -c "import irods.client_init, getpass
153+
bash$ echo '{ "irods_user_name":"rods",
154+
... # other parameters as needed
155+
}'> ~/.irods/irods_environment.json
156+
bash$ python -c "import irods.client_init, getpass
157157
irods.client_init.write_native_irodsA_file(getpass.getpass('Enter iRODS password -> '))"
158158
```
159159

160-
If an .irodsA file already exists, it will be overwritten by default; however, if these functions'
161-
overwrite parameter is set to `False`, an exception of type `irods.client_init.irodsA_already_exists`
162-
will be raised to warn of an older .irodsA file that might otherwise be overwritten.
160+
By default, when an `.irodsA` file already exists, it will be overwritten. If however the
161+
`overwrite` parameter is set to `False`, an exception of type `irods.client_init.irodsA_already_exists`
162+
is raised to warn of any older `.irodsA` file that might otherwise have been overwritten.
163163

164-
Equivalently, we can issue the following command.
164+
Equivalently to the above, we can issue the following command.
165165

166166
```bash
167-
$ prc_write_irodsA.py native <<<"${MY_CURRENT_IRODS_PASSWORD}"
167+
bash$ prc_write_irodsA.py native <<<"${MY_CURRENT_IRODS_PASSWORD}"
168168
```
169169

170-
The redirect may be left off, in which case the user is prompted for the iRODS password
171-
and echo of the keyboard input will be suppressed. (Regardless which technique is used,
172-
no password will be visible on the terminal during or after input.)
170+
The redirect may of course be left off, in which case the user is prompted for the iRODS password
171+
and echo of the keyboard input will be suppressed, in the style of `iinit`. Regardless
172+
which technique is used, no password will be visible on the terminal during or after input.
173173

174174
For the `pam_password` scheme, typically SSL/TLS must first be enabled to avoid sending data related
175175
to the password - or even sending the raw password itself - over a network connection in the clear.
176176

177-
Thus, for `pam_password` authentication to work well, we should first ensure when setting up the
178-
client environment that the `irods_environment.json` file includes the appropriate
179-
SSL/TLS connection parameters. If present, `iinit` can be used to verify this condition is fulfilled,
180-
as of course its invocation would create a valid .irodsA from merely prompting the user for their
181-
PAM password
177+
Thus for `pam_password` authentication to work well, we should first ensure, when setting up the
178+
client environment, to include within `irods_environment.json` the appropriate SSL/TLS connection
179+
parameters. In a pinch, `iinit` can be used to verify this prerequisite is fulfilled,
180+
as its invocation would then create a valid .irodsA from merely prompting the user for their PAM password.
182181

183-
But if we wish to use the Python client for this purpose instead, we can run:
182+
Once again, this can also be done either using the free function directly:
184183

185184
```python
186185
irods.client_init.write_pam_irodsA_file(getpass.getpass('Enter current PAM password -> '))
187186
```
188187

189-
Or from the Bash command shell, we simply run:
188+
or from the Bash command shell:
190189

191190
```bash
192-
$ prc_write_irodsA.py pam_password <<<"${MY_CURRENT_PAM_PASSWORD}"
191+
bash$ prc_write_irodsA.py pam_password <<<"${MY_CURRENT_PAM_PASSWORD}"
193192
```
194193

195-
again leaving out the redirection if password prompting is preferable.
196-
197-
As a final note, in the "pam_password" scheme the default SSL requirement can be disabled (for purposes
198-
of testing only):
194+
As a final note, in the "pam_password" scheme the default SSL requirement can be disabled (preferably for
195+
purposes of testing only!):
199196

200197
```python
198+
from irods.auth.pam_password import ENSURE_SSL_IS_ACTIVE
199+
201200
session = irods.session.iRODSSession(host = "localhost", port = 1247,
202201
user = "alice", password = "test123", zone="tempZone",
203202
authentication_scheme = "pam_password")
204203

205-
session.set_auth_option_for_scheme('pam_password', irods.auth.pam_password.ENSURE_SSL_IS_ACTIVE, False)
204+
session.set_auth_option_for_scheme('pam_password', ENSURE_SSL_IS_ACTIVE, False)
206205

207206
# Do something with the session:
208207
home = session.collections.get('/tempZone/home/alice')
209208
```
210209

211-
Note however that in future releases of iRODS it is possible that extra SSL checking could be
212-
implemented server-side, at which point, the above code could not be guaranteed to work.
210+
Note, however, in future releases of iRODS it is possible that extra SSL checking could be
211+
implemented server-side, at which point the above code could not be guaranteed to work.
213212

214213
Legacy (iRODS 4.2-compatible) PAM authentication
215214
------------------------------------------------

0 commit comments

Comments
 (0)