8 – How can I limit access to static pages in my project?

I have a site I created with Drupal 8, lets say https://example.com/.

I have “embedded” a static site (a bunch of static pages linked to each other) as a “subsite” of example.com, i.e. accessible as https://example.com/whatever/, by ‘simply’ putting all its files in a subfolder of the D8 site, i.e. docroot/whatever.
I’d like to limit access to this “subsite” to the users that are registered to my D8 site.

How can I do that?

root access – Rooting android device without internet connection

I need to root my Samsung s10 with android 10, but without internet connection to the device. I can download all necessary files to my PC and connect the device to the PC (use ADB Odin), but the device itself doesn’t have an internet connection.

I know the best tool to root android is Magisk, but from what I understood it must have internet connectionn. Does anyone know how can I do that? maybe use Magisk in some other way?…

Thanks

javascript – Checking if the access token is valid or expired

Welcome to Code Review!

As I already mentioned in comments, epoch values can be treated as normal numerals, without having to involve momentjs or other external libraries.

In js, you can get current epoch value in milliseconds accuracy using Date.now(). The value in token is with seconds accuracy. It is only a factor of 1000.

Rewrite

/**
The token object passed in the function looks like this:
{
  access_token: '2hbssMdXDpwQX5WcnZ-iJlO754MLkEeDCmF-f1A-MaU',
  token_type: 'Bearer',
  expires_in: 604800,
  refresh_token: 'VxnN9uBVIcNMpuwRVpvXo2YxWuNFEayHqfnCM7aCTSI',
  scope: 'public',
  created_at: 1603604241
}
*/

export default function tokenValid(token = {}) {
  const now = Date.now() / 1000;
  const expiry = token.created_at + token.expires_in;
  return now < expiry;
}

EDIT

In response to the comment:

Changed

// from
parseInt(Date.now() / 1000)
// to
Date.now() / 1000

In the case here, Math.floor or Math.round are more suitable. parseInt is usually called when you want to convert from string to integer. We already know that Date.now() is giving a number and not a string. Also, the conversion/rounding is not really needed here.

How to limit access to a subsite of my Drupal 8 site?

I have a site I created with Drupal 8, lets say http://falzon.xyz/.
I have “embedded” a static site (a bunch of static pages linked to each other) as a “subsite” of falzon.xyz, i.e. accessible as http://falzon.xyz/whatever/, by ‘simply’ putting all its files in a subfolder of the D8 site, i.e. docroot/whatever.
I’d like to limit access to this “subsite” to the users that are registered to my D8 site.
How can I do that?

root access – Best adb command and system tweaks for non rooted phone to get closer to rooted experience

As I always owned rooted phones I find frustrating living with all the limitations of non-rooted phones.

I would like to list here all the adb commands you can issue and system settings you can tweak to get your non-rooted phone experience closer to a rooted one. In a way decreasing “security” when connected to a PC.

Especially targeting Android 10+

Of course we all know everything starts enabling Developer Options and USB Debug

I can execute some pm disable package or pm uninstall package to get rid of some bloat system apps.

Then I can do some setting put global parameter n to tweak some system settings.
I.E. setting put global dropbox_max_files 9 limits the number of files in /data/system/dropbox directory (unaccessible) to 9 instead of hundreds (if not thousands).
Dropbox app not installed, but there is log activity in /data/system/dropbox

Finally there’s pm grant com.package.name android.permission.WRITE_SECURE_SETTINGS to play with…

www.domain.com is working but "domain.com" is access denied

  1. s3 bucket

    • Main bucket — domain.com
    • redirect bucket — www(dot)domain.com
  2. bucket policy — restricted access in cloudfront,
    so policy only include "getobject" through cloudfront in both domain.com & www(dot)domain.com

  3. cname

    • domain.com cname — www.domain.com
    • www.domain.com cname — domain.com
  4. cloudfront

    • domain.com — domain.com.s3.amazonaws.com
    • www.domain.com — www.domain.com.s3.amazonaws.com
  5. Error pages 403 forbidden

    • redirect to "/index.html"
    • 402 OK
  6. If i check ping

    • domain.com — ping fine, 0% loss
    • www.domain.com — ping fine. 0% loss
  7. whatsmydns.net — general behavior

    • domain.com — not working in few locations, rest are pinging good
    • www.domain.com — not working in few locations, rest are pinging good
  8. index.html specified as index document/error document in domain.com s3 bucket

  9. index.html specified as root object in both domain.com & www.domain.com

How does the rsync daemon handle simultaneous access to the file?

In order to give different permission to different users. I have module like this:

[cvs]
    path = /data/cvs
    comment = example
    uid = rsyncbackup
    gid = rsyncbackup
    read only = no
    list = yes
    auth users = , guest1:ro, guest2:ro, admin1:rw, admin2:rw
    secrets file = /etc/rsyncd.secrets
  • There will not be any problem if both guest1 and guest2 are connected, since they are all read only.
  • What will happen if both guest1 and admin1 connect to the daemon? since admin1 is modifying the files and the guest1 is reading from it. Will there be racing? I can of course limit the max connection to 1. But this is inefficient when only ro users want to connect. Is there lock to prevent other user to connect when a rw user connect to the daemon? Is there options to only allow single rw user to connect but allow multiple ro users to connect?
  • what will happen if both admin1 and admin2 connect to the daemon? Both admin want to modify the path, is there lock prevent later one modify anything before the first one drops connection? Or is there lock to prevent multiple user modify the same file but still allow them modify different files?
  • what will happen if multiple ips try to connect to the daemon with same user for example admin1?

networking – WIFI Access point in Kali linux – Alfa AWUS1900

I am using kali linux 5.8.0-kali2-amd64 and its upto date no broken or missing package is there and I have connected to wlan0 and it has Internet access too. I Am using alfa awus1900 as my usb wireless adapter and what to setup a access point with my adapter and its working perfectly and its in mint condition brought it one day before. Also don’t have any issues with connecting to WiFi and I have tried creating a hot-spot as mentioned here https://unix.stackexchange.com/questions/458057/how-to-create-a-wifi-hotspot-share-a-connection-on-kali-linux it also create a access point and I got connected but it shows no Internet in my mobile. What should I need to do for routing from Internet from wlan0 to wlan1.

My configuration files

/etc/dnsmasq.conf

bind-interfaces
# Choose interface for binding
interface=wlan1
# Specify range of IP addresses for DHCP leasses
dhcp-range=192.168.150.2,192.168.150.10

/etc/hostapd.conf

interface=wlan1
# Select driver
driver=nl80211
# Set access point name
ssid=. 
# Set access point harware mode to 802.11g
hw_mode=g
# Set WIFI channel (can be easily changed)
channel=6
# Enable WPA2 only (1 for WPA, 2 for WPA2, 3 for WPA + WPA2)
wpa=2
wpa_passphrase=password

Near my wlan0 is my internal NIC and wlan1 is Alfa Awus1900 what should I need to change to make hot-spot route Internet from wlan0 to wlan1