| Index | Recent Threads | Unanswered Threads | Who's Active | Guidelines | Search |
| World Community Grid Forums
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 11
|
|
| Author |
|
|
Former Member
Cruncher Joined: May 22, 2018 Post Count: 0 Status: Offline |
Trying to connect to website this morning resulted in a message indicating site was down for maintenance but no News notice seen indicating there was maintenance today. Client also had several results stuck in Upload. Was down less than an hour. Anyone know why? Transition activities?
|
||
|
|
knreed
Former World Community Grid Tech Joined: Nov 8, 2004 Post Count: 4504 Status: Offline Project Badges:
|
It was a quick patch for the PolKit vulnerability (https://www.helpnetsecurity.com/2022/01/26/cve-2021-4034/).
I should have posted a quick note here. The outage was about 10 minutes long. |
||
|
|
adriverhoef
Master Cruncher The Netherlands Joined: Apr 3, 2009 Post Count: 2346 Status: Offline Project Badges:
|
The outage was about 10 minutes long. That was a nice testcase for one of my scripts. I was just testing something at 2022-01-26T15:02:16 localtime (14:02:16 UTC) - and it worked - when suddenly an unexpected message from the script appeared at 2022-01-26T15:04:03: Use of uninitialized value in printf at -e line 12, <> line 158. Strange, also my device didn't have a name in the output of my script anymore. Another run of my script revealed that it was taking a long time to request a cookie. After finding out that the website was a bit down and much more testing I found the problem in my script: it didn't take the case of invalid cookies into account, where the input is unusable. No JSON, but HTML instead. That's what you get, a webpage with this message in HTML: World Community Grid's website is undergoing planned maintenance, but Since that isn't JSON, my script's only output were complaints about uninitialized values. That's not very helpful, so I modified the program to test if anything that looked like JSON could be found first, before outputting valid records. That was not much, but just a tiny little bit more helpful. (For those who are interested , wcgstats is the script that is involved. ) |
||
|
|
BobbyB
Veteran Cruncher Canada Joined: Apr 25, 2020 Post Count: 638 Status: Offline Project Badges:
|
I got a copy of wcgresults and wcgstats in October 2021 and after reading this post I updated to your latest version. I made a dumb error and forgot about the credentials in the script. Of course I got no results until I compared the two and got my DUH moment. This got me thinking.
Now if there were a wcgcreds file in the same directory which contained my credentials then there would be no need to ever edit either file again after an update. I'm presuming there is some type of include statement in bash to allow this. I know there is because I just read it. ![]() |
||
|
|
adriverhoef
Master Cruncher The Netherlands Joined: Apr 3, 2009 Post Count: 2346 Status: Offline Project Badges:
|
I got a copy of wcgresults and wcgstats in October 2021 and after reading this post I updated to your latest version. I made a dumb error and forgot about the credentials in the script. Of course I got no results until I compared the two and got my DUH moment. This got me thinking. Now if there were a wcgcreds file in the same directory which contained my credentials then there would be no need to ever edit either file again after an update. I'm presuming there is some type of include statement in bash to allow this. I know there is because I just read it. ![]() Thanks for the interest, BobbyB! There are many ways indeed. One way would be to write a small script that substitutes your personal credentials in-place in the designated file. E.g., #!/bin/sh Here, fill out the real credentials and save this code to wcgcreds.sh or so and then chmod 700 your credentials script. Don't forget the backslash before the @ in your real e-mail address. Also, if your password contains a slash, change the current slashes in the PASSWORD line into something like a comma (if your password doesn't contain a comma), like this: s,^(PASSWORD)="0[^"]*0",$1="MY_SECRET_PASSWORD_FOR_WCG",; # 3 commas instead of 3 slashes If your password contains an apostrophe, like e.g. "it's a secret", change each apostrophe into apostrophe backslash apostrophe apostrophe, like this: s/^(PASSWORD)="0[^"]*0"/$1="it'\''s a secret"/; # using "'\''" to escape the apostrophe in my password This script would work on wcgstats as well as on wcgresults, since each pair of credentials (MAILADDR/PASSWORD vs MEMBER/VERIFY) is unique in the scripts. Don't forget to update this small credentials script if anything changes in your credentials. ![]() EDIT- Come to think of it, if your password contains any non-alphanumeric character, place a backslash in front of each non-alphanumeric character (except the apostrophe), then apply the apostrophe substitution (using "'\''" to escape any apostrophe in your password). There are many non-alphanumeric characters with special meaning in Perl. EDIT 2- Because it just works like that, even more fun if your password contains a quotation mark. In that case, and your password is stored in a string surrounded by quotation marks itself, you must use backslash backslash in front of the quotation mark to escape the quotation mark. E.g., if your password is the three words "my "secret" access" (where only the word "secret" is surrounded by quotation marks), then you could use: s/^(PASSWORD)="0[^"]*0"/$1="my \\"secret\\" access"/; [Edit 3 times, last edit by adriverhoef at Jan 27, 2022 11:44:58 AM] |
||
|
|
BobbyB
Veteran Cruncher Canada Joined: Apr 25, 2020 Post Count: 638 Status: Offline Project Badges:
|
I was thinking more like: https://tecadmin.net/include-bash-script-in-other-bash-script/
----------------------------------------TL;DR (config.sh) USERNAME="jumpingjackflash" (main.sh) #!/bin/bash This is tested/working standalone and not as part of your 2 scripts. Just a word about passwords and using sneaky things like question marks to make it "harder". It's the length of the password and not the characters used which counts. Using brute force, abcdef is just as easy to break as $%#!/?* . abcdefghijklmnopqrstuvwxyz is way better even if it is obvious (to us and AI) then give it a ! at each end or other weird combo like 2 and 7. [Edit 1 times, last edit by BobbyB at Jan 27, 2022 3:54:57 PM] |
||
|
|
BobbyB
Veteran Cruncher Canada Joined: Apr 25, 2020 Post Count: 638 Status: Offline Project Badges:
|
Something like:
----------------------------------------MEMBER="jumpinjackflash" Seems I'm on the wrong script. more this one. I'm sure you know what I meant. Both together in wcgcreds MAILADDR="jumpinjackflash@example.com [Edit 1 times, last edit by BobbyB at Jan 27, 2022 9:22:42 PM] |
||
|
|
adriverhoef
Master Cruncher The Netherlands Joined: Apr 3, 2009 Post Count: 2346 Status: Offline Project Badges:
|
There are several reasons why I didn't implement it that way, i.e. adding a separate configuration file.
(a) The KISS principle: Keep It Simple Stupid. Adding a separate configuration file doesn't make it simpler as a whole (IMHO). (b) Adding a separate configuration file means that we will have to agree on a name and a place in the filesystem for that separate file. (c) People will probably find the need to configure their own device(s) in the wcgstats script, so an edit session is needed anyhow for that. (d) You can always update the script (and not lose your credentials) by using the option -U of the original script, e.g.: wcgresults -U PATH_TO_NEWLY_DOWNLOADED_VERSION_OF_THE_SCRIPT |
||
|
|
BobbyB
Veteran Cruncher Canada Joined: Apr 25, 2020 Post Count: 638 Status: Offline Project Badges:
|
a) I disagree strongly.
a) 1) KISS -> Or "Keep It Stupidly Simple" so as to not offend.b) You are the author and if you decide the file is named wcgcredentials (or whatever) then so it is. The place is the home directory of the user. There must be an environment variable available to the script which points to the home directory. Then if the scripts are put on the path somewhere it will still point to the logged in user home. c) Then that should be in an external file. Why not the same one? If they are smart enough to fiddle with your script then they are smart enough to adapt to an external config file. d) Did not get that far into the options TL;DR In any case it's your stuff and so be it. This was just a thought (of how I would do something like that). |
||
|
|
adriverhoef
Master Cruncher The Netherlands Joined: Apr 3, 2009 Post Count: 2346 Status: Offline Project Badges:
|
Alrighty, I guess there is something to be said in favour of an option to include a separate configuration file for those who desire to use one (I'm just saying that it's anyone's own choice). I've added a variable WCGINITRC that may point to a separate configuration file. It's a file that may contain separate configuration parameters that will override their equivalent configuration parameters in the main script (wcgformat, wcglog, wcgmembercmp, wcgresults, wcgstats). If you keep your configuration in the main script and update through the option -U, you would't need the separate file.
----------------------------------------[Edit 1 times, last edit by adriverhoef at Jan 29, 2022 4:14:23 PM] |
||
|
|
|