Difference between revisions of "User:Admin"

From FRC11 - Mentor Wiki
Jump to navigation Jump to search
Line 48: Line 48:
 
'''Force users to connect using HTTPS and turn on HSTS:'''
 
'''Force users to connect using HTTPS and turn on HSTS:'''
  
−
Create .htaccess files in the sub-folder of the website and put this text in the file:
+
Apache: Create .htaccess files in the sub-folder of the website and put this text in the file:
  
 
  Header set Strict-Transport-Security "max-age=300" env=HTTPS
 
  Header set Strict-Transport-Security "max-age=300" env=HTTPS
Line 55: Line 55:
 
  RewriteRule ^(.*)$ <nowiki>https://{replace with relevant URL}/$1</nowiki> [R=301,L]
 
  RewriteRule ^(.*)$ <nowiki>https://{replace with relevant URL}/$1</nowiki> [R=301,L]
  
 +
Nginx: Edit nginx.conf and make it look like the following:
 +
server {
 +
  listen 443 ssl;
 +
  # Put this HSTS line here for it to wrap all locations that don't have their own defines.
 +
  add_header Strict-Transport-Security "max-age=300" env=HTTPS
 +
 +
  location / {
 +
    # Put this HSTS line in the location section if that section defines other headers like proxies.
 +
    add_header Strict-Transport-Security "max-age=300" env=HTTPS
 +
    rewrite ^(.*)$ https://{replace with relevant URL}/$1
 +
    redirect;
 +
}
  
 
'''MediaWiki notes:'''
 
'''MediaWiki notes:'''

Revision as of 21:25, 28 July 2018

Administration Control Panel - [1]

Changes to block new user creation:

Need to edit: /home/wasteam8/public_html/mentor.wiki/LocalSettings.php

Add this to the bottom:

# Regulate user group permissions.
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = false;
$wgGroupPermissions['administrators']['createaccount'] = false;

Need to edit: /home/wasteam8/public_html/mentor.wiki/includes/specials/SpecialCreateAccount.php

Edit this function:

public function userCanExecute( User $user ) {
  /**
   * return $user->isAllowed( 'createaccount' );
  */
  global $wgUser;
  if ( $wgUser->isLoggedIn() ) {
    return $user->isAllowed( 'createaccount' );
  } else {
    return false;
  }
 }

This will block non-logged-in users from viewing the content if the user group isn't configured in the LocalSettings.php. Can be used in other things as well.

Relevant Links:

https://lists.gt.net/wiki/mediawiki/126271
https://www.mediawiki.org/wiki/Manual:Special_pages#Constructor
https://www.mediawiki.org/wiki/Manual:LocalSettings.php#User_rights
https://www.mediawiki.org/wiki/Manual:User_rights#Example
https://stackoverflow.com/questions/219135/how-do-i-create-my-own-custom-group-in-mediawiki
https://www.mediawiki.org/wiki/Topic:Qji4lqoeaodggoft
https://www.mediawiki.org/wiki/Topic:Pl8qrwn9l15vc0ex
https://doc.wikimedia.org/mediawiki-core/master/php/classUser.html
https://www.mediawiki.org/wiki/Extension%3aAccessControl


Force users to connect using HTTPS and turn on HSTS:

Apache: Create .htaccess files in the sub-folder of the website and put this text in the file:

Header set Strict-Transport-Security "max-age=300" env=HTTPS
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://{replace with relevant URL}/$1 [R=301,L]

Nginx: Edit nginx.conf and make it look like the following:

server {
  listen 443 ssl;
  # Put this HSTS line here for it to wrap all locations that don't have their own defines.
  add_header Strict-Transport-Security "max-age=300" env=HTTPS
  location / {
    # Put this HSTS line in the location section if that section defines other headers like proxies.
    add_header Strict-Transport-Security "max-age=300" env=HTTPS
    rewrite ^(.*)$ https://{replace with relevant URL}/$1
    redirect;
}

MediaWiki notes:

    1. To make code blocks, indent the content with at least 1 space.
    2. To put URLs into code blocks without being acted upon use < nowiki > < /nowiki > tags (remove the spaces inside the symbols), this bypasses a MediaWiki throw back called magic links (community wants to end this function anyway).
    3. To make numbered lists, start the list with < ol start > < /ol start > tags (remove the spaces inside the symbols), then start each line with a hashtag.
    4. MediaWiki logos should be around 100 pixels wide and 150 pixels tall.
    5. MediaWiki logos go in the folder: /home/wasteam8/public_html/mentor.wiki/resources/assets
    6. Edit LocalSettings.php and change the $wgLogo variable to set the logo.
    7. Colons at the start of a line cause indents, more colons, more tab stops. They also reset the list counts.

Relevant links:

https://www.mediawiki.org/wiki/Help:Formatting


How to generate a GPG public/private key pair to get SSH keys:

    1. For Windows download GPG4Win: https://gpg4win.org/download.html. Don't panic when it asks for a donation, select PayPal and $0.
    2. During install select your language, usually English.
    3. Then uncheck the check boxes next to GPA and GpgOL.
    4. Accept the defaults till the installation closes.
    5. This will create a red dot in the notification area of your start menu with a small white tea cup on it.
    6. Double click the Kleopatra icon a dialog will open.
    7. Click the 'File' menu.
    8. Click 'New Key Pair'.
    9. Click 'Create a personal OpenPGP key pair'.
    10. Provide a name.
    11. Provide a valid e-mail.
    12. In advanced settings you can change the details of the keys, the defaults are RSA 2048bits. You can also set an expiration for these certificate.
    13. Set a passphrase that will be later be used like a password to use the private key you are generating.
    14. Click 'Finish' on the final menu after the keys are made.
    15. Right click on the keys you just created.
    16. Select 'Export' to export the public key.
    17. Put the file into a folder where you can find it.
    18. Name it something like: 'Public-Key_7-28-2018.asc'
    19. Send that file as an attachment to: 'techhelpbb@gmail' as part of the SSH request.
    20. I'll generate you an SSH key and encrypt it with your public key.
    21. Then e-mail the encrypted file back to you where you can decrypt it, first save it to a known folder.
    22. To decrypt the file in Kleopatra open the Kleopatra dialog again by double clicking on the icon.
    23. On the large buttons at the top of the dialog select 'Decrypt/Verify'.
    24. Find the e-mail attachment you saved in the previous step.
    25. After a brief delay the program should ask you if you want to 'Save All' and at the top of the dialog ask you where.
    26. Specify a location you prefer for the output and click 'Save All'.

Relevant links:

https://www.dash.org/forum/threads/basic-guide-to-pgp-on-windows-pc-kleopatra-%E2%80%93-gpg4win.4086/