From d8d54b4d663234c47c722d99482fe8b7eb0a8691 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 3 Mar 2024 07:52:08 -0700 Subject: [PATCH] Modifications to tools/nocem scripts to move config to config file. --- Rocksolid_Light/tools/nocem/nocemlist.inc.php | 92 +++++++++++++++++++ Rocksolid_Light/tools/nocem/nocemlist.php | 50 ++-------- Rocksolid_Light/tools/nocem/nocempost.sh | 18 ---- 3 files changed, 101 insertions(+), 59 deletions(-) create mode 100644 Rocksolid_Light/tools/nocem/nocemlist.inc.php delete mode 100644 Rocksolid_Light/tools/nocem/nocempost.sh diff --git a/Rocksolid_Light/tools/nocem/nocemlist.inc.php b/Rocksolid_Light/tools/nocem/nocemlist.inc.php new file mode 100644 index 0000000..4551656 --- /dev/null +++ b/Rocksolid_Light/tools/nocem/nocemlist.inc.php @@ -0,0 +1,92 @@ +"; +$from_email = "from@example.com"; +$contact = "your_email_address"; + +$gpglocaluser = "XXXXXXXX"; +$nntpserver = "news.example.com"; +$nntpuser = "nntpusername"; +$nntppassword = "nntppassword"; + +// Your gpg signing key: +$signing_key = "XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX"; +// URL to view/download key: +$key_location = "https://"; + +// Comma separated list of newsgroups to send this message: +$spamgroup = "alt.test,misc.test"; + +// The hierarchies where these nocem may apply. +// Example: de.* or ALL +$hierarchies = "the alt.* and de.* hierarchies"; +// $hierarchies = "ALL hierarchies"; + +// EDIT THE BELOW LINES to reflect your specific needs +// NOTE: You may comment out any lines below you do not want + +// Where to find your statement about how messages get listed +$link_to_statement = "https://www.example.com/nocem/my_statement.html"; + +// Statement about the scope of your NoCeM messages: +$scope = 'The scope of these messages is '. $hierarchies; + +// Statement about where to find details of your nocem: +$statement = "You may find information about how messages are listed here:\n" . $link_to_statement; + + +/* ***** Please do not change anything below this line ***** */ + +$spamdir = $workpath."incoming"; +$nocem = $workpath."nocem.out"; +$headerdat = $workpath."header.out"; + +/* This creates nocempost.sh */ + +$nocempost = "#!/bin/bash\n\n"; +$nocempost .= "gpg2 --local-user $gpglocaluser --clearsign -a nocem.out\n\n"; + +$nocempost .= "newsserver=$nntpserver\n"; +$nocempost .= 'rpost $newsserver '."-U $nntpuser -P $nntppassword <<%end\n"; +$nocempost .= '$( $nocempost_mtime) { + $create_post = true; +} else { + $create_post = false; +} diff --git a/Rocksolid_Light/tools/nocem/nocemlist.php b/Rocksolid_Light/tools/nocem/nocemlist.php index 9554185..bfb26cc 100755 --- a/Rocksolid_Light/tools/nocem/nocemlist.php +++ b/Rocksolid_Light/tools/nocem/nocemlist.php @@ -1,45 +1,6 @@ #!/usr/bin/php "; -$organization = ""; -$from = "from_address "; -$from_email = " 0) { - $is_header = 0; + break; } if ($is_header == 1) { $lines ++; @@ -115,6 +76,7 @@ fwrite($nocem_file, "The GPG key needed to verify the signature of cancels\n"); fwrite($nocem_file, "issued by $from_email is available at:\n"); fwrite($nocem_file, "$key_location\n\n"); +fwrite($nocem_file, $statement."\n\n"); fwrite($nocem_file, "For information contact $contact.\n\n"); fwrite($nocem_file, "@@BEGIN NCM HEADERS\n"); @@ -133,4 +95,10 @@ foreach($nocem_list as $list) { fwrite($nocem_file, "@@END NCM BODY"); fclose($nocem_file); + +// Create nocempost.sh if it is older than config +if($create_post) { + file_put_contents($nocempost_filename, $nocempost); + chmod($nocempost_filename, 0700); +} ?> diff --git a/Rocksolid_Light/tools/nocem/nocempost.sh b/Rocksolid_Light/tools/nocem/nocempost.sh deleted file mode 100644 index 6bb8690..0000000 --- a/Rocksolid_Light/tools/nocem/nocempost.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -gpglocaluser="XXXXXXXX" -nntpserver="news.example.com" -nntpuser="nntpusername" -nntppassword="nntppassword" - -gpg2 --local-user $gpglocaluser --clearsign -a nocem.out - -newsserver=$nntpserver -today=$(date -u +%F-%H:%M) -id=$(od -xvAn -N8 < /dev/urandom | tr -cd 0-9a-f) -rpost $newsserver -U $nntpuser -P $nntppassword <<%end -$(