[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-04-21 Thread Brian Houser (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17526184#comment-17526184
 ] 

Brian Houser commented on CASSANDRA-16983:
--

I think we agreed to make some minor changes to this (plain_text_auth) in 
credentials working with the new custom loading system

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-24 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511811#comment-17511811
 ] 

Bowen Song commented on CASSANDRA-16983:


[~bschoeni] The warnings.warn() output message can be very ugly. I personally 
have a distaste for it.

For example:
{code:java}
$ pwd
/tmp/some/long/directory/name
$ cat warn.py 
import warnings


def main():
print('==')
print('Using warnings.warn()')
print('--')
warnings.warn('This is a multi-line\nwarning message\nfor testing purpose', 
FutureWarning)
print('--')
print()
print('==')
print('Using print()')
print('--')
print('This is a multi-line\nwarning message\nfor testing purpose')
print('--')


if __name__ == '__main__':
main()
$ python warn.py
==
Using warnings.warn()
--
/tmp/some/long/directory/name/warn.py:8: FutureWarning: This is a multi-line
warning message
for testing purpose
  warnings.warn('This is a multi-line\nwarning message\nfor testing purpose', 
FutureWarning)
--

==
Using print()
--
This is a multi-line
warning message
for testing purpose
--
 {code}
 

However, if that's what the community wants, feel free to change it.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-23 Thread Brad Schoening (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17511560#comment-17511560
 ] 

Brad Schoening commented on CASSANDRA-16983:


[~Bowen Song] Should the warning message here use the warnings package which 
has a UserWarning or FutureWarning type? 

 
{noformat}
import warnings  # already imported and used in cqlsh.py
warnings.warn("don't do this", FutureWarning)
{noformat}
 

This would allow the use of filterwarnings() in the test case.

https://docs.python.org/3/library/exceptions.html#FutureWarning

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503903#comment-17503903
 ] 

Bowen Song commented on CASSANDRA-16983:


[~bschoeni] That explained everything.

Perhaps the best way to deal with this is have an env var for the test to use 
an alternative cqlshrc file, so you can have different cqlshrc files for 4.0 
and 4.1, and one of them may contain credentials and the other may only contain 
the path to the credentials file. What do you think?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Brad Schoening (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503862#comment-17503862
 ] 

Brad Schoening commented on CASSANDRA-16983:


[~Bowen Song] yes, I'm providing credentials in CQL_TEST_USER and CQL_TEST_PWD, 
but test_cqlsh_output is still looking for my cqlshrc and printing out the 
warning message.  Ideally, you'd be able to specify credentials either way, 
file based or with ENV variables because it can't be done interactively like 
cqlsh can to request a pwd.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503792#comment-17503792
 ] 

Bowen Song commented on CASSANDRA-16983:


[~bschoeni] May I ask how is cqlshrc file involved in the test? I don't see any 
test creating the cqlshrc file. I ran the test in a machine without the cqlshrc 
file or the credential file, and all tests in the test/test_cqlsh_output.py 
were successful. The tests in the test/test_unicode.py are failing, but I 
believe it has more to do with the runtime environment than the code.

Are you using your own cqlshrc/credentials file to run the test? We might need 
to make the test ignore existing cqlshrc/credentials file if this is the case, 
because according to the content in the README.asc file, the environment 
variables CQL_TEST_USER and CQL_TEST_PWD should be used, not the 
cqlshrc/credentials file. 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Brad Schoening (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503762#comment-17503762
 ] 

Brad Schoening commented on CASSANDRA-16983:


[~stefan.miklosovic]  I'm describing what would happen if you run locally.  Say 
you run cassandra4.0/bin/cqlsh.py with the version from C* 4.0, and then try to 
run cassandra4.1/bin/cqlsh.py with the version from C* 4.1.  You can't run the 
tests with the same cqlshrc file due to the warning, and that 4.0 won't read 
the credentials file if you put credentials there.  

I'm not sure if unittest could ignore the stderr here, but the workaround is 
that with 4.1 you must 

[~Bowen Song] I don't know why you had problems with futures, but its not 
needed anymore, so removing it from requiremens.txt is the right long term fix.

I found documentation on the format for the new credentials sparse.  Could we 
update the pylib/README with something about cqlshrc and the new credentials 
file?



Unrelated, but shouldn't the CQLSH version be bumped in C* 4.1 from 6.0.0?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503545#comment-17503545
 ] 

Bowen Song commented on CASSANDRA-16983:


[~smiklosovic] removing futures from requirements.txt files locally worked, but 
now I'm getting some Unicode encode/decode errors instead. I don't have much 
time to debug this right now, but I suspect it may have something to do with 
the runtime environment, such as Python version (I have Python 3.10, which is 
relatively new). I will have a look into this next week if the issue Brad 
mentioned remains unresolved by then.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503526#comment-17503526
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Hi [~Bowen Song], I am hitting the same issue, locally I just remove futures 
from requirements.txt, there is a ticket for that, look at 
https://issues.apache.org/jira/browse/CASSANDRA-17393

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503511#comment-17503511
 ] 

Bowen Song commented on CASSANDRA-16983:


[~bschoeni] Are you talking about the tests in cassandra/pylib/cqlshlib? I 
couldn't figure out how to run these tests. The README file says it requires 
Python 3.6+, but when I attempted to install dependencies in the 
requirements.txt file, the "pip install" command failed, because "futures" 
([https://pypi.org/project/futures/)] is not compatible with Python 3. May I 
ask how do you install the dependencies in Python 3? Or are you using Python 
2.7 (which has reached EoL 2 years ago)?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-09 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503411#comment-17503411
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Sorry I dont get it. Lastly I checked Jenkins was running all tests just fine, 
as well as my local test execution.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2022-03-08 Thread Brad Schoening (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503262#comment-17503262
 ] 

Brad Schoening commented on CASSANDRA-16983:


I wanted to mention that the new warning message emitted when the credential 
have not been separated out will cause the python unit tests to fail.  I was a 
little surprised since the warning was correctly sent to sys.stderr.

FAILED test/test_cqlsh_output.py

This makes the change sort of mandatory for running the tests. 

*E           AssertionError: 10 != 6 : output: '\nNotice: Credentials in the 
cqlshrc file is deprecated and will be ignored in the future.\nPlease use a 
credentials file to specify the username and password.\n\n\n num | asciicol   | 
bigintcol           | blobcol              | booleancol | decimalcol | 
doublecol | floatcol | intcol     | smallintcol | textcol | timestampcol        
            | tinyintcol | uuidcol                              | varcharcol    
| 
varintcol\n-++-+--+++---+--++-+-+-++--+---+---\n
   1 | __!\'$#@!~" | 9223372036854775807 | 0xff |       True |  
    1E-14 |     1e+07 |    1e+05 | 2147483647 |       32767 | ∭Ƕ⑮ฑ➳❏\' | 
1950-01-01 00:00:00.00+ |        127 | 
---- | newline->\\n<- |         9\n\n(1 rows)'*

 

*test/test_cqlsh_output.py*:141: AssertionError

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
> Fix For: 4.1
>
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-08 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17426209#comment-17426209
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

+1

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-08 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17426127#comment-17426127
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

tested manually locally, works fine.
I triggered the build here with Bowen's dtest: 
https://ci-cassandra.apache.org/view/patches/job/Cassandra-devbranch/1193/

On successful build I am +1, I would like to get the second +1 from another 
committer.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425698#comment-17425698
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

I agree with 2). I have already started it in 16956 (removal from pylib) so we 
can get rid of that there completely after this is in.

Is there anything else to cover? I can run a build and we can get to merging 
itself I guess?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425686#comment-17425686
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

I'm fine with 2.  Removing windows support entirely from the codebase is going 
to be a long road and hoisting the entire responsibility of removing it from 
cqlsh onto this ticket isn't appropriate, and a couple more lines is no big 
deal.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425680#comment-17425680
 ] 

Bowen Song commented on CASSANDRA-16983:


I'm okay with that. So here's two ways of dropping Windows support from CQLSH:
1. I remove the two lines referencing to the "is_win" variable, and commit my 
changes. Someone else later look at cqlsh.py code and remove all Windows 
related code.
2. My change gets merged as it is. Someone else later look at cqlsh.py and 
remove those two lines along with all other Windows related code.

I personally see the option 2 being more attractive, because it will gets this 
change out sooner, and it'll only create a negligible amount of extra work for 
the person who works on removing Windows support from CQLSH.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425531#comment-17425531
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

bq. what do you think about the complete removal of Windows from cqlsh?

I think Dinesh makes a good point, users interested in Windows support are best 
served by the project as a whole via WSL, so cqlsh should follow suit.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425513#comment-17425513
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

That's the vibe I am getting from [~djoshi]. I am on the fence here, I 
personaly do not mind to drop it completely and a user would have to use WSL if 
she needs that. We need some arbiter in this matter. [~brandon.williams] what 
do you think about the complete removal of Windows from cqlsh?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425508#comment-17425508
 ] 

Bowen Song commented on CASSANDRA-16983:


[~stefan.miklosovic] Are you saying that CQLSH should drop the support for 
Windows? Because if I remove all Windows related stuff from my PR, credentials 
file will not work on Windows for sure.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-07 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425492#comment-17425492
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

hi [~Bowen Song], could you please go one more time over your PR and  remove 
all Windows specific stuff? This work is related to CASSANDRA-16956 where I am 
touching pylib/cqlsh. Would you be so nice to go over the PR there and verify 
my changes related to Windows make sense? Thanks! 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-06 Thread Dinesh Joshi (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425358#comment-17425358
 ] 

Dinesh Joshi commented on CASSANDRA-16983:
--

+1 on removing vestiges of Windows support. If someone is really interested in 
using cqlsh on Windows, they can explore using Windows Subsystem for Linux 
which should work pretty well.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-05 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424486#comment-17424486
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

Well, that is a small check without adding anything Windows-specific (like 
messing with NTFS) and simply punting, so I think that's fine.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-05 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424484#comment-17424484
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Aha, interesting point, so in that case I think this is redundant:

https://github.com/apache/cassandra/blob/cd62e34a6133a2f5f8066c93654119114795faba/bin/cqlsh.py#L2121-L2124

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-05 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424478#comment-17424478
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

bq. I think that is still relevant to have there

I disagree.  Part of why we removed Windows support is because we weren't doing 
it properly, and we still have cruft from it to remove, so I don't want to add 
more here that will amount to partially supporting Windows again (and perhaps 
poorly, since it won't be tested regularly.)

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-04 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424185#comment-17424185
 ] 

Bowen Song commented on CASSANDRA-16983:


[~stefan.miklosovic] I'm fully aware that cqlsh will be used on Windows. This 
code checks for Windows is because Windows doesn't support POSIX file 
permissions, and that makes the file ownership and world-readable test very 
hard (will have to introduce some Windows & NTFS specific code). Therefore, the 
code will simply skip the check on Windows and allow an insecure credentials 
file to be used. It's a compromise between introducing OS specific code and 
being permissive on insecure files on some OSes.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-04 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424115#comment-17424115
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

btw, just saying, I think we are going to drop Windows support but this is only 
touching server side. I assume that Windows users should be still perfectly 
able to connect. I saw some check for "if we are on Windows" and I think that 
is still relevant to have there.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-04 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424114#comment-17424114
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

hey [~bhouser] would you be able to check this? What do you think about the 
implementaion? Thanks!

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-10-04 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17424043#comment-17424043
 ] 

Bowen Song commented on CASSANDRA-16983:


Please see the pull requests in the following two repositories for this change.

cassandra: https://github.com/apache/cassandra/pull/1220
and
cassandra-dtest: https://github.com/apache/cassandra-dtest/pull/163

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-29 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17422102#comment-17422102
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

Alright, let's go with that.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-28 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421774#comment-17421774
 ] 

Bowen Song commented on CASSANDRA-16983:


I could describe it in the code, but not making the option visible to the end 
user. This way, the option won't show up in the `cqlsh --help` output or the 
[HTML 
document|https://cassandra.apache.org/doc/latest/cassandra/tools/cqlsh.html], 
but if anyone read (or search it in) the source code of cqlsh.py, the option 
will be clearly documented. 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-28 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421559#comment-17421559
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

bq. 3. Do a substring match and an additional check on the number of lines in 
the hope of any other warning or error will add at least one additional line to 
the stderr. 

I think this would have to be the case, and this option seems to be the right 
amount of effort without introducing any mess.

bq. TBH, I'd rather add an undocumented hidden option and be done with it. 
Regular user will never find it out, and advanced users can use that option to 
silence the warning if they chose to do so. 

I'm ok with this option too, but I don't think we should leave it undocumented, 
these kind of things seem to end up biting us later on when we do (in hindsight 
we end up wishing we had documented them.)


> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421023#comment-17421023
 ] 

Bowen Song commented on CASSANDRA-16983:


[~brandon.williams] I'm a bit worried that doing a substring match may miss 
cases where there's a real error following the warning message. I don't like 
the exact match idea either, because it basically locks in the message itself. 
I can think of a few solutions to avoid locking down the message text or 
ignoring additional errors / warnings in the test:
1. Make the warning text a module level (pretty much a global) variable in 
cqlsh, then import the variable from cqlsh in the unittest. The less ideal part 
is cqlsh.py has tons of code gets executed at import time, and they are not 
exactly what I would say 'fast'.
2. Put the warning text in another .py file, and import it from both cqlsh.py 
and the unittest. I think the best place is in cqlshlib, but I'm unsure 
`util.py` is the best file for that. It's a bit messy because the message 
really isn't reusable other than being used by the test.
3. Do a substring match and an additional check on the number of lines in the 
hope of any other warning or error will add at least one additional line to the 
stderr. This way the content is flexible but the number of lines is locked down 
by the unittest. This is a compromise between doing too much and too little.

TBH, I'd rather add an undocumented hidden option and be done with it. Regular 
user will never find it out, and advanced users can use that option to silence 
the warning if they chose to do so. This way, the unittest would be a lot 
clearer. The option itself can also be tested by the unittest using a substring 
match, without worrying about additional errors after it, because the same test 
without the hidden option will still catch that error.

Let me know your thoughts on this.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420966#comment-17420966
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

I don't think we need to match the whole string, I would probably just do a 
meaningful substring match.  For the version I think greater than or equal to 
'4.1' is best, since even if trunk releases as 5.0 that will cover it.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420947#comment-17420947
 ] 

Bowen Song commented on CASSANDRA-16983:


[~brandon.williams] Is it a good idea to look for an exact match of the warning 
message text? FYI the text is 2 lines, 149 characters long.

Also, what is the recommended "specific value" for comparing with the 
'self.cluster.version()'? Is it '4.1' or something else?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420886#comment-17420886
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

Generally when the output has changed we have used option 3 in the past.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420875#comment-17420875
 ] 

Bowen Song commented on CASSANDRA-16983:


Okay, I need some opinions on the following issue.

The 'cqlsh_tests' in dtests doesn't like the newly added insecure password in 
command line warning message, and many tests will fail if the warning text is 
added without any other actions taken. I can think of 3 different solutions:
1. Add a new undocumented hidden option to 'cqlsh.py' to skip the warning 
message when '-p password' is used. For example 
"--insecure-password-without-warning". Then in the dtests, add this parameter 
to the command line if the Cassandra version is >= a specific value, such as 
'4.1'.
2. Add a new undocumented environment variable to 'cqlsh.py' to skip the 
warning message. For example "CQLSH_INSECURE_PASSWORD=1". In dtests, the 
environment variable can be set regardless of the version, as the old version 
cqlsh will ignore it automatically.
3. Change the dtests to expect the warning message if the Cassandra version is 
>= a specific value.

I would like to hear your opinions on the above, what do you think is the best 
approach?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420723#comment-17420723
 ] 

Bowen Song commented on CASSANDRA-16983:


I have installed `ant` and built the JAR files:

{noformat}
$ ant realclean && ant jar
..

_build-test:
[javac] Compiling 1034 source files to 
/home/user/cassandra_fork/build/test/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
 [copy] Copying 27 files to /home/user/cassandra_fork/build/test/classes

jar:
[mkdir] Created dir: /home/user/cassandra_fork/build/classes/stress/META-INF
[mkdir] Created dir: /home/user/cassandra_fork/build/tools/lib
  [jar] Building jar: /home/user/cassandra_fork/build/tools/lib/stress.jar
[mkdir] Created dir: 
/home/user/cassandra_fork/build/classes/fqltool/META-INF
  [jar] Building jar: /home/user/cassandra_fork/build/tools/lib/fqltool.jar

BUILD SUCCESSFUL
Total time: 50 seconds
{noformat}

However, the dtests are still failing. Any idea how to troubleshoot it?

BTW, I didn't wait for it to complete this time, because the tests are all 
failing anyway...


{noformat}
auditlog_test.py F  

  [  0%]
auth_join_ring_false_test.py    

  [  0%]
auth_test.py 
FFsssFEEE

   [  8%]
batch_test.py FFsss 

 [ 10%]
{noformat}


> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420680#comment-17420680
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Could you done a test which is dealing with file permissions only? Lets just 
verify all "sudo-needed" tests manually for now. At least something.

Yes you need Ant and yes you need Java development kit, you need to produce 
Cassandra JAR which is then started by CCM Python library. Dtests are build the 
Cassandra JAR first before running tests against that. 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420647#comment-17420647
 ] 

Bowen Song commented on CASSANDRA-16983:


I think there's two ways to avoid `sudo`, both requires `fakeroot`:
1. I can avoid mocking `os.getuid()` by dropping the root privilege inside the 
`fakeroot`, but that will require either forking or sub-processing. Because if 
I drop the root privilege from the main process, I won't be able to regain it.
2. If I run the entire unittest under `fakeroot`, I can avoid forking or 
sub-processing, but will need to mock the `os.getuid()` in order to test the 
non-root behaviour. I'm unsure if anything else will be affected by unexpected 
`os.getuid()` return value, this needs further investigation.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420642#comment-17420642
 ] 

Bowen Song commented on CASSANDRA-16983:


I don't have the `ant` command. JAVA_HOME is unset. However, `java -version` 
works:

{noformat}
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
{noformat}

Do I need to install a Java development environment in order to run Python 
tests? That sounds like a bit too much. May I write the unittests in a 
different way? For example, standard Python `unittest.TestCase`, and mocking 
the Datastax driver? I should be able to use `fakeroot` in combination with 
mocking the `os.getuid()` to avoid `sudo`, but that's going to be fairly 
complicated.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420638#comment-17420638
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

By the way, as I think more about that, it is very unfortunate you need sudo 
for this. I think that we should not depend on that at all. Is not there really 
any other way how to test this? At least partially ... I would avoid having 
"sudo" to be able to run a test. These tests also run locally, jenkins / 
circleci is not meant to be the only place.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420636#comment-17420636
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Would you mind to run 'ant realclean && ant jar' first on your fork?

What is your JAVA_HOME set to?

Do you have pyton env and all that stuff?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420627#comment-17420627
 ] 

Bowen Song commented on CASSANDRA-16983:


Hi [~stefan.miklosovic], I've just tried that, and I don't think it's working 
either. 

I have followed the README and installed the native dependencies and Python 
dependencies, and the command I used to run the tests is "pytest 
--cassandra-dir=$HOME/cassandra_fork". I first tried to use `~` as the document 
suggested, but that did not work for me, the test failed with "E   
FileNotFoundError: [Errno 2] No such file or directory: 
'~/cassandra_fork/build.xml'" immediately. The test runs after replacing `~` 
with `$HOME`, but most of them are failing. The output at the end is "724 
failed, 99 passed, 240 skipped, 4088 deselected, 2 xfailed, 162 error in 725.86 
seconds". I can only see hundreds lines of these errors repeating:


{noformat}
[, ,
 , 
]
test_thread_count_repair failed and was not selected for rerun.

'JAVA_HOME'
[, ,
 , 
]
test_multiple_concurrent_repairs failed and was not selected for rerun.

'JAVA_HOME'
[, ,
 , 
]
test_wide_row_repair failed and was not selected for rerun.

'JAVA_HOME'
[, ,
 , 
]
test_dead_sync_initiator failed and was not selected for rerun.

list index out of range
[, , , 
]
test_dead_sync_participant failed and was not selected for rerun.

list index out of range
[, , , 
]
test_failure_during_validation failed and was not selected for rerun.

list index out of range
[, , , 
]
{noformat}

Any tips on how to run this correctly?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-27 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420513#comment-17420513
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Hi [~Bowen Song]

there is this section in the readme,  have you read that? 
[https://github.com/apache/cassandra-dtest#usage]

We are running the build as "cassandra" and here I see that you can do "sudo" 
with that user:

https://github.com/apache/cassandra-builds/blob/trunk/docker/testing/ubuntu1910_j11.docker#L79-L83

 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-26 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420410#comment-17420410
 ] 

Bowen Song commented on CASSANDRA-16983:


Hi [~stefan.miklosovic], I can read and understand Java code, and can write bad 
(possibly very bad) Java code too. Also, I don't have a Java development 
environment, so I'll have no way to compile and run the Java tests. If I wrote 
some Java tests, I'll need to commit it as it is and hoping for the best. I'm 
not sure that's acceptable?

I can write much better Python tests, but I'm having trouble to understand how 
is the Python test run. I tried to run "nosetests" directly, but tests are 
failing with all sorts of errors. I can see the unittests are more like 
integrations tests, many of them depend on a running Cassandra cluster. Can 
anyone please point me to a document about it, a script that invokes the test 
or a correct (list of?) command to run the tests?

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-26 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420399#comment-17420399
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

There are also some python tests for cqlsh in 
[pylib/cqlshlib/test|https://github.com/apache/cassandra/tree/trunk/pylib/cqlshlib/test].

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-26 Thread Stefan Miklosovic (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420398#comment-17420398
 ] 

Stefan Miklosovic commented on CASSANDRA-16983:
---

Hi [~Bowen Song], great patch! The only thing I am kind of lacking are some 
tests. I think this can be tested via CQLSH invoked from Java as a tool. Check 
the package test/unit/org/apache/cassandra/tools/cqlsh/CqlshTest.  There is a 
bunch of stuff in ToolRunner related to cqlsh and it is imo just a matter of 
putting all the bits together to test what you just implemented.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-23 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17419141#comment-17419141
 ] 

Bowen Song commented on CASSANDRA-16983:


[~djoshi] Thank you. To get myself familiarise with the process, I decide to 
start from a smaller and much simpler change first. I created CASSANDRA-16987 
and then opened a pull request on GitHub. Now that's done (until some reviews 
it), I'm going to work on this one.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>  Labels: lhf
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-22 Thread Dinesh Joshi (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418640#comment-17418640
 ] 

Dinesh Joshi commented on CASSANDRA-16983:
--

[~Bowen Song] I have tentatively assigned the ticket to you. Like Brandon said, 
please reach out over email / slack if you have questions on working on a patch 
for this ticket. The good news is cqlsh is written in Python and uses Python 
driver.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Assignee: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-22 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418618#comment-17418618
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

[~Bowen Song], please don't hesitate to do so, there are plenty of us to help 
guide you through the Apache process if needed, and we are always keen to see 
new contributors!

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-22 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418617#comment-17418617
 ] 

Bowen Song commented on CASSANDRA-16983:


I'm tentative to work on this, and thinking about assigning this to myself. I 
haven't worked on the Cassandra project (or any Apache project), but I do have 
extensive experience working with Python.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-21 Thread Brandon Williams (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418211#comment-17418211
 ] 

Brandon Williams commented on CASSANDRA-16983:
--

I don't think we should fail if a password is specified, but warning is fine.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-21 Thread Dinesh Joshi (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418204#comment-17418204
 ] 

Dinesh Joshi commented on CASSANDRA-16983:
--

+1 on this idea. My personal preference would be to default to failing on 
detecting weak security practices. Introducing a flag to allow insecure 
practices could go back to the current behavior. I realize this would be 
breaking some users that call cqlsh in scripts but I think its worth it.

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-16983) Separating CQLSH credentials from the cqlshrc file

2021-09-21 Thread Bowen Song (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-16983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418201#comment-17418201
 ] 

Bowen Song commented on CASSANDRA-16983:


Thank you, [~dchenbecker], for the great presentation in the ApacheCon, which 
inspired me to create this JIRA ticket. 

> Separating CQLSH credentials from the cqlshrc file
> --
>
> Key: CASSANDRA-16983
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16983
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Tool/cqlsh
>Reporter: Bowen Song
>Priority: Normal
>
> Currently, the CQLSH tool accepts credentials (username & password) from the 
> following 3 places:
> 1. the command line parameter "-p"
> 2. the cqlshrc file
> 3. prompt the user
> This is not ideal.
> Credentials in the command line is a security risk, because it could be see 
> by other users on a shared system.
> The cqlshrc file is better, but still not good enough. Because the cqlshrc 
> file is a config file,  it's often acceptable to have it as a world readable 
> file, and share it with other users. It also prevents user from having 
> multiple sets of credentials, either for the same Cassandra cluster or 
> different clusters.
> To improve the security of CQLSH and make it secure by design, I purpose the 
> following changes:
> * Warn the user if a password is giving in the command line, and recommend 
> them to use a credential file instead
> * Warn the user if credentials are present in the cqlshrc file and the 
> cqlshrc file is not secure (e.g.: world readable or owned by a different user)
> * Deprecate credentials in the cqlshrc, and recommend the user to move them 
> to a separate credential file. The aim is to not break anything at the 
> moment, but eventually stop accepting credentials from the cqlshrc file.
> * Reject the credentials file if it's not secure, and tell the user how to 
> secure it. Optionally, prompt the user for password if it's an interactive 
> session. (Think how does OpenSSH handle insecure credential files)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org