Rick_C137

joined 1 year ago
12
submitted 2 days ago* (last edited 2 days ago) by [email protected] to c/[email protected]
 

Hi,

I'm following my previous post
How encrypt email with a GnuPG public key ? [ solved ]

So I managed to encrypt the email body with GnuPG public key.. But I don't figure how I can do the same for the title ?!
ThunderBird manage it.. any idea how ?
asked on Official Thunderbird forum

Thanks.

[–] [email protected] 1 points 3 weeks ago (1 children)

I finally manage to encrypt the body trough ptyhon-gnupg ( warning their documentation is still in alpha stage. )

now, remain to encrypt the subject (ThunderBird compatible) if you have any clues I'm all ears

When time permit I will publish my code in a pastbin.

Wubba Lubba dub-dub**

[–] [email protected] 1 points 3 weeks ago* (last edited 3 weeks ago)

indeed, but a lot of Linux distribution come with it :)
otherwise it's installable.

[–] [email protected] 2 points 3 weeks ago* (last edited 3 weeks ago) (2 children)

instead of using a library I can directly use subprocess with gnupg but in both case it seem gnupg require to import the public key to the keyring !? I don't want that.

 

Hi,

I'm already using

from smtplib import SMTP_SSL
from email.message import EmailMessage

To send emails.

Now I would like to be able to encrypt them with the public key of the recipient. ( PublicKey.asc )

an A.I provide me this

import smtplib
from email.message import EmailMessage
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

# Load the ECC public key from the .asc file
with open('recipient_public_key.asc', 'rb') as key_file:
    public_key_bytes = key_file.read()
public_key = ec.EllipticCurvePublicKey.from_public_bytes(
    ec.SECP384R1(),
    public_key_bytes
)

# Create the email message
msg = EmailMessage()
msg.set_content('This is the encrypted email.')
msg['Subject'] = 'Encrypted Email'
msg['From'] = '[email protected]'
msg['To'] = '[email protected]'

# Encrypt the email message using the ECC public key
nonce = bytes.fromhex('000102030405060708090a0b0c0d0e0f')
cipher = AESGCM(public_key.public_key().secret_key_bytes)
ciphertext = cipher.encrypt(nonce, msg.as_bytes(), None)

# Send the encrypted email
server = smtplib.SMTP('smtp.example.com')
server.send_message(msg, from_addr='[email protected]', to_addr='[email protected]')
server.quit()

# Save the encrypted email to a file
with open('encrypted_email.bin', 'wb') as f:
    f.write(ciphertext)

I like the approach, only one "low level" import cryptography

but the code seem wrong. if the body has been encrypted as ciphertext I don't see this one included while sending the email.

How are you doing it ? or do you have good tutorial, documentations ? because I found nothing "pure and simple" meaning not with of unnecessary stuff.

Thanks.

 

cross-posted from: https://programming.dev/post/19958073

Hi,

I'm looking for a solution to archive files in a decentralized system. that would meet those requirement:

  • FLOSS
  • date-stamp the upload of the file.
  • immutable storage ~ WORM
  • anonymous (like TOR)

I was considering IPFS but it does not date-stamp the upload :'( you can make a description-file but this is unreliable, as you can set any date..

I'm lost between hyphanet.org and Freenet.org ?!
are those the same project ?

According to A.I:

Hyphanet is focused on secure, private, and efficient communication and data sharing, with an emphasis on enabling users to monetize their data while maintaining control over their data sovereignty.

is that true ? I can't found the information on their website...

 

Hi,

I'm looking for a solution to archive files in a decentralized system. that would meet those requirement:

  • FLOSS
  • date-stamp the upload of the file.
  • immutable storage ~ WORM
  • anonymous (like TOR)

I was considering IPFS but it does not date-stamp the upload :'( you can make a description-file but this is unreliable, as you can set any date..

I'm lost between hyphanet.org and Freenet.org ?!
are those the same project ?

According to A.I:

Hyphanet is focused on secure, private, and efficient communication and data sharing, with an emphasis on enabling users to monetize their data while maintaining control over their data sovereignty.

is that true ? I can't found the information on their website...

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago)

Thanks all for your input !

So yes /sdcard was /storage/emulated/0 and it's a real sd-card.

That was indeed formatted as FAT, I reformatted into EXT4 (from a desktop Linux) put the SD-card back into the phone and started the phone.

Ive tried (in the phone)

su
chmod 777 /storage/emulated/0 #yes it's still mounted as emulated !
stat /storage/emulated/0
#...
#Access: (0771)
#....

So I'm still blocked... any ideas ?

Thanks.

 

Hi,

I would like to change the owner of a directory on the sdcard /sdcard/aDirectory

I have a terminal installed on my Android 10 (LineageOS 17) com.android.terminal

sudo is not present so I use su and it works.

su
#Terminal was granted Superuser rights

cd /sdcard
chown 10:10 aDirectory
#I don't get any error message.

stat aDirectory
#Uid (0/root)

So the owner stay root no matter what I'm doing, any ideas ?

[–] [email protected] 1 points 1 month ago

I've found the most simple way (for my case) adb shell 'a command'

example

adb shell ls /
[–] [email protected] 1 points 1 month ago* (last edited 1 month ago) (1 children)

Thank you all for your input.. but it seem my question is still not fully answered...

let me rephrase, I'm not looking to have a GUI to transfer files, but I would like to execute terminal command remotely (from my computer) to my android phone. Like SSH .

So I've read that I can install a SSH server on my android phone.. (If you know some's (FLOSS), I'm all ears) Or if you know a better way than SSH I'm all ears too.

Thanks.

[–] [email protected] 9 points 1 month ago (1 children)

I've found

#container > div:not(div.barfoo)

seem to do the trick..

 

Hi everyone,

I have something like this

<div id="container">

    <div>
        <div class="foobar"></div>
    </div>

    <div>
        <div class="foobar"></div>
    </div>

    <div>
        <div class="foobar"></div>
        <div class="barfoo"></div>
    </div>

    <div>
        <div class="foobar"></div>
    </div>

    <div>
        <div class="foobar"></div>
    </div>

<div>

I would like to select all the #container > div (the childs of container)

that do not have a div.barfoo in their childs.

is it possible with CSS ?

I'm at

#container> div :not(div.barfoo) {} 

but this is not working, and will select anyway #container > div > div

Any ideas ?

 

Hi,

I created another user on my custom rom Android (aka Multiple users)

Unfortunately when doing so the system do not adapt the permission of the sdcard and some other directory, thus the new user can't access them :/

So I wanted to "remote" terminal into my android device from my computer.

How are you achieving this ? ( without 3thparty apps please ! )

Thanks.

-13
Mozilla - Devil Incarnate (programming.dev)
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 

Hi everyone,

Is there somewhere a list of all the changes made compared to Firefox ?

edit:

~~Sorry if it's been already asked over here, but it seem that Lemmy do not provide a search within a Community 😮~~

no, actually we can, there isn't a shortcut to make such a search. and no ability to limit the search to the titles..

*Wubba Lubba dub-dub*

 

cross-posted from: https://programming.dev/post/18360806

Hi everyone,

I would like to enable Cross-Origin Resource Sharing on my Nginx server. for few origins (cors requestor)/domains.

I've found this article https://www.juannicolas.eu/how-to-set-up-nginx-cors-multiple-origins that is nice, but not complete and on my browser seem really hard to read due to the layout 🤮

So I've opened a CodeBerg git repository for the good soul that want to perfect this piece of code the allow the most of use to use CORS with Nginx.

https://codeberg.org/R1ckSanchez_C137/BestOfxxx/src/branch/main/Nginx/CORS_MultiDomains.py

If you don't want to create an account on codeberg feel free to post your code here !

server {
    # Server

    map "$http_origin" $cors { # map in Nginx is somewhat like a switch case in a programming language.
        default ''; #Seem to set $cors to '' empty string if none of the follwing rexeg match ?
        "~^https:\/\/([\w-_\.]+\.)?example.com$" "$http_origin";
            #regex domain match
            # ~ mean I suppose the string is RegEx ?
            # Need to come with a RegEx expression that match https://anything.example.com[optional ports and Query string ?X=Y]
        "~^https:\/\/([\w-_\.]+\.)?example2.com$" "$http_origin"; #regex domain match
        }
               

    location /static {
        
        # if preflight request, we will cache it
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Max-Age' 1728000; #20 days
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204; #https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 }

        if ($cors != "") {
            add_header 'Access-Control-Allow-Origin' "$cors" always; # <-- Variable $cors
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With' always;}

       # configuration lines...

    }
}

}
 

cross-posted from: https://programming.dev/post/18360806

Hi everyone,

I would like to enable Cross-Origin Resource Sharing on my Nginx server. for few origins (cors requestor)/domains.

I've found this article https://www.juannicolas.eu/how-to-set-up-nginx-cors-multiple-origins that is nice, but not complete and on my browser seem really hard to read due to the layout 🤮

So I've opened a CodeBerg git repository for the good soul that want to perfect this piece of code the allow the most of use to use CORS with Nginx.

https://codeberg.org/R1ckSanchez_C137/BestOfxxx/src/branch/main/Nginx/CORS_MultiDomains.py

If you don't want to create an account on codeberg feel free to post your code here !

server {
    # Server

    map "$http_origin" $cors { # map in Nginx is somewhat like a switch case in a programming language.
        default ''; #Seem to set $cors to '' empty string if none of the follwing rexeg match ?
        "~^https:\/\/([\w-_\.]+\.)?example.com$" "$http_origin";
            #regex domain match
            # ~ mean I suppose the string is RegEx ?
            # Need to come with a RegEx expression that match https://anything.example.com[optional ports and Query string ?X=Y]
        "~^https:\/\/([\w-_\.]+\.)?example2.com$" "$http_origin"; #regex domain match
        }
               

    location /static {
        
        # if preflight request, we will cache it
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Max-Age' 1728000; #20 days
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204; #https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 }

        if ($cors != "") {
            add_header 'Access-Control-Allow-Origin' "$cors" always; # <-- Variable $cors
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With' always;}

       # configuration lines...

    }
}

}
3
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 

Hi everyone,

I would like to enable Cross-Origin Resource Sharing on my Nginx server. for few origins (cors requestor)/domains.

I've found this article https://www.juannicolas.eu/how-to-set-up-nginx-cors-multiple-origins that is nice, but not complete and on my browser seem really hard to read due to the layout 🤮

So I've opened a CodeBerg git repository for the good soul that want to perfect this piece of code the allow the most of use to use CORS with Nginx.

https://codeberg.org/R1ckSanchez_C137/BestOfxxx/src/branch/main/Nginx/CORS_MultiDomains.py
and
https://codeberg.org/R1ckSanchez_C137/BestOfxxx/issues \

If you don't want to create an account on codeberg feel free to post your code here !

server {
    # Server

    map "$http_origin" $cors { # map in Nginx is somewhat like a switch case in a programming language.
        default ''; #Seem to set $cors to '' empty string if none of the follwing rexeg match ?
        "~^https:\/\/([\w-_\.]+\.)?example.com$" "$http_origin";
            #regex domain match
            # ~ mean I suppose the string is RegEx ?
            # Need to come with a RegEx expression that match https://anything.example.com[optional ports and Query string ?X=Y]
        "~^https:\/\/([\w-_\.]+\.)?example2.com$" "$http_origin"; #regex domain match
        }
               

    location /static {
        
        # if preflight request, we will cache it
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Max-Age' 1728000; #20 days
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204; #https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204 }

        if ($cors != "") {
            add_header 'Access-Control-Allow-Origin' "$cors" always; # <-- Variable $cors
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
            add_header 'Access-Control-Allow-Headers' 'Accept, Authorization, Cache-Control, Content-Type, DNT, If-Modified-Since, Keep-Alive, Origin, User-Agent, X-Requested-With' always;}

       # configuration lines...

    }
}

}
[–] [email protected] 2 points 2 months ago
setfacl -m m:r aFile
#re set the mask

solve the problem, but the question is: why the F**** this is happening !?

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago) (2 children)

Update, this is only happening when I copy files from a ~SMB share... :'(
Otherwise it's correct...

[–] [email protected] 5 points 2 months ago (5 children)
[–] [email protected] 1 points 3 months ago

Thank you all !

Indeed setting execute perm on example, sub1, sub2, static

The program/user have now access to the directory.

In order words all the parents directory need at least execute in order to have access in the targeted directory...

Now I gave 751 for static. Meaning than others (here nginx) cannot list the files within. But never the less it works
the static files are appearing when requested (HTTP) but forbidding nginx to list the directory is changing something ? (performance/security)

Thanks

[–] [email protected] 1 points 4 months ago* (last edited 4 months ago)

I wanted to have a default server that catch ~wrong DNS query to the server

Solution

I don't know how to link to my previous lemmy post, so here it is again

server {
    listen 443 ssl;
    server_name _;
    ssl_certificate /etc/nginx/ssl/catchall.crt;
    ssl_certificate_key /etc/nginx/ssl/catchall.key;

    error_page 404 /404_CatchAll.html;

    # Everything is a 404
    location / {
        return 404;
    }

    location /404_CatchAll.html {root /var/www/html/;}
}

view more: next ›