Antonio Nardella
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # HORNET Installation Party ## OpenSSH keys (Windows) putty.org Why ed25519: https://cryptsus.com/blog/how-to-secure-your-ssh-server-with-public-key-elliptic-curve-ed25519-crypto.html Medium article: https://medium.com/risan/upgrade-your-ssh-key-to-ed25519-c6e8d60d3c54 ## OpenSSH keys (GNU/Linux, MacOS) `ssh-keygen -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "antonio.nardella@iota.org"` `-a rounds` When saving a private key, this option specifies the number of KDF (key derivation function) rounds used. Higher numbers result in slower passphrase verification and increased resistance to brute-force password cracking (should the keys be stolen). `-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa` Specifies the type of key to create. The possible values are “dsa”, “ecdsa”, “ecdsa-sk”, “ed25519”, “ed25519-sk”, or “rsa”. `-f filename` Specifies the filename of the key file. ## OpenSSH keys Ledger https://thoughts.t37.net/a-step-by-step-guide-to-securing-your-ssh-keys-with-the-ledger-nano-s-92e58c64a005 ## Install HORNET https://github.com/gohornet/hornet/wiki/Tutorials%3A-Linux%3A-Install-HORNET ### Steps #### Update and upgrade system `apt update && apt upgrade` #### Add GPG keys `wget -qO - https://ppa.hornet.zone/pubkey.txt | sudo apt-key add -` #### Add HORNET repository to APT `sh -c 'echo "deb http://ppa.hornet.zone stable main" >> /etc/apt/sources.list.d/hornet.list'` #### Install HORNET `apt update && apt install hornet` #### Enable HORNET service `systemctl enable hornet.service` #### Start HORNET `service hornet start` #### Verify HORNET state `journalctl -u hornet.service -f` ### HORNET Dashboard - SSH tunnel `ssh -N -L 8081:localhost:8081 root@remote_host_or_ip` `-N` Do not execute a remote command. This is useful for just forwarding ports. ``` -L [bind_address:]port:host:hostport -L [bind_address:]port:remote_socket -L local_socket:host:hostport -L local_socket:remote_socket ``` Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine. Port forwardings can also be specified in the configuration file. Only the superuser can forward privileged ports. IPv6 addresses can be specified by enclosing the address in square brackets. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of “localhost” indicates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port should be available from all interfaces. ### COMNET #### Edit HORNET defaults `nano /etc/default/hornet` #### Add COMNET configuration ``` # Add cli arguments to hornet, e.g.: # (For the full list of cli options run 'hornet -h') OPTIONS="--config config_comnet" ``` ## Security Do not feel _safe_ because you take these precautions. This is the minimal setup! ### Firewall **DISCLAIMER** If you are running other services or use a different port for SSH this instructions might disrupt those services. Be careful when you copy/paste commands from online website, make sure you understand what you do! Install uncomplicated firewall `apt install ufw` Allow any outgoing connection `ufw default allow outgoing` Deny any incoming connection `ufw default deny incoming` Allow ssh (secure shell) over the port `22` `ufw allow ssh` Allow the autopeering UDP port 14626 `ufw allow 14626/udp` Allow the gossip TCP port 15600 `ufw allow 15600/tcp` ### Create a new sudo user The sudo command (short for Super-user do) is a program designed to allow users to execute commands with the security privileges of another user, by default the root user. You can use this user account to execute administrative commands without a need to log in to your Debian server as a root user Login as root and type following commands `apt update && apt install sudo` Create new user `adduser beekeeper` Add to the `sudo` group `usermod -aG sudo beekeeper` ### fail2ban "Fail2ban scans log files (e.g. /var/log/apache/error_log) and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. Generally Fail2Ban is then used to update firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary other action (e.g. sending an email) could also be configured. Out of the box Fail2Ban comes with filters for various services (apache, courier, ssh, etc). Fail2Ban is able to reduce the rate of incorrect authentications attempts however it cannot eliminate the risk that weak authentication presents. Configure services to use only two factor or public/private authentication mechanisms if you really want to protect services." [Fail2ban main page](https://www.fail2ban.org/wiki/index.php/Main_Page) Update apt and install fail2ban `sudo apt update && sudo apt install fail2ban` These commands start and enable fail2ban ``` sudo systemctl start fail2ban sudo systemctl enable fail2ban ``` ### Unattended Upgrades Install the necessary packages `sudo apt-get install unattended-upgrades apt-listchanges` The default configuration file for the unattended-upgrades package is at /etc/apt/apt.conf.d/50unattended-upgrades. The defaults will work fine, but you should read it and make changes as needed. `sudo nano /etc/apt/apt.conf.d/50unattended-upgrades` This section controls which packages are upgraded: ``` Unattended-Upgrade::Origins-Pattern { // ... }; ``` You should at least uncomment the following line: `Unattended-Upgrade::Mail "root";` Create the file /etc/apt/apt.conf.d/20auto-upgrades by running the following command as root: `sudo dpkg-reconfigure -plow unattended-upgrades` ### Changing the ssh-port and some hardening 1. Choosing a New Port Number In Linux, port numbers below 1024 are reserved for well-known services and can only be bound to by root. Although you can use a port within 1-1024 range for the SSH service to avoid issues with port allocation in the future it is recommended to choose a port above 1024. In this example will change the SSH port to ``3322``, you can choose any port you like. 2. Adjusting Firewall Before changing the SSH port, first you’ll need to adjust your firewall to allow traffic on the new SSH port. If you are using UFW, the default firewall configuration tool for Ubuntu run the following command to open the new SSH port: `sudo ufw allow 3322/tcp` 3. Configuring SSH Open the SSH configuration file /etc/ssh/sshd_config with your text editor: `sudo nano /etc/ssh/sshd_config` Search for the line starting with Port 22. In most cases, this line will start with a hash #. Remove the hash # and enter your new SSH port number that will be used instead of the standard SSH port 22. /etc/ssh/sshd_config `Port 3322` Be extra careful when modifying the SSH configuration file. The incorrect configuration may cause the SSH service to fail to start. Once you are done save the file and restart the SSH service to apply the changes: `sudo systemctl restart ssh` To verify that SSH daemon is listening on the new port 3322 type: ss -an | grep 3322 The output should look something like this: tcp LISTEN 0 128 0.0.0.0:3322 0.0.0.0:* tcp ESTAB 0 0 192.168.121.108:3322 192.168.121.1:57638 tcp LISTEN 0 128 [::]:3322 [::]:* Using the New SSH Port Now that you changed the SSH port when login to the remote machine you’ll need to specify the new port. Run the ssh followed by the -p <port_number> option to specify the port: ssh -p 3322 beekeeper@remote_host_or_ip ## Ledger Nano for your SSH session (GNU/Linux & MacOS) [Guide](https://thoughts.t37.net/a-step-by-step-guide-to-securing-your-ssh-keys-with-the-ledger-nano-s-92e58c64a005) On your local PC: `ledger-agent beekeeper@VPSADDRESS` Get the public key: ``` ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC+qDQh0BxMYLw5JR/FIUlBid5FZuR8uDZIIRJwkCE8D1Cw7peGLuwL9eA0G+IvbYLjVmdfLf/i6Y25mr+UKYoQ= <ssh://beekeeper@remote_host_or_ip|nist256p1> ``` On the VPS: ``` mkdir .ssh nano .ssh/authorized_keys ``` Paste the public key ``` ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC+qDQh0BxMYLw5JR/FIUlBid5FZuR8uDZIIRJwkCE8D1Cw7peGLuwL9eA0G+IvbYLjVmdfLf/i6Y25mr+UKYoQ= <ssh://beekeeper@remote_host_or_ip|nist256p1> ``` ## Learn more about VPS security! https://www.cyberciti.biz/tips/linux-security.html

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully