This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Files
  • More Options
  1. Dashboard
  2. Members
    1. Recent Activity
    2. Users Online
    3. Staff
    4. Search Members
  3. Forum
  4. Downloads
  5. ISeeT Main Site
  • Login
  • Register
  • Search
  1. Dashboard
  2. Members
    1. Recent Activity
    2. Users Online
    3. Staff
    4. Search Members
  3. Forum
  4. Downloads
  5. ISeeT Main Site
  1. Dashboard
  2. Members
    1. Recent Activity
    2. Users Online
    3. Staff
    4. Search Members
  3. Forum
  4. Downloads
  5. ISeeT Main Site
  1. ISeeT Forums
  2. ICT (Information & Communication Technology)
  3. Synology
  • Sidebar
  • Sidebar

SWAG - Secure Web Application Gateway

  • ISeeTWizard
  • October 26, 2025 at 1:55 PM
1st Official Post
  • ISeeTWizard
    Administrator
    Posts
    142
    Files
    26
    • October 26, 2025 at 1:55 PM
    • Official Post
    • #1

    SWAG is a reverse proxy software based on NGINX. I tried to do the same with Traefik but I failed - even if it worked somehow, many pages simply had missing information and were therefore useless.
    SWAG has a lot of ready-made configuration files for frequently used programs integrated and is therefore very easy to use.
    You can also have SSL certificates created automatically by Let's Encrypt and fail2ban is also on board.

    However, there is a big problem on a Synology, namely ports 80 and 443. Although the DSM software runs on a different port, these two ports were blocked and redirected.

    To get around this, there is a small script that I am giving you here. This is run via an SSH session and unlocks ports 80 and 443 again.

    There are a lot of instructions on the internet about this but I found a script on Github that worked for me - a lot of things hadn't worked before. As always, I put the link below in the list of used links.

    External Content youtu.be
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.

    Bash
    #! /bin/bash
    
    # NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
    # Developed for DSM 6 - 7.0.1. Not tested on other versions.
    # Steps to install
    # Save this script in one of your shares
    # Edit it according to your requirements
    # Backup /usr/syno/share/nginx/ as follows:
    # # cd /usr/syno/share/
    # # tar cvf ~/nginx.tar nginx
    # Run this script as root
    # Reboot and ensure everything is still working
    # If not, restore the backup and post a comment on this script's gist page
    # If it did, schedule it to run as root at boot
    #   through Control Panel -> Task Scheduler
    
    HTTP_PORT=81
    HTTPS_PORT=444
    
    BACKUP_FILES=true # change to false to disable backups
    BACKUP_DIR=/volume1/apps/free_ports/backup
    DELETE_OLD_BACKUPS=false # change to true to automatically delete old backups.
    KEEP_BACKUP_DAYS=30
    
    DATE=$(date +%Y-%m-%d-%H-%M-%S)
    CURRENT_BACKUP_DIR="$BACKUP_DIR/$DATE"
    
    if [ "$BACKUP_FILES" == "true" ]; then
      mkdir -p "$CURRENT_BACKUP_DIR"
      cp /usr/syno/share/nginx/*.mustache "$CURRENT_BACKUP_DIR"
    fi
    
    if [ "$DELETE_OLD_BACKUPS" == "true" ]; then
      find "$BACKUP_DIR/" -type d -mtime +$KEEP_BACKUP_DAYS -exec rm -r {} \;
    fi
    
    sed -i "s/^\([ \t]\+listen[ \t]\+[]:[]*\)80\([^0-9]\)/\1$HTTP_PORT\2/" /usr/syno/share/nginx/*.mustache
    sed -i "s/^\([ \t]\+listen[ \t]\+[]:[]*\)443\([^0-9]\)/\1$HTTPS_PORT\2/" /usr/syno/share/nginx/*.mustache
    
    if which synoservicecfg; then
      synoservicecfg --restart nginx
    else
      synosystemctl restart nginx
    fi
    
    echo "Made these changes:"
    
    diff /usr/syno/share/nginx/ $CURRENT_BACKUP_DIR 2>&1 | tee $CURRENT_BACKUP_DIR/changes.log
    Display More

    To run the script, please change to the directory where you created it and run it as follows:

    Code
    sudo ./free_ports.sh

    Why this script? Well, as I said, it works, and above all it creates a backup of all changed files and tells you at the end what it has changed.

    You can also decide which port should be used instead of 80 and 443 to then free them up.

    It is best to save this script in a share under the name free_ports.sh, for example, and run it in an SSH session (don't forget sudo).

    I use Bitvise, for example, as an SSH client under Windows - but there are countless others.

    The script is supposed to always run at startup - but I haven't had to do that yet (my server restarts every day overnight - so it shuts down for 6 hours a night).

    Bash
    docker run -d \
      --name=swag \
      --cap-add=NET_ADMIN \
      -e PUID=1027 \
      -e PGID=100 \
      -e TZ=Europe/Luxembourg \
      -e URL=my.ddns.server \
      -e VALIDATION=http \
      -e EMAIL=euremailadresse \  
      -e SUBDOMAINS=heimdall, \
      -p 443:443 \
      -p 80:80 \
      -v /volume1/docker/Swag:/config \
      --restart unless-stopped \
      linuxserver/swag
    Display More

    Please remember to enter your DynDNS domain or similar under URL as well as a correct email address. Also always enter the correct IDs for folder rights.

    To create a .htpasswd file, use the following command:

    Code
    sudo htpasswd -c /volume1/docker/Swag/nginx/.htpasswd newuser


    Or for an additional user:

    Code
    sudo htpasswd /volume1/docker/Swag/nginx/.htpasswd newuser2

    Used Links

    TZ - Timezone

    Random Number (for a port number by random generator)

    SWAG @DockerHub

    Free_Ports Script @GitHub

    Bitvise SSH Client

    SWAG Reverse Proxy Configurations @GitHub (read the readme.md on this page!)

    • Quote

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!

Register Yourself Login

Did you know…?

“There are so many great things in life; why dwell on negativity?”

Zendaya

“Ambition is the path to success. Persistence is the vehicle you arrive in.”

Bill Bradley

“I’m not going to continue knocking on that old door that doesn’t open for me. I’m going to create my own door and walk through that.”

W.P. Kinsella

“If you live long enough, you’ll make mistakes. But if you learn from them, you’ll be a better person.”

Bill Clinton

“Keep your face towards the sunshine and shadows will fall behind you.”

Walt Whitman

“For me, becoming isn’t about arriving somewhere or achieving a certain aim. I see it instead as forward motion, a means of evolving, a way to reach continuously toward a better self. The journey doesn’t end.”

Michelle Obama

“You may not control all the events that happen to you, but you can decide not to be reduced by them.”

Maya Angelou

“Before anything else, preparation is the key to success.”

Alexander Graham Bell

“It does not matter how slowly you go, as long as you do not stop.”

Confucius

“I’m not going to continue knocking that old door that doesn’t open for me. I’m going to create my own door and walk through that.”

Ava DuVernay

“And when you want something, all the universe conspires in helping you achieve it.”

Paulo Coelho

“We have to dare to be ourselves, however frightening or strange that self may prove to be.”

May Sarton

“It is better to be hated for what you are than to be loved for what you are not.”

Andre Gide

“Be sure you put your feet in the right place, then stand firm.”

Abraham Lincoln

“Life is very interesting…in the end, some of your greatest pains become your greatest strengths.”

Drew Barrymore

“We make a living by what we get, but we make a life by what we give.”

Winston Churchill

“Dream big and dare to fail.”

Norman Vaughan

“All dreams are within reach. All you have to do is keep moving towards them.”

Viola Davis

“Life does not have to be perfect to be wonderful.”

Annette Funicello

“You can be everything. You can be the infinite amount of things that people are.”

Kesha

“Do one thing every day that scares you.”

Eleanor Roosevelt

“Be yourself; everyone else is already taken.”

Oscar Wilde

“It is never too late to be what you might have been.”

George Elliot

“The art of life is to know how to enjoy a little and to endure very much.”

William Hazlitt

“My wish for you is that you continue. Continue to be who you are, to astonish a mean world with your acts of kindness.”

Maya Angelou

“Some people want it to happen, some wish it would happen, others make it happen.”

Michael Jordan

“Life has no limitations, except the ones you make.”

Les Brown

“There are no regrets in life. Just lessons.”

Jennifer Aniston

“If you have knowledge, let others light their candles in it.”

Margaret Fuller

“It’s amazing how a little tomorrow can make up for a whole lot of yesterday.”

John Guare

“Dreaming, after all, is a form of planning.”

Gloria Steinem

“The purpose of life is to live it, to taste experience to the utmost, to reach out eagerly and without fear for newer and richer experience.”

Eleanor Roosevelt

“I believe that if you’ll just stand up and go, life will open up for you. Something just motivates you to keep moving.”

Tina Turner

“You have to believe in yourself when no one else does.”

Serena Williams

“Don’t take yourself too seriously. Know when to laugh at yourself, and find a way to laugh at obstacles that inevitably present themselves.”

Halle Bailey

“There is no passion to be found playing small—in settling for a life that is less than the one you are capable of living.”

Nelson Mandela

“The fear of death follows from the fear of life. A man who lives fully is prepared to die at any time.”

Mark Twain

“Failure is a great teacher and, if you are open to it, every mistake has a lesson to offer.”

Oprah Winfrey

“Good friends, good books, and a sleepy conscience: This is the ideal life.”

Mark Twain

“You don’t always need a plan. Sometimes you just need to breathe, trust, let go and see what happens.”

Mandy Hale

“Tomorrow is a new day. You shall begin it serenely and with too high a spirit to be encumbered with your old nonsense.”

Ralph Waldo Emerson

“The biggest adventure you can take is to live the life of your dreams.”

Oprah Winfrey

“Dreams do not come true just because you dream them. It’s hard work that makes things happen. It’s hard work that creates change.”

Shonda Rhimes

“You will face many defeats in life, but never let yourself be defeated.”

Maya Angelou

“Always do your best. What you plant now, you will harvest later.”

Og Mandino

“Everything you can imagine is real.”

Pablo Picasso

“The new dawn blooms as we free it. For there is always light if only we’re brave enough to see it, if only we’re brave enough to be it.”

Amanda Gorman

“It is better to fail in originality than to succeed in imitation.”

Herman Melville

“When you have a dream, you’ve got to grab it and never let go.”

Carol Burnett

“Once you face your fear, nothing is ever as hard as you think.”

Olivia Newton-John

“You only live once, but if you do it right, once is enough.”

Mae West

“Spread love everywhere you go. Let no one ever come without leaving happier.”

Mother Teresa

“Don’t judge each day by the harvest you reap but by the seeds that you plant.”

Robert Louis Stevenson

“To succeed in life, you need three things: a wishbone, a backbone, and a funnybone.”

Reba McEntire

“Let us make our future now, and let us make our dreams tomorrow’s reality.”

Malala Yousafzai

“It is during our darkest moments that we must focus to see the light.”

Aristotle

“The great courageous act that we must all do is to have the courage to step out of our history and past so that we can live our dreams.”

Oprah Winfrey

“One of the deep secrets of life is that all that is really worth doing is what we do for others.”

Lewis Carroll

“Next time, ask ‘What’s the worst that will happen?’ Then push yourself a little further than you dare.”

Audre Lorde

“Life is like riding a bicycle. To keep your balance, you must keep moving.”

Albert Einstein

“Whatever we are, whatever we make of ourselves, is all we will ever have—and that, in its profound simplicity, is the meaning of life.”

Philip Appleman

“Find out who you are and do it on purpose.”

Dolly Parton

“Be where you are; otherwise you will miss your life.”

Buddha

“There is no perfection, only life.”

Milan Kundera

You cannot change what you refuse to confront.

“Life is what happens to you when you are busy making other plans.”

John Lennon

“The future belongs to those who believe in the beauty of their dreams.”

Eleanor Roosevelt

“Be persistent and never give up hope.”

George Lucas

“We must let go of the life we have planned, so as to accept the one that is waiting for us.”

Joseph Campbell

“Life is a daring adventure or it is nothing at all.”

Helen Keller

“No need to hurry. No need to sparkle. No need to be anybody but oneself.”

Virginia Woolf

“Live in the sunshine, swim the sea, drink the wild air.”

Ralph Waldo Emerson

“We pass through this world but once.”

Stephen Jay Gould

“Living might mean taking chances, but they’re worth taking.”

Lee Ann Womack

“The only thing we have to fear is fear itself.”

Franklin D. Roosevelt

“When I let go of what I am, I become what I might be.”

Lao Tzu

“Success is stumbling from failure to failure with no loss of enthusiasm.”

Winston Churchill

“Get busy living or get busy dying.”

Stephen King

“I may not have gone where I intended to go, but I think I have ended up where I needed to be.”

Douglas Adams

“Nothing is impossible. The word itself says ‘I’m possible!’”

Audrey Hepburn

“In three words I can sum up everything I’ve learned about life: It goes on.”

Robert Frost

“If you don’t like the road you’re walking, start paving another one.”

Dolly Parton

“Coming together is a beginning; keeping together is progress; working together is success.”

Henry Ford

“Keep smiling, because life is a beautiful thing and there’s so much to smile about.”

Marilyn Monroe

“You can’t help what you feel, but you can help how you behave.”

Margaret Atwood

“Life is made of ever so many partings welded together.”

Charles Dickens

“If you don’t have any shadows, you’re not in the light.”

Lady Gaga

“Never let the fear of striking out keep you from playing the game.”

Babe Ruth

“Yesterday is but today’s memory and tomorrow is today’s dream.”

Khalil Gibran

“Always remember that you are absolutely unique. Just like everyone else.”

Margaret Mead

“The future belongs to those who prepare for it today.”

Malcolm X

“There’s love enough in this world for everybody, if people will just look.”

Kurt Vonnegut

“For the great doesn’t happen through impulse alone, and is a succession of little things that are brought together.”

Vincent Van Gogh

“We are here to add what we can to life, not to get what we can from life.”

William Osler

“Life isn’t about finding yourself. Life is about creating yourself.”

George Bernard Shaw

“The world you desire can be won. It exists... it is real... it is possible... it’s yours.”

Ayn Rand

“Don’t worry about failure, you only have to be right once.”

Drew Houston

“Always go with your passions. Never ask yourself if it’s realistic or not.”

Deepak Chopra

“Just when you think it can’t get any worse, it can. And just when you think it can’t get any better, it can.”

Nicholas Sparks

“The simple things are also the most extraordinary things, and only the wise can see them.”

Paulo Coelho

“The future is not something we enter. The future is something we create.”

Leonard I. Sweet

Users Viewing This Thread

  • 1 Guest
  1. Privacy Policy
  2. Contact
  3. Legal Notice
Powered by WoltLab Suite™
Style: Ambience by cls-design
Stylename
Ambience
Manufacturer
cls-design
Licence
Commercial styles
Help
Supportforum
Visit cls-design