Index  | Recent Threads  | Unanswered Threads  | Who's Active  | Guidelines  | Search
 

Quick Go »
No member browsing this thread
Thread Status: Active
Total posts in this thread: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4179 times and has 10 replies Next Thread
Former Member
Cruncher
Joined: May 22, 2018
Post Count: 0
Status: Offline
Reply to this Post  Reply with Quote 
Site Down at 1400 UTC Today

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?
[Jan 26, 2022 2:57:51 PM]   Link   Report threatening or abusive post: please login first  Go to top 
knreed
Former World Community Grid Tech
Joined: Nov 8, 2004
Post Count: 4504
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

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.
[Jan 26, 2022 3:31:17 PM]   Link   Report threatening or abusive post: please login first  Go to top 
adriverhoef
Master Cruncher
The Netherlands
Joined: Apr 3, 2009
Post Count: 2346
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

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. thinking
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
we'll be back up shortly. Please visit us on Facebook or Twitter for more
information.

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. wink

(For those who are interested talk to the hand , wcgstats is the script that is involved. nerd)
[Jan 26, 2022 5:30:42 PM]   Link   Report threatening or abusive post: please login first  Go to top 
BobbyB
Veteran Cruncher
Canada
Joined: Apr 25, 2020
Post Count: 638
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

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. cool
[Jan 26, 2022 9:56:03 PM]   Link   Report threatening or abusive post: please login first  Go to top 
adriverhoef
Master Cruncher
The Netherlands
Joined: Apr 3, 2009
Post Count: 2346
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

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. cool

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
perl -i -wpe '
s/^(MAILADDR)="your_e-mail_address"/$1="joe\@example.com"/;
s/^(PASSWORD)="0[^"]*0"/$1="MY_SECRET_PASSWORD_FOR_WCG"/;
s/^(MEMBER)="youraccountname"/$1="YOUR_REAL_MEMBERNAME"/;
s/^(VERIFY)="x[^"]*x"/$1="YOUR_VERIFICATION_CODE"/;
' "$@"


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. nerd

Don't forget to update this small credentials script if anything changes in your credentials. wink

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]
[Jan 27, 2022 1:14:43 AM]   Link   Report threatening or abusive post: please login first  Go to top 
BobbyB
Veteran Cruncher
Canada
Joined: Apr 25, 2020
Post Count: 638
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

I was thinking more like: https://tecadmin.net/include-bash-script-in-other-bash-script/

TL;DR
(config.sh)
USERNAME="jumpingjackflash"
EMAIL="jumpingjackflash@example.com"


(main.sh)
#!/bin/bash
# Including config.sh, set filename with proper path.
source config.sh
echo Welcome ${USERNAME}!
echo Your email is ${EMAIL}.


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]
[Jan 27, 2022 3:38:42 PM]   Link   Report threatening or abusive post: please login first  Go to top 
BobbyB
Veteran Cruncher
Canada
Joined: Apr 25, 2020
Post Count: 638
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

Something like:

MEMBER="jumpinjackflash"
VERIFY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
MEMBER1="anotheraccount"
VERIFY1="11111111111111111111111111111111"

source wcgcreds


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
PASSWORD="Itsagasgasgas"
MAILADDR_1="another_e-mail_address"
PASSWORD_1="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
MAILADDR_2="yet_another_e-mail_address"
PASSWORD_2="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"

----------------------------------------
[Edit 1 times, last edit by BobbyB at Jan 27, 2022 9:22:42 PM]
[Jan 27, 2022 7:17:49 PM]   Link   Report threatening or abusive post: please login first  Go to top 
adriverhoef
Master Cruncher
The Netherlands
Joined: Apr 3, 2009
Post Count: 2346
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

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

[Jan 27, 2022 9:43:57 PM]   Link   Report threatening or abusive post: please login first  Go to top 
BobbyB
Veteran Cruncher
Canada
Joined: Apr 25, 2020
Post Count: 638
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Site Down at 1400 UTC Today

a) I disagree strongly.
a) 1) KISS -> Or "Keep It Stupidly Simple" smile 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).
[Jan 28, 2022 10:46:55 PM]   Link   Report threatening or abusive post: please login first  Go to top 
adriverhoef
Master Cruncher
The Netherlands
Joined: Apr 3, 2009
Post Count: 2346
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
wcgformat, wcglog, wcgmembercmp, wcgresults, wcgstats

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]
[Jan 29, 2022 4:13:30 PM]   Link   Report threatening or abusive post: please login first  Go to top 
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread