WeBWorK Problems

WebWorK error help

Re: WebWorK error help

by Danny Glin -
Number of replies: 8
I'm assuming that your web server is running with user "apache" and group "apache".
Double check that the parent directory (/opt/webwork/webwork2/DATA) is at least readable and executable ("rx") by either the apache user or the apache group.

In the RHEL world permissions issues can also be caused by SELinux, though I didn't run into that on my install.
In reply to Danny Glin

Re: WebWorK error help

by Alexander Hostetter -
Yes, your assumption is correct. I have double checked:
[root@webwork conf]# sudo -u apache ls /opt/webwork/webwork2/DATA
068f622c-cc17-3a18-8bce-64fe1d88099f 6df5dc76-c7f3-3e2d-9627-d857176bce71 cfc69399-86cd-3f52-9eb4-84c5844fa6a9
0c782f7b-08c3-365d-8add-cb687989cd7d 87b1ddd1-a8c9-3ee5-a746-d72b1d2ce7b2 f05d4cc5-a97b-30cd-8f6c-a1d4034eee86
2b4c68f8-fd8f-37c4-b69a-d53ecea18f6c 8c3a29fe-a4de-34ed-98c5-e22f092934eb fcd4cc8a-9b6a-38cb-aae5-792d99d7c7b3
4082d6c7-7dfd-3ff5-9397-ef522970b98a acd7e104-19ad-3bcc-8f76-ce67276b0d7c uploads
5b98d3d3-cfbf-32a9-8961-569eb67c9acb ad5331a1-250e-3c97-87dd-89e8b237a771
6dbf5d54-631b-38ea-8346-eb7547ba62b1 c3395f6d-1ddc-3a69-ad8f-bca976b21031

[root@webwork conf]# ls -ld /opt /opt/webwork /opt/webwork/webwork2 /opt/webwork/webwork2/DATA
drwxrwxr-x. 9 root root 120 Oct 18 09:41 /opt
drwxrwxr-x. 7 apache apache 79 Jun 1 2020 /opt/webwork
drwxrwsr-x. 15 wwadmin apache 4096 Oct 22 11:55 /opt/webwork/webwork2
drwxrwsr-x. 3 wwadmin apache 4096 Nov 9 2020 /opt/webwork/webwork2/DATA

I am also beginning to suspect SELinux, although I did follow the directions in the webwork install docs for RHEL systems to make the necessary exceptions. I am going to turn it off temporarily and ask the instructor to test and report their results. Thank you for the reply.
In reply to Alexander Hostetter

Re: WebWorK error help

by John Eismeier -
from rhel SELinux please try:

aureport -a

as root to see if SELinux is blocking? If WebWork is installed on NAS, SELinux does need a setting (setsebool -P use_nfs_home_dirs 1)

Does this help?
In reply to John Eismeier

Re: WebWorK error help

by Alexander Hostetter -
I have disabled SELinux and the instructor has reported that the file did upload but the import utility did not. I have a new error to investigate. 

Attachment Screenshot 2025-01-23 110753.png
In reply to Alexander Hostetter

Re: WebWorK error help

by Alexander Hostetter -

Looking at Utils.pm, this is the offending section of code:

sub cryptPassword($) {

        my ($clearPassword) = @_;

        #Use an SHA512 salt with 16 digits

        my $salt = '$6$';

        for (my $i=0; $i<16; $i++) {

            $salt .= ('.','/','0'..'9','A'..'Z','a'..'z')[rand 64];

        }


        my $cryptPassword = crypt($clearPassword, $salt);

        return $cryptPassword;

}


I also see that "use Encode qw(encode_utf8 decode_utf8);" is loaded, might the following modification solve the error?

sub cryptPassword($) {

        my ($clearPassword) = @_;
        $clearPassword = encode_utf8($clearPassword);

        #Use an SHA512 salt with 16 digits

        my $salt = '$6$';

        for (my $i=0; $i<16; $i++) {

            $salt .= ('.','/','0'..'9','A'..'Z','a'..'z')[rand 64];

        }


        my $cryptPassword = crypt($clearPassword, $salt);

        return $cryptPassword;

}


In reply to Alexander Hostetter

Re: WebWorK error help

by Glenn Rice -
Currently WeBWorK does not support wide characters in passwords. If this occurred it means that the user entered a wide character in the password field on login. I is not possible to set a password containing a wide character that causes this failure, so that means the instructor entered an invalid password.

There is a pending pull request to add support for wide characters in passwords. However, it isn't ready to merge yet, and that will only be available in the next release of WeBWorK if merged.
In reply to Alexander Hostetter

Re: WebWorK error help

by Alexander Hostetter -
I made this modification to Utils.pm and this did work to eliminate the wide character error. Just wanted to report back in case anyone else sees this issue come up. I can consider this matter resolved; thank you everyone for your assistance.
In reply to Alexander Hostetter

Re: WebWorK error help

by Glenn Rice -
Note that this approach is not recommended. It can break the usage of existing passwords if they happen to contain one of the wide characters that did work with the native perl crypt method (see https://github.com/openwebwork/webwork2/issues/1141). It also uses Encode::encode_utf8 method which should not be used anymore. The Encode::encode method should be used instead specifying the 'UTF-8' encoding.  Furthermore, this is not complete.  A user that has a password created by this method will not actually be able to sign in to WeBWorK since the same error will occur on authentication if the password with the wide character is used.

The correct thing to do at this point is not attempt to import a classlist file that has passwords containing wide characters. If you have such a file, then those passwords in the file should be changed. Alternately, you could apply the changes in https://github.com/openwebwork/webwork2/pull/2659 that properly fixes this issue.
In reply to Glenn Rice

Re: WebWorK error help

by Alexander Hostetter -
Thank you for this additional context Glenn. I was concerned that making these changes on my own would lead to additional issues down the road. I will apply the changes in https://github.com/openwebwork/webwork2/pull/2659 to avoid this.