25-03-2025
This commit is contained in:
@@ -183,3 +183,23 @@ batch
|
||||
yes
|
||||
```
|
||||
|
||||
|
||||
|
||||
### gpg: WARNING: unsafe permissions on homedir '/var/services/homes/bruno/.gnupg'
|
||||
|
||||
```bash
|
||||
$ chown -R $(whoami) ~/.gnupg/
|
||||
$ find ~/.gnupg -type f -exec chmod 600 {} \;
|
||||
$ find ~/.gnupg -type d -exec chmod 700 {} \;
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### gpg: WARNING: server 'gpg-agent' is older than us (2.2.41 < 2.4.5)
|
||||
|
||||
gpg: problem with fast path key listing: Erreur de paramètre IPC - ignored
|
||||
|
||||
```bash
|
||||
$ gpgconf --kill all
|
||||
```
|
||||
|
||||
|
||||
@@ -69,6 +69,85 @@ bundle services
|
||||
|
||||
|
||||
|
||||
##### **brew bundle**
|
||||
|
||||
Usage: brew bundle [subcommand]
|
||||
|
||||
Bundler pour les dépendances non-Ruby provenant de Homebrew, Homebrew Cask, Mac App Store, Whalebrew et Visual Studio Code.
|
||||
|
||||
**brew bundle [install]:**
|
||||
Install and upgrade (by default) all dependencies from the Brewfile.
|
||||
|
||||
You can specify the Brewfile location using --file or by setting the $HOMEBREW_BUNDLE_FILE environment variable.
|
||||
|
||||
You can skip the installation of dependencies by adding space-separated values to one or more of the following environment variables:
|
||||
$HOMEBREW_BUNDLE_BREW_SKIP, $HOMEBREW_BUNDLE_CASK_SKIP, $HOMEBREW_BUNDLE_MAS_SKIP, $HOMEBREW_BUNDLE_WHALEBREW_SKIP,
|
||||
$HOMEBREW_BUNDLE_TAP_SKIP.
|
||||
|
||||
**brew bundle upgrade:**
|
||||
Shorthand for brew bundle install --upgrade.
|
||||
|
||||
**brew bundle dump:**
|
||||
Write all installed casks/formulae/images/taps into a Brewfile in the current directory or to a custom file specified with the --file option.
|
||||
|
||||
**brew bundle cleanup:**
|
||||
Uninstall all dependencies not present in the Brewfile.
|
||||
|
||||
This workflow is useful for maintainers or testers who regularly install lots of formulae.
|
||||
|
||||
Unless --force is passed, this returns a 1 exit code if anything would be removed.
|
||||
|
||||
**brew bundle check:**
|
||||
Check if all dependencies present in the Brewfile are installed.
|
||||
|
||||
This provides a successful exit code if everything is up-to-date, making it useful for scripting.
|
||||
|
||||
**brew bundle list:**
|
||||
List all dependencies present in the Brewfile.
|
||||
|
||||
By default, only Homebrew formula dependencies are listed.
|
||||
|
||||
**brew bundle edit:**
|
||||
Edit the Brewfile in your editor.
|
||||
|
||||
**brew bundle exec command:**
|
||||
Run an external command in an isolated build environment based on the Brewfile dependencies.
|
||||
|
||||
This sanitized build environment ignores unrequested dependencies, which makes sure that things you didn't specify in your Brewfile won't get picked up by commands like bundle install, npm install, etc. It will also add compiler flags which will help with finding keg-only dependencies like openssl, icu4c, etc.
|
||||
|
||||
**brew bundle sh:**
|
||||
Run your shell in a brew bundle exec environment.
|
||||
|
||||
**brew bundle env:**
|
||||
Print the environment variables that would be set in a brew bundle exec
|
||||
environment.
|
||||
|
||||
##### **brew fetch**
|
||||
|
||||
Usage: brew fetch [options] formula|cask [...]
|
||||
|
||||
Télécharger une bottle (si disponible) ou les paquets sources pour les formules et les binaires pour les casks. Pour les fichiers, imprimer également les sommes de contrôle SHA-256.
|
||||
|
||||
##### **brew gist-logs**
|
||||
|
||||
Usage: brew gist-logs [options] formula
|
||||
|
||||
Transfère les logs d'un échec de construction de la formule vers un nouveau Gist. Présente un message d'erreur si aucun journal n'est trouvé.
|
||||
|
||||
##### **brew home**
|
||||
|
||||
Usage: brew home, homepage [--formula] [--cask] [formula|cask ...]
|
||||
|
||||
Ouvrir la page d'accueil d'une formule ou d'un cask dans un navigateur, ou ouvrir la page d'accueil de Homebrew si aucun argument n'est fourni.
|
||||
|
||||
##### **brew info**
|
||||
|
||||
Usage: brew info, abv [options] [formula|cask ...]
|
||||
|
||||
Affiche de brèves statistiques sur votre installation Homebrew. Si une formule ou un cask est fournie, afficher un résumé des informations la concernant.
|
||||
|
||||
|
||||
|
||||
### Formules:
|
||||
|
||||
#### Mettre à jour une formule:
|
||||
|
||||
16
docs/macos/homebrew/commandes.md
Normal file
16
docs/macos/homebrew/commandes.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# commandes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### immich
|
||||
|
||||
```bash
|
||||
$ immich login https://immich.photos-nas.ovh aYGUwGZXDJins0zLCjio7zEleblSFw5R27DqqLQM
|
||||
```
|
||||
|
||||
```bash
|
||||
$ immich upload /Users/bruno/Pictures/_Canon/Export/2024/Aout/2024-0807_Chevrette_1413.jpg
|
||||
```
|
||||
|
||||
@@ -49,7 +49,7 @@ $ nvm --version
|
||||
#### Avec git (méthode officielle):
|
||||
|
||||
```bash
|
||||
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.40.1/install.sh | bash
|
||||
```
|
||||
|
||||
Le script d'installation ajoute les lignes suivantes à votre profil (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).
|
||||
@@ -64,7 +64,7 @@ export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
|
||||
Relancer le script d'installation
|
||||
|
||||
```bash
|
||||
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
|
||||
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
```
|
||||
|
||||
|
||||
@@ -85,13 +85,15 @@ $ nvm install 8.9.4
|
||||
# la dernière version 6
|
||||
$ nvm install 6
|
||||
|
||||
# la dernière version LTS (v16)
|
||||
$ nvm install --lts=gallium
|
||||
|
||||
# la dernière version LTS (v18)
|
||||
$ nvm install --lts=hydrogen
|
||||
|
||||
# la dernière version LTS (v20)
|
||||
$ nvm install --lts=iron
|
||||
```
|
||||
|
||||
https://nodejs.org/fr/about/previous-releases
|
||||
|
||||
Mettre à jour NodeJS et réinstaller les paquets.
|
||||
|
||||
```bash
|
||||
|
||||
@@ -226,8 +226,64 @@ Il est recommandé d'installer les modules suivants:
|
||||
- Term::ReadLine::Perl (réclamé par le shell cpan)
|
||||
|
||||
- CPAN::DistnameInfo (réclamé par l'installeur de module)
|
||||
- Log::Log4perl
|
||||
- Log::Log4perl (pas installé le 3/9/24)
|
||||
|
||||
|
||||
|
||||
###
|
||||
#####Mettre à jour tous les modules:
|
||||
|
||||
Lancer le shell cpan:
|
||||
|
||||
```bash
|
||||
$ cpan
|
||||
```
|
||||
|
||||
puis
|
||||
|
||||
```bash
|
||||
cpan[1]> upgrade /(.*)/
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Erreur après mise-à-jour de tous les modules:
|
||||
|
||||
```bash
|
||||
$ exiftool -j /Users/bruno/Pictures/_Canon/Export/2024/Juillet/2024-07-13_Cerfs_9771.jpg
|
||||
|
||||
ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0x10200080, needed 0xfb80080)
|
||||
```
|
||||
|
||||
```bash
|
||||
brew uninstall perl
|
||||
rm -rf $HOME/perl5
|
||||
brew install perl
|
||||
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
|
||||
|
||||
cpan -i App::pmuninstall
|
||||
cpan -i App::cpanoutdated
|
||||
```
|
||||
|
||||
|
||||
|
||||
##### perl-migrate-modules
|
||||
|
||||
```bash
|
||||
$ cpan App::MigrateModules
|
||||
```
|
||||
|
||||
```bash
|
||||
$ perl-migrate-modules --from perl5_old /usr/bin/perl
|
||||
|
||||
# Don't be alarmed by passing /usr/bin/perl as the destination of perl-migrate-modules. As long as you have the local::lib environment variables configured, it'll make a new ~/perl5 directory (or whatever you have it set to) and migrate the modules into that folder.
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
perl -MCPAN -e 'recompile()'
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://stackoverflow.com/questions/11680500/how-to-upgrade-perl-modules-that-install-from-cpan/11680539
|
||||
|
||||
@@ -67,6 +67,14 @@ $ pipx install 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,g
|
||||
|
||||
|
||||
|
||||
#### Installer un paquet avec une version précise de python:
|
||||
|
||||
```bash
|
||||
$ pipx install mac-cleanup --python /opt/homebrew/opt/python@3.11/libexec/bin/python3
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Exécuter un paquet sans l'installer:
|
||||
|
||||
```bash
|
||||
|
||||
53
docs/macos/python/python3_pep668.md
Normal file
53
docs/macos/python/python3_pep668.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Python 3 (PEP 668)
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ brew install python@3.12
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
❯ python3.12 -m pip install --upgrade pip
|
||||
error: externally-managed-environment
|
||||
|
||||
× This environment is externally managed
|
||||
╰─> To install Python packages system-wide, try brew install
|
||||
xyz, where xyz is the package you are trying to
|
||||
install.
|
||||
|
||||
If you wish to install a Python library that isn't in Homebrew,
|
||||
use a virtual environment:
|
||||
|
||||
python3 -m venv path/to/venv
|
||||
source path/to/venv/bin/activate
|
||||
python3 -m pip install xyz
|
||||
|
||||
If you wish to install a Python application that isn't in Homebrew,
|
||||
it may be easiest to use 'pipx install xyz', which will manage a
|
||||
virtual environment for you. You can install pipx with
|
||||
|
||||
brew install pipx
|
||||
|
||||
You may restore the old behavior of pip by passing
|
||||
the '--break-system-packages' flag to pip, or by adding
|
||||
'break-system-packages = true' to your pip.conf file. The latter
|
||||
will permanently disable this error.
|
||||
|
||||
If you disable this error, we STRONGLY recommend that you additionally
|
||||
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
|
||||
file. Failure to do this can result in a broken Homebrew installation.
|
||||
|
||||
Read more about this behavior here: <https://peps.python.org/pep-0668/>
|
||||
|
||||
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
||||
hint: See PEP 668 for the detailed specification.
|
||||
|
||||
[notice] A new release of pip is available: 24.0 -> 24.1.1
|
||||
[notice] To update, run: python3.12 -m pip install --upgrade pip
|
||||
|
||||
```
|
||||
|
||||
@@ -231,7 +231,7 @@ soco-cli ❯ deactivate
|
||||
soco-cli version: 0.4.52
|
||||
soco version: 0.28.0
|
||||
python version: 3.10.8
|
||||
command path: /Users/bruno/Documents/venv/soco-cli/bin/soco
|
||||
command path:
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,8 @@ Agent pid 2876
|
||||
Ajouter la clé à ssh-agent:
|
||||
|
||||
```bash
|
||||
$ ssh-add -K ~/.ssh/id_rsa
|
||||
$ ssh-add -K ~/.ssh/id_rsa # Déprécié
|
||||
$ ssh-add --apple-use-keychain ~/.ssh/id_rsa
|
||||
Enter passphrase for /Users/bruno/.ssh/id_rsa:
|
||||
Identity added: /Users/bruno/.ssh/id_rsa (/Users/bruno/.ssh/id_rsa)
|
||||
```
|
||||
|
||||
@@ -85,7 +85,7 @@ Créer une .plist:
|
||||
La copier dans `$HOME/Library/LaunchAgent`
|
||||
|
||||
```bash
|
||||
cp com.update-motd.plist /Users/bruno/Library/LaunchAgents/
|
||||
cp com.bruno21.update-motd.plist /Users/bruno/Library/LaunchAgents/
|
||||
```
|
||||
|
||||
puis la charger:
|
||||
@@ -109,6 +109,24 @@ launchctl load -w /Users/bruno/Library/LaunchAgents/com.bruno21.update-motd.plis
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
cp update-motd.sh ${HOME}/.local/bin/
|
||||
```
|
||||
|
||||
```bash
|
||||
# test
|
||||
|
||||
~/.local/bin
|
||||
➜ ./update-motd.sh
|
||||
./update-motd.sh: line 46: /etc/motd: Permission denied
|
||||
|
||||
# si erreur: /Users/bruno/.local/bin/update-motd.sh: line 46: /etc/motd: Permission denied
|
||||
sudo touch /etc/motd
|
||||
sudo chmod 666 /etc/motd
|
||||
```
|
||||
|
||||
|
||||
|
||||
https://apple.stackexchange.com/questions/392789/launchctl-plist-has-a-stderr-that-talks-about-how-getcwd-operation-not-permitted?newreg=7f5230c960a74d99b1105a9f66d9cfa2
|
||||
|
||||
https://rakhesh.com/mac/macos-launchctl-commands/
|
||||
|
||||
@@ -26,6 +26,19 @@ You have mail in /var/mail/bruno
|
||||
|
||||
Taper d 1 (delete) pour supprimer le message
|
||||
|
||||
```bash
|
||||
$ mail
|
||||
Mail version 8.1 6/6/93. Type ? for help.
|
||||
"/var/mail/bruno": 3 messages 3 new
|
||||
>N 1 MAILER-DAEMON@airboo Sat Aug 3 09:37 75/2510 "Undelivered Mail Returned to Sender"
|
||||
N 2 MAILER-DAEMON@airboo Wed Aug 21 18:25 75/2510 "Undelivered Mail Returned to Sender"
|
||||
N 3 MAILER-DAEMON@airboo Wed Aug 21 18:25 75/2510 "Undelivered Mail Returned to Sender"
|
||||
|
||||
d 1 # (delete) pour supprimer le message
|
||||
d * # pour supprimer tous les messages
|
||||
q # pour quitter
|
||||
```
|
||||
|
||||
**Solution 2**
|
||||
|
||||
```bash
|
||||
|
||||
160
docs/macos/webserver/geoipfast.md
Normal file
160
docs/macos/webserver/geoipfast.md
Normal file
@@ -0,0 +1,160 @@
|
||||
# geoipfast
|
||||
|
||||
|
||||
|
||||
Version:
|
||||
|
||||
```bash
|
||||
$ geoip2fast -v
|
||||
GeoIP2Fast v1.2.2 Usage: geoip2fast.py [-h] [-v] [-d] [-i] [data_filename_to_be_used] <ip_address_1>,<ip_address_2>,<ip_address_N>,...
|
||||
```
|
||||
|
||||
Self-test:
|
||||
|
||||
```bash
|
||||
$ geoip2fast geoip2fast-city-asn.dat.gz --self-test-city
|
||||
GeoIP2Fast v1.2.2 is ready! geoip2fast-city-asn.dat.gz loaded with 2.405.140 networks in 0.25481 seconds and using 268.59 MiB.
|
||||
|
||||
Starting a self-test...
|
||||
|
||||
> x37,106,248,137 <invalid ip address> [0.000017000 sec] Cached > [0.000003042 sec]
|
||||
> 90.120.130.164/32 <invalid ip address> [0.000002542 sec] Cached > [0.000001209 sec]
|
||||
> 23.172.161.24 -- <not found in database> [0.000027041 sec] Cached > [0.000001750 sec]
|
||||
> 192.168.134.8 -- Private Network Class C [0.000044917 sec] Cached > [0.000006208 sec]
|
||||
> 61.158.159.224 CN China [0.000039167 sec] Cached > [0.000004166 sec] Shangqiu
|
||||
> 51.251.173.172 GB United Kingdom [0.000022625 sec] Cached > [0.000002917 sec]
|
||||
> 176.134.67.240 FR France [0.000020708 sec] Cached > [0.000003834 sec] Les Touches
|
||||
> 118.34.78.111 KR South Korea [0.000019292 sec] Cached > [0.000004084 sec] Seosan City
|
||||
|
||||
Self-test with 30 randomic IPv4 addresses.
|
||||
- Average Lookup Time: 0.000025018 seconds.
|
||||
- Average Cached Lookups: 0.000004118 seconds.
|
||||
```
|
||||
|
||||
```bash
|
||||
$ geoip2fast --self-test-city
|
||||
GeoIP2Fast v1.2.2 is ready! geoip2fast.dat.gz loaded with 494.069 networks in 0.02374 seconds and using 31.25 MiB.
|
||||
|
||||
Starting a self-test...
|
||||
|
||||
> x14,15,17,31 <invalid ip address> [0.000012000 sec] Cached > [0.000002959 sec]
|
||||
> 59.92.124.53/32 <invalid ip address> [0.000002208 sec] Cached > [0.000001166 sec]
|
||||
> 23.172.162.217 -- <not found in database> [0.000019792 sec] Cached > [0.000001583 sec]
|
||||
> 172.31.55.201 -- Private Network Class B [0.000018125 sec] Cached > [0.000002958 sec]
|
||||
> 1.250.34.180 KR South Korea [0.000010416 sec] Cached > [0.000001459 sec]
|
||||
> 62.138.239.182 DE Germany [0.000011333 sec] Cached > [0.000001375 sec]
|
||||
> 192.46.25.17 US United States [0.000011458 sec] Cached > [0.000001334 sec]
|
||||
> 83.125.115.33 DE Germany [0.000011792 sec] Cached > [0.000001416 sec]
|
||||
> 81.58.16.237 NL The Netherlands [0.000015500 sec] Cached > [0.000002208 sec]
|
||||
> 32.187.65.34 US United States [0.000013208 sec] Cached > [0.000001625 sec]
|
||||
> 77.152.80.234 FR France [0.000012500 sec] Cached > [0.000001583 sec]
|
||||
> 93.9.4.164 FR France [0.000009959 sec] Cached > [0.000001375 sec]
|
||||
> 7.231.125.137 US United States [0.000011500 sec] Cached > [0.000001334 sec]
|
||||
|
||||
Self-test with 30 randomic IPv4 addresses.
|
||||
- Average Lookup Time: 0.000011775 seconds.
|
||||
- Average Cached Lookups: 0.000001539 seconds.
|
||||
```
|
||||
|
||||
Mise-à-jour des bases:
|
||||
|
||||
```bash
|
||||
$ geoip2fast --update-file geoip2fast-city-asn.dat.gz
|
||||
geoip2fast-city-asn.dat.gz
|
||||
|
||||
# Allowed values:
|
||||
# geoip2fast.dat.gz OR geoip2fast-ipv6.dat.gz OR
|
||||
# geoip2fast-asn.dat.gz OR geoip2fast-asn-ipv6.dat.gz OR
|
||||
# geoip2fast-city.dat.gz OR geoip2fast-city-ipv6.dat.gz OR
|
||||
# geoip2fast-city-asn.dat.gz OR geoip2fast-city-asn-ipv6.dat.gz
|
||||
```
|
||||
|
||||
|
||||
|
||||
Le fichier data par défaut:
|
||||
|
||||
```bash
|
||||
$ geoip2fast -i
|
||||
{
|
||||
"database_content": "Country with IPv4 only",
|
||||
"database_fullpath": "/Users/bruno/.local/pipx/venvs/geoip2fast/lib/python3.12/site-packages/geoip2fast/geoip2fast.dat.gz",
|
||||
"file_size": 1192502,
|
||||
"uncompressed_file_size": 4970211,
|
||||
"source_info": "MAXMIND:GeoLite2-Country-IPv4-en-20240618",
|
||||
"dat_version": 120,
|
||||
"country": {
|
||||
"main_index_size": 99,
|
||||
"first_ip_list_size": 494069,
|
||||
"country_code_id_list_size": 494069,
|
||||
"netlength_list_size": 494069,
|
||||
"country_names": 267,
|
||||
"ipv4_networks": 494069,
|
||||
"ipv6_networks": 0,
|
||||
"number_of_chunks": 99,
|
||||
"chunk_size": 5000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
On choisit le fichier data:
|
||||
|
||||
```bash
|
||||
# Fibre
|
||||
|
||||
$ geoip2fast 86.235.4.116 geoip2fast-city-asn.dat.gz
|
||||
{
|
||||
"ip": "86.235.4.116",
|
||||
"country_code": "FR",
|
||||
"country_name": "France",
|
||||
"city": {
|
||||
"name": "Chenôve",
|
||||
"subdivision_code": "BFC",
|
||||
"subdivision_name": "Bourgogne-Franche-Comté",
|
||||
"latitude": null,
|
||||
"longitude": null
|
||||
},
|
||||
"cidr": "86.235.0.0/20",
|
||||
"hostname": "",
|
||||
"asn_name": "Orange",
|
||||
"asn_cidr": "86.234.0.0/15",
|
||||
"is_private": false,
|
||||
"elapsed_time": "0.000076166 sec"
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
# 4G
|
||||
|
||||
$ geoip2fast 92.184.105.244 geoip2fast-city-asn.dat.gz
|
||||
{
|
||||
"ip": "92.184.105.244",
|
||||
"country_code": "FR",
|
||||
"country_name": "France",
|
||||
"city": {
|
||||
"name": "Paris",
|
||||
"subdivision_code": "IDF",
|
||||
"subdivision_name": "Île-de-France",
|
||||
"latitude": null,
|
||||
"longitude": null
|
||||
},
|
||||
"cidr": "92.184.96.0/20",
|
||||
"hostname": "",
|
||||
"asn_name": "Orange",
|
||||
"asn_cidr": "92.184.96.0/19",
|
||||
"is_private": false,
|
||||
"elapsed_time": "0.000069667 sec"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
https://www.maxmind.com/en/accounts/356803/geoip/downloads
|
||||
|
||||
@@ -195,6 +195,7 @@ $ pecl install apcu
|
||||
# fatal error: 'pcre2.h' file not found
|
||||
|
||||
$ ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/
|
||||
$ ln -s /opt/homebrew/opt/pcre2/include/pcre2.h /opt/homebrew/opt/php@8.4/include/php/ext/pcre/
|
||||
|
||||
ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/8.3.1/include/php/ext/pcre/pcre2.h
|
||||
|
||||
|
||||
@@ -178,6 +178,21 @@ Si PHP n'est pas interprété, redémarrer le mac.
|
||||
|
||||
|
||||
|
||||
### PHP interactif:
|
||||
|
||||
Executer PHP dans le terminal.
|
||||
|
||||
```bash
|
||||
$ php -a
|
||||
Interactive shell
|
||||
|
||||
php > $var = 'ABCDEFGH:/MNRPQR/';
|
||||
php > echo "Original: $var<hr />\n";
|
||||
Original: ABCDEFGH:/MNRPQR/<hr />
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Changer de version:
|
||||
|
||||
*PHP switcher script*:
|
||||
|
||||
117
docs/macos/webserver/security-txt.md
Normal file
117
docs/macos/webserver/security-txt.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# security.txt
|
||||
|
||||
|
||||
|
||||
Créer le fichier security.txt sur https://securitytxt.org
|
||||
|
||||
```bash
|
||||
Contact: mailto:bruno@clicclac.info
|
||||
Expires: 2026-09-05T18:00:00.000Z
|
||||
Encryption: openpgp4fpr:2D5E 6C77 2EC1 15C8 21BD 6D8A 4B92 F1D5 84F5 513F
|
||||
Preferred-Languages: en,fr
|
||||
Canonical: https://photos-nas.ovh/.well-known/security.txt
|
||||
```
|
||||
|
||||
Créer une signature numérique:
|
||||
|
||||
```bash
|
||||
gpg --output security.txt.sig --armor --detach-sig security.txt
|
||||
gpg: using "2D5E6C772EC115C821BD6D8A4B92F1D584F5513F" as default secret key for signing
|
||||
```
|
||||
|
||||
Vérifier la signature:
|
||||
|
||||
```bash
|
||||
gpg --verify security.txt.sig security.txt
|
||||
gpg: Signature faite le Jeu 5 sep 15:35:53 2024 CEST
|
||||
gpg: avec la clef RSA 2D5E6C772EC115C821BD6D8A4B92F1D584F5513F
|
||||
gpg: Bonne signature de « Bruno Pesenti <bruno@clicclac.info> » [ultime]
|
||||
```
|
||||
|
||||
Ajouter la signature au fichier security.txt
|
||||
|
||||
```bash
|
||||
cat security.txt.sig >> security.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
gpg --clearsign -o security-signed.txt security.txt
|
||||
gpg: using "2D5E6C772EC115C821BD6D8A4B92F1D584F5513F" as default secret key for signing
|
||||
```
|
||||
|
||||
```bash
|
||||
gpg --verify -v security-signed.txt
|
||||
gpg: enabled compatibility flags:
|
||||
gpg: en-tête d'armure : Hash: SHA256
|
||||
gpg: nom de fichier original : « »
|
||||
gpg: Signature faite le Jeu 5 sep 16:02:58 2024 CEST
|
||||
gpg: avec la clef RSA 2D5E6C772EC115C821BD6D8A4B92F1D584F5513F
|
||||
gpg: utilisation du modèle de confiance pgp
|
||||
gpg: Bonne signature de « Bruno Pesenti <bruno@clicclac.info> » [ultime]
|
||||
gpg: signature mode texte, algorithme de hachage SHA256, algorithme de clef rsa4096
|
||||
```
|
||||
|
||||
```bash
|
||||
mv security-signed.txt security.txt
|
||||
```
|
||||
|
||||
```bash
|
||||
cat security.txt
|
||||
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA256
|
||||
|
||||
Contact: https://photos-nas.ovh/contact/
|
||||
Expires: 2026-09-05T18:00:00.000Z
|
||||
Encryption: openpgp4fpr:2D5E 6C77 2EC1 15C8 21BD 6D8A 4B92 F1D5 84F5 513F
|
||||
Preferred-Languages: en,fr
|
||||
Canonical: https://photos-nas.ovh/.well-known/security.txt
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAEBCAAdFiEELV5sdy7BFcghvW2KS5Lx1YT1UT8FAmbZuhIACgkQS5Lx1YT1
|
||||
UT9hsg/6AjjR0ASQ1UA0rHwVeKw7WOlLJv1lkdypKi5Sou1sYZcM3sFNwq1T/KX8
|
||||
lkgy3Y0uAH2QJ/nbsyhyNi5tHI2oA1zhF7U/l9ovRD3esQGoZ0iRIFRKzoKwNsBb
|
||||
yxOzS1BJEvH3ntE2QwcTCBPx5D8RNBcIa3xK8DnrZCfkIU3tm49yRNyFo+MUWDZw
|
||||
f0ASIWFwvPrB3oKdB9orzwQHq2UtwIK8yPkeZV2Tbe3OuN0utVSaqeSXDyNewCDI
|
||||
ziorAnjl5TL41Lo3UtO69ByYB2yCHaIgGr/9EK19fZG7jx/AcD8wCQ5FKdj8woQB
|
||||
KwCEu4PqoHpi8yncHAUZPsrH9XHTm5GegeGHU6/uguzDw4jc5Nxg/ARpDvD/337m
|
||||
iWKoA7UXoffmGNizyGiP//zkzkp4wTStD9G8i9TA3BSSKIFtHQqYFqYQlJQEopRd
|
||||
ju8KIHPORXxyR1GX58V0UUJ2Gtzk4AHRS5/XqAqSHyQyI9YK0O79iufx6nGW+zkR
|
||||
c1MmVp4YkhQcHB5NbWH0XC/6lOn5jfx7hNfQDbPBemPOpBZ2n9V13ckxhgynlurh
|
||||
hBNQQT526cZmxhLTXWrSRcuFiWjtpi8CgJaWMw7ebhncLb1dHlebq8cispqJn2vK
|
||||
+v6pgoN0aJvtKZC8ugHi62SniVaX22B55QQDbfhGFvlhWnzJSl4=
|
||||
=8KJk
|
||||
-----END PGP SIGNATURE-----
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Content Security Policy (CSP)
|
||||
|
||||
https://content-security-policy.com/examples/
|
||||
|
||||
https://www.magentix.fr/blog/strategie-de-securite-du-contenu-content-security-policy.html
|
||||
|
||||
|
||||
|
||||
Ajouter l'entête:
|
||||
|
||||
```html
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';">
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
header("Content-Security-Policy: default-src 'self'");
|
||||
?>
|
||||
```
|
||||
|
||||
|
||||
|
||||
### HSTS
|
||||
|
||||
https://hstspreload.org/
|
||||
Reference in New Issue
Block a user