Code Monkey home page Code Monkey logo

literate-auth's Introduction

literate-auth

To use the included Bash script to implement a two-factor authentication layer (2FA) on a Linux server, follow these steps:

  1. Download and save the script: Save the script with:

    git clone https://github.com/carligithub400/literate-auth/
  2. Set up a Telegram bot:

    • Create a new Telegram bot by talking to the BotFather on Telegram. Make a note of the token provided.
  3. Get your chat ID:

    • Start a chat with your newly created bot on Telegram.
    • Visit the following URL and replace <YOUR_BOT_TOKEN> with your actual bot token: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
    • Look for the 'chat' part in the answer. The id field in the chat object is your chat ID. Make a note of it.
  4. Edit the script:

    • Open the script in a text editor and replace "token" with your Telegram bot token and "id" with your chat ID.
  5. Run the script:

    • Run the script in your terminal:

      bash literate-auth/main.sh
  6. Follow the directions:

    • The script will generate a random 6-digit challenge and send it to your Telegram bot.
    • You will be asked to enter the challenge answer without the entry being displayed.
    • Type the correct answer to continue.
  7. Access to the scale:

    • If the answer is correct, the script grants access to the /bin/bash shell.
    • If the answer is incorrect, the connection will be disconnected.
  8. Cleanup:

    • After successful authentication, the script deletes the challenge file.
  9. Create a user and connect to ssh

    • Create a user with the command that has the code main.sh as the default shell.

      sudo adduser $user --shell=$path_main.sh
    • Change $user with the name of the user and $path_main.sh with the path of the cloned code.

    • Make sure it has execution rights:

    chmod a+xrw literate-auth/
    • Ssh to the user and if all goes well it will say that you have to enter a code.

Important Considerations:

  • Test environment: This script is for testing purposes only. Do not use it in production or for critical tasks.
  • Security: Be careful where and how you deploy this script. Telegram is used for communication, so make sure your bot and chat ID are safe.
  • Permissions: Ensure that the script has the necessary permissions to read and write to the file system.

By following these steps, you can experiment with implementing a simple 2FA layer using Telegram for code transfer in a controlled test environment.

literate-auth's People

Contributors

carligithub400 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.